From 638c2dd0ab504e22af08e4d56b43959a8be2382e Mon Sep 17 00:00:00 2001 From: Matt Caswell Date: Mon, 3 Jul 2017 11:47:10 +0100 Subject: [PATCH] Updates following feedback on OPENSSL_assert() removal Reviewed-by: Andy Polyakov (Merged from https://github.com/openssl/openssl/pull/3740) --- crypto/bio/b_addr.c | 3 --- crypto/ec/ec_key.c | 2 -- crypto/ec/ec_lib.c | 2 -- crypto/x509v3/v3_addr.c | 2 -- crypto/x509v3/v3_asid.c | 6 +----- 5 files changed, 1 insertion(+), 14 deletions(-) diff --git a/crypto/bio/b_addr.c b/crypto/bio/b_addr.c index d3b758fc7a..d0b2428450 100644 --- a/crypto/bio/b_addr.c +++ b/crypto/bio/b_addr.c @@ -566,9 +566,6 @@ static int addrinfo_wrap(int family, int socktype, unsigned short port, BIO_ADDRINFO **bai) { - if (bai == NULL) - return 0; - *bai = OPENSSL_zalloc(sizeof(**bai)); if (*bai == NULL) return 0; diff --git a/crypto/ec/ec_key.c b/crypto/ec/ec_key.c index fb8c3ed756..6aa204eed0 100644 --- a/crypto/ec/ec_key.c +++ b/crypto/ec/ec_key.c @@ -191,8 +191,6 @@ int EC_KEY_generate_key(EC_KEY *eckey) int ossl_ec_key_gen(EC_KEY *eckey) { - if (!ossl_assert(eckey->group->meth->keygen != NULL)) - return 0; return eckey->group->meth->keygen(eckey); } diff --git a/crypto/ec/ec_lib.c b/crypto/ec/ec_lib.c index baf94f6a57..6ccf6f12cc 100644 --- a/crypto/ec/ec_lib.c +++ b/crypto/ec/ec_lib.c @@ -330,8 +330,6 @@ const BIGNUM *EC_GROUP_get0_order(const EC_GROUP *group) int EC_GROUP_order_bits(const EC_GROUP *group) { - if (!ossl_assert(group->meth->group_order_bits != NULL)) - return 0; return group->meth->group_order_bits(group); } diff --git a/crypto/x509v3/v3_addr.c b/crypto/x509v3/v3_addr.c index f08e6a6902..64d27f26e5 100644 --- a/crypto/x509v3/v3_addr.c +++ b/crypto/x509v3/v3_addr.c @@ -430,8 +430,6 @@ static int make_addressRange(IPAddressOrRange **result, if ((aor = IPAddressOrRange_new()) == NULL) return 0; aor->type = IPAddressOrRange_addressRange; - if (!ossl_assert(aor->u.addressRange == NULL)) - return 0; if ((aor->u.addressRange = IPAddressRange_new()) == NULL) goto err; if (aor->u.addressRange->min == NULL && diff --git a/crypto/x509v3/v3_asid.c b/crypto/x509v3/v3_asid.c index 771f6da203..66259bae1b 100644 --- a/crypto/x509v3/v3_asid.c +++ b/crypto/x509v3/v3_asid.c @@ -168,8 +168,6 @@ int X509v3_asid_add_inherit(ASIdentifiers *asid, int which) if (*choice == NULL) { if ((*choice = ASIdentifierChoice_new()) == NULL) return 0; - if (!ossl_assert((*choice)->u.inherit == NULL)) - return 0; if (((*choice)->u.inherit = ASN1_NULL_new()) == NULL) return 0; (*choice)->type = ASIdentifierChoice_inherit; @@ -202,8 +200,6 @@ int X509v3_asid_add_id_or_range(ASIdentifiers *asid, if (*choice == NULL) { if ((*choice = ASIdentifierChoice_new()) == NULL) return 0; - if (!ossl_assert((*choice)->u.asIdsOrRanges == NULL)) - return 0; (*choice)->u.asIdsOrRanges = sk_ASIdOrRange_new(ASIdOrRange_cmp); if ((*choice)->u.asIdsOrRanges == NULL) return 0; @@ -238,7 +234,7 @@ int X509v3_asid_add_id_or_range(ASIdentifiers *asid, static int extract_min_max(ASIdOrRange *aor, ASN1_INTEGER **min, ASN1_INTEGER **max) { - if (!ossl_assert(aor != NULL && min != NULL && max != NULL)) + if (!ossl_assert(aor != NULL)) return 0; switch (aor->type) { case ASIdOrRange_id: -- 2.25.1