summaryrefslogtreecommitdiffstats
path: root/crypto/ec/ec_backend.c
diff options
context:
space:
mode:
authorShane Lontis <shane.lontis@oracle.com>2020-05-26 13:53:07 +1000
committerShane Lontis <shane.lontis@oracle.com>2020-05-26 13:53:07 +1000
commitb8086652650c0782bc8d63b620663e04a3c6a3a7 (patch)
tree831362a2004a3b79808f04eb4e387b7e649177ab /crypto/ec/ec_backend.c
parentf32af93c924dca25728d8e7b85b8e4b660154e12 (diff)
Update core_names.h fields and document most fields.
Renamed some values in core_names i.e Some DH specific names were changed to use DH instead of FFC. Added some strings values related to RSA keys. Moved set_params related docs out of EVP_PKEY_CTX_ctrl.pod into its own file. Updated Keyexchange and signature code and docs. Moved some common DSA/DH docs into a shared EVP_PKEY-FFC.pod. Moved Ed25519.pod into EVP_SIGNATURE-ED25519.pod and reworked it. Added some usage examples. As a result of the usage examples the following change was also made: ec allows OSSL_PKEY_PARAM_USE_COFACTOR_ECDH as a settable gen parameter. Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/11610)
Diffstat (limited to 'crypto/ec/ec_backend.c')
-rw-r--r--crypto/ec/ec_backend.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/crypto/ec/ec_backend.c b/crypto/ec/ec_backend.c
index 98dd0ecf5d..fb6497b084 100644
--- a/crypto/ec/ec_backend.c
+++ b/crypto/ec/ec_backend.c
@@ -19,15 +19,10 @@
* implementations alike.
*/
-int ec_set_param_ecdh_cofactor_mode(EC_KEY *ec, const OSSL_PARAM *p)
+int ec_set_ecdh_cofactor_mode(EC_KEY *ec, int mode)
{
const EC_GROUP *ecg = EC_KEY_get0_group(ec);
const BIGNUM *cofactor;
- int mode;
-
- if (!OSSL_PARAM_get_int(p, &mode))
- return 0;
-
/*
* mode can be only 0 for disable, or 1 for enable here.
*
@@ -224,8 +219,12 @@ int ec_key_otherparams_fromdata(EC_KEY *ec, const OSSL_PARAM params[])
return 0;
p = OSSL_PARAM_locate_const(params, OSSL_PKEY_PARAM_USE_COFACTOR_ECDH);
- if (p != NULL && !ec_set_param_ecdh_cofactor_mode(ec, p))
- return 0;
+ if (p != NULL) {
+ int mode;
+ if (!OSSL_PARAM_get_int(p, &mode)
+ || !ec_set_ecdh_cofactor_mode(ec, mode))
+ return 0;
+ }
return 1;
}