diff options
| author | inoguchi <> | 2022-01-20 11:31:37 +0000 |
|---|---|---|
| committer | inoguchi <> | 2022-01-20 11:31:37 +0000 |
| commit | 08017d5c7cc33ae5611e7d98f2bf7ad2d26a9d4b (patch) | |
| tree | 3a7ec1f957424bf49bf6a83b63fcc3f049ed204a /src/lib/libc | |
| parent | 5bd8cace3f0ab8fb1911e9db876c5353877a2fd5 (diff) | |
| download | openbsd-08017d5c7cc33ae5611e7d98f2bf7ad2d26a9d4b.tar.gz openbsd-08017d5c7cc33ae5611e7d98f2bf7ad2d26a9d4b.tar.bz2 openbsd-08017d5c7cc33ae5611e7d98f2bf7ad2d26a9d4b.zip | |
Add check for EVP_CIPHER_CTX_ctrl
suggestion from tb@
Diffstat (limited to '')
| -rw-r--r-- | src/lib/libcrypto/evp/e_rc2.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/lib/libcrypto/evp/e_rc2.c b/src/lib/libcrypto/evp/e_rc2.c index d8c331d535..b07fafddfd 100644 --- a/src/lib/libcrypto/evp/e_rc2.c +++ b/src/lib/libcrypto/evp/e_rc2.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: e_rc2.c,v 1.13 2022/01/20 11:22:48 inoguchi Exp $ */ | 1 | /* $OpenBSD: e_rc2.c,v 1.14 2022/01/20 11:31:37 inoguchi Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -150,7 +150,8 @@ rc2_meth_to_magic(EVP_CIPHER_CTX *e) | |||
| 150 | { | 150 | { |
| 151 | int i; | 151 | int i; |
| 152 | 152 | ||
| 153 | EVP_CIPHER_CTX_ctrl(e, EVP_CTRL_GET_RC2_KEY_BITS, 0, &i); | 153 | if (EVP_CIPHER_CTX_ctrl(e, EVP_CTRL_GET_RC2_KEY_BITS, 0, &i) <= 0) |
| 154 | return (0); | ||
| 154 | if (i == 128) | 155 | if (i == 128) |
| 155 | return (RC2_128_MAGIC); | 156 | return (RC2_128_MAGIC); |
| 156 | else if (i == 64) | 157 | else if (i == 64) |
| @@ -199,8 +200,9 @@ rc2_get_asn1_type_and_iv(EVP_CIPHER_CTX *c, ASN1_TYPE *type) | |||
| 199 | return (-1); | 200 | return (-1); |
| 200 | if (i > 0 && !EVP_CipherInit_ex(c, NULL, NULL, NULL, iv, -1)) | 201 | if (i > 0 && !EVP_CipherInit_ex(c, NULL, NULL, NULL, iv, -1)) |
| 201 | return -1; | 202 | return -1; |
| 202 | EVP_CIPHER_CTX_ctrl(c, EVP_CTRL_SET_RC2_KEY_BITS, | 203 | if (EVP_CIPHER_CTX_ctrl(c, EVP_CTRL_SET_RC2_KEY_BITS, |
| 203 | key_bits, NULL); | 204 | key_bits, NULL) <= 0) |
| 205 | return -1; | ||
| 204 | if (!EVP_CIPHER_CTX_set_key_length(c, key_bits / 8)) | 206 | if (!EVP_CIPHER_CTX_set_key_length(c, key_bits / 8)) |
| 205 | return -1; | 207 | return -1; |
| 206 | } | 208 | } |
