aboutsummaryrefslogtreecommitdiff
path: root/crypto/dsa/dsa_pmeth.c
diff options
context:
space:
mode:
authorJung-uk Kim <jkim@FreeBSD.org>2018-08-14 16:18:14 +0000
committerJung-uk Kim <jkim@FreeBSD.org>2018-08-14 16:18:14 +0000
commit43a67e02da9068b94df1c07fc6f0d70bafd9263b (patch)
treeded01a82a7afcee0e7b8a379adbe42bd68ae3ce5 /crypto/dsa/dsa_pmeth.c
parent02be298e504b8554caca6dc85af450e1ea44d19d (diff)
Diffstat (limited to 'crypto/dsa/dsa_pmeth.c')
-rw-r--r--crypto/dsa/dsa_pmeth.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/crypto/dsa/dsa_pmeth.c b/crypto/dsa/dsa_pmeth.c
index 78724839b524..7f00e97036f2 100644
--- a/crypto/dsa/dsa_pmeth.c
+++ b/crypto/dsa/dsa_pmeth.c
@@ -3,7 +3,7 @@
* 2006.
*/
/* ====================================================================
- * Copyright (c) 2006 The OpenSSL Project. All rights reserved.
+ * Copyright (c) 2006-2018 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -230,10 +230,16 @@ static int pkey_dsa_ctrl_str(EVP_PKEY_CTX *ctx,
EVP_PKEY_CTRL_DSA_PARAMGEN_Q_BITS, qbits,
NULL);
}
- if (!strcmp(type, "dsa_paramgen_md")) {
+ if (strcmp(type, "dsa_paramgen_md") == 0) {
+ const EVP_MD *md = EVP_get_digestbyname(value);
+
+ if (md == NULL) {
+ DSAerr(DSA_F_PKEY_DSA_CTRL_STR, DSA_R_INVALID_DIGEST_TYPE);
+ return 0;
+ }
return EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DSA, EVP_PKEY_OP_PARAMGEN,
EVP_PKEY_CTRL_DSA_PARAMGEN_MD, 0,
- (void *)EVP_get_digestbyname(value));
+ (void *)md);
}
return -2;
}