Updates following feedback on OPENSSL_assert() removal
authorMatt Caswell <matt@openssl.org>
Mon, 3 Jul 2017 10:47:10 +0000 (11:47 +0100)
committerMatt Caswell <matt@openssl.org>
Mon, 21 Aug 2017 07:44:44 +0000 (08:44 +0100)
Reviewed-by: Andy Polyakov <appro@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3740)

crypto/bio/b_addr.c
crypto/ec/ec_key.c
crypto/ec/ec_lib.c
crypto/x509v3/v3_addr.c
crypto/x509v3/v3_asid.c

index d3b758fc7af2075747d4374beb50cf84f34b6297..d0b2428450c6e6941228e21b34c89b6ac806bff2 100644 (file)
@@ -566,9 +566,6 @@ static int addrinfo_wrap(int family, int socktype,
                          unsigned short port,
                          BIO_ADDRINFO **bai)
 {
                          unsigned short port,
                          BIO_ADDRINFO **bai)
 {
-    if (bai == NULL)
-        return 0;
-
     *bai = OPENSSL_zalloc(sizeof(**bai));
     if (*bai == NULL)
         return 0;
     *bai = OPENSSL_zalloc(sizeof(**bai));
     if (*bai == NULL)
         return 0;
index fb8c3ed756cf4b964591cbea91b26c4c42e58fa4..6aa204eed09b2554cfeaa3af2067a29d6444d9e8 100644 (file)
@@ -191,8 +191,6 @@ int EC_KEY_generate_key(EC_KEY *eckey)
 
 int ossl_ec_key_gen(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);
 }
 
     return eckey->group->meth->keygen(eckey);
 }
 
index baf94f6a574ff796b42f11b6ffdeeb161f5c9ac3..6ccf6f12ccc9174ac6cdb88c2853e29b149655bb 100644 (file)
@@ -330,8 +330,6 @@ const BIGNUM *EC_GROUP_get0_order(const EC_GROUP *group)
 
 int EC_GROUP_order_bits(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);
 }
 
     return group->meth->group_order_bits(group);
 }
 
index f08e6a6902dc171db8cec38ff9ea95b8fdde5d89..64d27f26e545d9e13e050afc263fd4d6bcd2176a 100644 (file)
@@ -430,8 +430,6 @@ static int make_addressRange(IPAddressOrRange **result,
     if ((aor = IPAddressOrRange_new()) == NULL)
         return 0;
     aor->type = IPAddressOrRange_addressRange;
     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 &&
     if ((aor->u.addressRange = IPAddressRange_new()) == NULL)
         goto err;
     if (aor->u.addressRange->min == NULL &&
index 771f6da203fb84b56bd829f69b50bf83a9dff898..66259bae1bb19e3ead1dcae46760671934ef2079 100644 (file)
@@ -168,8 +168,6 @@ int X509v3_asid_add_inherit(ASIdentifiers *asid, int which)
     if (*choice == NULL) {
         if ((*choice = ASIdentifierChoice_new()) == NULL)
             return 0;
     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;
         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 (*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;
         (*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)
 {
 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:
         return 0;
     switch (aor->type) {
     case ASIdOrRange_id: