SirWumpus / libsnert

Library of supporting functions, APIs, and tools for SnertSoft BarricadeMX and milters.
BSD 2-Clause "Simplified" License
5 stars 1 forks source link

SHA hash function name errors on lines 53 & 54 of mail/dkim-hash.c #5

Closed drscriptt closed 1 week ago

drscriptt commented 1 week ago

Hi,

I'm receiving the following errors on lines 53 & 54 of mail/dkim-hash.c when compiling libsnert:

lib% make
...
***************************************************************
==> /tmp/com/snert/src/lib/mail
***************************************************************

gcc  -Wall -Wno-unused -Wno-char-subscripts -I../../../include -I.  -L../../../lib -odkim-hash ./dkim-hash.c -lsnert -lmd
./dkim-hash.c:53:21: error: ‘SHA256_Init’ undeclared here (not in a function); did you mean ‘SHA256Init’?
   53 |         { "sha256", SHA256_Init, SHA256_Update, SHA256_Final, SHA256_DIGEST_LENGTH, sizeof (SHA256_CTX) },
      |                     ^~~~~~~~~~~
      |                     SHA256Init
./dkim-hash.c:53:34: error: ‘SHA256_Update’ undeclared here (not in a function); did you mean ‘SHA256Update’?
   53 |         { "sha256", SHA256_Init, SHA256_Update, SHA256_Final, SHA256_DIGEST_LENGTH, sizeof (SHA256_CTX) },
      |                                  ^~~~~~~~~~~~~
      |                                  SHA256Update
./dkim-hash.c:53:49: error: ‘SHA256_Final’ undeclared here (not in a function); did you mean ‘SHA256Final’?
   53 |         { "sha256", SHA256_Init, SHA256_Update, SHA256_Final, SHA256_DIGEST_LENGTH, sizeof (SHA256_CTX) },
      |                                                 ^~~~~~~~~~~~
      |                                                 SHA256Final
./dkim-hash.c:53:93: error: ‘SHA256_CTX’ undeclared here (not in a function); did you mean ‘SHA2_CTX’?
   53 |         { "sha256", SHA256_Init, SHA256_Update, SHA256_Final, SHA256_DIGEST_LENGTH, sizeof (SHA256_CTX) },
      |                                                                                             ^~~~~~~~~~
      |                                                                                             SHA2_CTX
./dkim-hash.c:54:21: error: ‘SHA512_Init’ undeclared here (not in a function); did you mean ‘SHA512Init’?
   54 |         { "sha512", SHA512_Init, SHA512_Update, SHA512_Final, SHA512_DIGEST_LENGTH, sizeof (SHA512_CTX) },
      |                     ^~~~~~~~~~~
      |                     SHA512Init
./dkim-hash.c:54:34: error: ‘SHA512_Update’ undeclared here (not in a function); did you mean ‘SHA512Update’?
   54 |         { "sha512", SHA512_Init, SHA512_Update, SHA512_Final, SHA512_DIGEST_LENGTH, sizeof (SHA512_CTX) },
      |                                  ^~~~~~~~~~~~~
      |                                  SHA512Update
./dkim-hash.c:54:49: error: ‘SHA512_Final’ undeclared here (not in a function); did you mean ‘SHA512Final’?
   54 |         { "sha512", SHA512_Init, SHA512_Update, SHA512_Final, SHA512_DIGEST_LENGTH, sizeof (SHA512_CTX) },
      |                                                 ^~~~~~~~~~~~
      |                                                 SHA512Final
./dkim-hash.c:54:93: error: ‘SHA512_CTX’ undeclared here (not in a function); did you mean ‘SHA2_CTX’?
   54 |         { "sha512", SHA512_Init, SHA512_Update, SHA512_Final, SHA512_DIGEST_LENGTH, sizeof (SHA512_CTX) },
      |                                                                                             ^~~~~~~~~~
      |                                                                                             SHA2_CTX

If I rename the functions as gcc recommends, dkim-hash.c and the rest of libsnert compiles just fine.

lib% diff mail/dkim-hash.c mail/dkim-hash.c.bak
53,54c53,54
<       { "sha256", SHA256Init, SHA256Update, SHA256Final, SHA256_DIGEST_LENGTH, sizeof (SHA2_CTX) },
<       { "sha512", SHA512Init, SHA512Update, SHA512Final, SHA512_DIGEST_LENGTH, sizeof (SHA2_CTX) },
---
>       { "sha256", SHA256_Init, SHA256_Update, SHA256_Final, SHA256_DIGEST_LENGTH, sizeof (SHA256_CTX) },
>       { "sha512", SHA512_Init, SHA512_Update, SHA512_Final, SHA512_DIGEST_LENGTH, sizeof (SHA512_CTX) },
lib% make
...
***************************************************************
==> /tmp/com/snert/src/lib/mail
***************************************************************

gcc  -Wall -Wno-unused -Wno-char-subscripts -I../../../include -I.  -L../../../lib -odkim-hash ./dkim-hash.c -lsnert -lmd
./dkim-hash.c: In function ‘canon_body_simple’:
./dkim-hash.c:341:9: warning: enumeration value ‘STATE_END’ not handled in switch [-Wswitch]
  341 |         switch (cs->state) {
      |         ^~~~~~
./dkim-hash.c:341:9: warning: enumeration value ‘STATE_ERROR’ not handled in switch [-Wswitch]
./dkim-hash.c:341:9: warning: enumeration value ‘STATE_WSP’ not handled in switch [-Wswitch]
./dkim-hash.c:341:9: warning: enumeration value ‘STATE_HDR’ not handled in switch [-Wswitch]
./dkim-hash.c:341:9: warning: enumeration value ‘STATE_HDR_WSP’ not handled in switch [-Wswitch]
./dkim-hash.c:341:9: warning: enumeration value ‘STATE_COLON’ not handled in switch [-Wswitch]
./dkim-hash.c:341:9: warning: enumeration value ‘STATE_EOH_CR’ not handled in switch [-Wswitch]
./dkim-hash.c: In function ‘canon_body_relaxed’:
./dkim-hash.c:407:9: warning: enumeration value ‘STATE_END’ not handled in switch [-Wswitch]
  407 |         switch (cs->state) {
      |         ^~~~~~
./dkim-hash.c:407:9: warning: enumeration value ‘STATE_ERROR’ not handled in switch [-Wswitch]
./dkim-hash.c:407:9: warning: enumeration value ‘STATE_HDR’ not handled in switch [-Wswitch]
./dkim-hash.c:407:9: warning: enumeration value ‘STATE_HDR_WSP’ not handled in switch [-Wswitch]
./dkim-hash.c:407:9: warning: enumeration value ‘STATE_COLON’ not handled in switch [-Wswitch]
./dkim-hash.c:407:9: warning: enumeration value ‘STATE_EOH_CR’ not handled in switch [-Wswitch]
make[1]: Leaving directory '/tmp/com/snert/src/lib/mail'
...
***************************************************************
LibSnert 1.77.2 tools DONE
***************************************************************