Index: openssl/crypto/x509v3/v3_asid.c |
=================================================================== |
--- openssl/crypto/x509v3/v3_asid.c (revision 105093) |
+++ openssl/crypto/x509v3/v3_asid.c (working copy) |
@@ -61,7 +61,6 @@ |
#include <stdio.h> |
#include <string.h> |
-#include <assert.h> |
#include "cryptlib.h" |
#include <openssl/conf.h> |
#include <openssl/asn1.h> |
@@ -152,7 +151,7 @@ |
/* |
* i2r method for an ASIdentifier extension. |
*/ |
-static int i2r_ASIdentifiers(X509V3_EXT_METHOD *method, |
+static int i2r_ASIdentifiers(const X509V3_EXT_METHOD *method, |
void *ext, |
BIO *out, |
int indent) |
@@ -172,11 +171,11 @@ |
{ |
const ASIdOrRange *a = *a_, *b = *b_; |
- assert((a->type == ASIdOrRange_id && a->u.id != NULL) || |
+ OPENSSL_assert((a->type == ASIdOrRange_id && a->u.id != NULL) || |
(a->type == ASIdOrRange_range && a->u.range != NULL && |
a->u.range->min != NULL && a->u.range->max != NULL)); |
- assert((b->type == ASIdOrRange_id && b->u.id != NULL) || |
+ OPENSSL_assert((b->type == ASIdOrRange_id && b->u.id != NULL) || |
(b->type == ASIdOrRange_range && b->u.range != NULL && |
b->u.range->min != NULL && b->u.range->max != NULL)); |
@@ -215,7 +214,7 @@ |
if (*choice == NULL) { |
if ((*choice = ASIdentifierChoice_new()) == NULL) |
return 0; |
- assert((*choice)->u.inherit == NULL); |
+ OPENSSL_assert((*choice)->u.inherit == NULL); |
if (((*choice)->u.inherit = ASN1_NULL_new()) == NULL) |
return 0; |
(*choice)->type = ASIdentifierChoice_inherit; |
@@ -250,7 +249,7 @@ |
if (*choice == NULL) { |
if ((*choice = ASIdentifierChoice_new()) == NULL) |
return 0; |
- assert((*choice)->u.asIdsOrRanges == NULL); |
+ OPENSSL_assert((*choice)->u.asIdsOrRanges == NULL); |
(*choice)->u.asIdsOrRanges = sk_ASIdOrRange_new(ASIdOrRange_cmp); |
if ((*choice)->u.asIdsOrRanges == NULL) |
return 0; |
@@ -286,7 +285,7 @@ |
ASN1_INTEGER **min, |
ASN1_INTEGER **max) |
{ |
- assert(aor != NULL && min != NULL && max != NULL); |
+ OPENSSL_assert(aor != NULL && min != NULL && max != NULL); |
switch (aor->type) { |
case ASIdOrRange_id: |
*min = aor->u.id; |
@@ -373,7 +372,7 @@ |
int v3_asid_is_canonical(ASIdentifiers *asid) |
{ |
return (asid == NULL || |
- (ASIdentifierChoice_is_canonical(asid->asnum) || |
+ (ASIdentifierChoice_is_canonical(asid->asnum) && |
ASIdentifierChoice_is_canonical(asid->rdi))); |
} |
@@ -395,7 +394,7 @@ |
/* |
* We have a list. Sort it. |
*/ |
- assert(choice->type == ASIdentifierChoice_asIdsOrRanges); |
+ OPENSSL_assert(choice->type == ASIdentifierChoice_asIdsOrRanges); |
sk_ASIdOrRange_sort(choice->u.asIdsOrRanges); |
/* |
@@ -413,7 +412,7 @@ |
/* |
* Make sure we're properly sorted (paranoia). |
*/ |
- assert(ASN1_INTEGER_cmp(a_min, b_min) <= 0); |
+ OPENSSL_assert(ASN1_INTEGER_cmp(a_min, b_min) <= 0); |
/* |
* Check for overlaps. |
@@ -466,13 +465,13 @@ |
break; |
} |
ASIdOrRange_free(b); |
- (void)sk_ASIdOrRange_delete(choice->u.asIdsOrRanges, i + 1); |
+ sk_ASIdOrRange_delete(choice->u.asIdsOrRanges, i + 1); |
i--; |
continue; |
} |
} |
- assert(ASIdentifierChoice_is_canonical(choice)); /* Paranoia */ |
+ OPENSSL_assert(ASIdentifierChoice_is_canonical(choice)); /* Paranoia */ |
ret = 1; |
@@ -495,7 +494,7 @@ |
/* |
* v2i method for an ASIdentifier extension. |
*/ |
-static void *v2i_ASIdentifiers(struct v3_ext_method *method, |
+static void *v2i_ASIdentifiers(const struct v3_ext_method *method, |
struct v3_ext_ctx *ctx, |
STACK_OF(CONF_VALUE) *values) |
{ |
@@ -707,11 +706,11 @@ |
{ |
ASIdOrRanges *child_as = NULL, *child_rdi = NULL; |
int i, ret = 1, inherit_as = 0, inherit_rdi = 0; |
- X509 *x = NULL; |
+ X509 *x; |
- assert(chain != NULL && sk_X509_num(chain) > 0); |
- assert(ctx != NULL || ext != NULL); |
- assert(ctx == NULL || ctx->verify_cb != NULL); |
+ OPENSSL_assert(chain != NULL && sk_X509_num(chain) > 0); |
+ OPENSSL_assert(ctx != NULL || ext != NULL); |
+ OPENSSL_assert(ctx == NULL || ctx->verify_cb != NULL); |
/* |
* Figure out where to start. If we don't have an extension to |
@@ -720,10 +719,11 @@ |
*/ |
if (ext != NULL) { |
i = -1; |
+ x = NULL; |
} else { |
i = 0; |
x = sk_X509_value(chain, i); |
- assert(x != NULL); |
+ OPENSSL_assert(x != NULL); |
if ((ext = x->rfc3779_asid) == NULL) |
goto done; |
} |
@@ -756,7 +756,7 @@ |
*/ |
for (i++; i < sk_X509_num(chain); i++) { |
x = sk_X509_value(chain, i); |
- assert(x != NULL); |
+ OPENSSL_assert(x != NULL); |
if (x->rfc3779_asid == NULL) { |
if (child_as != NULL || child_rdi != NULL) |
validation_err(X509_V_ERR_UNNESTED_RESOURCE); |
@@ -799,6 +799,7 @@ |
/* |
* Trust anchor can't inherit. |
*/ |
+ OPENSSL_assert(x != NULL); |
if (x->rfc3779_asid != NULL) { |
if (x->rfc3779_asid->asnum != NULL && |
x->rfc3779_asid->asnum->type == ASIdentifierChoice_inherit) |