HMAC doesn't work with a default digest
[openssl.git] / apps / dgst.c
index 15f9e2e6850dcb2be751f5f7c5844366e5dca031..7ac101330351c881ccb400e2e815f313f95717b7 100644 (file)
@@ -330,6 +330,8 @@ int dgst_main(int argc, char **argv)
     }
 
     if (hmac_key != NULL) {
+        if (md == NULL)
+            md = (EVP_MD *)EVP_sha256();
         sigkey = EVP_PKEY_new_raw_private_key(EVP_PKEY_HMAC, impl,
                                               (unsigned char *)hmac_key,
                                               strlen(hmac_key));