From fa7a388e9e8248bdb229c56d92b1d639c09c76c0 Mon Sep 17 00:00:00 2001 From: Joel Sing Date: Wed, 30 Sep 2015 17:30:17 +0000 Subject: Replace M_ASN1_INTEGER_(new|free) with ASN1_INTEGER_(new|free) - this is different from the macro expansion, but the result is the same. Also replace some ASN1_STRING_dup() with ASN1_INTEGER_dup(). ok beck@ doug@ --- lib/libssl/src/crypto/asn1/a_int.c | 14 +++++++------- lib/libssl/src/crypto/asn1/asn1_par.c | 4 ++-- lib/libssl/src/crypto/asn1/evp_asn1.c | 4 ++-- lib/libssl/src/crypto/asn1/p5_pbev2.c | 6 +++--- lib/libssl/src/crypto/pkcs12/p12_mutl.c | 4 ++-- lib/libssl/src/crypto/pkcs7/pk7_lib.c | 6 +++--- lib/libssl/src/crypto/x509/x509_r2x.c | 4 ++-- lib/libssl/src/crypto/x509/x509_req.c | 4 ++-- lib/libssl/src/crypto/x509/x509_set.c | 8 ++++---- lib/libssl/src/crypto/x509/x509cset.c | 8 ++++---- lib/libssl/src/crypto/x509v3/v3_akey.c | 6 +++--- lib/libssl/src/crypto/x509v3/v3_sxnet.c | 14 +++++++------- 12 files changed, 41 insertions(+), 41 deletions(-) diff --git a/lib/libssl/src/crypto/asn1/a_int.c b/lib/libssl/src/crypto/asn1/a_int.c index cbe68ec6d8c..5c0103ba36f 100644 --- a/lib/libssl/src/crypto/asn1/a_int.c +++ b/lib/libssl/src/crypto/asn1/a_int.c @@ -1,4 +1,4 @@ -/* $OpenBSD: a_int.c,v 1.29 2015/09/30 17:04:09 jsing Exp $ */ +/* $OpenBSD: a_int.c,v 1.30 2015/09/30 17:30:15 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -196,7 +196,7 @@ c2i_ASN1_INTEGER(ASN1_INTEGER **a, const unsigned char **pp, long len) int i; if ((a == NULL) || ((*a) == NULL)) { - if ((ret = M_ASN1_INTEGER_new()) == NULL) + if ((ret = ASN1_INTEGER_new()) == NULL) return (NULL); } else ret = (*a); @@ -268,7 +268,7 @@ c2i_ASN1_INTEGER(ASN1_INTEGER **a, const unsigned char **pp, long len) err: ASN1err(ASN1_F_C2I_ASN1_INTEGER, i); if (a == NULL || *a != ret) - M_ASN1_INTEGER_free(ret); + ASN1_INTEGER_free(ret); return (NULL); } @@ -289,7 +289,7 @@ d2i_ASN1_UINTEGER(ASN1_INTEGER **a, const unsigned char **pp, long length) int i; if ((a == NULL) || ((*a) == NULL)) { - if ((ret = M_ASN1_INTEGER_new()) == NULL) + if ((ret = ASN1_INTEGER_new()) == NULL) return (NULL); } else ret = (*a); @@ -334,7 +334,7 @@ d2i_ASN1_UINTEGER(ASN1_INTEGER **a, const unsigned char **pp, long length) err: ASN1err(ASN1_F_D2I_ASN1_UINTEGER, i); if (a == NULL || *a != ret) - M_ASN1_INTEGER_free(ret); + ASN1_INTEGER_free(ret); return (NULL); } @@ -412,7 +412,7 @@ BN_to_ASN1_INTEGER(const BIGNUM *bn, ASN1_INTEGER *ai) int len, j; if (ai == NULL) - ret = M_ASN1_INTEGER_new(); + ret = ASN1_INTEGER_new(); else ret = ai; if (ret == NULL) { @@ -444,7 +444,7 @@ BN_to_ASN1_INTEGER(const BIGNUM *bn, ASN1_INTEGER *ai) err: if (ret != ai) - M_ASN1_INTEGER_free(ret); + ASN1_INTEGER_free(ret); return (NULL); } diff --git a/lib/libssl/src/crypto/asn1/asn1_par.c b/lib/libssl/src/crypto/asn1/asn1_par.c index b5742fe97df..9057185e748 100644 --- a/lib/libssl/src/crypto/asn1/asn1_par.c +++ b/lib/libssl/src/crypto/asn1/asn1_par.c @@ -1,4 +1,4 @@ -/* $OpenBSD: asn1_par.c,v 1.22 2015/02/07 13:19:15 doug Exp $ */ +/* $OpenBSD: asn1_par.c,v 1.23 2015/09/30 17:30:15 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -313,7 +313,7 @@ asn1_parse2(BIO *bp, const unsigned char **pp, long length, int offset, if (BIO_write(bp, "BAD INTEGER", 11) <= 0) goto end; } - M_ASN1_INTEGER_free(bs); + ASN1_INTEGER_free(bs); } else if (tag == V_ASN1_ENUMERATED) { ASN1_ENUMERATED *bs; int i; diff --git a/lib/libssl/src/crypto/asn1/evp_asn1.c b/lib/libssl/src/crypto/asn1/evp_asn1.c index a982866f2e1..e5fcf26030c 100644 --- a/lib/libssl/src/crypto/asn1/evp_asn1.c +++ b/lib/libssl/src/crypto/asn1/evp_asn1.c @@ -1,4 +1,4 @@ -/* $OpenBSD: evp_asn1.c,v 1.15 2015/09/10 14:29:22 jsing Exp $ */ +/* $OpenBSD: evp_asn1.c,v 1.16 2015/09/30 17:30:15 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -194,6 +194,6 @@ err: ASN1_R_DATA_IS_WRONG); } M_ASN1_OCTET_STRING_free(os); - M_ASN1_INTEGER_free(ai); + ASN1_INTEGER_free(ai); return (ret); } diff --git a/lib/libssl/src/crypto/asn1/p5_pbev2.c b/lib/libssl/src/crypto/asn1/p5_pbev2.c index 795721fad2d..0a6d18d154f 100644 --- a/lib/libssl/src/crypto/asn1/p5_pbev2.c +++ b/lib/libssl/src/crypto/asn1/p5_pbev2.c @@ -1,4 +1,4 @@ -/* $OpenBSD: p5_pbev2.c,v 1.21 2015/02/11 04:00:39 jsing Exp $ */ +/* $OpenBSD: p5_pbev2.c,v 1.22 2015/09/30 17:30:15 jsing Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 1999-2004. */ @@ -330,9 +330,9 @@ PKCS5_pbkdf2_set(int iter, unsigned char *salt, int saltlen, int prf_nid, /* If have a key len set it up */ if (keylen > 0) { - if (!(kdf->keylength = M_ASN1_INTEGER_new())) + if (!(kdf->keylength = ASN1_INTEGER_new())) goto merr; - if (!ASN1_INTEGER_set (kdf->keylength, keylen)) + if (!ASN1_INTEGER_set(kdf->keylength, keylen)) goto merr; } diff --git a/lib/libssl/src/crypto/pkcs12/p12_mutl.c b/lib/libssl/src/crypto/pkcs12/p12_mutl.c index 00acf1f210c..bf88c782702 100644 --- a/lib/libssl/src/crypto/pkcs12/p12_mutl.c +++ b/lib/libssl/src/crypto/pkcs12/p12_mutl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: p12_mutl.c,v 1.20 2015/07/29 14:58:34 jsing Exp $ */ +/* $OpenBSD: p12_mutl.c,v 1.21 2015/09/30 17:30:15 jsing Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 1999. */ @@ -176,7 +176,7 @@ PKCS12_setup_mac(PKCS12 *p12, int iter, unsigned char *salt, int saltlen, if (!(p12->mac = PKCS12_MAC_DATA_new())) return PKCS12_ERROR; if (iter > 1) { - if (!(p12->mac->iter = M_ASN1_INTEGER_new())) { + if (!(p12->mac->iter = ASN1_INTEGER_new())) { PKCS12err(PKCS12_F_PKCS12_SETUP_MAC, ERR_R_MALLOC_FAILURE); return 0; diff --git a/lib/libssl/src/crypto/pkcs7/pk7_lib.c b/lib/libssl/src/crypto/pkcs7/pk7_lib.c index 9f7e4f2dd36..7aedc3c44e9 100644 --- a/lib/libssl/src/crypto/pkcs7/pk7_lib.c +++ b/lib/libssl/src/crypto/pkcs7/pk7_lib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pk7_lib.c,v 1.16 2015/07/29 14:58:34 jsing Exp $ */ +/* $OpenBSD: pk7_lib.c,v 1.17 2015/09/30 17:30:15 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -378,7 +378,7 @@ PKCS7_SIGNER_INFO_set(PKCS7_SIGNER_INFO *p7i, X509 *x509, EVP_PKEY *pkey, /* because ASN1_INTEGER_set is used to set a 'long' we will do * things the ugly way. */ - M_ASN1_INTEGER_free(p7i->issuer_and_serial->serial); + ASN1_INTEGER_free(p7i->issuer_and_serial->serial); if (!(p7i->issuer_and_serial->serial = ASN1_STRING_dup(X509_get_serialNumber(x509)))) goto err; @@ -543,7 +543,7 @@ PKCS7_RECIP_INFO_set(PKCS7_RECIP_INFO *p7i, X509 *x509) X509_get_issuer_name(x509))) return 0; - M_ASN1_INTEGER_free(p7i->issuer_and_serial->serial); + ASN1_INTEGER_free(p7i->issuer_and_serial->serial); if (!(p7i->issuer_and_serial->serial = ASN1_STRING_dup(X509_get_serialNumber(x509)))) return 0; diff --git a/lib/libssl/src/crypto/x509/x509_r2x.c b/lib/libssl/src/crypto/x509/x509_r2x.c index 9a9a59d9bb2..76faa29b7f2 100644 --- a/lib/libssl/src/crypto/x509/x509_r2x.c +++ b/lib/libssl/src/crypto/x509/x509_r2x.c @@ -1,4 +1,4 @@ -/* $OpenBSD: x509_r2x.c,v 1.9 2014/07/11 08:44:49 jsing Exp $ */ +/* $OpenBSD: x509_r2x.c,v 1.10 2015/09/30 17:30:16 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -82,7 +82,7 @@ X509_REQ_to_X509(X509_REQ *r, int days, EVP_PKEY *pkey) xi = ret->cert_info; if (sk_X509_ATTRIBUTE_num(r->req_info->attributes) != 0) { - if ((xi->version = M_ASN1_INTEGER_new()) == NULL) + if ((xi->version = ASN1_INTEGER_new()) == NULL) goto err; if (!ASN1_INTEGER_set(xi->version, 2)) goto err; diff --git a/lib/libssl/src/crypto/x509/x509_req.c b/lib/libssl/src/crypto/x509/x509_req.c index 8813f372cce..dc4bc2639a4 100644 --- a/lib/libssl/src/crypto/x509/x509_req.c +++ b/lib/libssl/src/crypto/x509/x509_req.c @@ -1,4 +1,4 @@ -/* $OpenBSD: x509_req.c,v 1.17 2015/03/15 22:52:17 doug Exp $ */ +/* $OpenBSD: x509_req.c,v 1.18 2015/09/30 17:30:16 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -86,7 +86,7 @@ X509_to_X509_REQ(X509 *x, EVP_PKEY *pkey, const EVP_MD *md) ri = ret->req_info; - if ((ri->version = M_ASN1_INTEGER_new()) == NULL) + if ((ri->version = ASN1_INTEGER_new()) == NULL) goto err; if (ASN1_INTEGER_set(ri->version, 0) == 0) goto err; diff --git a/lib/libssl/src/crypto/x509/x509_set.c b/lib/libssl/src/crypto/x509/x509_set.c index c6160b90b08..e77b49ea95a 100644 --- a/lib/libssl/src/crypto/x509/x509_set.c +++ b/lib/libssl/src/crypto/x509/x509_set.c @@ -1,4 +1,4 @@ -/* $OpenBSD: x509_set.c,v 1.10 2015/07/29 14:58:34 jsing Exp $ */ +/* $OpenBSD: x509_set.c,v 1.11 2015/09/30 17:30:16 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -69,7 +69,7 @@ X509_set_version(X509 *x, long version) if (x == NULL) return (0); if (x->cert_info->version == NULL) { - if ((x->cert_info->version = M_ASN1_INTEGER_new()) == NULL) + if ((x->cert_info->version = ASN1_INTEGER_new()) == NULL) return (0); } return (ASN1_INTEGER_set(x->cert_info->version, version)); @@ -84,9 +84,9 @@ X509_set_serialNumber(X509 *x, ASN1_INTEGER *serial) return (0); in = x->cert_info->serialNumber; if (in != serial) { - in = ASN1_STRING_dup(serial); + in = ASN1_INTEGER_dup(serial); if (in != NULL) { - M_ASN1_INTEGER_free(x->cert_info->serialNumber); + ASN1_INTEGER_free(x->cert_info->serialNumber); x->cert_info->serialNumber = in; } } diff --git a/lib/libssl/src/crypto/x509/x509cset.c b/lib/libssl/src/crypto/x509/x509cset.c index 94c419301a1..a0fbdfbc3be 100644 --- a/lib/libssl/src/crypto/x509/x509cset.c +++ b/lib/libssl/src/crypto/x509/x509cset.c @@ -1,4 +1,4 @@ -/* $OpenBSD: x509cset.c,v 1.9 2015/07/29 14:58:34 jsing Exp $ */ +/* $OpenBSD: x509cset.c,v 1.10 2015/09/30 17:30:16 jsing Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 2001. */ @@ -69,7 +69,7 @@ X509_CRL_set_version(X509_CRL *x, long version) if (x == NULL) return (0); if (x->crl->version == NULL) { - if ((x->crl->version = M_ASN1_INTEGER_new()) == NULL) + if ((x->crl->version = ASN1_INTEGER_new()) == NULL) return (0); } return (ASN1_INTEGER_set(x->crl->version, version)); @@ -163,9 +163,9 @@ X509_REVOKED_set_serialNumber(X509_REVOKED *x, ASN1_INTEGER *serial) return (0); in = x->serialNumber; if (in != serial) { - in = ASN1_STRING_dup(serial); + in = ASN1_INTEGER_dup(serial); if (in != NULL) { - M_ASN1_INTEGER_free(x->serialNumber); + ASN1_INTEGER_free(x->serialNumber); x->serialNumber = in; } } diff --git a/lib/libssl/src/crypto/x509v3/v3_akey.c b/lib/libssl/src/crypto/x509v3/v3_akey.c index 2a5c65ea396..2b652deee81 100644 --- a/lib/libssl/src/crypto/x509v3/v3_akey.c +++ b/lib/libssl/src/crypto/x509v3/v3_akey.c @@ -1,4 +1,4 @@ -/* $OpenBSD: v3_akey.c,v 1.15 2015/07/29 16:13:48 jsing Exp $ */ +/* $OpenBSD: v3_akey.c,v 1.16 2015/09/30 17:30:16 jsing Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 1999. */ @@ -175,7 +175,7 @@ v2i_AUTHORITY_KEYID(X509V3_EXT_METHOD *method, X509V3_CTX *ctx, if ((issuer && !ikeyid) || (issuer == 2)) { isname = X509_NAME_dup(X509_get_issuer_name(cert)); - serial = ASN1_STRING_dup(X509_get_serialNumber(cert)); + serial = ASN1_INTEGER_dup(X509_get_serialNumber(cert)); if (!isname || !serial) { X509V3err(X509V3_F_V2I_AUTHORITY_KEYID, X509V3_R_UNABLE_TO_GET_ISSUER_DETAILS); @@ -209,7 +209,7 @@ err: GENERAL_NAME_free(gen); sk_GENERAL_NAME_free(gens); X509_NAME_free(isname); - M_ASN1_INTEGER_free(serial); + ASN1_INTEGER_free(serial); M_ASN1_OCTET_STRING_free(ikeyid); return NULL; } diff --git a/lib/libssl/src/crypto/x509v3/v3_sxnet.c b/lib/libssl/src/crypto/x509v3/v3_sxnet.c index c10feed0ef8..29976b1d687 100644 --- a/lib/libssl/src/crypto/x509v3/v3_sxnet.c +++ b/lib/libssl/src/crypto/x509v3/v3_sxnet.c @@ -1,4 +1,4 @@ -/* $OpenBSD: v3_sxnet.c,v 1.16 2015/07/29 16:13:49 jsing Exp $ */ +/* $OpenBSD: v3_sxnet.c,v 1.17 2015/09/30 17:30:16 jsing Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 1999. */ @@ -272,10 +272,10 @@ SXNET_add_id_ulong(SXNET **psx, unsigned long lzone, char *user, int userlen) { ASN1_INTEGER *izone = NULL; - if (!(izone = M_ASN1_INTEGER_new()) || + if (!(izone = ASN1_INTEGER_new()) || !ASN1_INTEGER_set(izone, lzone)) { X509V3err(X509V3_F_SXNET_ADD_ID_ULONG, ERR_R_MALLOC_FAILURE); - M_ASN1_INTEGER_free(izone); + ASN1_INTEGER_free(izone); return 0; } return SXNET_add_id_INTEGER(psx, izone, user, userlen); @@ -350,7 +350,7 @@ SXNET_get_id_asc(SXNET *sx, char *zone) return NULL; } oct = SXNET_get_id_INTEGER(sx, izone); - M_ASN1_INTEGER_free(izone); + ASN1_INTEGER_free(izone); return oct; } @@ -360,14 +360,14 @@ SXNET_get_id_ulong(SXNET *sx, unsigned long lzone) ASN1_INTEGER *izone = NULL; ASN1_OCTET_STRING *oct; - if (!(izone = M_ASN1_INTEGER_new()) || + if (!(izone = ASN1_INTEGER_new()) || !ASN1_INTEGER_set(izone, lzone)) { X509V3err(X509V3_F_SXNET_GET_ID_ULONG, ERR_R_MALLOC_FAILURE); - M_ASN1_INTEGER_free(izone); + ASN1_INTEGER_free(izone); return NULL; } oct = SXNET_get_id_INTEGER(sx, izone); - M_ASN1_INTEGER_free(izone); + ASN1_INTEGER_free(izone); return oct; } -- cgit v1.2.3