diff options
author | miod <> | 2015-02-10 09:52:35 +0000 |
---|---|---|
committer | miod <> | 2015-02-10 09:52:35 +0000 |
commit | d2f68f95d95ff1ca4370b66eb67e8add10d9d079 (patch) | |
tree | 58f7f299c05557099d7278079e061aed0f4a9f23 /src/lib/libcrypto/evp/evp_lib.c | |
parent | 9c8f4b278d0fe6c5ae67ecea60905c57ccf4c4e1 (diff) | |
download | openbsd-d2f68f95d95ff1ca4370b66eb67e8add10d9d079.tar.gz openbsd-d2f68f95d95ff1ca4370b66eb67e8add10d9d079.tar.bz2 openbsd-d2f68f95d95ff1ca4370b66eb67e8add10d9d079.zip |
Replace assert() and OPENSSL_assert() calls with proper error return paths.
Careful review, feedback & ok doug@ jsing@
Diffstat (limited to 'src/lib/libcrypto/evp/evp_lib.c')
-rw-r--r-- | src/lib/libcrypto/evp/evp_lib.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/lib/libcrypto/evp/evp_lib.c b/src/lib/libcrypto/evp/evp_lib.c index 310252d0e8..491c8d6f67 100644 --- a/src/lib/libcrypto/evp/evp_lib.c +++ b/src/lib/libcrypto/evp/evp_lib.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: evp_lib.c,v 1.13 2014/07/11 08:44:48 jsing Exp $ */ | 1 | /* $OpenBSD: evp_lib.c,v 1.14 2015/02/10 09:52:35 miod 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 | * |
@@ -99,7 +99,11 @@ EVP_CIPHER_get_asn1_iv(EVP_CIPHER_CTX *c, ASN1_TYPE *type) | |||
99 | 99 | ||
100 | if (type != NULL) { | 100 | if (type != NULL) { |
101 | l = EVP_CIPHER_CTX_iv_length(c); | 101 | l = EVP_CIPHER_CTX_iv_length(c); |
102 | OPENSSL_assert(l <= sizeof(c->iv)); | 102 | if (l > sizeof(c->iv)) { |
103 | EVPerr(EVP_F_EVP_CIPHER_GET_ASN1_IV, | ||
104 | EVP_R_IV_TOO_LARGE); | ||
105 | return 0; | ||
106 | } | ||
103 | i = ASN1_TYPE_get_octetstring(type, c->oiv, l); | 107 | i = ASN1_TYPE_get_octetstring(type, c->oiv, l); |
104 | if (i != (int)l) | 108 | if (i != (int)l) |
105 | return (-1); | 109 | return (-1); |
@@ -117,7 +121,11 @@ EVP_CIPHER_set_asn1_iv(EVP_CIPHER_CTX *c, ASN1_TYPE *type) | |||
117 | 121 | ||
118 | if (type != NULL) { | 122 | if (type != NULL) { |
119 | j = EVP_CIPHER_CTX_iv_length(c); | 123 | j = EVP_CIPHER_CTX_iv_length(c); |
120 | OPENSSL_assert(j <= sizeof(c->iv)); | 124 | if (j > sizeof(c->iv)) { |
125 | EVPerr(EVP_F_EVP_CIPHER_SET_ASN1_IV, | ||
126 | EVP_R_IV_TOO_LARGE); | ||
127 | return 0; | ||
128 | } | ||
121 | i = ASN1_TYPE_set_octetstring(type, c->oiv, j); | 129 | i = ASN1_TYPE_set_octetstring(type, c->oiv, j); |
122 | } | 130 | } |
123 | return (i); | 131 | return (i); |