diff --git a/crypto/asn1/a_bitstr.c b/crypto/asn1/a_bitstr.c index 4024ed2b2..b945cb188 100644 --- a/crypto/asn1/a_bitstr.c +++ b/crypto/asn1/a_bitstr.c @@ -67,7 +67,7 @@ int ASN1_BIT_STRING_set(ASN1_BIT_STRING *x, unsigned char *d, int len) { - return M_ASN1_BIT_STRING_set(x, d, len); + return ASN1_STRING_set(x, d, len); } int i2c_ASN1_BIT_STRING(const ASN1_BIT_STRING *a, unsigned char **pp) @@ -146,7 +146,7 @@ ASN1_BIT_STRING *c2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a, } if ((a == NULL) || ((*a) == NULL)) { - if ((ret = M_ASN1_BIT_STRING_new()) == NULL) + if ((ret = ASN1_BIT_STRING_new()) == NULL) return (NULL); } else ret = (*a); @@ -188,7 +188,7 @@ ASN1_BIT_STRING *c2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a, return (ret); err: if ((ret != NULL) && ((a == NULL) || (*a != ret))) - M_ASN1_BIT_STRING_free(ret); + ASN1_BIT_STRING_free(ret); return (NULL); } diff --git a/crypto/asn1/a_enum.c b/crypto/asn1/a_enum.c index b99663b22..d7a7357f8 100644 --- a/crypto/asn1/a_enum.c +++ b/crypto/asn1/a_enum.c @@ -153,7 +153,7 @@ ASN1_ENUMERATED *BN_to_ASN1_ENUMERATED(const BIGNUM *bn, ASN1_ENUMERATED *ai) int len, j; if (ai == NULL) - ret = M_ASN1_ENUMERATED_new(); + ret = ASN1_ENUMERATED_new(); else ret = ai; if (ret == NULL) { @@ -179,7 +179,7 @@ ASN1_ENUMERATED *BN_to_ASN1_ENUMERATED(const BIGNUM *bn, ASN1_ENUMERATED *ai) return (ret); err: if (ret != ai) - M_ASN1_ENUMERATED_free(ret); + ASN1_ENUMERATED_free(ret); return (NULL); } diff --git a/crypto/asn1/a_int.c b/crypto/asn1/a_int.c index 2eda6c08d..1695fd07e 100644 --- a/crypto/asn1/a_int.c +++ b/crypto/asn1/a_int.c @@ -67,7 +67,7 @@ ASN1_INTEGER *ASN1_INTEGER_dup(const ASN1_INTEGER *x) { - return M_ASN1_INTEGER_dup(x); + return ASN1_STRING_dup(x); } int ASN1_INTEGER_cmp(const ASN1_INTEGER *x, const ASN1_INTEGER *y) @@ -206,7 +206,7 @@ ASN1_INTEGER *c2i_ASN1_INTEGER(ASN1_INTEGER **a, const unsigned char **pp, } if ((a == NULL) || ((*a) == NULL)) { - if ((ret = M_ASN1_INTEGER_new()) == NULL) + if ((ret = ASN1_INTEGER_new()) == NULL) return (NULL); ret->type = V_ASN1_INTEGER; } else @@ -282,7 +282,7 @@ ASN1_INTEGER *c2i_ASN1_INTEGER(ASN1_INTEGER **a, const unsigned char **pp, err: OPENSSL_PUT_ERROR(ASN1, i); if ((ret != NULL) && ((a == NULL) || (*a != ret))) - M_ASN1_INTEGER_free(ret); + ASN1_INTEGER_free(ret); return (NULL); } @@ -374,7 +374,7 @@ ASN1_INTEGER *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) { @@ -404,7 +404,7 @@ ASN1_INTEGER *BN_to_ASN1_INTEGER(const BIGNUM *bn, ASN1_INTEGER *ai) return (ret); err: if (ret != ai) - M_ASN1_INTEGER_free(ret); + ASN1_INTEGER_free(ret); return (NULL); } diff --git a/crypto/asn1/a_octet.c b/crypto/asn1/a_octet.c index 2e74d6bfd..312993b9b 100644 --- a/crypto/asn1/a_octet.c +++ b/crypto/asn1/a_octet.c @@ -61,17 +61,17 @@ ASN1_OCTET_STRING *ASN1_OCTET_STRING_dup(const ASN1_OCTET_STRING *x) { - return M_ASN1_OCTET_STRING_dup(x); + return ASN1_STRING_dup(x); } int ASN1_OCTET_STRING_cmp(const ASN1_OCTET_STRING *a, const ASN1_OCTET_STRING *b) { - return M_ASN1_OCTET_STRING_cmp(a, b); + return ASN1_STRING_cmp(a, b); } int ASN1_OCTET_STRING_set(ASN1_OCTET_STRING *x, const unsigned char *d, int len) { - return M_ASN1_OCTET_STRING_set(x, d, len); + return ASN1_STRING_set(x, d, len); } diff --git a/crypto/asn1/a_utctm.c b/crypto/asn1/a_utctm.c index f7519df78..d5bd0e435 100644 --- a/crypto/asn1/a_utctm.c +++ b/crypto/asn1/a_utctm.c @@ -197,7 +197,7 @@ ASN1_UTCTIME *ASN1_UTCTIME_adj(ASN1_UTCTIME *s, time_t t, if (s == NULL) { free_s = 1; - s = M_ASN1_UTCTIME_new(); + s = ASN1_UTCTIME_new(); } if (s == NULL) goto err; @@ -234,7 +234,7 @@ ASN1_UTCTIME *ASN1_UTCTIME_adj(ASN1_UTCTIME *s, time_t t, return (s); err: if (free_s && s) - M_ASN1_UTCTIME_free(s); + ASN1_UTCTIME_free(s); return NULL; } diff --git a/crypto/asn1/asn1_lib.c b/crypto/asn1/asn1_lib.c index 93957ba8d..5fdbd5bce 100644 --- a/crypto/asn1/asn1_lib.c +++ b/crypto/asn1/asn1_lib.c @@ -422,17 +422,17 @@ int ASN1_STRING_cmp(const ASN1_STRING *a, const ASN1_STRING *b) int ASN1_STRING_length(const ASN1_STRING *x) { - return M_ASN1_STRING_length(x); + return x->length; } int ASN1_STRING_type(const ASN1_STRING *x) { - return M_ASN1_STRING_type(x); + return x->type; } unsigned char *ASN1_STRING_data(ASN1_STRING *x) { - return M_ASN1_STRING_data(x); + return x->data; } const unsigned char *ASN1_STRING_get0_data(const ASN1_STRING *x) diff --git a/crypto/asn1/asn1_test.cc b/crypto/asn1/asn1_test.cc index 7f71c8c87..54d6ee8d1 100644 --- a/crypto/asn1/asn1_test.cc +++ b/crypto/asn1/asn1_test.cc @@ -70,9 +70,9 @@ TEST(ASN1Test, LargeTags) { } TEST(ASN1Test, IntegerSetting) { - bssl::UniquePtr by_bn(M_ASN1_INTEGER_new()); - bssl::UniquePtr by_long(M_ASN1_INTEGER_new()); - bssl::UniquePtr by_uint64(M_ASN1_INTEGER_new()); + bssl::UniquePtr by_bn(ASN1_INTEGER_new()); + bssl::UniquePtr by_long(ASN1_INTEGER_new()); + bssl::UniquePtr by_uint64(ASN1_INTEGER_new()); bssl::UniquePtr bn(BN_new()); const std::vector kValues = { diff --git a/crypto/x509/x509_cmp.c b/crypto/x509/x509_cmp.c index 92ed8715a..cf0a94152 100644 --- a/crypto/x509/x509_cmp.c +++ b/crypto/x509/x509_cmp.c @@ -77,7 +77,7 @@ int X509_issuer_and_serial_cmp(const X509 *a, const X509 *b) ai = a->cert_info; bi = b->cert_info; - i = M_ASN1_INTEGER_cmp(ai->serialNumber, bi->serialNumber); + i = ASN1_INTEGER_cmp(ai->serialNumber, bi->serialNumber); if (i) return (i); return (X509_NAME_cmp(ai->issuer, bi->issuer)); diff --git a/crypto/x509/x509_r2x.c b/crypto/x509/x509_r2x.c index 723bd4955..a44b172fa 100644 --- a/crypto/x509/x509_r2x.c +++ b/crypto/x509/x509_r2x.c @@ -79,7 +79,7 @@ X509 *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/crypto/x509/x509_set.c b/crypto/x509/x509_set.c index 470bf70a0..6141af0d9 100644 --- a/crypto/x509/x509_set.c +++ b/crypto/x509/x509_set.c @@ -75,12 +75,12 @@ int X509_set_version(X509 *x, long version) if (x == NULL) return (0); if (version == 0) { - M_ASN1_INTEGER_free(x->cert_info->version); + ASN1_INTEGER_free(x->cert_info->version); x->cert_info->version = NULL; return (1); } 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)); @@ -94,9 +94,9 @@ int X509_set_serialNumber(X509 *x, ASN1_INTEGER *serial) return (0); in = x->cert_info->serialNumber; if (in != serial) { - in = M_ASN1_INTEGER_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/crypto/x509/x509cset.c b/crypto/x509/x509cset.c index a5cb3a3d6..04f1f87eb 100644 --- a/crypto/x509/x509cset.c +++ b/crypto/x509/x509cset.c @@ -66,7 +66,7 @@ int 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)); @@ -224,9 +224,9 @@ int X509_REVOKED_set_serialNumber(X509_REVOKED *x, ASN1_INTEGER *serial) return (0); in = x->serialNumber; if (in != serial) { - in = M_ASN1_INTEGER_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/crypto/x509/x_pkey.c b/crypto/x509/x_pkey.c index 8231a24b3..e562d7309 100644 --- a/crypto/x509/x_pkey.c +++ b/crypto/x509/x_pkey.c @@ -78,7 +78,7 @@ X509_PKEY *X509_PKEY_new(void) ret->enc_algor = X509_ALGOR_new(); if (ret->enc_algor == NULL) goto err; - ret->enc_pkey = M_ASN1_OCTET_STRING_new(); + ret->enc_pkey = ASN1_OCTET_STRING_new(); if (ret->enc_pkey == NULL) goto err; return ret; @@ -97,7 +97,7 @@ void X509_PKEY_free(X509_PKEY *x) if (x->enc_algor != NULL) X509_ALGOR_free(x->enc_algor); if (x->enc_pkey != NULL) - M_ASN1_OCTET_STRING_free(x->enc_pkey); + ASN1_OCTET_STRING_free(x->enc_pkey); if (x->dec_pkey != NULL) EVP_PKEY_free(x->dec_pkey); if ((x->key_data != NULL) && (x->key_free)) diff --git a/crypto/x509v3/v3_akey.c b/crypto/x509v3/v3_akey.c index 30c02e2c2..10376737a 100644 --- a/crypto/x509v3/v3_akey.c +++ b/crypto/x509v3/v3_akey.c @@ -172,7 +172,7 @@ static AUTHORITY_KEYID *v2i_AUTHORITY_KEYID(X509V3_EXT_METHOD *method, if ((issuer && !ikeyid) || (issuer == 2)) { isname = X509_NAME_dup(X509_get_issuer_name(cert)); - serial = M_ASN1_INTEGER_dup(X509_get_serialNumber(cert)); + serial = ASN1_INTEGER_dup(X509_get_serialNumber(cert)); if (!isname || !serial) { OPENSSL_PUT_ERROR(X509V3, X509V3_R_UNABLE_TO_GET_ISSUER_DETAILS); goto err; @@ -201,7 +201,7 @@ static AUTHORITY_KEYID *v2i_AUTHORITY_KEYID(X509V3_EXT_METHOD *method, err: X509_NAME_free(isname); - M_ASN1_INTEGER_free(serial); - M_ASN1_OCTET_STRING_free(ikeyid); + ASN1_INTEGER_free(serial); + ASN1_OCTET_STRING_free(ikeyid); return NULL; } diff --git a/crypto/x509v3/v3_alt.c b/crypto/x509v3/v3_alt.c index a142e0e76..4d540754c 100644 --- a/crypto/x509v3/v3_alt.c +++ b/crypto/x509v3/v3_alt.c @@ -386,7 +386,7 @@ static int copy_email(X509V3_CTX *ctx, GENERAL_NAMES *gens, int move_p) while ((i = X509_NAME_get_index_by_NID(nm, NID_pkcs9_emailAddress, i)) >= 0) { ne = X509_NAME_get_entry(nm, i); - email = M_ASN1_IA5STRING_dup(X509_NAME_ENTRY_get_data(ne)); + email = ASN1_STRING_dup(X509_NAME_ENTRY_get_data(ne)); if (move_p) { X509_NAME_delete_entry(nm, i); X509_NAME_ENTRY_free(ne); @@ -410,7 +410,7 @@ static int copy_email(X509V3_CTX *ctx, GENERAL_NAMES *gens, int move_p) err: GENERAL_NAME_free(gen); - M_ASN1_IA5STRING_free(email); + ASN1_IA5STRING_free(email); return 0; } @@ -517,7 +517,7 @@ GENERAL_NAME *a2i_GENERAL_NAME(GENERAL_NAME *out, } if (is_string) { - if (!(gen->d.ia5 = M_ASN1_IA5STRING_new()) || + if (!(gen->d.ia5 = ASN1_IA5STRING_new()) || !ASN1_STRING_set(gen->d.ia5, (unsigned char *)value, strlen(value))) { OPENSSL_PUT_ERROR(X509V3, ERR_R_MALLOC_FAILURE); diff --git a/crypto/x509v3/v3_bitst.c b/crypto/x509v3/v3_bitst.c index 86a8c3615..402f830fb 100644 --- a/crypto/x509v3/v3_bitst.c +++ b/crypto/x509v3/v3_bitst.c @@ -113,7 +113,7 @@ ASN1_BIT_STRING *v2i_ASN1_BIT_STRING(X509V3_EXT_METHOD *method, ASN1_BIT_STRING *bs; size_t i; const BIT_STRING_BITNAME *bnam; - if (!(bs = M_ASN1_BIT_STRING_new())) { + if (!(bs = ASN1_BIT_STRING_new())) { OPENSSL_PUT_ERROR(X509V3, ERR_R_MALLOC_FAILURE); return NULL; } @@ -124,7 +124,7 @@ ASN1_BIT_STRING *v2i_ASN1_BIT_STRING(X509V3_EXT_METHOD *method, !strcmp(bnam->lname, val->name)) { if (!ASN1_BIT_STRING_set_bit(bs, bnam->bitnum, 1)) { OPENSSL_PUT_ERROR(X509V3, ERR_R_MALLOC_FAILURE); - M_ASN1_BIT_STRING_free(bs); + ASN1_BIT_STRING_free(bs); return NULL; } break; @@ -133,7 +133,7 @@ ASN1_BIT_STRING *v2i_ASN1_BIT_STRING(X509V3_EXT_METHOD *method, if (!bnam->lname) { OPENSSL_PUT_ERROR(X509V3, X509V3_R_UNKNOWN_BIT_STRING_ARGUMENT); X509V3_conf_err(val); - M_ASN1_BIT_STRING_free(bs); + ASN1_BIT_STRING_free(bs); return NULL; } } diff --git a/crypto/x509v3/v3_conf.c b/crypto/x509v3/v3_conf.c index ba02873da..158f8df18 100644 --- a/crypto/x509v3/v3_conf.c +++ b/crypto/x509v3/v3_conf.c @@ -199,7 +199,7 @@ static X509_EXTENSION *do_ext_i2d(const X509V3_EXT_METHOD *method, p = ext_der; method->i2d(ext_struc, &p); } - if (!(ext_oct = M_ASN1_OCTET_STRING_new())) + if (!(ext_oct = ASN1_OCTET_STRING_new())) goto merr; ext_oct->data = ext_der; ext_oct->length = ext_len; @@ -207,7 +207,7 @@ static X509_EXTENSION *do_ext_i2d(const X509V3_EXT_METHOD *method, ext = X509_EXTENSION_create_by_NID(NULL, ext_nid, crit, ext_oct); if (!ext) goto merr; - M_ASN1_OCTET_STRING_free(ext_oct); + ASN1_OCTET_STRING_free(ext_oct); return ext; @@ -289,7 +289,7 @@ static X509_EXTENSION *v3_generic_extension(const char *ext, const char *value, goto err; } - if (!(oct = M_ASN1_OCTET_STRING_new())) { + if (!(oct = ASN1_OCTET_STRING_new())) { OPENSSL_PUT_ERROR(X509V3, ERR_R_MALLOC_FAILURE); goto err; } @@ -302,7 +302,7 @@ static X509_EXTENSION *v3_generic_extension(const char *ext, const char *value, err: ASN1_OBJECT_free(obj); - M_ASN1_OCTET_STRING_free(oct); + ASN1_OCTET_STRING_free(oct); if (ext_der) OPENSSL_free(ext_der); return extension; diff --git a/crypto/x509v3/v3_cpols.c b/crypto/x509v3/v3_cpols.c index 18d260b56..216e7aea3 100644 --- a/crypto/x509v3/v3_cpols.c +++ b/crypto/x509v3/v3_cpols.c @@ -245,7 +245,7 @@ static POLICYINFO *policy_section(X509V3_CTX *ctx, OPENSSL_PUT_ERROR(X509V3, ERR_R_INTERNAL_ERROR); goto err; } - qual->d.cpsuri = M_ASN1_IA5STRING_new(); + qual->d.cpsuri = ASN1_IA5STRING_new(); if (qual->d.cpsuri == NULL) { goto err; } @@ -319,7 +319,7 @@ static POLICYQUALINFO *notice_section(X509V3_CTX *ctx, for (i = 0; i < sk_CONF_VALUE_num(unot); i++) { cnf = sk_CONF_VALUE_value(unot, i); if (!strcmp(cnf->name, "explicitText")) { - not->exptext = M_ASN1_VISIBLESTRING_new(); + not->exptext = ASN1_VISIBLESTRING_new(); if (not->exptext == NULL) goto merr; if (!ASN1_STRING_set(not->exptext, cnf->value, diff --git a/crypto/x509v3/v3_ia5.c b/crypto/x509v3/v3_ia5.c index 6b2056dcb..700200c52 100644 --- a/crypto/x509v3/v3_ia5.c +++ b/crypto/x509v3/v3_ia5.c @@ -108,11 +108,10 @@ static ASN1_IA5STRING *s2i_ASN1_IA5STRING(X509V3_EXT_METHOD *method, OPENSSL_PUT_ERROR(X509V3, X509V3_R_INVALID_NULL_ARGUMENT); return NULL; } - if (!(ia5 = M_ASN1_IA5STRING_new())) + if (!(ia5 = ASN1_IA5STRING_new())) goto err; - if (!ASN1_STRING_set((ASN1_STRING *)ia5, (unsigned char *)str, - strlen(str))) { - M_ASN1_IA5STRING_free(ia5); + if (!ASN1_STRING_set(ia5, str, strlen(str))) { + ASN1_IA5STRING_free(ia5); goto err; } return ia5; diff --git a/crypto/x509v3/v3_prn.c b/crypto/x509v3/v3_prn.c index b508eb3c5..f6f341a22 100644 --- a/crypto/x509v3/v3_prn.c +++ b/crypto/x509v3/v3_prn.c @@ -183,7 +183,7 @@ int X509V3_extensions_print(BIO *bp, const char *title, return 0; if (!X509V3_EXT_print(bp, ex, flag, indent + 4)) { BIO_printf(bp, "%*s", indent + 4, ""); - M_ASN1_OCTET_STRING_print(bp, ex->value); + ASN1_STRING_print(bp, ex->value); } if (BIO_write(bp, "\n", 1) <= 0) return 0; diff --git a/crypto/x509v3/v3_skey.c b/crypto/x509v3/v3_skey.c index eb5ba55e9..140356d7a 100644 --- a/crypto/x509v3/v3_skey.c +++ b/crypto/x509v3/v3_skey.c @@ -88,13 +88,13 @@ ASN1_OCTET_STRING *s2i_ASN1_OCTET_STRING(X509V3_EXT_METHOD *method, ASN1_OCTET_STRING *oct; long length; - if (!(oct = M_ASN1_OCTET_STRING_new())) { + if (!(oct = ASN1_OCTET_STRING_new())) { OPENSSL_PUT_ERROR(X509V3, ERR_R_MALLOC_FAILURE); return NULL; } if (!(oct->data = x509v3_hex_to_bytes(str, &length))) { - M_ASN1_OCTET_STRING_free(oct); + ASN1_OCTET_STRING_free(oct); return NULL; } @@ -115,7 +115,7 @@ static ASN1_OCTET_STRING *s2i_skey_id(X509V3_EXT_METHOD *method, if (strcmp(str, "hash")) return s2i_ASN1_OCTET_STRING(method, ctx, str); - if (!(oct = M_ASN1_OCTET_STRING_new())) { + if (!(oct = ASN1_OCTET_STRING_new())) { OPENSSL_PUT_ERROR(X509V3, ERR_R_MALLOC_FAILURE); return NULL; } @@ -142,7 +142,7 @@ static ASN1_OCTET_STRING *s2i_skey_id(X509V3_EXT_METHOD *method, (pk->data, pk->length, pkey_dig, &diglen, EVP_sha1(), NULL)) goto err; - if (!M_ASN1_OCTET_STRING_set(oct, pkey_dig, diglen)) { + if (!ASN1_OCTET_STRING_set(oct, pkey_dig, diglen)) { OPENSSL_PUT_ERROR(X509V3, ERR_R_MALLOC_FAILURE); goto err; } @@ -150,6 +150,6 @@ static ASN1_OCTET_STRING *s2i_skey_id(X509V3_EXT_METHOD *method, return oct; err: - M_ASN1_OCTET_STRING_free(oct); + ASN1_OCTET_STRING_free(oct); return NULL; } diff --git a/include/openssl/asn1.h b/include/openssl/asn1.h index 289717175..27753033e 100644 --- a/include/openssl/asn1.h +++ b/include/openssl/asn1.h @@ -460,46 +460,53 @@ typedef struct BIT_STRING_BITNAME_st { const char *sname; } BIT_STRING_BITNAME; - -#define M_ASN1_STRING_length(x) ((x)->length) -#define M_ASN1_STRING_type(x) ((x)->type) -#define M_ASN1_STRING_data(x) ((x)->data) - -// Macros for string operations -#define M_ASN1_BIT_STRING_new() \ - (ASN1_BIT_STRING *)ASN1_STRING_type_new(V_ASN1_BIT_STRING) -#define M_ASN1_BIT_STRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) -#define M_ASN1_BIT_STRING_dup(a) \ - (ASN1_BIT_STRING *)ASN1_STRING_dup((const ASN1_STRING *)a) -#define M_ASN1_BIT_STRING_cmp(a, b) \ - ASN1_STRING_cmp((const ASN1_STRING *)a, (const ASN1_STRING *)b) -#define M_ASN1_BIT_STRING_set(a, b, c) ASN1_STRING_set((ASN1_STRING *)a, b, c) - -#define M_ASN1_INTEGER_new() \ - (ASN1_INTEGER *)ASN1_STRING_type_new(V_ASN1_INTEGER) -#define M_ASN1_INTEGER_free(a) ASN1_STRING_free((ASN1_STRING *)a) -#define M_ASN1_INTEGER_dup(a) \ - (ASN1_INTEGER *)ASN1_STRING_dup((const ASN1_STRING *)a) -#define M_ASN1_INTEGER_cmp(a, b) \ - ASN1_STRING_cmp((const ASN1_STRING *)a, (const ASN1_STRING *)b) - -#define M_ASN1_ENUMERATED_new() \ - (ASN1_ENUMERATED *)ASN1_STRING_type_new(V_ASN1_ENUMERATED) -#define M_ASN1_ENUMERATED_free(a) ASN1_STRING_free((ASN1_STRING *)a) -#define M_ASN1_ENUMERATED_dup(a) \ - (ASN1_ENUMERATED *)ASN1_STRING_dup((const ASN1_STRING *)a) -#define M_ASN1_ENUMERATED_cmp(a, b) \ - ASN1_STRING_cmp((const ASN1_STRING *)a, (const ASN1_STRING *)b) - -#define M_ASN1_OCTET_STRING_new() \ - (ASN1_OCTET_STRING *)ASN1_STRING_type_new(V_ASN1_OCTET_STRING) -#define M_ASN1_OCTET_STRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) -#define M_ASN1_OCTET_STRING_dup(a) \ - (ASN1_OCTET_STRING *)ASN1_STRING_dup((const ASN1_STRING *)a) -#define M_ASN1_OCTET_STRING_cmp(a, b) \ - ASN1_STRING_cmp((const ASN1_STRING *)a, (const ASN1_STRING *)b) -#define M_ASN1_OCTET_STRING_set(a, b, c) ASN1_STRING_set((ASN1_STRING *)a, b, c) -#define M_ASN1_OCTET_STRING_print(a, b) ASN1_STRING_print(a, (ASN1_STRING *)b) +// M_ASN1_* are legacy aliases for various |ASN1_STRING| functions. Use the +// functions themselves. +#define M_ASN1_STRING_length(x) ASN1_STRING_length(x) +#define M_ASN1_STRING_type(x) ASN1_STRING_type(x) +#define M_ASN1_STRING_data(x) ASN1_STRING_data(x) +#define M_ASN1_BIT_STRING_new() ASN1_BIT_STRING_new() +#define M_ASN1_BIT_STRING_free(a) ASN1_BIT_STRING_free(a) +#define M_ASN1_BIT_STRING_dup(a) ASN1_STRING_dup(a) +#define M_ASN1_BIT_STRING_cmp(a, b) ASN1_STRING_cmp(a, b) +#define M_ASN1_BIT_STRING_set(a, b, c) ASN1_BIT_STRING_set(a, b, c) +#define M_ASN1_INTEGER_new() ASN1_INTEGER_new() +#define M_ASN1_INTEGER_free(a) ASN1_INTEGER_free(a) +#define M_ASN1_INTEGER_dup(a) ASN1_INTEGER_dup(a) +#define M_ASN1_INTEGER_cmp(a, b) ASN1_INTEGER_cmp(a, b) +#define M_ASN1_ENUMERATED_new() ASN1_ENUMERATED_new() +#define M_ASN1_ENUMERATED_free(a) ASN1_ENUMERATED_free(a) +#define M_ASN1_ENUMERATED_dup(a) ASN1_STRING_dup(a) +#define M_ASN1_ENUMERATED_cmp(a, b) ASN1_STRING_cmp(a, b) +#define M_ASN1_OCTET_STRING_new() ASN1_OCTET_STRING_new() +#define M_ASN1_OCTET_STRING_free(a) ASN1_OCTET_STRING_free() +#define M_ASN1_OCTET_STRING_dup(a) ASN1_OCTET_STRING_dup(a) +#define M_ASN1_OCTET_STRING_cmp(a, b) ASN1_OCTET_STRING_cmp(a, b) +#define M_ASN1_OCTET_STRING_set(a, b, c) ASN1_OCTET_STRING_set(a, b, c) +#define M_ASN1_OCTET_STRING_print(a, b) ASN1_STRING_print(a, b) +#define M_ASN1_PRINTABLESTRING_new() ASN1_PRINTABLESTRING_new() +#define M_ASN1_PRINTABLESTRING_free(a) ASN1_PRINTABLESTRING_free(a) +#define M_ASN1_IA5STRING_new() ASN1_IA5STRING_new() +#define M_ASN1_IA5STRING_free(a) ASN1_IA5STRING_free(a) +#define M_ASN1_IA5STRING_dup(a) ASN1_STRING_dup(a) +#define M_ASN1_UTCTIME_new() ASN1_UTCTIME_new() +#define M_ASN1_UTCTIME_free(a) ASN1_UTCTIME_free(a) +#define M_ASN1_UTCTIME_dup(a) ASN1_STRING_dup(a) +#define M_ASN1_T61STRING_new() ASN1_T61STRING_new() +#define M_ASN1_T61STRING_free(a) ASN1_T61STRING_free(a) +#define M_ASN1_GENERALIZEDTIME_new() ASN1_GENERALIZEDTIME_new() +#define M_ASN1_GENERALIZEDTIME_free(a) ASN1_GENERALIZEDTIME_free(a) +#define M_ASN1_GENERALIZEDTIME_dup(a) ASN1_STRING_dup(a) +#define M_ASN1_GENERALSTRING_new() ASN1_GENERALSTRING_new() +#define M_ASN1_GENERALSTRING_free(a) ASN1_GENERALSTRING_free(a) +#define M_ASN1_UNIVERSALSTRING_new() ASN1_UNIVERSALSTRING_new() +#define M_ASN1_UNIVERSALSTRING_free(a) ASN1_UNIVERSALSTRING_free(a) +#define M_ASN1_BMPSTRING_new() ASN1_BMPSTRING_new() +#define M_ASN1_BMPSTRING_free(a) ASN1_BMPSTRING_free(a) +#define M_ASN1_VISIBLESTRING_new() ASN1_VISIBLESTRING_new() +#define M_ASN1_VISIBLESTRING_free(a) ASN1_VISIBLESTRING_free(a) +#define M_ASN1_UTF8STRING_new() ASN1_UTF8STRING_new() +#define M_ASN1_UTF8STRING_free(a) ASN1_UTF8STRING_free(a) #define B_ASN1_TIME B_ASN1_UTCTIME | B_ASN1_GENERALIZEDTIME @@ -524,56 +531,10 @@ typedef struct BIT_STRING_BITNAME_st { #define M_DISPLAYTEXT_new() ASN1_STRING_type_new(V_ASN1_VISIBLESTRING) #define M_DISPLAYTEXT_free(a) ASN1_STRING_free((ASN1_STRING *)a) -#define M_ASN1_PRINTABLESTRING_new() \ - (ASN1_PRINTABLESTRING *)ASN1_STRING_type_new(V_ASN1_PRINTABLESTRING) -#define M_ASN1_PRINTABLESTRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) - -#define M_ASN1_T61STRING_new() \ - (ASN1_T61STRING *)ASN1_STRING_type_new(V_ASN1_T61STRING) -#define M_ASN1_T61STRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) - -#define M_ASN1_IA5STRING_new() \ - (ASN1_IA5STRING *)ASN1_STRING_type_new(V_ASN1_IA5STRING) -#define M_ASN1_IA5STRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) -#define M_ASN1_IA5STRING_dup(a) \ - (ASN1_IA5STRING *)ASN1_STRING_dup((const ASN1_STRING *)a) - -#define M_ASN1_UTCTIME_new() \ - (ASN1_UTCTIME *)ASN1_STRING_type_new(V_ASN1_UTCTIME) -#define M_ASN1_UTCTIME_free(a) ASN1_STRING_free((ASN1_STRING *)a) -#define M_ASN1_UTCTIME_dup(a) \ - (ASN1_UTCTIME *)ASN1_STRING_dup((const ASN1_STRING *)a) - -#define M_ASN1_GENERALIZEDTIME_new() \ - (ASN1_GENERALIZEDTIME *)ASN1_STRING_type_new(V_ASN1_GENERALIZEDTIME) -#define M_ASN1_GENERALIZEDTIME_free(a) ASN1_STRING_free((ASN1_STRING *)a) -#define M_ASN1_GENERALIZEDTIME_dup(a) \ - (ASN1_GENERALIZEDTIME *)ASN1_STRING_dup((const ASN1_STRING *)a) - #define M_ASN1_TIME_new() (ASN1_TIME *)ASN1_STRING_type_new(V_ASN1_UTCTIME) #define M_ASN1_TIME_free(a) ASN1_STRING_free((ASN1_STRING *)a) #define M_ASN1_TIME_dup(a) (ASN1_TIME *)ASN1_STRING_dup((const ASN1_STRING *)a) -#define M_ASN1_GENERALSTRING_new() \ - (ASN1_GENERALSTRING *)ASN1_STRING_type_new(V_ASN1_GENERALSTRING) -#define M_ASN1_GENERALSTRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) - -#define M_ASN1_UNIVERSALSTRING_new() \ - (ASN1_UNIVERSALSTRING *)ASN1_STRING_type_new(V_ASN1_UNIVERSALSTRING) -#define M_ASN1_UNIVERSALSTRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) - -#define M_ASN1_BMPSTRING_new() \ - (ASN1_BMPSTRING *)ASN1_STRING_type_new(V_ASN1_BMPSTRING) -#define M_ASN1_BMPSTRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) - -#define M_ASN1_VISIBLESTRING_new() \ - (ASN1_VISIBLESTRING *)ASN1_STRING_type_new(V_ASN1_VISIBLESTRING) -#define M_ASN1_VISIBLESTRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) - -#define M_ASN1_UTF8STRING_new() \ - (ASN1_UTF8STRING *)ASN1_STRING_type_new(V_ASN1_UTF8STRING) -#define M_ASN1_UTF8STRING_free(a) ASN1_STRING_free((ASN1_STRING *)a) - DECLARE_ASN1_FUNCTIONS_fname(ASN1_TYPE, ASN1_ANY, ASN1_TYPE) OPENSSL_EXPORT int ASN1_TYPE_get(const ASN1_TYPE *a);