diff options
| author | op <> | 2024-08-26 22:01:28 +0000 |
|---|---|---|
| committer | op <> | 2024-08-26 22:01:28 +0000 |
| commit | 07d3f305ea24da68aec66c7e4be39317f6ea7dae (patch) | |
| tree | b4380f19ddfae3ecff8a6134f17a46a472cdd415 /src/lib/libcrypto/ec | |
| parent | 74733354b5147290f7bc39826a56793e0c4bdcda (diff) | |
| download | openbsd-07d3f305ea24da68aec66c7e4be39317f6ea7dae.tar.gz openbsd-07d3f305ea24da68aec66c7e4be39317f6ea7dae.tar.bz2 openbsd-07d3f305ea24da68aec66c7e4be39317f6ea7dae.zip | |
replace atoi(3) usage with strtonum(3); ok/tweaks tb@
Diffstat (limited to 'src/lib/libcrypto/ec')
| -rw-r--r-- | src/lib/libcrypto/ec/ec_pmeth.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/lib/libcrypto/ec/ec_pmeth.c b/src/lib/libcrypto/ec/ec_pmeth.c index 16fc07642a..d422765b00 100644 --- a/src/lib/libcrypto/ec/ec_pmeth.c +++ b/src/lib/libcrypto/ec/ec_pmeth.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ec_pmeth.c,v 1.21 2023/12/28 22:12:37 tb Exp $ */ | 1 | /* $OpenBSD: ec_pmeth.c,v 1.22 2024/08/26 22:01:28 op Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project 2006. | 3 | * project 2006. |
| 4 | */ | 4 | */ |
| @@ -57,6 +57,7 @@ | |||
| 57 | */ | 57 | */ |
| 58 | 58 | ||
| 59 | #include <stdio.h> | 59 | #include <stdio.h> |
| 60 | #include <stdlib.h> | ||
| 60 | #include <string.h> | 61 | #include <string.h> |
| 61 | 62 | ||
| 62 | #include <openssl/asn1t.h> | 63 | #include <openssl/asn1t.h> |
| @@ -445,10 +446,15 @@ pkey_ec_ctrl_str(EVP_PKEY_CTX *ctx, const char *type, const char *value) | |||
| 445 | } | 446 | } |
| 446 | return EVP_PKEY_CTX_set_ecdh_kdf_md(ctx, md); | 447 | return EVP_PKEY_CTX_set_ecdh_kdf_md(ctx, md); |
| 447 | } else if (strcmp(type, "ecdh_cofactor_mode") == 0) { | 448 | } else if (strcmp(type, "ecdh_cofactor_mode") == 0) { |
| 448 | int co_mode; | 449 | int cofactor_mode; |
| 449 | co_mode = atoi(value); | 450 | const char *errstr; |
| 450 | return EVP_PKEY_CTX_set_ecdh_cofactor_mode(ctx, co_mode); | 451 | |
| 452 | cofactor_mode = strtonum(value, -1, 1, &errstr); | ||
| 453 | if (errstr != NULL) | ||
| 454 | return -2; | ||
| 455 | return EVP_PKEY_CTX_set_ecdh_cofactor_mode(ctx, cofactor_mode); | ||
| 451 | } | 456 | } |
| 457 | |||
| 452 | return -2; | 458 | return -2; |
| 453 | } | 459 | } |
| 454 | 460 | ||
