diff options
author | Shane Lontis <shane.lontis@oracle.com> | 2021-03-09 09:48:16 +1000 |
---|---|---|
committer | Shane Lontis <shane.lontis@oracle.com> | 2021-03-18 17:52:37 +1000 |
commit | adf7e6d1d63890f037625031789ed042187c3947 (patch) | |
tree | 48c61a773e33b6df45664d1a46e8be54e0a9092d | |
parent | 1335ca4b0799d1714a2f8e21525cb23edf660e93 (diff) |
Add ossl_asn1 symbols
Partial fix for #12964
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14473)
38 files changed, 270 insertions, 263 deletions
diff --git a/crypto/asn1/a_bitstr.c b/crypto/asn1/a_bitstr.c index 7d179e6f89..a9da7eab3b 100644 --- a/crypto/asn1/a_bitstr.c +++ b/crypto/asn1/a_bitstr.c @@ -18,7 +18,7 @@ int ASN1_BIT_STRING_set(ASN1_BIT_STRING *x, unsigned char *d, int len) return ASN1_STRING_set(x, d, len); } -int i2c_ASN1_BIT_STRING(ASN1_BIT_STRING *a, unsigned char **pp) +int ossl_i2c_ASN1_BIT_STRING(ASN1_BIT_STRING *a, unsigned char **pp) { int ret, j, bits, len; unsigned char *p, *d; @@ -76,8 +76,8 @@ int i2c_ASN1_BIT_STRING(ASN1_BIT_STRING *a, unsigned char **pp) return ret; } -ASN1_BIT_STRING *c2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a, - const unsigned char **pp, long len) +ASN1_BIT_STRING *ossl_c2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a, + const unsigned char **pp, long len) { ASN1_BIT_STRING *ret = NULL; const unsigned char *p; diff --git a/crypto/asn1/a_digest.c b/crypto/asn1/a_digest.c index 0fd1e6e0b8..3976cfbd16 100644 --- a/crypto/asn1/a_digest.c +++ b/crypto/asn1/a_digest.c @@ -53,9 +53,9 @@ int ASN1_digest(i2d_of_void *i2d, const EVP_MD *type, char *data, #endif -int asn1_item_digest_ex(const ASN1_ITEM *it, const EVP_MD *md, void *asn, - unsigned char *data, unsigned int *len, - OSSL_LIB_CTX *libctx, const char *propq) +int ossl_asn1_item_digest_ex(const ASN1_ITEM *it, const EVP_MD *md, void *asn, + unsigned char *data, unsigned int *len, + OSSL_LIB_CTX *libctx, const char *propq) { int i, ret = 0; unsigned char *str = NULL; @@ -89,6 +89,6 @@ err: int ASN1_item_digest(const ASN1_ITEM *it, const EVP_MD *md, void *asn, unsigned char *data, unsigned int *len) { - return asn1_item_digest_ex(it, md, asn, data, len, NULL, NULL); + return ossl_asn1_item_digest_ex(it, md, asn, data, len, NULL, NULL); } diff --git a/crypto/asn1/a_gentm.c b/crypto/asn1/a_gentm.c index 1d89e23b8f..aed5ae7499 100644 --- a/crypto/asn1/a_gentm.c +++ b/crypto/asn1/a_gentm.c @@ -21,12 +21,13 @@ IMPLEMENT_ASN1_DUP_FUNCTION(ASN1_GENERALIZEDTIME) /* This is the primary function used to parse ASN1_GENERALIZEDTIME */ -int asn1_generalizedtime_to_tm(struct tm *tm, const ASN1_GENERALIZEDTIME *d) +static int asn1_generalizedtime_to_tm(struct tm *tm, + const ASN1_GENERALIZEDTIME *d) { - /* wrapper around asn1_time_to_tm */ + /* wrapper around ossl_asn1_time_to_tm */ if (d->type != V_ASN1_GENERALIZEDTIME) return 0; - return asn1_time_to_tm(tm, d); + return ossl_asn1_time_to_tm(tm, d); } int ASN1_GENERALIZEDTIME_check(const ASN1_GENERALIZEDTIME *d) @@ -74,7 +75,7 @@ ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_adj(ASN1_GENERALIZEDTIME *s, return NULL; } - return asn1_time_from_tm(s, ts, V_ASN1_GENERALIZEDTIME); + return ossl_asn1_time_from_tm(s, ts, V_ASN1_GENERALIZEDTIME); } int ASN1_GENERALIZEDTIME_print(BIO *bp, const ASN1_GENERALIZEDTIME *tm) diff --git a/crypto/asn1/a_int.c b/crypto/asn1/a_int.c index 98c759cc93..92c58b3418 100644 --- a/crypto/asn1/a_int.c +++ b/crypto/asn1/a_int.c @@ -204,7 +204,7 @@ static size_t c2i_ibuf(unsigned char *b, int *pneg, return plen; } -int i2c_ASN1_INTEGER(ASN1_INTEGER *a, unsigned char **pp) +int ossl_i2c_ASN1_INTEGER(ASN1_INTEGER *a, unsigned char **pp) { return i2c_ibuf(a->data, a->length, a->type & V_ASN1_NEG, pp); } @@ -283,8 +283,8 @@ static int asn1_get_int64(int64_t *pr, const unsigned char *b, size_t blen, } /* Convert ASN1 INTEGER content octets to ASN1_INTEGER structure */ -ASN1_INTEGER *c2i_ASN1_INTEGER(ASN1_INTEGER **a, const unsigned char **pp, - long len) +ASN1_INTEGER *ossl_c2i_ASN1_INTEGER(ASN1_INTEGER **a, const unsigned char **pp, + long len) { ASN1_INTEGER *ret = NULL; size_t r; @@ -609,7 +609,8 @@ BIGNUM *ASN1_ENUMERATED_to_BN(const ASN1_ENUMERATED *ai, BIGNUM *bn) } /* Internal functions used by x_int64.c */ -int c2i_uint64_int(uint64_t *ret, int *neg, const unsigned char **pp, long len) +int ossl_c2i_uint64_int(uint64_t *ret, int *neg, + const unsigned char **pp, long len) { unsigned char buf[sizeof(uint64_t)]; size_t buflen; @@ -625,7 +626,7 @@ int c2i_uint64_int(uint64_t *ret, int *neg, const unsigned char **pp, long len) return asn1_get_uint64(ret, buf, buflen); } -int i2c_uint64_int(unsigned char *p, uint64_t r, int neg) +int ossl_i2c_uint64_int(unsigned char *p, uint64_t r, int neg) { unsigned char buf[sizeof(uint64_t)]; size_t off; diff --git a/crypto/asn1/a_object.c b/crypto/asn1/a_object.c index 15726e7f03..6967ab44e8 100644 --- a/crypto/asn1/a_object.c +++ b/crypto/asn1/a_object.c @@ -226,7 +226,7 @@ ASN1_OBJECT *d2i_ASN1_OBJECT(ASN1_OBJECT **a, const unsigned char **pp, i = ASN1_R_EXPECTING_AN_OBJECT; goto err; } - ret = c2i_ASN1_OBJECT(a, &p, len); + ret = ossl_c2i_ASN1_OBJECT(a, &p, len); if (ret) *pp = p; return ret; @@ -235,8 +235,8 @@ ASN1_OBJECT *d2i_ASN1_OBJECT(ASN1_OBJECT **a, const unsigned char **pp, return NULL; } -ASN1_OBJECT *c2i_ASN1_OBJECT(ASN1_OBJECT **a, const unsigned char **pp, - long len) +ASN1_OBJECT *ossl_c2i_ASN1_OBJECT(ASN1_OBJECT **a, const unsigned char **pp, + long len) { ASN1_OBJECT *ret = NULL, tobj; const unsigned char *p; diff --git a/crypto/asn1/a_time.c b/crypto/asn1/a_time.c index b9950cc5cb..1a0c91ef9f 100644 --- a/crypto/asn1/a_time.c +++ b/crypto/asn1/a_time.c @@ -73,7 +73,7 @@ static void determine_days(struct tm *tm) tm->tm_wday = (d + (13 * m) / 5 + y + y / 4 + c / 4 + 5 * c + 6) % 7; } -int asn1_time_to_tm(struct tm *tm, const ASN1_TIME *d) +int ossl_asn1_time_to_tm(struct tm *tm, const ASN1_TIME *d) { static const int min[9] = { 0, 0, 1, 1, 0, 0, 0, 0, 0 }; static const int max[9] = { 99, 99, 12, 31, 23, 59, 59, 12, 59 }; @@ -130,14 +130,14 @@ int asn1_time_to_tm(struct tm *tm, const ASN1_TIME *d) i++; break; } - if (!ascii_isdigit(a[o])) + if (!ossl_ascii_isdigit(a[o])) goto err; n = a[o] - num_zero; /* incomplete 2-digital number */ if (++o == l) goto err; - if (!ascii_isdigit(a[o])) + if (!ossl_ascii_isdigit(a[o])) goto err; n = (n * 10) + a[o] - num_zero; /* no more bytes to read, but we haven't seen time-zone yet */ @@ -198,7 +198,7 @@ int asn1_time_to_tm(struct tm *tm, const ASN1_TIME *d) if (++o == l) goto err; i = o; - while ((o < l) && ascii_isdigit(a[o])) + while ((o < l) && ossl_ascii_isdigit(a[o])) o++; /* Must have at least one digit after decimal point */ if (i == o) @@ -229,11 +229,11 @@ int asn1_time_to_tm(struct tm *tm, const ASN1_TIME *d) if (o + 4 != l) goto err; for (i = end; i < end + 2; i++) { - if (!ascii_isdigit(a[o])) + if (!ossl_ascii_isdigit(a[o])) goto err; n = a[o] - num_zero; o++; - if (!ascii_isdigit(a[o])) + if (!ossl_ascii_isdigit(a[o])) goto err; n = (n * 10) + a[o] - num_zero; i2 = (d->type == V_ASN1_UTCTIME) ? i + 1 : i; @@ -264,7 +264,7 @@ int asn1_time_to_tm(struct tm *tm, const ASN1_TIME *d) return 0; } -ASN1_TIME *asn1_time_from_tm(ASN1_TIME *s, struct tm *ts, int type) +ASN1_TIME *ossl_asn1_time_from_tm(ASN1_TIME *s, struct tm *ts, int type) { char* p; ASN1_TIME *tmps = NULL; @@ -336,7 +336,7 @@ ASN1_TIME *ASN1_TIME_adj(ASN1_TIME *s, time_t t, if (!OPENSSL_gmtime_adj(ts, offset_day, offset_sec)) return NULL; } - return asn1_time_from_tm(s, ts, V_ASN1_UNDEF); + return ossl_asn1_time_from_tm(s, ts, V_ASN1_UNDEF); } int ASN1_TIME_check(const ASN1_TIME *t) @@ -361,7 +361,7 @@ ASN1_GENERALIZEDTIME *ASN1_TIME_to_generalizedtime(const ASN1_TIME *t, if (out != NULL) ret = *out; - ret = asn1_time_from_tm(ret, &tm, V_ASN1_GENERALIZEDTIME); + ret = ossl_asn1_time_from_tm(ret, &tm, V_ASN1_GENERALIZEDTIME); if (out != NULL && ret != NULL) *out = ret; @@ -410,7 +410,7 @@ int ASN1_TIME_set_string_X509(ASN1_TIME *s, const char *str) */ if (s != NULL && t.type == V_ASN1_GENERALIZEDTIME) { - if (!asn1_time_to_tm(&tm, &t)) + if (!ossl_asn1_time_to_tm(&tm, &t)) goto out; if (is_utc(tm.tm_year)) { t.length -= 2; @@ -448,7 +448,7 @@ int ASN1_TIME_to_tm(const ASN1_TIME *s, struct tm *tm) return 0; } - return asn1_time_to_tm(tm, s); + return ossl_asn1_time_to_tm(tm, s); } int ASN1_TIME_diff(int *pday, int *psec, @@ -471,19 +471,19 @@ static const char _asn1_mon[12][4] = { /* returns 1 on success, 0 on BIO write error or parse failure */ int ASN1_TIME_print(BIO *bp, const ASN1_TIME *tm) { - return asn1_time_print_ex(bp, tm) > 0; + return ossl_asn1_time_print_ex(bp, tm) > 0; } /* returns 0 on BIO write error, else -1 in case of parse failure, else 1 */ -int asn1_time_print_ex(BIO *bp, const ASN1_TIME *tm) +int ossl_asn1_time_print_ex(BIO *bp, const ASN1_TIME *tm) { char *v; int gmt = 0, l; struct tm stm; const char upper_z = 0x5A, period = 0x2E; - /* asn1_time_to_tm will check the time type */ - if (!asn1_time_to_tm(&stm, tm)) + /* ossl_asn1_time_to_tm will check the time type */ + if (!ossl_asn1_time_to_tm(&stm, tm)) return BIO_write(bp, "Bad time value", 14) ? -1 : 0; l = tm->length; @@ -502,7 +502,7 @@ int asn1_time_print_ex(BIO *bp, const ASN1_TIME *tm) if (tm->length > 15 && v[14] == period) { f = &v[14]; f_len = 1; - while (14 + f_len < l && ascii_isdigit(f[f_len])) + while (14 + f_len < l && ossl_ascii_isdigit(f[f_len])) ++f_len; } @@ -546,7 +546,7 @@ int ASN1_TIME_normalize(ASN1_TIME *t) if (!ASN1_TIME_to_tm(t, &tm)) return 0; - return asn1_time_from_tm(t, &tm, V_ASN1_UNDEF) != NULL; + return ossl_asn1_time_from_tm(t, &tm, V_ASN1_UNDEF) != NULL; } int ASN1_TIME_compare(const ASN1_TIME *a, const ASN1_TIME *b) diff --git a/crypto/asn1/a_type.c b/crypto/asn1/a_type.c index 3a75385a25..c0eee53ff0 100644 --- a/crypto/asn1/a_type.c +++ b/crypto/asn1/a_type.c @@ -29,7 +29,7 @@ void ASN1_TYPE_set(ASN1_TYPE *a, int type, void *value) && a->type != V_ASN1_NULL && a->value.ptr != NULL) { ASN1_TYPE **tmp_a = &a; - asn1_primitive_free((ASN1_VALUE **)tmp_a, NULL, 0); + ossl_asn1_primitive_free((ASN1_VALUE **)tmp_a, NULL, 0); } a->type = type; if (type == V_ASN1_BOOLEAN) diff --git a/crypto/asn1/a_utctm.c b/crypto/asn1/a_utctm.c index c5b49730ff..5ae878a8e6 100644 --- a/crypto/asn1/a_utctm.c +++ b/crypto/asn1/a_utctm.c @@ -17,17 +17,17 @@ IMPLEMENT_ASN1_DUP_FUNCTION(ASN1_UTCTIME) /* This is the primary function used to parse ASN1_UTCTIME */ -int asn1_utctime_to_tm(struct tm *tm, const ASN1_UTCTIME *d) +int ossl_asn1_utctime_to_tm(struct tm *tm, const ASN1_UTCTIME *d) { - /* wrapper around asn1_time_to_tm */ + /* wrapper around ossl_asn1_time_to_tm */ if (d->type != V_ASN1_UTCTIME) return 0; - return asn1_time_to_tm(tm, d); + return ossl_asn1_time_to_tm(tm, d); } int ASN1_UTCTIME_check(const ASN1_UTCTIME *d) { - return asn1_utctime_to_tm(NULL, d); + return ossl_asn1_utctime_to_tm(NULL, d); } /* Sets the string via simple copy without cleaning it up */ @@ -69,7 +69,7 @@ ASN1_UTCTIME *ASN1_UTCTIME_adj(ASN1_UTCTIME *s, time_t t, return NULL; } - return asn1_time_from_tm(s, ts, V_ASN1_UTCTIME); + return ossl_asn1_time_from_tm(s, ts, V_ASN1_UTCTIME); } int ASN1_UTCTIME_cmp_time_t(const ASN1_UTCTIME *s, time_t t) @@ -77,7 +77,7 @@ int ASN1_UTCTIME_cmp_time_t(const ASN1_UTCTIME *s, time_t t) struct tm stm, ttm; int day, sec; - if (!asn1_utctime_to_tm(&stm, s)) + if (!ossl_asn1_utctime_to_tm(&stm, s)) return -2; if (OPENSSL_gmtime(&t, &ttm) == NULL) diff --git a/crypto/asn1/asn1_lib.c b/crypto/asn1/asn1_lib.c index 97b016ae18..1fd46913af 100644 --- a/crypto/asn1/asn1_lib.c +++ b/crypto/asn1/asn1_lib.c @@ -340,7 +340,7 @@ ASN1_STRING *ASN1_STRING_type_new(int type) return ret; } -void asn1_string_embed_free(ASN1_STRING *a, int embed) +void ossl_asn1_string_embed_free(ASN1_STRING *a, int embed) { if (a == NULL) return; @@ -354,7 +354,7 @@ void ASN1_STRING_free(ASN1_STRING *a) { if (a == NULL) return; - asn1_string_embed_free(a, a->flags & ASN1_STRING_FLAG_EMBED); + ossl_asn1_string_embed_free(a, a->flags & ASN1_STRING_FLAG_EMBED); } void ASN1_STRING_clear_free(ASN1_STRING *a) @@ -411,8 +411,9 @@ unsigned char *ASN1_STRING_data(ASN1_STRING *x) } #endif -char *sk_ASN1_UTF8STRING2text(STACK_OF(ASN1_UTF8STRING) *text, const char *sep, - size_t max_len /* excluding NUL terminator */) +char *ossl_sk_ASN1_UTF8STRING2text(STACK_OF(ASN1_UTF8STRING) *text, + const char *sep, + size_t max_len /* excluding NUL terminator */) { int i; ASN1_UTF8STRING *current; diff --git a/crypto/asn1/asn1_local.h b/crypto/asn1/asn1_local.h index 5720c9096a..f7717c09f8 100644 --- a/crypto/asn1/asn1_local.h +++ b/crypto/asn1/asn1_local.h @@ -12,9 +12,8 @@ typedef const ASN1_VALUE const_ASN1_VALUE; SKM_DEFINE_STACK_OF(const_ASN1_VALUE, const ASN1_VALUE, ASN1_VALUE) -int asn1_time_to_tm(struct tm *tm, const ASN1_TIME *d); -int asn1_utctime_to_tm(struct tm *tm, const ASN1_UTCTIME *d); -int asn1_generalizedtime_to_tm(struct tm *tm, const ASN1_GENERALIZEDTIME *d); +int ossl_asn1_time_to_tm(struct tm *tm, const ASN1_TIME *d); +int ossl_asn1_utctime_to_tm(struct tm *tm, const ASN1_UTCTIME *d); /* ASN1 scan context structure */ @@ -46,44 +45,47 @@ DEFINE_STACK_OF(MIME_PARAM) typedef struct mime_header_st MIME_HEADER; DEFINE_STACK_OF(MIME_HEADER) -void asn1_string_embed_free(ASN1_STRING *a, int embed); +void ossl_asn1_string_embed_free(ASN1_STRING *a, int embed); -int asn1_get_choice_selector(ASN1_VALUE **pval, const ASN1_ITEM *it); -int asn1_get_choice_selector_const(const ASN1_VALUE **pval, const ASN1_ITEM *it); -int asn1_set_choice_selector(ASN1_VALUE **pval, int value, - const ASN1_ITEM *it); +int ossl_asn1_get_choice_selector(ASN1_VALUE **pval, const ASN1_ITEM *it); +int ossl_asn1_get_choice_selector_const(const ASN1_VALUE **pval, + const ASN1_ITEM *it); +int ossl_asn1_set_choice_selector(ASN1_VALUE **pval, int value, + const ASN1_ITEM *it); -ASN1_VALUE **asn1_get_field_ptr(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt); -const ASN1_VALUE **asn1_get_const_field_ptr(const ASN1_VALUE **pval, - const ASN1_TEMPLATE *tt); +ASN1_VALUE **ossl_asn1_get_field_ptr(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt); +const ASN1_VALUE **ossl_asn1_get_const_field_ptr(const ASN1_VALUE **pval, + const ASN1_TEMPLATE *tt); -const ASN1_TEMPLATE *asn1_do_adb(const ASN1_VALUE *val, const ASN1_TEMPLATE *tt, - int nullerr); +const ASN1_TEMPLATE *ossl_asn1_do_adb(const ASN1_VALUE *val, + const ASN1_TEMPLATE *tt, + int nullerr); -int asn1_do_lock(ASN1_VALUE **pval, int op, const ASN1_ITEM *it); +int ossl_asn1_do_lock(ASN1_VALUE **pval, int op, const ASN1_ITEM *it); -void asn1_enc_init(ASN1_VALUE **pval, const ASN1_ITEM *it); -void asn1_enc_free(ASN1_VALUE **pval, const ASN1_ITEM *it); -int asn1_enc_restore(int *len, unsigned char **out, const ASN1_VALUE **pval, - const ASN1_ITEM *it); -int asn1_enc_save(ASN1_VALUE **pval, const unsigned char *in, int inlen, - const ASN1_ITEM *it); +void ossl_asn1_enc_init(ASN1_VALUE **pval, const ASN1_ITEM *it); +void ossl_asn1_enc_free(ASN1_VALUE **pval, const ASN1_ITEM *it); +int ossl_asn1_enc_restore(int *len, unsigned char **out, const ASN1_VALUE **pval, + const ASN1_ITEM *it); +int ossl_asn1_enc_save(ASN1_VALUE **pval, const unsigned char *in, int inlen, + const ASN1_ITEM *it); -void asn1_item_embed_free(ASN1_VALUE **pval, const ASN1_ITEM *it, int embed); -void asn1_primitive_free(ASN1_VALUE **pval, const ASN1_ITEM *it, int embed); -void asn1_template_free(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt); +void ossl_asn1_item_embed_free(ASN1_VALUE **pval, const ASN1_ITEM *it, int embed); +void ossl_asn1_primitive_free(ASN1_VALUE **pval, const ASN1_ITEM *it, int embed); +void ossl_asn1_template_free(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt); -ASN1_OBJECT *c2i_ASN1_OBJECT(ASN1_OBJECT **a, const unsigned char **pp, - long length); -int i2c_ASN1_BIT_STRING(ASN1_BIT_STRING *a, unsigned char **pp); -ASN1_BIT_STRING *c2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a, - const unsigned char **pp, long length); -int i2c_ASN1_INTEGER(ASN1_INTEGER *a, unsigned char **pp); -ASN1_INTEGER *c2i_ASN1_INTEGER(ASN1_INTEGER **a, const unsigned char **pp, - long length); +ASN1_OBJECT *ossl_c2i_ASN1_OBJECT(ASN1_OBJECT **a, const unsigned char **pp, + long length); +int ossl_i2c_ASN1_BIT_STRING(ASN1_BIT_STRING *a, unsigned char **pp); +ASN1_BIT_STRING *ossl_c2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a, + const unsigned char **pp, long length); +int ossl_i2c_ASN1_INTEGER(ASN1_INTEGER *a, unsigned char **pp); +ASN1_INTEGER *ossl_c2i_ASN1_INTEGER(ASN1_INTEGER **a, const unsigned char **pp, + long length); /* Internal functions used by x_int64.c */ -int c2i_uint64_int(uint64_t *ret, int *neg, const unsigned char **pp, long len); -int i2c_uint64_int(unsigned char *p, uint64_t r, int neg); +int ossl_c2i_uint64_int(uint64_t *ret, int *neg, const unsigned char **pp, + long len); +int ossl_i2c_uint64_int(unsigned char *p, uint64_t r, int neg); -ASN1_TIME *asn1_time_from_tm(ASN1_TIME *s, struct tm *ts, int type); +ASN1_TIME *ossl_asn1_time_from_tm(ASN1_TIME *s, struct tm *ts, int type); diff --git a/crypto/asn1/evp_asn1.c b/crypto/asn1/evp_asn1.c index 3129fdf2df..d3db5f75cb 100644 --- a/crypto/asn1/evp_asn1.c +++ b/crypto/asn1/evp_asn1.c @@ -143,8 +143,8 @@ ASN1_SEQUENCE(asn1_oct_int) = { DECLARE_ASN1_ITEM(asn1_oct_int) -int asn1_type_set_octetstring_int(ASN1_TYPE *a, long num, unsigned char *data, - int len) +int ossl_asn1_type_set_octetstring_int(ASN1_TYPE *a, long num, + unsigned char *data, int len) { asn1_oct_int atmp; ASN1_OCTET_STRING oct; @@ -158,8 +158,8 @@ int asn1_type_set_octetstring_int(ASN1_TYPE *a, long num, unsigned char *data, return 0; } -int asn1_type_get_octetstring_int(const ASN1_TYPE *a, long *num, - unsigned char *data, int max_len) +int ossl_asn1_type_get_octetstring_int(const ASN1_TYPE *a, long *num, + unsigned char *data, int max_len) { asn1_oct_int *atmp = NULL; int ret = -1; diff --git a/crypto/asn1/standard_methods.h b/crypto/asn1/standard_methods.h index 7d225b308a..664d657178 100644 --- a/crypto/asn1/standard_methods.h +++ b/crypto/asn1/standard_methods.h @@ -13,35 +13,35 @@ * is used to search it. */ static const EVP_PKEY_ASN1_METHOD *standard_methods[] = { - &rsa_asn1_meths[0], - &rsa_asn1_meths[1], + &ossl_rsa_asn1_meths[0], + &ossl_rsa_asn1_meths[1], #ifndef OPENSSL_NO_DH - &dh_asn1_meth, + &ossl_dh_asn1_meth, #endif #ifndef OPENSSL_NO_DSA - &dsa_asn1_meths[0], - &dsa_asn1_meths[1], - &dsa_asn1_meths[2], - &dsa_asn1_meths[3], - &dsa_asn1_meths[4], + &ossl_dsa_asn1_meths[0], + &ossl_dsa_asn1_meths[1], + &ossl_dsa_asn1_meths[2], + &ossl_dsa_asn1_meths[3], + &ossl_dsa_asn1_meths[4], #endif #ifndef OPENSSL_NO_EC - &eckey_asn1_meth, + &ossl_eckey_asn1_meth, #endif - &rsa_pss_asn1_meth, + &ossl_rsa_pss_asn1_meth, #ifndef OPENSSL_NO_DH - &dhx_asn1_meth, + &ossl_dhx_asn1_meth, #endif #ifndef OPENSSL_NO_EC - &ecx25519_asn1_meth, - &ecx448_asn1_meth, + &ossl_ecx25519_asn1_meth, + &ossl_ecx448_asn1_meth, #endif #ifndef OPENSSL_NO_EC - &ed25519_asn1_meth, - &ed448_asn1_meth, + &ossl_ed25519_asn1_meth, + &ossl_ed448_asn1_meth, #endif #ifndef OPENSSL_NO_SM2 - &sm2_asn1_meth, + &ossl_sm2_asn1_meth, #endif }; diff --git a/crypto/asn1/tasn_dec.c b/crypto/asn1/tasn_dec.c index 9a210e221f..0987c2ece3 100644 --- a/crypto/asn1/tasn_dec.c +++ b/crypto/asn1/tasn_dec.c @@ -239,12 +239,12 @@ static int asn1_item_embed_d2i(ASN1_VALUE **pval, const unsigned char **in, goto auxerr; if (*pval) { /* Free up and zero CHOICE value if initialised */ - i = asn1_get_choice_selector(pval, it); + i = ossl_asn1_get_choice_selector(pval, it); if ((i >= 0) && (i < it->tcount)) { tt = it->templates + i; - pchptr = asn1_get_field_ptr(pval, tt); - asn1_template_free(pchptr, tt); - asn1_set_choice_selector(pval, -1, it); + pchptr = ossl_asn1_get_field_ptr(pval, tt); + ossl_asn1_template_free(pchptr, tt); + ossl_asn1_set_choice_selector(pval, -1, it); } } else if (!ASN1_item_ex_new(pval, it)) { ERR_raise(ERR_LIB_ASN1, ERR_R_NESTED_ASN1_ERROR); @@ -253,7 +253,7 @@ static int asn1_item_embed_d2i(ASN1_VALUE **pval, const unsigned char **in, /* CHOICE type, try each possibility in turn */ p = *in; for (i = 0, tt = it->templates; i < it->tcount; i++, tt++) { - pchptr = asn1_get_field_ptr(pval, tt); + pchptr = ossl_asn1_get_field_ptr(pval, tt); /* * We mark field as OPTIONAL so its absence can be recognised. */ @@ -268,7 +268,7 @@ static int asn1_item_embed_d2i(ASN1_VALUE **pval, const unsigned char **in, * Must be an ASN1 parsing error. * Free up any partial choice value */ - asn1_template_free(pchptr, tt); + ossl_asn1_template_free(pchptr, tt); errtt = tt; ERR_raise(ERR_LIB_ASN1, ERR_R_NESTED_ASN1_ERROR); goto err; @@ -286,7 +286,7 @@ static int asn1_item_embed_d2i(ASN1_VALUE **pval, const unsigned char **in, goto err; } - asn1_set_choice_selector(pval, i, it); + ossl_asn1_set_choice_selector(pval, i, it); if (asn1_cb && !asn1_cb(ASN1_OP_D2I_POST, pval, it, NULL)) goto auxerr; @@ -336,11 +336,11 @@ static int asn1_item_embed_d2i(ASN1_VALUE **pval, const unsigned char **in, if (tt->flags & ASN1_TFLG_ADB_MASK) { const ASN1_TEMPLATE *seqtt; ASN1_VALUE **pseqval; - seqtt = asn1_do_adb(*pval, tt, 0); + seqtt = ossl_asn1_do_adb(*pval, tt, 0); if (seqtt == NULL) continue; - pseqval = asn1_get_field_ptr(pval, seqtt); - asn1_template_free(pseqval, seqtt); + pseqval = ossl_asn1_get_field_ptr(pval, seqtt); + ossl_asn1_template_free(pseqval, seqtt); } } @@ -348,10 +348,10 @@ static int asn1_item_embed_d2i(ASN1_VALUE **pval, const unsigned char **in, for (i = 0, tt = it->templates; i < it->tcount; i++, tt++) { const ASN1_TEMPLATE *seqtt; ASN1_VALUE **pseqval; - seqtt = asn1_do_adb(*pval, tt, 1); + seqtt = ossl_asn1_do_adb(*pval, tt, 1); if (seqtt == NULL) goto err; - pseqval = asn1_get_field_ptr(pval, seqtt); + pseqval = ossl_asn1_get_field_ptr(pval, seqtt); /* Have we ran out of data? */ if (!len) break; @@ -388,7 +388,7 @@ static int asn1_item_embed_d2i(ASN1_VALUE **pval, const unsigned char **in, /* * OPTIONAL component absent. Free and zero the field. */ - asn1_template_free(pseqval, seqtt); + ossl_asn1_template_free(pseqval, seqtt); continue; } /* Update length */ @@ -413,13 +413,13 @@ static int asn1_item_embed_d2i(ASN1_VALUE **pval, const unsigned char **in, */ for (; i < it->tcount; tt++, i++) { const ASN1_TEMPLATE *seqtt; - seqtt = asn1_do_adb(*pval, tt, 1); + seqtt = ossl_asn1_do_adb(*pval, tt, 1); if (seqtt == NULL) goto err; if (seqtt->flags & ASN1_TFLG_OPTIONAL) { ASN1_VALUE **pseqval; - pseqval = asn1_get_field_ptr(pval, seqtt); - asn1_template_free(pseqval, seqtt); + pseqval = ossl_asn1_get_field_ptr(pval, seqtt); + ossl_asn1_template_free(pseqval, seqtt); } else { errtt = seqtt; ERR_raise(ERR_LIB_ASN1, ASN1_R_FIELD_MISSING); @@ -427,7 +427,7 @@ static int asn1_item_embed_d2i(ASN1_VALUE **pval, const unsigned char **in, } } /* Save encoding */ - if (!asn1_enc_save(pval, *in, p - *in, it)) + if (!ossl_asn1_enc_save(pval, *in, p - *in, it)) goto auxerr; if (asn1_cb && !asn |