Use _hx509_abort.

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@16436 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Love Hörnquist Åstrand
2006-01-03 08:26:26 +00:00
parent fde07b8b17
commit 02d27ea231
6 changed files with 31 additions and 16 deletions

View File

@@ -69,7 +69,23 @@ typedef struct hx509_name_constraints {
#define GeneralSubtrees_SET(g,var) \
(g)->len = (var)->len, (g)->val = (var)->val;
/*
*
*/
void
_hx509_abort(const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
vprintf(fmt, ap);
va_end(ap);
abort();
}
/*
*
*/
Certificate *
_hx509_get_cert(hx509_cert cert)
@@ -145,7 +161,7 @@ hx509_cert_free(hx509_cert cert)
int i;
if (cert->ref <= 0)
abort();
_hx509_abort("refcount <= 0");
if (--cert->ref > 0)
return;
free_Certificate(cert->data);
@@ -166,10 +182,10 @@ hx509_cert
hx509_cert_ref(hx509_cert cert)
{
if (cert->ref <= 0)
abort();
_hx509_abort("refcount <= 0");
cert->ref++;
if (cert->ref == 0)
abort();
_hx509_abort("refcount == 0");
return cert;
}

View File

@@ -772,7 +772,7 @@ hx509_cms_create_signed_1(const heim_oid *eContentType,
if (ret)
goto out;
if (size != buf.length)
abort();
_hx509_abort("internal ASN.1 encoder error");
ret = add_one_attribute(&signer_info->signedAttrs->val,
&signer_info->signedAttrs->len,
@@ -794,7 +794,7 @@ hx509_cms_create_signed_1(const heim_oid *eContentType,
if (ret)
goto out;
if (size != buf.length)
abort();
_hx509_abort("internal ASN.1 encoder error");
ret = add_one_attribute(&signer_info->signedAttrs->val,
&signer_info->signedAttrs->len,
@@ -822,8 +822,7 @@ hx509_cms_create_signed_1(const heim_oid *eContentType,
if (ret)
goto out;
if (size != os.length)
abort();
_hx509_abort("internal ASN.1 encoder error");
ret = _hx509_create_signature(_hx509_cert_private_key(cert),
hx509_signature_rsa_with_sha1(),
@@ -874,7 +873,7 @@ hx509_cms_create_signed_1(const heim_oid *eContentType,
if (ret)
goto out;
if (signed_data->length != size)
abort();
_hx509_abort("internal ASN.1 encoder error");
out:
free_SignedData(&sd);

View File

@@ -202,7 +202,7 @@ rsa_verify_signature(const struct signature_alg *sig_alg,
goto out;
}
if (ret > tosize)
abort();
_hx509_abort("internal rsa decryption failure: ret > tosize");
ret = decode_DigestInfo(to, ret, &di, &size);
free(to);
if (ret) {
@@ -714,7 +714,7 @@ _hx509_public_encrypt(const heim_octet_string *cleartext,
return EINVAL;
}
if (ret > tosize)
abort();
_hx509_abort("internal rsa decryption failure: ret > tosize");
ciphertext->length = ret;
ciphertext->data = to;
@@ -1043,7 +1043,7 @@ hx509_crypto_get_params(hx509_crypto crypto,
if (ret)
return ret;
if (param->length != size)
abort();
_hx509_abort("internal ASN.1 encoder error");
return 0;
}

View File

@@ -247,7 +247,7 @@ cms_create_sd(struct cms_create_sd_options *opt, int argc, char **argv)
if (ret)
errx(1, "encode ContentInfo");
if (o.length != size)
abort();
_hx509_abort("internal ASN.1 encoder error");
free_ContentInfo(&ci);
@@ -391,7 +391,7 @@ cms_create_enveloped(struct cms_envelope_options *opt, int argc, char **argv)
if (ret)
errx(1, "encode ContentInfo");
if (o.length != size)
abort();
_hx509_abort("internal ASN.1 encoder error");
free_ContentInfo(&ci);

View File

@@ -137,7 +137,7 @@ ShroudedKeyBag_parser(struct collector *c, const void *data, size_t length,
void *d;
d = realloc(c->val.data, (c->val.len + 1) * sizeof(c->val.data[0]));
if (d == NULL) {
abort();
_hx509_abort("allocation failure"); /* XXX */
}
c->val.data = d;
c->val.data[c->val.len] = key;
@@ -453,7 +453,7 @@ p12_init(hx509_certs certs, void **data, int flags,
struct ks_pkcs12 *p12;
p12 = malloc(sizeof(*p12));
if (p12 == NULL) {
abort();
_hx509_abort("allocation failure"); /* XXX */
}
memset(p12, 0, sizeof(*p12));
p12->certs = c.certs;

View File

@@ -172,7 +172,7 @@ check_Null(hx509_validate_ctx ctx, enum critical_flag cf, const Extension *e)
"\tCritical set on MUST NOT\n");
break;
default:
abort();
_hx509_abort("internal check_Null state error");
}
return 0;
}