commit b5d59aa6f5d4946adc16397ae3166d2ab3bfcccf from: Martijn van Duren date: Sat Apr 6 12:12:58 2019 UTC Filter now produces valid output if -c flag is not included. Tested via dkimproxy_in commit - 06f6b49b29480f8a3027791df2dcc85f1c871e6b commit + b5d59aa6f5d4946adc16397ae3166d2ab3bfcccf blob - 6f8831125f075cd3ee773d55426af3321e62bded blob + 4d56beb1aa39c28bb2cc0143439f50206c940b3c --- main.c +++ main.c @@ -119,13 +119,11 @@ main(int argc, char *argv[]) case 'a': if (strncmp(optarg, "rsa-", 4)) err(1, "invalid algorithm"); - if (strcmp(optarg + 4, "sha256") == 0) { + if (strcmp(optarg + 4, "sha256") == 0) hashalg = HASH_SHA256; - hash_md = EVP_sha256(); - } else if (strcmp(optarg + 4, "sha1") == 0) { + else if (strcmp(optarg + 4, "sha1") == 0) hashalg = HASH_SHA1; - hash_md = EVP_sha1(); - } else + else err(1, "invalid algorithm"); break; case 'c': @@ -175,6 +173,10 @@ main(int argc, char *argv[]) usage(); } } + if (hashalg == HASH_SHA1) + hash_md = EVP_sha1(); + else + hash_md = EVP_sha256(); log_init(debug, LOG_MAIL); if (pledge("tmppath stdio", NULL) == -1)