Avoid needless EVP_get_digestbyname() and EVP_DigestInit_ex() calls

This commit is contained in:
Cameron Gutman
2021-07-24 07:27:03 -05:00
parent faa7eef9a4
commit e84ae26ccc

View File

@@ -293,15 +293,7 @@ static int sign_it(const char *msg, size_t mlen, unsigned char **sig, size_t *sl
if (ctx == NULL) if (ctx == NULL)
return GS_FAILED; return GS_FAILED;
const EVP_MD *md = EVP_get_digestbyname("SHA256"); int rc = EVP_DigestSignInit(ctx, NULL, EVP_sha256(), NULL, pkey);
if (md == NULL)
goto cleanup;
int rc = EVP_DigestInit_ex(ctx, md, NULL);
if (rc != 1)
goto cleanup;
rc = EVP_DigestSignInit(ctx, NULL, md, NULL, pkey);
if (rc != 1) if (rc != 1)
goto cleanup; goto cleanup;