summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/asn1/asn1.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/lib/libcrypto/asn1/asn1.h74
1 files changed, 38 insertions, 36 deletions
diff --git a/src/lib/libcrypto/asn1/asn1.h b/src/lib/libcrypto/asn1/asn1.h
index 3a2da6463e..a20471a7ec 100644
--- a/src/lib/libcrypto/asn1/asn1.h
+++ b/src/lib/libcrypto/asn1/asn1.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: asn1.h,v 1.45 2018/03/29 02:29:24 inoguchi Exp $ */ 1/* $OpenBSD: asn1.h,v 1.46 2018/04/25 11:48:21 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -754,14 +754,14 @@ ASN1_TYPE *d2i_ASN1_TYPE(ASN1_TYPE **a, const unsigned char **in, long len);
754int i2d_ASN1_TYPE(ASN1_TYPE *a, unsigned char **out); 754int i2d_ASN1_TYPE(ASN1_TYPE *a, unsigned char **out);
755extern const ASN1_ITEM ASN1_ANY_it; 755extern const ASN1_ITEM ASN1_ANY_it;
756 756
757int ASN1_TYPE_get(ASN1_TYPE *a); 757int ASN1_TYPE_get(const ASN1_TYPE *a);
758void ASN1_TYPE_set(ASN1_TYPE *a, int type, void *value); 758void ASN1_TYPE_set(ASN1_TYPE *a, int type, void *value);
759int ASN1_TYPE_set1(ASN1_TYPE *a, int type, const void *value); 759int ASN1_TYPE_set1(ASN1_TYPE *a, int type, const void *value);
760int ASN1_TYPE_cmp(ASN1_TYPE *a, ASN1_TYPE *b); 760int ASN1_TYPE_cmp(const ASN1_TYPE *a, const ASN1_TYPE *b);
761 761
762ASN1_OBJECT *ASN1_OBJECT_new(void ); 762ASN1_OBJECT *ASN1_OBJECT_new(void );
763void ASN1_OBJECT_free(ASN1_OBJECT *a); 763void ASN1_OBJECT_free(ASN1_OBJECT *a);
764int i2d_ASN1_OBJECT(ASN1_OBJECT *a, unsigned char **pp); 764int i2d_ASN1_OBJECT(const ASN1_OBJECT *a, unsigned char **pp);
765ASN1_OBJECT *c2i_ASN1_OBJECT(ASN1_OBJECT **a, const unsigned char **pp, 765ASN1_OBJECT *c2i_ASN1_OBJECT(ASN1_OBJECT **a, const unsigned char **pp,
766 long length); 766 long length);
767ASN1_OBJECT *d2i_ASN1_OBJECT(ASN1_OBJECT **a, const unsigned char **pp, 767ASN1_OBJECT *d2i_ASN1_OBJECT(ASN1_OBJECT **a, const unsigned char **pp,
@@ -783,7 +783,7 @@ int ASN1_STRING_set(ASN1_STRING *str, const void *data, int len);
783void ASN1_STRING_set0(ASN1_STRING *str, void *data, int len); 783void ASN1_STRING_set0(ASN1_STRING *str, void *data, int len);
784int ASN1_STRING_length(const ASN1_STRING *x); 784int ASN1_STRING_length(const ASN1_STRING *x);
785void ASN1_STRING_length_set(ASN1_STRING *x, int n); 785void ASN1_STRING_length_set(ASN1_STRING *x, int n);
786int ASN1_STRING_type(ASN1_STRING *x); 786int ASN1_STRING_type(const ASN1_STRING *x);
787unsigned char *ASN1_STRING_data(ASN1_STRING *x); 787unsigned char *ASN1_STRING_data(ASN1_STRING *x);
788const unsigned char *ASN1_STRING_get0_data(const ASN1_STRING *x); 788const unsigned char *ASN1_STRING_get0_data(const ASN1_STRING *x);
789 789
@@ -797,16 +797,16 @@ ASN1_BIT_STRING *c2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a,
797 const unsigned char **pp, long length); 797 const unsigned char **pp, long length);
798int ASN1_BIT_STRING_set(ASN1_BIT_STRING *a, unsigned char *d, int length ); 798int ASN1_BIT_STRING_set(ASN1_BIT_STRING *a, unsigned char *d, int length );
799int ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, int n, int value); 799int ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, int n, int value);
800int ASN1_BIT_STRING_get_bit(ASN1_BIT_STRING *a, int n); 800int ASN1_BIT_STRING_get_bit(const ASN1_BIT_STRING *a, int n);
801int ASN1_BIT_STRING_check(ASN1_BIT_STRING *a, 801int ASN1_BIT_STRING_check(const ASN1_BIT_STRING *a,
802 unsigned char *flags, int flags_len); 802 const unsigned char *flags, int flags_len);
803 803
804#ifndef OPENSSL_NO_BIO 804#ifndef OPENSSL_NO_BIO
805int ASN1_BIT_STRING_name_print(BIO *out, ASN1_BIT_STRING *bs, 805int ASN1_BIT_STRING_name_print(BIO *out, ASN1_BIT_STRING *bs,
806 BIT_STRING_BITNAME *tbl, int indent); 806 BIT_STRING_BITNAME *tbl, int indent);
807#endif 807#endif
808int ASN1_BIT_STRING_num_asc(char *name, BIT_STRING_BITNAME *tbl); 808int ASN1_BIT_STRING_num_asc(const char *name, BIT_STRING_BITNAME *tbl);
809int ASN1_BIT_STRING_set_asc(ASN1_BIT_STRING *bs, char *name, int value, 809int ASN1_BIT_STRING_set_asc(ASN1_BIT_STRING *bs, const char *name, int value,
810 BIT_STRING_BITNAME *tbl); 810 BIT_STRING_BITNAME *tbl);
811 811
812int i2d_ASN1_BOOLEAN(int a, unsigned char **pp); 812int i2d_ASN1_BOOLEAN(int a, unsigned char **pp);
@@ -831,7 +831,7 @@ ASN1_ENUMERATED *d2i_ASN1_ENUMERATED(ASN1_ENUMERATED **a, const unsigned char **
831int i2d_ASN1_ENUMERATED(ASN1_ENUMERATED *a, unsigned char **out); 831int i2d_ASN1_ENUMERATED(ASN1_ENUMERATED *a, unsigned char **out);
832extern const ASN1_ITEM ASN1_ENUMERATED_it; 832extern const ASN1_ITEM ASN1_ENUMERATED_it;
833 833
834int ASN1_UTCTIME_check(ASN1_UTCTIME *a); 834int ASN1_UTCTIME_check(const ASN1_UTCTIME *a);
835ASN1_UTCTIME *ASN1_UTCTIME_set(ASN1_UTCTIME *s, time_t t); 835ASN1_UTCTIME *ASN1_UTCTIME_set(ASN1_UTCTIME *s, time_t t);
836ASN1_UTCTIME *ASN1_UTCTIME_adj(ASN1_UTCTIME *s, time_t t, 836ASN1_UTCTIME *ASN1_UTCTIME_adj(ASN1_UTCTIME *s, time_t t,
837 int offset_day, long offset_sec); 837 int offset_day, long offset_sec);
@@ -841,7 +841,7 @@ int ASN1_UTCTIME_set_string(ASN1_UTCTIME *s, const char *str);
841int ASN1_UTCTIME_cmp_time_t(const ASN1_UTCTIME *s, time_t t); 841int ASN1_UTCTIME_cmp_time_t(const ASN1_UTCTIME *s, time_t t);
842#endif /* !LIBRESSL_INTERNAL */ 842#endif /* !LIBRESSL_INTERNAL */
843 843
844int ASN1_GENERALIZEDTIME_check(ASN1_GENERALIZEDTIME *a); 844int ASN1_GENERALIZEDTIME_check(const ASN1_GENERALIZEDTIME *a);
845ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_set(ASN1_GENERALIZEDTIME *s, 845ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_set(ASN1_GENERALIZEDTIME *s,
846 time_t t); 846 time_t t);
847ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_adj(ASN1_GENERALIZEDTIME *s, 847ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_adj(ASN1_GENERALIZEDTIME *s,
@@ -943,8 +943,8 @@ ASN1_TIME *ASN1_TIME_set(ASN1_TIME *s, time_t t);
943ASN1_TIME *ASN1_TIME_set_tm(ASN1_TIME *s, struct tm *tm); 943ASN1_TIME *ASN1_TIME_set_tm(ASN1_TIME *s, struct tm *tm);
944ASN1_TIME *ASN1_TIME_adj(ASN1_TIME *s, time_t t, int offset_day, 944ASN1_TIME *ASN1_TIME_adj(ASN1_TIME *s, time_t t, int offset_day,
945 long offset_sec); 945 long offset_sec);
946int ASN1_TIME_check(ASN1_TIME *t); 946int ASN1_TIME_check(const ASN1_TIME *t);
947ASN1_GENERALIZEDTIME *ASN1_TIME_to_generalizedtime(ASN1_TIME *t, 947ASN1_GENERALIZEDTIME *ASN1_TIME_to_generalizedtime(const ASN1_TIME *t,
948 ASN1_GENERALIZEDTIME **out); 948 ASN1_GENERALIZEDTIME **out);
949int ASN1_TIME_set_string(ASN1_TIME *s, const char *str); 949int ASN1_TIME_set_string(ASN1_TIME *s, const char *str);
950 950
@@ -955,15 +955,15 @@ STACK_OF(OPENSSL_BLOCK) *d2i_ASN1_SET(STACK_OF(OPENSSL_BLOCK) **a,
955 void (*free_func)(OPENSSL_BLOCK), int ex_tag, int ex_class); 955 void (*free_func)(OPENSSL_BLOCK), int ex_tag, int ex_class);
956 956
957#ifndef OPENSSL_NO_BIO 957#ifndef OPENSSL_NO_BIO
958int i2a_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *a); 958int i2a_ASN1_INTEGER(BIO *bp, const ASN1_INTEGER *a);
959int a2i_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *bs, char *buf, int size); 959int a2i_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *bs, char *buf, int size);
960int i2a_ASN1_ENUMERATED(BIO *bp, ASN1_ENUMERATED *a); 960int i2a_ASN1_ENUMERATED(BIO *bp, const ASN1_ENUMERATED *a);
961int a2i_ASN1_ENUMERATED(BIO *bp, ASN1_ENUMERATED *bs, char *buf, int size); 961int a2i_ASN1_ENUMERATED(BIO *bp, ASN1_ENUMERATED *bs, char *buf, int size);
962int i2a_ASN1_OBJECT(BIO *bp, ASN1_OBJECT *a); 962int i2a_ASN1_OBJECT(BIO *bp, const ASN1_OBJECT *a);
963int a2i_ASN1_STRING(BIO *bp, ASN1_STRING *bs, char *buf, int size); 963int a2i_ASN1_STRING(BIO *bp, ASN1_STRING *bs, char *buf, int size);
964int i2a_ASN1_STRING(BIO *bp, ASN1_STRING *a, int type); 964int i2a_ASN1_STRING(BIO *bp, const ASN1_STRING *a, int type);
965#endif 965#endif
966int i2t_ASN1_OBJECT(char *buf, int buf_len, ASN1_OBJECT *a); 966int i2t_ASN1_OBJECT(char *buf, int buf_len, const ASN1_OBJECT *a);
967 967
968int a2d_ASN1_OBJECT(unsigned char *out, int olen, const char *buf, int num); 968int a2d_ASN1_OBJECT(unsigned char *out, int olen, const char *buf, int num);
969ASN1_OBJECT *ASN1_OBJECT_create(int nid, unsigned char *data, int len, 969ASN1_OBJECT *ASN1_OBJECT_create(int nid, unsigned char *data, int len,
@@ -975,9 +975,9 @@ ASN1_INTEGER *BN_to_ASN1_INTEGER(const BIGNUM *bn, ASN1_INTEGER *ai);
975BIGNUM *ASN1_INTEGER_to_BN(const ASN1_INTEGER *ai, BIGNUM *bn); 975BIGNUM *ASN1_INTEGER_to_BN(const ASN1_INTEGER *ai, BIGNUM *bn);
976 976
977int ASN1_ENUMERATED_set(ASN1_ENUMERATED *a, long v); 977int ASN1_ENUMERATED_set(ASN1_ENUMERATED *a, long v);
978long ASN1_ENUMERATED_get(ASN1_ENUMERATED *a); 978long ASN1_ENUMERATED_get(const ASN1_ENUMERATED *a);
979ASN1_ENUMERATED *BN_to_ASN1_ENUMERATED(BIGNUM *bn, ASN1_ENUMERATED *ai); 979ASN1_ENUMERATED *BN_to_ASN1_ENUMERATED(const BIGNUM *bn, ASN1_ENUMERATED *ai);
980BIGNUM *ASN1_ENUMERATED_to_BN(ASN1_ENUMERATED *ai, BIGNUM *bn); 980BIGNUM *ASN1_ENUMERATED_to_BN(const ASN1_ENUMERATED *ai, BIGNUM *bn);
981 981
982/* General */ 982/* General */
983/* given a string, return the correct type, max is the maximum length */ 983/* given a string, return the correct type, max is the maximum length */
@@ -1052,7 +1052,8 @@ int ASN1_i2d_fp(i2d_of_void *i2d, FILE *out, void *x);
1052 CHECKED_PTR_OF(const type, x))) 1052 CHECKED_PTR_OF(const type, x)))
1053 1053
1054int ASN1_item_i2d_fp(const ASN1_ITEM *it, FILE *out, void *x); 1054int ASN1_item_i2d_fp(const ASN1_ITEM *it, FILE *out, void *x);
1055int ASN1_STRING_print_ex_fp(FILE *fp, ASN1_STRING *str, unsigned long flags); 1055int ASN1_STRING_print_ex_fp(FILE *fp, const ASN1_STRING *str,
1056 unsigned long flags);
1056 1057
1057int ASN1_STRING_to_UTF8(unsigned char **out, ASN1_STRING *in); 1058int ASN1_STRING_to_UTF8(unsigned char **out, ASN1_STRING *in);
1058 1059
@@ -1083,7 +1084,7 @@ int ASN1_UTCTIME_print(BIO *fp, const ASN1_UTCTIME *a);
1083int ASN1_GENERALIZEDTIME_print(BIO *fp, const ASN1_GENERALIZEDTIME *a); 1084int ASN1_GENERALIZEDTIME_print(BIO *fp, const ASN1_GENERALIZEDTIME *a);
1084int ASN1_TIME_print(BIO *fp, const ASN1_TIME *a); 1085int ASN1_TIME_print(BIO *fp, const ASN1_TIME *a);
1085int ASN1_STRING_print(BIO *bp, const ASN1_STRING *v); 1086int ASN1_STRING_print(BIO *bp, const ASN1_STRING *v);
1086int ASN1_STRING_print_ex(BIO *out, ASN1_STRING *str, unsigned long flags); 1087int ASN1_STRING_print_ex(BIO *out, const ASN1_STRING *str, unsigned long flags);
1087int ASN1_bn_print(BIO *bp, const char *number, const BIGNUM *num, 1088int ASN1_bn_print(BIO *bp, const char *number, const BIGNUM *num,
1088 unsigned char *buf, int off); 1089 unsigned char *buf, int off);
1089int ASN1_parse(BIO *bp, const unsigned char *pp, long len, int indent); 1090int ASN1_parse(BIO *bp, const unsigned char *pp, long len, int indent);
@@ -1102,18 +1103,19 @@ extern const ASN1_ITEM NETSCAPE_X509_it;
1102int ASN1_UNIVERSALSTRING_to_string(ASN1_UNIVERSALSTRING *s); 1103int ASN1_UNIVERSALSTRING_to_string(ASN1_UNIVERSALSTRING *s);
1103 1104
1104int ASN1_TYPE_set_octetstring(ASN1_TYPE *a, unsigned char *data, int len); 1105int ASN1_TYPE_set_octetstring(ASN1_TYPE *a, unsigned char *data, int len);
1105int ASN1_TYPE_get_octetstring(ASN1_TYPE *a, unsigned char *data, int max_len); 1106int ASN1_TYPE_get_octetstring(const ASN1_TYPE *a, unsigned char *data,
1107 int max_len);
1106int ASN1_TYPE_set_int_octetstring(ASN1_TYPE *a, long num, unsigned char *data, 1108int ASN1_TYPE_set_int_octetstring(ASN1_TYPE *a, long num, unsigned char *data,
1107 int len); 1109 int len);
1108int ASN1_TYPE_get_int_octetstring(ASN1_TYPE *a, long *num, unsigned char *data, 1110int ASN1_TYPE_get_int_octetstring(const ASN1_TYPE *a, long *num,
1109 int max_len); 1111 unsigned char *data, int max_len);
1110 1112
1111STACK_OF(OPENSSL_BLOCK) *ASN1_seq_unpack(const unsigned char *buf, int len, 1113STACK_OF(OPENSSL_BLOCK) *ASN1_seq_unpack(const unsigned char *buf, int len,
1112 d2i_of_void *d2i, void (*free_func)(OPENSSL_BLOCK)); 1114 d2i_of_void *d2i, void (*free_func)(OPENSSL_BLOCK));
1113unsigned char *ASN1_seq_pack(STACK_OF(OPENSSL_BLOCK) *safes, i2d_of_void *i2d, 1115unsigned char *ASN1_seq_pack(STACK_OF(OPENSSL_BLOCK) *safes, i2d_of_void *i2d,
1114 unsigned char **buf, int *len ); 1116 unsigned char **buf, int *len );
1115void *ASN1_unpack_string(ASN1_STRING *oct, d2i_of_void *d2i); 1117void *ASN1_unpack_string(ASN1_STRING *oct, d2i_of_void *d2i);
1116void *ASN1_item_unpack(ASN1_STRING *oct, const ASN1_ITEM *it); 1118void *ASN1_item_unpack(const ASN1_STRING *oct, const ASN1_ITEM *it);
1117ASN1_STRING *ASN1_pack_string(void *obj, i2d_of_void *i2d, 1119ASN1_STRING *ASN1_pack_string(void *obj, i2d_of_void *i2d,
1118 ASN1_OCTET_STRING **oct); 1120 ASN1_OCTET_STRING **oct);
1119 1121
@@ -1139,15 +1141,15 @@ void ASN1_STRING_TABLE_cleanup(void);
1139/* Old API compatible functions */ 1141/* Old API compatible functions */
1140ASN1_VALUE *ASN1_item_new(const ASN1_ITEM *it); 1142ASN1_VALUE *ASN1_item_new(const ASN1_ITEM *it);
1141void ASN1_item_free(ASN1_VALUE *val, const ASN1_ITEM *it); 1143void ASN1_item_free(ASN1_VALUE *val, const ASN1_ITEM *it);
1142ASN1_VALUE * ASN1_item_d2i(ASN1_VALUE **val, const unsigned char **in, 1144ASN1_VALUE *ASN1_item_d2i(ASN1_VALUE **val, const unsigned char **in,
1143 long len, const ASN1_ITEM *it); 1145 long len, const ASN1_ITEM *it);
1144int ASN1_item_i2d(ASN1_VALUE *val, unsigned char **out, const ASN1_ITEM *it); 1146int ASN1_item_i2d(ASN1_VALUE *val, unsigned char **out, const ASN1_ITEM *it);
1145int ASN1_item_ndef_i2d(ASN1_VALUE *val, unsigned char **out, const ASN1_ITEM *it); 1147int ASN1_item_ndef_i2d(ASN1_VALUE *val, unsigned char **out, const ASN1_ITEM *it);
1146 1148
1147void ASN1_add_oid_module(void); 1149void ASN1_add_oid_module(void);
1148 1150
1149ASN1_TYPE *ASN1_generate_nconf(char *str, CONF *nconf); 1151ASN1_TYPE *ASN1_generate_nconf(const char *str, CONF *nconf);
1150ASN1_TYPE *ASN1_generate_v3(char *str, X509V3_CTX *cnf); 1152ASN1_TYPE *ASN1_generate_v3(const char *str, X509V3_CTX *cnf);
1151 1153
1152/* ASN1 Print flags */ 1154/* ASN1 Print flags */
1153 1155
@@ -1174,15 +1176,15 @@ int ASN1_item_print(BIO *out, ASN1_VALUE *ifld, int indent,
1174 const ASN1_ITEM *it, const ASN1_PCTX *pctx); 1176 const ASN1_ITEM *it, const ASN1_PCTX *pctx);
1175ASN1_PCTX *ASN1_PCTX_new(void); 1177ASN1_PCTX *ASN1_PCTX_new(void);
1176void ASN1_PCTX_free(ASN1_PCTX *p); 1178void ASN1_PCTX_free(ASN1_PCTX *p);
1177unsigned long ASN1_PCTX_get_flags(ASN1_PCTX *p); 1179unsigned long ASN1_PCTX_get_flags(const ASN1_PCTX *p);
1178void ASN1_PCTX_set_flags(ASN1_PCTX *p, unsigned long flags); 1180void ASN1_PCTX_set_flags(ASN1_PCTX *p, unsigned long flags);
1179unsigned long ASN1_PCTX_get_nm_flags(ASN1_PCTX *p); 1181unsigned long ASN1_PCTX_get_nm_flags(const ASN1_PCTX *p);
1180void ASN1_PCTX_set_nm_flags(ASN1_PCTX *p, unsigned long flags); 1182void ASN1_PCTX_set_nm_flags(ASN1_PCTX *p, unsigned long flags);
1181unsigned long ASN1_PCTX_get_cert_flags(ASN1_PCTX *p); 1183unsigned long ASN1_PCTX_get_cert_flags(const ASN1_PCTX *p);
1182void ASN1_PCTX_set_cert_flags(ASN1_PCTX *p, unsigned long flags); 1184void ASN1_PCTX_set_cert_flags(ASN1_PCTX *p, unsigned long flags);
1183unsigned long ASN1_PCTX_get_oid_flags(ASN1_PCTX *p); 1185unsigned long ASN1_PCTX_get_oid_flags(const ASN1_PCTX *p);
1184void ASN1_PCTX_set_oid_flags(ASN1_PCTX *p, unsigned long flags); 1186void ASN1_PCTX_set_oid_flags(ASN1_PCTX *p, unsigned long flags);
1185unsigned long ASN1_PCTX_get_str_flags(ASN1_PCTX *p); 1187unsigned long ASN1_PCTX_get_str_flags(const ASN1_PCTX *p);
1186void ASN1_PCTX_set_str_flags(ASN1_PCTX *p, unsigned long flags); 1188void ASN1_PCTX_set_str_flags(ASN1_PCTX *p, unsigned long flags);
1187 1189
1188BIO_METHOD *BIO_f_asn1(void); 1190BIO_METHOD *BIO_f_asn1(void);