diff options
Diffstat (limited to 'src/lib/libcrypto/x509v3/v3_asid.c')
| -rw-r--r-- | src/lib/libcrypto/x509v3/v3_asid.c | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/src/lib/libcrypto/x509v3/v3_asid.c b/src/lib/libcrypto/x509v3/v3_asid.c index 56702f86b9..3f434c0603 100644 --- a/src/lib/libcrypto/x509v3/v3_asid.c +++ b/src/lib/libcrypto/x509v3/v3_asid.c | |||
| @@ -61,7 +61,6 @@ | |||
| 61 | 61 | ||
| 62 | #include <stdio.h> | 62 | #include <stdio.h> |
| 63 | #include <string.h> | 63 | #include <string.h> |
| 64 | #include <assert.h> | ||
| 65 | #include "cryptlib.h" | 64 | #include "cryptlib.h" |
| 66 | #include <openssl/conf.h> | 65 | #include <openssl/conf.h> |
| 67 | #include <openssl/asn1.h> | 66 | #include <openssl/asn1.h> |
| @@ -172,11 +171,11 @@ static int ASIdOrRange_cmp(const ASIdOrRange * const *a_, | |||
| 172 | { | 171 | { |
| 173 | const ASIdOrRange *a = *a_, *b = *b_; | 172 | const ASIdOrRange *a = *a_, *b = *b_; |
| 174 | 173 | ||
| 175 | assert((a->type == ASIdOrRange_id && a->u.id != NULL) || | 174 | OPENSSL_assert((a->type == ASIdOrRange_id && a->u.id != NULL) || |
| 176 | (a->type == ASIdOrRange_range && a->u.range != NULL && | 175 | (a->type == ASIdOrRange_range && a->u.range != NULL && |
| 177 | a->u.range->min != NULL && a->u.range->max != NULL)); | 176 | a->u.range->min != NULL && a->u.range->max != NULL)); |
| 178 | 177 | ||
| 179 | assert((b->type == ASIdOrRange_id && b->u.id != NULL) || | 178 | OPENSSL_assert((b->type == ASIdOrRange_id && b->u.id != NULL) || |
| 180 | (b->type == ASIdOrRange_range && b->u.range != NULL && | 179 | (b->type == ASIdOrRange_range && b->u.range != NULL && |
| 181 | b->u.range->min != NULL && b->u.range->max != NULL)); | 180 | b->u.range->min != NULL && b->u.range->max != NULL)); |
| 182 | 181 | ||
| @@ -215,7 +214,7 @@ int v3_asid_add_inherit(ASIdentifiers *asid, int which) | |||
| 215 | if (*choice == NULL) { | 214 | if (*choice == NULL) { |
| 216 | if ((*choice = ASIdentifierChoice_new()) == NULL) | 215 | if ((*choice = ASIdentifierChoice_new()) == NULL) |
| 217 | return 0; | 216 | return 0; |
| 218 | assert((*choice)->u.inherit == NULL); | 217 | OPENSSL_assert((*choice)->u.inherit == NULL); |
| 219 | if (((*choice)->u.inherit = ASN1_NULL_new()) == NULL) | 218 | if (((*choice)->u.inherit = ASN1_NULL_new()) == NULL) |
| 220 | return 0; | 219 | return 0; |
| 221 | (*choice)->type = ASIdentifierChoice_inherit; | 220 | (*choice)->type = ASIdentifierChoice_inherit; |
| @@ -250,7 +249,7 @@ int v3_asid_add_id_or_range(ASIdentifiers *asid, | |||
| 250 | if (*choice == NULL) { | 249 | if (*choice == NULL) { |
| 251 | if ((*choice = ASIdentifierChoice_new()) == NULL) | 250 | if ((*choice = ASIdentifierChoice_new()) == NULL) |
| 252 | return 0; | 251 | return 0; |
| 253 | assert((*choice)->u.asIdsOrRanges == NULL); | 252 | OPENSSL_assert((*choice)->u.asIdsOrRanges == NULL); |
| 254 | (*choice)->u.asIdsOrRanges = sk_ASIdOrRange_new(ASIdOrRange_cmp); | 253 | (*choice)->u.asIdsOrRanges = sk_ASIdOrRange_new(ASIdOrRange_cmp); |
| 255 | if ((*choice)->u.asIdsOrRanges == NULL) | 254 | if ((*choice)->u.asIdsOrRanges == NULL) |
| 256 | return 0; | 255 | return 0; |
| @@ -286,7 +285,7 @@ static void extract_min_max(ASIdOrRange *aor, | |||
| 286 | ASN1_INTEGER **min, | 285 | ASN1_INTEGER **min, |
| 287 | ASN1_INTEGER **max) | 286 | ASN1_INTEGER **max) |
| 288 | { | 287 | { |
| 289 | assert(aor != NULL && min != NULL && max != NULL); | 288 | OPENSSL_assert(aor != NULL && min != NULL && max != NULL); |
| 290 | switch (aor->type) { | 289 | switch (aor->type) { |
| 291 | case ASIdOrRange_id: | 290 | case ASIdOrRange_id: |
| 292 | *min = aor->u.id; | 291 | *min = aor->u.id; |
| @@ -373,7 +372,7 @@ static int ASIdentifierChoice_is_canonical(ASIdentifierChoice *choice) | |||
| 373 | int v3_asid_is_canonical(ASIdentifiers *asid) | 372 | int v3_asid_is_canonical(ASIdentifiers *asid) |
| 374 | { | 373 | { |
| 375 | return (asid == NULL || | 374 | return (asid == NULL || |
| 376 | (ASIdentifierChoice_is_canonical(asid->asnum) || | 375 | (ASIdentifierChoice_is_canonical(asid->asnum) && |
| 377 | ASIdentifierChoice_is_canonical(asid->rdi))); | 376 | ASIdentifierChoice_is_canonical(asid->rdi))); |
| 378 | } | 377 | } |
| 379 | 378 | ||
| @@ -395,7 +394,7 @@ static int ASIdentifierChoice_canonize(ASIdentifierChoice *choice) | |||
| 395 | /* | 394 | /* |
| 396 | * We have a list. Sort it. | 395 | * We have a list. Sort it. |
| 397 | */ | 396 | */ |
| 398 | assert(choice->type == ASIdentifierChoice_asIdsOrRanges); | 397 | OPENSSL_assert(choice->type == ASIdentifierChoice_asIdsOrRanges); |
| 399 | sk_ASIdOrRange_sort(choice->u.asIdsOrRanges); | 398 | sk_ASIdOrRange_sort(choice->u.asIdsOrRanges); |
| 400 | 399 | ||
| 401 | /* | 400 | /* |
| @@ -413,7 +412,7 @@ static int ASIdentifierChoice_canonize(ASIdentifierChoice *choice) | |||
| 413 | /* | 412 | /* |
| 414 | * Make sure we're properly sorted (paranoia). | 413 | * Make sure we're properly sorted (paranoia). |
| 415 | */ | 414 | */ |
| 416 | assert(ASN1_INTEGER_cmp(a_min, b_min) <= 0); | 415 | OPENSSL_assert(ASN1_INTEGER_cmp(a_min, b_min) <= 0); |
| 417 | 416 | ||
| 418 | /* | 417 | /* |
| 419 | * Check for overlaps. | 418 | * Check for overlaps. |
| @@ -472,7 +471,7 @@ static int ASIdentifierChoice_canonize(ASIdentifierChoice *choice) | |||
| 472 | } | 471 | } |
| 473 | } | 472 | } |
| 474 | 473 | ||
| 475 | assert(ASIdentifierChoice_is_canonical(choice)); /* Paranoia */ | 474 | OPENSSL_assert(ASIdentifierChoice_is_canonical(choice)); /* Paranoia */ |
| 476 | 475 | ||
| 477 | ret = 1; | 476 | ret = 1; |
| 478 | 477 | ||
| @@ -709,9 +708,9 @@ static int v3_asid_validate_path_internal(X509_STORE_CTX *ctx, | |||
| 709 | int i, ret = 1, inherit_as = 0, inherit_rdi = 0; | 708 | int i, ret = 1, inherit_as = 0, inherit_rdi = 0; |
| 710 | X509 *x; | 709 | X509 *x; |
| 711 | 710 | ||
| 712 | assert(chain != NULL && sk_X509_num(chain) > 0); | 711 | OPENSSL_assert(chain != NULL && sk_X509_num(chain) > 0); |
| 713 | assert(ctx != NULL || ext != NULL); | 712 | OPENSSL_assert(ctx != NULL || ext != NULL); |
| 714 | assert(ctx == NULL || ctx->verify_cb != NULL); | 713 | OPENSSL_assert(ctx == NULL || ctx->verify_cb != NULL); |
| 715 | 714 | ||
| 716 | /* | 715 | /* |
| 717 | * Figure out where to start. If we don't have an extension to | 716 | * Figure out where to start. If we don't have an extension to |
| @@ -724,7 +723,7 @@ static int v3_asid_validate_path_internal(X509_STORE_CTX *ctx, | |||
| 724 | } else { | 723 | } else { |
| 725 | i = 0; | 724 | i = 0; |
| 726 | x = sk_X509_value(chain, i); | 725 | x = sk_X509_value(chain, i); |
| 727 | assert(x != NULL); | 726 | OPENSSL_assert(x != NULL); |
| 728 | if ((ext = x->rfc3779_asid) == NULL) | 727 | if ((ext = x->rfc3779_asid) == NULL) |
| 729 | goto done; | 728 | goto done; |
| 730 | } | 729 | } |
| @@ -757,7 +756,7 @@ static int v3_asid_validate_path_internal(X509_STORE_CTX *ctx, | |||
| 757 | */ | 756 | */ |
| 758 | for (i++; i < sk_X509_num(chain); i++) { | 757 | for (i++; i < sk_X509_num(chain); i++) { |
| 759 | x = sk_X509_value(chain, i); | 758 | x = sk_X509_value(chain, i); |
| 760 | assert(x != NULL); | 759 | OPENSSL_assert(x != NULL); |
| 761 | if (x->rfc3779_asid == NULL) { | 760 | if (x->rfc3779_asid == NULL) { |
| 762 | if (child_as != NULL || child_rdi != NULL) | 761 | if (child_as != NULL || child_rdi != NULL) |
| 763 | validation_err(X509_V_ERR_UNNESTED_RESOURCE); | 762 | validation_err(X509_V_ERR_UNNESTED_RESOURCE); |
| @@ -800,7 +799,7 @@ static int v3_asid_validate_path_internal(X509_STORE_CTX *ctx, | |||
| 800 | /* | 799 | /* |
| 801 | * Trust anchor can't inherit. | 800 | * Trust anchor can't inherit. |
| 802 | */ | 801 | */ |
| 803 | assert(x != NULL); | 802 | OPENSSL_assert(x != NULL); |
| 804 | if (x->rfc3779_asid != NULL) { | 803 | if (x->rfc3779_asid != NULL) { |
| 805 | if (x->rfc3779_asid->asnum != NULL && | 804 | if (x->rfc3779_asid->asnum != NULL && |
| 806 | x->rfc3779_asid->asnum->type == ASIdentifierChoice_inherit) | 805 | x->rfc3779_asid->asnum->type == ASIdentifierChoice_inherit) |
