diff options
Diffstat (limited to 'src/lib/libcrypto/ecdh')
| -rw-r--r-- | src/lib/libcrypto/ecdh/ecdh.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/lib/libcrypto/ecdh/ecdh.c b/src/lib/libcrypto/ecdh/ecdh.c index d2de3a09af..d0486777e3 100644 --- a/src/lib/libcrypto/ecdh/ecdh.c +++ b/src/lib/libcrypto/ecdh/ecdh.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ecdh.c,v 1.1 2023/07/05 12:31:14 tb Exp $ */ | 1 | /* $OpenBSD: ecdh.c,v 1.2 2023/07/05 14:39:05 tb Exp $ */ |
| 2 | /* ==================================================================== | 2 | /* ==================================================================== |
| 3 | * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. | 3 | * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. |
| 4 | * | 4 | * |
| @@ -161,7 +161,7 @@ ecdh_compute_key(void *out, size_t outlen, const EC_POINT *pub_key, EC_KEY *ecdh | |||
| 161 | 161 | ||
| 162 | if (outlen > INT_MAX) { | 162 | if (outlen > INT_MAX) { |
| 163 | /* Sort of, anyway. */ | 163 | /* Sort of, anyway. */ |
| 164 | ECDHerror(ERR_R_MALLOC_FAILURE); | 164 | ECerror(ERR_R_MALLOC_FAILURE); |
| 165 | return -1; | 165 | return -1; |
| 166 | } | 166 | } |
| 167 | 167 | ||
| @@ -182,7 +182,7 @@ ecdh_compute_key(void *out, size_t outlen, const EC_POINT *pub_key, EC_KEY *ecdh | |||
| 182 | goto err; | 182 | goto err; |
| 183 | 183 | ||
| 184 | if ((point = EC_POINT_new(group)) == NULL) { | 184 | if ((point = EC_POINT_new(group)) == NULL) { |
| 185 | ECDHerror(ERR_R_MALLOC_FAILURE); | 185 | ECerror(ERR_R_MALLOC_FAILURE); |
| 186 | goto err; | 186 | goto err; |
| 187 | } | 187 | } |
| 188 | 188 | ||
| @@ -193,11 +193,11 @@ ecdh_compute_key(void *out, size_t outlen, const EC_POINT *pub_key, EC_KEY *ecdh | |||
| 193 | 193 | ||
| 194 | if ((EC_KEY_get_flags(ecdh) & EC_FLAG_COFACTOR_ECDH) != 0) { | 194 | if ((EC_KEY_get_flags(ecdh) & EC_FLAG_COFACTOR_ECDH) != 0) { |
| 195 | if (!EC_GROUP_get_cofactor(group, cofactor, NULL)) { | 195 | if (!EC_GROUP_get_cofactor(group, cofactor, NULL)) { |
| 196 | ECDHerror(ERR_R_EC_LIB); | 196 | ECerror(ERR_R_EC_LIB); |
| 197 | goto err; | 197 | goto err; |
| 198 | } | 198 | } |
| 199 | if (!BN_mul(cofactor, cofactor, priv_key, ctx)) { | 199 | if (!BN_mul(cofactor, cofactor, priv_key, ctx)) { |
| 200 | ECDHerror(ERR_R_BN_LIB); | 200 | ECerror(ERR_R_BN_LIB); |
| 201 | goto err; | 201 | goto err; |
| 202 | } | 202 | } |
| 203 | priv_key = cofactor; | 203 | priv_key = cofactor; |
| @@ -214,7 +214,7 @@ ecdh_compute_key(void *out, size_t outlen, const EC_POINT *pub_key, EC_KEY *ecdh | |||
| 214 | } | 214 | } |
| 215 | 215 | ||
| 216 | if ((buflen = ECDH_size(ecdh)) < BN_num_bytes(x)) { | 216 | if ((buflen = ECDH_size(ecdh)) < BN_num_bytes(x)) { |
| 217 | ECDHerror(ERR_R_INTERNAL_ERROR); | 217 | ECerror(ERR_R_INTERNAL_ERROR); |
| 218 | goto err; | 218 | goto err; |
| 219 | } | 219 | } |
| 220 | if (KDF == NULL && outlen < buflen) { | 220 | if (KDF == NULL && outlen < buflen) { |
| @@ -223,11 +223,11 @@ ecdh_compute_key(void *out, size_t outlen, const EC_POINT *pub_key, EC_KEY *ecdh | |||
| 223 | goto err; | 223 | goto err; |
| 224 | } | 224 | } |
| 225 | if ((buf = malloc(buflen)) == NULL) { | 225 | if ((buf = malloc(buflen)) == NULL) { |
| 226 | ECDHerror(ERR_R_MALLOC_FAILURE); | 226 | ECerror(ERR_R_MALLOC_FAILURE); |
| 227 | goto err; | 227 | goto err; |
| 228 | } | 228 | } |
| 229 | if (BN_bn2binpad(x, buf, buflen) != buflen) { | 229 | if (BN_bn2binpad(x, buf, buflen) != buflen) { |
| 230 | ECDHerror(ERR_R_BN_LIB); | 230 | ECerror(ERR_R_BN_LIB); |
| 231 | goto err; | 231 | goto err; |
| 232 | } | 232 | } |
| 233 | 233 | ||
