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;
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;
#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;
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);
}
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)
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)
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);
}
}
/* 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;
}
/* 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;
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;
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;
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;
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 };
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 */
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)
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;
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;
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)
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;
*/
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;
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,
/* 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;
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;
}
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)
&& 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)
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 */
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)
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)
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;
{
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)
}
#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;
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 */
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);
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;
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;
* 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
};
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);
/* 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.
*/
* 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;
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;
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);
}
}
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;
/*
* OPTIONAL component absent. Free and zero the field.
*/
- asn1_template_free(pseqval, seqtt);
+ ossl_asn1_template_free(pseqval, seqtt);
continue;
}
/* Update length */
*/
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);
}
}
/* 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 && !asn1_cb(ASN1_OP_D2I_POST, pval, it, NULL))
goto auxerr;
}
switch (utype) {
case V_ASN1_OBJECT:
- if (!c2i_ASN1_OBJECT((ASN1_OBJECT **)pval, &cont, len))
+ if (!ossl_c2i_ASN1_OBJECT((ASN1_OBJECT **)pval, &cont, len))
goto err;
break;
break;
case V_ASN1_BIT_STRING:
- if (!c2i_ASN1_BIT_STRING((ASN1_BIT_STRING **)pval, &cont, len))
+ if (!ossl_c2i_ASN1_BIT_STRING((ASN1_BIT_STRING **)pval, &cont, len))
goto err;
break;
case V_ASN1_INTEGER:
case V_ASN1_ENUMERATED:
tint = (ASN1_INTEGER **)pval;
- if (!c2i_ASN1_INTEGER(tint, &cont, len))
+ if (!ossl_c2i_ASN1_INTEGER(tint, &cont, len))
goto err;
/* Fixup type to match the expected form */
(*tint)->type = utype | ((*tint)->type & V_ASN1_NEG);
}
if (asn1_cb && !asn1_cb(ASN1_OP_I2D_PRE, pval, it, NULL))
return 0;
- i = asn1_get_choice_selector_const(pval, it);
+ i = ossl_asn1_get_choice_selector_const(pval, it);
if ((i >= 0) && (i < it->tcount)) {
const ASN1_VALUE **pchval;
const ASN1_TEMPLATE *chtt;
chtt = it->templates + i;
- pchval = asn1_get_const_field_ptr(pval, chtt);
+ pchval = ossl_asn1_get_const_field_ptr(pval, chtt);
return asn1_template_ex_i2d(pchval, out, chtt, -1, aclass);
}
/* Fixme: error condition if selector out of range */
/* fall through */
case ASN1_ITYPE_SEQUENCE:
- i = asn1_enc_restore(&seqcontlen, out, pval, it);
+ i = ossl_asn1_enc_restore(&seqcontlen, out, pval, it);
/* An error occurred */
if (i < 0)
return 0;
const ASN1_TEMPLATE *seqtt;
const ASN1_VALUE **pseqval;
int tmplen;
- seqtt = asn1_do_adb(*pval, tt, 1);
+ seqtt = ossl_asn1_do_adb(*pval, tt, 1);
if (!seqtt)
return 0;
- pseqval = asn1_get_const_field_ptr(pval, seqtt);
+ pseqval = ossl_asn1_get_const_field_ptr(pval, seqtt);
tmplen = asn1_template_ex_i2d(pseqval, NULL, seqtt, -1, aclass);
if (tmplen == -1 || (tmplen > INT_MAX - seqcontlen))
return -1;
for (i = 0, tt = it->templates; i < it->tcount; tt++, i++) {
const ASN1_TEMPLATE *seqtt;
const ASN1_VALUE **pseqval;
- seqtt = asn1_do_adb(*pval, tt, 1);
+ seqtt = ossl_asn1_do_adb(*pval, tt, 1);
if (!seqtt)
return 0;
- pseqval = asn1_get_const_field_ptr(pval, seqtt);
+ pseqval = ossl_asn1_get_const_field_ptr(pval, seqtt);
/* FIXME: check for errors in enhanced version */
asn1_template_ex_i2d(pseqval, out, seqtt, -1, aclass);
}
break;
case V_ASN1_BIT_STRING:
- return i2c_ASN1_BIT_STRING((ASN1_BIT_STRING *)*pval,
- cout ? &cout : NULL);
+ return ossl_i2c_ASN1_BIT_STRING((ASN1_BIT_STRING *)*pval,
+ cout ? &cout : NULL);
case V_ASN1_INTEGER:
case V_ASN1_ENUMERATED:
/*
* These are all have the same content format as ASN1_INTEGER
*/
- return i2c_ASN1_INTEGER((ASN1_INTEGER *)*pval, cout ? &cout : NULL);
+ return ossl_i2c_ASN1_INTEGER((ASN1_INTEGER *)*pval, cout ? &cout : NULL);
case V_ASN1_OCTET_STRING:
case V_ASN1_NUMERICSTRING:
void ASN1_item_free(ASN1_VALUE *val, const ASN1_ITEM *it)
{
- asn1_item_embed_free(&val, it, 0);
+ ossl_asn1_item_embed_free(&val, it, 0);
}
void ASN1_item_ex_free(ASN1_VALUE **pval, const ASN1_ITEM *it)
{
- asn1_item_embed_free(pval, it, 0);
+ ossl_asn1_item_embed_free(pval, it, 0);
}
-void asn1_item_embed_free(ASN1_VALUE **pval, const ASN1_ITEM *it, int embed)
+void ossl_asn1_item_embed_free(ASN1_VALUE **pval, const ASN1_ITEM *it, int embed)
{
const ASN1_TEMPLATE *tt = NULL, *seqtt;
const ASN1_EXTERN_FUNCS *ef;
case ASN1_ITYPE_PRIMITIVE:
if (it->templates)
- asn1_template_free(pval, it->templates);
+ ossl_asn1_template_free(pval, it->templates);
else
- asn1_primitive_free(pval, it, embed);
+ ossl_asn1_primitive_free(pval, it, embed);
break;
case ASN1_ITYPE_MSTRING:
- asn1_primitive_free(pval, it, embed);
+ ossl_asn1_primitive_free(pval, it, embed);
break;
case ASN1_ITYPE_CHOICE:
if (i == 2)
return;
}
- i = asn1_get_choice_selector(pval, it);
+ i = ossl_asn1_get_choice_selector(pval, it);
if ((i >= 0) && (i < it->tcount)) {
ASN1_VALUE **pchval;
tt = it->templates + i;
- pchval = asn1_get_field_ptr(pval, tt);
- asn1_template_free(pchval, tt);
+ pchval = ossl_asn1_get_field_ptr(pval, tt);
+ ossl_asn1_template_free(pchval, tt);
}
if (asn1_cb)
asn1_cb(ASN1_OP_FREE_POST, pval, it, NULL);
case ASN1_ITYPE_NDEF_SEQUENCE:
case ASN1_ITYPE_SEQUENCE:
- if (asn1_do_lock(pval, -1, it) != 0) /* if error or ref-counter > 0 */
+ if (ossl_asn1_do_lock(pval, -1, it) != 0) /* if error or ref-counter > 0 */
return;
if (asn1_cb) {
i = asn1_cb(ASN1_OP_FREE_PRE, pval, it, NULL);
if (i == 2)
return;
}
- asn1_enc_free(pval, it);
+ ossl_asn1_enc_free(pval, it);
/*
* If we free up as normal we will invalidate any ANY DEFINED BY
* field and we won't be able to determine the type of the field it
ASN1_VALUE **pseqval;
tt--;
- seqtt = asn1_do_adb(*pval, tt, 0);
+ seqtt = ossl_asn1_do_adb(*pval, tt, 0);
if (!seqtt)
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);
}
if (asn1_cb)
asn1_cb(ASN1_OP_FREE_POST, pval, it, NULL);
}
}
-void asn1_template_free(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt)
+void ossl_asn1_template_free(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt)
{
int embed = tt->flags & ASN1_TFLG_EMBED;
ASN1_VALUE *tval;
for (i = 0; i < sk_ASN1_VALUE_num(sk); i++) {
ASN1_VALUE *vtmp = sk_ASN1_VALUE_value(sk, i);
- asn1_item_embed_free(&vtmp, ASN1_ITEM_ptr(tt->item), embed);
+ ossl_asn1_item_embed_free(&vtmp, ASN1_ITEM_ptr(tt->item), embed);
}
sk_ASN1_VALUE_free(sk);
*pval = NULL;
} else {
- asn1_item_embed_free(pval, ASN1_ITEM_ptr(tt->item), embed);
+ ossl_asn1_item_embed_free(pval, ASN1_ITEM_ptr(tt->item), embed);
}
}
-void asn1_primitive_free(ASN1_VALUE **pval, const ASN1_ITEM *it, int embed)
+void ossl_asn1_primitive_free(ASN1_VALUE **pval, const ASN1_ITEM *it, int embed)
{
int utype;
break;
case V_ASN1_ANY:
- asn1_primitive_free(pval, NULL, 0);
+ ossl_asn1_primitive_free(pval, NULL, 0);
OPENSSL_free(*pval);
break;
default:
- asn1_string_embed_free((ASN1_STRING *)*pval, embed);
+ ossl_asn1_string_embed_free((ASN1_STRING *)*pval, embed);
break;
}
*pval = NULL;
if (*pval == NULL)
goto memerr;
}
- asn1_set_choice_selector(pval, -1, it);
+ ossl_asn1_set_choice_selector(pval, -1, it);
if (asn1_cb && !asn1_cb(ASN1_OP_NEW_POST, pval, it, NULL))
goto auxerr2;
break;
goto memerr;
}
/* 0 : init. lock */
- if (asn1_do_lock(pval, 0, it) < 0) {
+ if (ossl_asn1_do_lock(pval, 0, it) < 0) {
if (!embed) {
OPENSSL_free(*pval);
*pval = NULL;
}
goto memerr;
}
- asn1_enc_init(pval, it);
+ ossl_asn1_enc_init(pval, it);
for (i = 0, tt = it->templates; i < it->tcount; tt++, i++) {
- pseqval = asn1_get_field_ptr(pval, tt);
+ pseqval = ossl_asn1_get_field_ptr(pval, tt);
if (!asn1_template_new(pseqval, tt))
goto memerr2;
}
return 1;
memerr2:
- asn1_item_embed_free(pval, it, embed);
+ ossl_asn1_item_embed_free(pval, it, embed);
memerr:
ERR_raise(ERR_LIB_ASN1, ERR_R_MALLOC_FAILURE);
return 0;
auxerr2:
- asn1_item_embed_free(pval, it, embed);
+ ossl_asn1_item_embed_free(pval, it, embed);
auxerr:
ERR_raise(ERR_LIB_ASN1, ASN1_R_AUX_ERROR);
return 0;
case ASN1_ITYPE_CHOICE:
/* CHOICE type, get selector */
- i = asn1_get_choice_selector_const(fld, it);
+ i = ossl_asn1_get_choice_selector_const(fld, it);
/* This should never happen... */
if ((i < 0) || (i >= it->tcount)) {
if (BIO_printf(out, "ERROR: selector [%d] invalid\n", i) <= 0)
return 1;
}
tt = it->templates + i;
- tmpfld = asn1_get_const_field_ptr(fld, tt);
+ tmpfld = ossl_asn1_get_const_field_ptr(fld, tt);
if (!asn1_template_print_ctx(out, tmpfld, indent, tt, pctx))
return 0;
break;
/* Print each field entry */
for (i = 0, tt = it->templates; i < it->tcount; i++, tt++) {
const ASN1_TEMPLATE *seqtt;
- seqtt = asn1_do_adb(*fld, tt, 1);
+ seqtt = ossl_asn1_do_adb(*fld, tt, 1);
if (!seqtt)
return 0;
- tmpfld = asn1_get_const_field_ptr(fld, seqtt);
+ tmpfld = ossl_asn1_get_const_field_ptr(fld, seqtt);
if (!asn1_template_print_ctx(out, tmpfld,
indent + 2, seqtt, pctx))
return 0;
* Given an ASN1_ITEM CHOICE type return the selector value
*/
-int asn1_get_choice_selector(ASN1_VALUE **pval, const ASN1_ITEM *it)
+int ossl_asn1_get_choice_selector(ASN1_VALUE **pval, const ASN1_ITEM *it)
{
int *sel = offset2ptr(*pval, it->utype);
return *sel;
}
-int asn1_get_choice_selector_const(const ASN1_VALUE **pval, const ASN1_ITEM *it)
+int ossl_asn1_get_choice_selector_const(const ASN1_VALUE **pval,
+ const ASN1_ITEM *it)
{
int *sel = offset2ptr(*pval, it->utype);
* Given an ASN1_ITEM CHOICE type set the selector value, return old value.
*/
-int asn1_set_choice_selector(ASN1_VALUE **pval, int value,
- const ASN1_ITEM *it)
+int ossl_asn1_set_choice_selector(ASN1_VALUE **pval, int value,
+ const ASN1_ITEM *it)
{
int *sel, ret;
* It returns -1 on initialisation error.
* Used by ASN1_SEQUENCE construct of X509, X509_REQ, X509_CRL objects
*/
-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)
{
const ASN1_AUX *aux;
CRYPTO_REF_COUNT *lck;
return offset2ptr(*pval, aux->enc_offset);
}
-void asn1_enc_init(ASN1_VALUE **pval, const ASN1_ITEM *it)
+void ossl_asn1_enc_init(ASN1_VALUE **pval, const ASN1_ITEM *it)
{
ASN1_ENCODING *enc = asn1_get_enc_ptr(pval, it);
}
}
-void asn1_enc_free(ASN1_VALUE **pval, const ASN1_ITEM *it)
+void ossl_asn1_enc_free(ASN1_VALUE **pval, const ASN1_ITEM *it)
{
ASN1_ENCODING *enc = asn1_get_enc_ptr(pval, it);
}
}
-int asn1_enc_save(ASN1_VALUE **pval, const unsigned char *in, int inlen,
- const ASN1_ITEM *it)
+int ossl_asn1_enc_save(ASN1_VALUE **pval, const unsigned char *in, int inlen,
+ const ASN1_ITEM *it)
{
ASN1_ENCODING *enc = asn1_get_enc_ptr(pval, it);
return 1;
}
-int asn1_enc_restore(int *len, unsigned char **out, const 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)
{
const ASN1_ENCODING *enc = asn1_get_const_enc_ptr(pval, it);
}
/* Given an ASN1_TEMPLATE get a pointer to a field */
-ASN1_VALUE **asn1_get_field_ptr(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt)
+ASN1_VALUE **ossl_asn1_get_field_ptr(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt)
{
ASN1_VALUE **pvaltmp = offset2ptr(*pval, tt->offset);
}
/* Given an ASN1_TEMPLATE get a const pointer to a field */
-const ASN1_VALUE **asn1_get_const_field_ptr(const ASN1_VALUE **pval,
- const ASN1_TEMPLATE *tt)
+const ASN1_VALUE **ossl_asn1_get_const_field_ptr(const ASN1_VALUE **pval,
+ const ASN1_TEMPLATE *tt)
{
return offset2ptr(*pval, tt->offset);
}
* ASN1_TEMPLATE in the table and return it.
*/
-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)
{
const ASN1_ADB *adb;
const ASN1_ADB_TABLE *atbl;
}
/* allocate and set algorithm ID from EVP_MD, default SHA1 */
-int x509_algor_new_from_md(X509_ALGOR **palg, const EVP_MD *md)
+int ossl_x509_algor_new_from_md(X509_ALGOR **palg, const EVP_MD *md)
{
/* Default is SHA1 so no need to create it - still success */
if (md == NULL || EVP_MD_is_a(md, "SHA1"))
}
/* convert algorithm ID to EVP_MD, default SHA1 */
-const EVP_MD *x509_algor_get_md(X509_ALGOR *alg)
+const EVP_MD *ossl_x509_algor_get_md(X509_ALGOR *alg)
{
const EVP_MD *md;
return md;
}
-X509_ALGOR *x509_algor_mgf1_decode(X509_ALGOR *alg)
+X509_ALGOR *ossl_x509_algor_mgf1_decode(X509_ALGOR *alg)
{
if (OBJ_obj2nid(alg->algorithm) != NID_mgf1)
return NULL;
}
/* Allocate and set MGF1 algorithm ID from EVP_MD */
-int x509_algor_md_to_mgf1(X509_ALGOR **palg, const EVP_MD *mgf1md)
+int ossl_x509_algor_md_to_mgf1(X509_ALGOR **palg, const EVP_MD *mgf1md)
{
X509_ALGOR *algtmp = NULL;
ASN1_STRING *stmp = NULL;
if (mgf1md == NULL || EVP_MD_is_a(mgf1md, "SHA1"))
return 1;
/* need to embed algorithm ID inside another */
- if (!x509_algor_new_from_md(&algtmp, mgf1md))
+ if (!ossl_x509_algor_new_from_md(&algtmp, mgf1md))
goto err;
if (ASN1_item_pack(algtmp, ASN1_ITEM_rptr(X509_ALGOR), &stmp) == NULL)
goto err;
return -1;
if ((it->size & INTxx_FLAG_SIGNED) == INTxx_FLAG_SIGNED
&& (int64_t)utmp < 0) {
- /* i2c_uint64_int() assumes positive values */
+ /* ossl_i2c_uint64_int() assumes positive values */
utmp = 0 - utmp;
neg = 1;
}
- return i2c_uint64_int(cont, utmp, neg);
+ return ossl_i2c_uint64_int(cont, utmp, neg);
}
static int uint64_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len,
if (len == 0)
goto long_compat;
- if (!c2i_uint64_int(&utmp, &neg, &cont, len))
+ if (!ossl_c2i_uint64_int(&utmp, &neg, &cont, len))
return 0;
if ((it->size & INTxx_FLAG_SIGNED) == 0 && neg) {
ERR_raise(ERR_LIB_ASN1, ASN1_R_ILLEGAL_NEGATIVE_VALUE);
return 0;
}
if (neg)
- /* c2i_uint64_int() returns positive values */
+ /* ossl_c2i_uint64_int() returns positive values */
utmp = 0 - utmp;
long_compat:
return -1;
if ((it->size & INTxx_FLAG_SIGNED) == INTxx_FLAG_SIGNED
&& (int32_t)utmp < 0) {
- /* i2c_uint64_int() assumes positive values */
+ /* ossl_i2c_uint64_int() assumes positive values */
utmp = 0 - utmp;
neg = 1;
}
- return i2c_uint64_int(cont, (uint64_t)utmp, neg);
+ return ossl_i2c_uint64_int(cont, (uint64_t)utmp, neg);
}
/*
if (len == 0)
goto long_compat;
- if (!c2i_uint64_int(&utmp, &neg, &cont, len))
+ if (!ossl_c2i_uint64_int(&utmp, &neg, &cont, len))
return 0;
if ((it->size & INTxx_FLAG_SIGNED) == 0 && neg) {
ERR_raise(ERR_LIB_ASN1, ASN1_R_ILLEGAL_NEGATIVE_VALUE);
ASN1_INTEGER_get(emc->errorCode)) > 0)
ERR_add_error_data(1, buf);
if (emc->errorDetails != NULL) {
- char *text = sk_ASN1_UTF8STRING2text(emc->errorDetails, ", ",
- OSSL_CMP_PKISI_BUFLEN - 1);
+ char *text = ossl_sk_ASN1_UTF8STRING2text(emc->errorDetails, ", ",
+ OSSL_CMP_PKISI_BUFLEN - 1);
if (text != NULL)
ERR_add_error_data(2, "; errorDetails: ", text);
" with reason = '")) < 0) {
*str = '\0';
} else {
- char *text = sk_ASN1_UTF8STRING2text(pollRep->reason, ", ",
- sizeof(str) - len - 2);
+ char *text = ossl_sk_ASN1_UTF8STRING2text(pollRep->reason, ", ",
+ sizeof(str) - len - 2);
if (text == NULL
|| BIO_snprintf(str + len, sizeof(str) - len,
if (md == NULL)
return 0;
- if (!asn1_item_digest_ex(ASN1_ITEM_rptr(CMS_Attributes_Verify), md,
- si->signedAttrs, dig, diglen,
- ossl_cms_ctx_get0_libctx(si->cms_ctx),
- ossl_cms_ctx_get0_propq(si->cms_ctx)))
+ if (!ossl_asn1_item_digest_ex(ASN1_ITEM_rptr(CMS_Attributes_Verify), md,
+ si->signedAttrs, dig, diglen,
+ ossl_cms_ctx_get0_libctx(si->cms_ctx),
+ ossl_cms_ctx_get0_propq(si->cms_ctx)))
return 0;
return 1;
}
return NULL;
if (oaep->maskGenFunc != NULL) {
- oaep->maskHash = x509_algor_mgf1_decode(oaep->maskGenFunc);
+ oaep->maskHash = ossl_x509_algor_mgf1_decode(oaep->maskGenFunc);
if (oaep->maskHash == NULL) {
RSA_OAEP_PARAMS_free(oaep);
return NULL;
goto err;
}
- mgf1md = x509_algor_get_md(oaep->maskHash);
+ mgf1md = ossl_x509_algor_get_md(oaep->maskHash);
if (mgf1md == NULL)
goto err;
- md = x509_algor_get_md(oaep->hashFunc);
+ md = ossl_x509_algor_get_md(oaep->hashFunc);
if (md == NULL)
goto err;
oaep = RSA_OAEP_PARAMS_new();
if (oaep == NULL)
goto err;
- if (!x509_algor_new_from_md(&oaep->hashFunc, md))
+ if (!ossl_x509_algor_new_from_md(&oaep->hashFunc, md))
goto err;
- if (!x509_algor_md_to_mgf1(&oaep->maskGenFunc, mgf1md))
+ if (!ossl_x509_algor_md_to_mgf1(&oaep->maskGenFunc, mgf1md))
goto err;
if (labellen > 0) {
ASN1_OCTET_STRING *los;
return ossl_islower(c) ? c ^ case_change : c;
}
-int ascii_isdigit(const char inchar) {
+int ossl_ascii_isdigit(const char inchar) {
if (inchar > 0x2F && inchar < 0x3A)
return 1;
return 0;
long length)
{
DH *dh = NULL;
- int is_dhx = (pkey->ameth == &dhx_asn1_meth);
+ int is_dhx = (pkey->ameth == &ossl_dhx_asn1_meth);
if (is_dhx)
dh = d2i_DHxparams(NULL, pp, length);
static int i2d_dhp(const EVP_PKEY *pkey, const DH *a, unsigned char **pp)
{
- if (pkey->ameth == &dhx_asn1_meth)
+ if (pkey->ameth == &ossl_dhx_asn1_meth)
return i2d_DHxparams(a, pp);
return i2d_DHparams(a, pp);
}
static int dh_cmp_parameters(const EVP_PKEY *a, const EVP_PKEY *b)
{
return ossl_ffc_params_cmp(&a->pkey.dh->params, &a->pkey.dh->params,
- a->ameth != &dhx_asn1_meth);
+ a->ameth != &ossl_dhx_asn1_meth);
}
static int int_dh_param_copy(DH *to, const DH *from, int is_x942)
return 0;
}
return int_dh_param_copy(to->pkey.dh, from->pkey.dh,
- from->ameth == &dhx_asn1_meth);
+ from->ameth == &ossl_dhx_asn1_meth);
}
static int dh_missing_parameters(const EVP_PKEY *a)
return dh_pkey_import_from_type(params, vpctx, EVP_PKEY_DHX);
}
-const EVP_PKEY_ASN1_METHOD dh_asn1_meth = {
+const EVP_PKEY_ASN1_METHOD ossl_dh_asn1_meth = {
EVP_PKEY_DH,
EVP_PKEY_DH,
0,
dh_pkey_import_from,
};
-const EVP_PKEY_ASN1_METHOD dhx_asn1_meth = {
+const EVP_PKEY_ASN1_METHOD ossl_dhx_asn1_meth = {
EVP_PKEY_DHX,
EVP_PKEY_DHX,
0,
/* NB these are sorted in pkey_id order, lowest first */
-const EVP_PKEY_ASN1_METHOD dsa_asn1_meths[5] = {
+const EVP_PKEY_ASN1_METHOD ossl_dsa_asn1_meths[5] = {
{
EVP_PKEY_DSA2,
return 1;
}
-const EVP_PKEY_ASN1_METHOD eckey_asn1_meth = {
+const EVP_PKEY_ASN1_METHOD ossl_eckey_asn1_meth = {
EVP_PKEY_EC,
EVP_PKEY_EC,
0,
};
#if !defined(OPENSSL_NO_SM2)
-const EVP_PKEY_ASN1_METHOD sm2_asn1_meth = {
+const EVP_PKEY_ASN1_METHOD ossl_sm2_asn1_meth = {
EVP_PKEY_SM2,
EVP_PKEY_EC,
ASN1_PKEY_ALIAS
return ecx_generic_import_from(params, vpctx, EVP_PKEY_X25519);
}
-const EVP_PKEY_ASN1_METHOD ecx25519_asn1_meth = {
+const EVP_PKEY_ASN1_METHOD ossl_ecx25519_asn1_meth = {
EVP_PKEY_X25519,
EVP_PKEY_X25519,
0,
return ecx_generic_import_from(params, vpctx, EVP_PKEY_X448);
}
-const EVP_PKEY_ASN1_METHOD ecx448_asn1_meth = {
+const EVP_PKEY_ASN1_METHOD ossl_ecx448_asn1_meth = {
EVP_PKEY_X448,
EVP_PKEY_X448,
0,
return ecx_generic_import_from(params, vpctx, EVP_PKEY_ED25519);
}
-const EVP_PKEY_ASN1_METHOD ed25519_asn1_meth = {
+const EVP_PKEY_ASN1_METHOD ossl_ed25519_asn1_meth = {
EVP_PKEY_ED25519,
EVP_PKEY_ED25519,
0,
return ecx_generic_import_from(params, vpctx, EVP_PKEY_ED448);
}
-const EVP_PKEY_ASN1_METHOD ed448_asn1_meth = {
+const EVP_PKEY_ASN1_METHOD ossl_ed448_asn1_meth = {
EVP_PKEY_ED448,
EVP_PKEY_ED448,
0,
if (type == NULL || asn1_params == NULL)
return 0;
- i = asn1_type_get_octetstring_int(type, &tl, NULL, EVP_MAX_IV_LENGTH);
+ i = ossl_asn1_type_get_octetstring_int(type, &tl, NULL, EVP_MAX_IV_LENGTH);
if (i <= 0)
return -1;
- asn1_type_get_octetstring_int(type, &tl, iv, i);
+ ossl_asn1_type_get_octetstring_int(type, &tl, iv, i);
memcpy(asn1_params->iv, iv, i);
asn1_params->iv_len = i;
if (type == NULL || asn1_params == NULL)
return 0;
- return asn1_type_set_octetstring_int(type, asn1_params->tag_len,
- asn1_params->iv, asn1_params->iv_len);
+ return ossl_asn1_type_set_octetstring_int(type, asn1_params->tag_len,
+ asn1_params->iv,
+ asn1_params->iv_len);
}
#endif /* !defined(FIPS_MODULE) */
goto err;
if (BIO_puts(bp, " with ") <= 0)
goto err;
- maskHash = x509_algor_mgf1_decode(pss->maskGenAlgorithm);
+ maskHash = ossl_x509_algor_mgf1_decode(pss->maskGenAlgorithm);
if (maskHash != NULL) {
if (i2a_ASN1_OBJECT(bp, maskHash->algorithm) <= 0)
goto err;
return NULL;
if (pss->maskGenAlgorithm != NULL) {
- pss->maskHash = x509_algor_mgf1_decode(pss->maskGenAlgorithm);
+ pss->maskHash = ossl_x509_algor_mgf1_decode(pss->maskGenAlgorithm);
if (pss->maskHash == NULL) {
RSA_PSS_PARAMS_free(pss);
return NULL;
if (!ASN1_INTEGER_set(pss->saltLength, saltlen))
goto err;
}
- if (!x509_algor_new_from_md(&pss->hashAlgorithm, sigmd))
+ if (!ossl_x509_algor_new_from_md(&pss->hashAlgorithm, sigmd))
goto err;
if (mgf1md == NULL)
mgf1md = sigmd;
- if (!x509_algor_md_to_mgf1(&pss->maskGenAlgorithm, mgf1md))
+ if (!ossl_x509_algor_md_to_mgf1(&pss->maskGenAlgorithm, mgf1md))
goto err;
- if (!x509_algor_new_from_md(&pss->maskHash, mgf1md))
+ if (!ossl_x509_algor_new_from_md(&pss->maskHash, mgf1md))
goto err;
return pss;
err:
if (pss == NULL)
return 0;
- *pmd = x509_algor_get_md(pss->hashAlgorithm);
+ *pmd = ossl_x509_algor_get_md(pss->hashAlgorithm);
if (*pmd == NULL)
return 0;
- *pmgf1md = x509_algor_get_md(pss->maskHash);
+ *pmgf1md = ossl_x509_algor_get_md(pss->maskHash);
if (*pmgf1md == NULL)
return 0;
if (pss->saltLength)
return rsa_int_import_from(params, vpctx, RSA_FLAG_TYPE_RSASSAPSS);
}
-const EVP_PKEY_ASN1_METHOD rsa_asn1_meths[2] = {
+const EVP_PKEY_ASN1_METHOD ossl_rsa_asn1_meths[2] = {
{
EVP_PKEY_RSA,
EVP_PKEY_RSA,
ASN1_PKEY_ALIAS}
};
-const EVP_PKEY_ASN1_METHOD rsa_pss_asn1_meth = {
+const EVP_PKEY_ASN1_METHOD ossl_rsa_pss_asn1_meth = {
EVP_PKEY_RSA_PSS,
EVP_PKEY_RSA_PSS,
ASN1_PKEY_SIGPARAM_NULL,
static char *ts_get_status_text(STACK_OF(ASN1_UTF8STRING) *text)
{
- return sk_ASN1_UTF8STRING2text(text, "/", TS_MAX_STATUS_LENGTH);
+ return ossl_sk_ASN1_UTF8STRING2text(text, "/", TS_MAX_STATUS_LENGTH);
}
static int ts_check_policy(const ASN1_OBJECT *req_oid,
goto err;
if (BIO_write(bp, " Not Before: ", 24) <= 0)
goto err;
- if (asn1_time_print_ex(bp, X509_get0_notBefore(x)) == 0)
+ if (ossl_asn1_time_print_ex(bp, X509_get0_notBefore(x)) == 0)
goto err;
if (BIO_write(bp, "\n Not After : ", 25) <= 0)
goto err;
- if (asn1_time_print_ex(bp, X509_get0_notAfter(x)) == 0)
+ if (ossl_asn1_time_print_ex(bp, X509_get0_notAfter(x)) == 0)
goto err;
if (BIO_write(bp, "\n", 1) <= 0)
goto err;
* Digit and date ranges will be verified in the conversion methods.
*/
for (i = 0; i < ctm->length - 1; i++) {
- if (!ascii_isdigit(ctm->data[i]))
+ if (!ossl_ascii_isdigit(ctm->data[i]))
return 0;
}
if (ctm->data[ctm->length - 1] != upper_z)
memcpy(data, cert->sha1_hash, sizeof(cert->sha1_hash));
return 1;
}
- return (asn1_item_digest_ex(ASN1_ITEM_rptr(X509), md, (char *)cert, data,
- len, cert->libctx, cert->propq));
+ return (ossl_asn1_item_digest_ex(ASN1_ITEM_rptr(X509), md, (char *)cert,
+ data, len, cert->libctx, cert->propq));
}
/* calculate cert digest using the same hash algorithm as in its signature */
DEFINE_STACK_OF_CONST(EVP_PKEY_ASN1_METHOD)
-extern const EVP_PKEY_ASN1_METHOD dh_asn1_meth;
-extern const EVP_PKEY_ASN1_METHOD dhx_asn1_meth;
-extern const EVP_PKEY_ASN1_METHOD dsa_asn1_meths[5];
-extern const EVP_PKEY_ASN1_METHOD eckey_asn1_meth;
-extern const EVP_PKEY_ASN1_METHOD ecx25519_asn1_meth;
-extern const EVP_PKEY_ASN1_METHOD ecx448_asn1_meth;
-extern const EVP_PKEY_ASN1_METHOD ed25519_asn1_meth;
-extern const EVP_PKEY_ASN1_METHOD ed448_asn1_meth;
-extern const EVP_PKEY_ASN1_METHOD sm2_asn1_meth;
-
-extern const EVP_PKEY_ASN1_METHOD rsa_asn1_meths[2];
-extern const EVP_PKEY_ASN1_METHOD rsa_pss_asn1_meth;
+extern const EVP_PKEY_ASN1_METHOD ossl_dh_asn1_meth;
+extern const EVP_PKEY_ASN1_METHOD ossl_dhx_asn1_meth;
+extern const EVP_PKEY_ASN1_METHOD ossl_dsa_asn1_meths[5];
+extern const EVP_PKEY_ASN1_METHOD ossl_eckey_asn1_meth;
+extern const EVP_PKEY_ASN1_METHOD ossl_ecx25519_asn1_meth;
+extern const EVP_PKEY_ASN1_METHOD ossl_ecx448_asn1_meth;
+extern const EVP_PKEY_ASN1_METHOD ossl_ed25519_asn1_meth;
+extern const EVP_PKEY_ASN1_METHOD ossl_ed448_asn1_meth;
+extern const EVP_PKEY_ASN1_METHOD ossl_sm2_asn1_meth;
+
+extern const EVP_PKEY_ASN1_METHOD ossl_rsa_asn1_meths[2];
+extern const EVP_PKEY_ASN1_METHOD ossl_rsa_pss_asn1_meth;
/*
* These are used internally in the ASN1_OBJECT to keep track of whether the
/* ASN1 type functions */
-int asn1_type_set_octetstring_int(ASN1_TYPE *a, long num,
- unsigned char *data, int len);
-int asn1_type_get_octetstring_int(const ASN1_TYPE *a, long *num,
- unsigned char *data, int max_len);
+int ossl_asn1_type_set_octetstring_int(ASN1_TYPE *a, long num,
+ unsigned char *data, int len);
+int ossl_asn1_type_get_octetstring_int(const ASN1_TYPE *a, long *num,
+ unsigned char *data, int max_len);
-int x509_algor_new_from_md(X509_ALGOR **palg, const EVP_MD *md);
-const EVP_MD *x509_algor_get_md(X509_ALGOR *alg);
-X509_ALGOR *x509_algor_mgf1_decode(X509_ALGOR *alg);
-int x509_algor_md_to_mgf1(X509_ALGOR **palg, const EVP_MD *mgf1md);
-int asn1_time_print_ex(BIO *bp, const ASN1_TIME *tm);
+int ossl_x509_algor_new_from_md(X509_ALGOR **palg, const EVP_MD *md);
+const EVP_MD *ossl_x509_algor_get_md(X509_ALGOR *alg);
+X509_ALGOR *ossl_x509_algor_mgf1_decode(X509_ALGOR *alg);
+int ossl_x509_algor_md_to_mgf1(X509_ALGOR **palg, const EVP_MD *mgf1md);
+int ossl_asn1_time_print_ex(BIO *bp, const ASN1_TIME *tm);
#endif /* ndef OSSL_CRYPTO_ASN1_H */
int ossl_tolower(int c);
int ossl_toupper(int c);
-int ascii_isdigit(const char inchar);
+int ossl_ascii_isdigit(const char inchar);
# define ossl_isalnum(c) (ossl_ctype_check((c), CTYPE_MASK_alnum))
# define ossl_isalpha(c) (ossl_ctype_check((c), CTYPE_MASK_alpha))
int x509_set0_libctx(X509 *x, OSSL_LIB_CTX *libctx, const char *propq);
int x509_crl_set0_libctx(X509_CRL *x, OSSL_LIB_CTX *libctx, const char *propq);
int x509_init_sig_info(X509 *x);
-int asn1_item_digest_ex(const ASN1_ITEM *it, const EVP_MD *type, void *data,
- unsigned char *md, unsigned int *len,
- OSSL_LIB_CTX *libctx, const char *propq);
+int ossl_asn1_item_digest_ex(const ASN1_ITEM *it, const EVP_MD *type, void *data,
+ unsigned char *md, unsigned int *len,
+ OSSL_LIB_CTX *libctx, const char *propq);
int ossl_x509_add_cert_new(STACK_OF(X509) **sk, X509 *cert, int flags);
int ossl_x509_add_certs_new(STACK_OF(X509) **p_sk, STACK_OF(X509) *certs,
int flags);
}
#endif /* defined OPENSSL_SYS_UNIX */
-char *sk_ASN1_UTF8STRING2text(STACK_OF(ASN1_UTF8STRING) *text, const char *sep,
- size_t max_len);
+char *ossl_sk_ASN1_UTF8STRING2text(STACK_OF(ASN1_UTF8STRING) *text,
+ const char *sep, size_t max_len);
char *ossl_ipaddr_to_asc(unsigned char *p, int len);
char *ossl_buf2hexstr_sep(const unsigned char *buf, long buflen, char sep);