summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjsing <>2014-05-22 14:45:14 +0000
committerjsing <>2014-05-22 14:45:14 +0000
commit47088465eae4e17bc85d800893191f6ab7699c3d (patch)
tree85629d66c0d011fc0d698b733110423db19c09db
parentc6539986de8b45584077216fc2581fb049302b84 (diff)
downloadopenbsd-47088465eae4e17bc85d800893191f6ab7699c3d.tar.gz
openbsd-47088465eae4e17bc85d800893191f6ab7699c3d.tar.bz2
openbsd-47088465eae4e17bc85d800893191f6ab7699c3d.zip
KNF.
-rw-r--r--src/lib/libcrypto/asn1/asn1.h266
-rw-r--r--src/lib/libcrypto/asn1/asn1_locl.h43
-rw-r--r--src/lib/libcrypto/asn1/asn1_mac.h16
-rw-r--r--src/lib/libssl/src/crypto/asn1/asn1.h266
-rw-r--r--src/lib/libssl/src/crypto/asn1/asn1_locl.h43
-rw-r--r--src/lib/libssl/src/crypto/asn1/asn1_mac.h16
6 files changed, 308 insertions, 342 deletions
diff --git a/src/lib/libcrypto/asn1/asn1.h b/src/lib/libcrypto/asn1/asn1.h
index 7e0ee8eab0..f92816b6c3 100644
--- a/src/lib/libcrypto/asn1/asn1.h
+++ b/src/lib/libcrypto/asn1/asn1.h
@@ -5,21 +5,21 @@
5 * This package is an SSL implementation written 5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com). 6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL. 7 * The implementation was written so as to conform with Netscapes SSL.
8 * 8 *
9 * This library is free for commercial and non-commercial use as long as 9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions 10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA, 11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation 12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms 13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com). 14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 * 15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in 16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed. 17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution 18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used. 19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or 20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package. 21 * in documentation (online or textual) provided with the package.
22 * 22 *
23 * Redistribution and use in source and binary forms, with or without 23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions 24 * modification, are permitted provided that the following conditions
25 * are met: 25 * are met:
@@ -34,10 +34,10 @@
34 * Eric Young (eay@cryptsoft.com)" 34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library 35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-). 36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from 37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement: 38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" 39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 * 40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND 41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -49,7 +49,7 @@
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE. 51 * SUCH DAMAGE.
52 * 52 *
53 * The licence and distribution terms for any publically available version or 53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be 54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence 55 * copied and put under another distribution licence
@@ -165,8 +165,7 @@ DECLARE_STACK_OF(X509_ALGOR)
165 asn1_const_ctx are exactly the same. Fortunately, as soon as 165 asn1_const_ctx are exactly the same. Fortunately, as soon as
166 the old ASN1 parsing macros are gone, we can throw this away 166 the old ASN1 parsing macros are gone, we can throw this away
167 as well... */ 167 as well... */
168typedef struct asn1_ctx_st 168typedef struct asn1_ctx_st {
169 {
170 unsigned char *p;/* work char pointer */ 169 unsigned char *p;/* work char pointer */
171 int eos; /* end of sequence read for indefinite encoding */ 170 int eos; /* end of sequence read for indefinite encoding */
172 int error; /* error code to use when returning an error */ 171 int error; /* error code to use when returning an error */
@@ -178,10 +177,9 @@ typedef struct asn1_ctx_st
178 unsigned char *q;/* temporary variable */ 177 unsigned char *q;/* temporary variable */
179 unsigned char **pp;/* variable */ 178 unsigned char **pp;/* variable */
180 int line; /* used in error processing */ 179 int line; /* used in error processing */
181 } ASN1_CTX; 180} ASN1_CTX;
182 181
183typedef struct asn1_const_ctx_st 182typedef struct asn1_const_ctx_st {
184 {
185 const unsigned char *p;/* work char pointer */ 183 const unsigned char *p;/* work char pointer */
186 int eos; /* end of sequence read for indefinite encoding */ 184 int eos; /* end of sequence read for indefinite encoding */
187 int error; /* error code to use when returning an error */ 185 int error; /* error code to use when returning an error */
@@ -193,7 +191,7 @@ typedef struct asn1_const_ctx_st
193 const unsigned char *q;/* temporary variable */ 191 const unsigned char *q;/* temporary variable */
194 const unsigned char **pp;/* variable */ 192 const unsigned char **pp;/* variable */
195 int line; /* used in error processing */ 193 int line; /* used in error processing */
196 } ASN1_const_CTX; 194} ASN1_const_CTX;
197 195
198/* These are used internally in the ASN1_OBJECT to keep track of 196/* These are used internally in the ASN1_OBJECT to keep track of
199 * whether the names and data need to be free()ed */ 197 * whether the names and data need to be free()ed */
@@ -201,35 +199,33 @@ typedef struct asn1_const_ctx_st
201#define ASN1_OBJECT_FLAG_CRITICAL 0x02 /* critical x509v3 object id */ 199#define ASN1_OBJECT_FLAG_CRITICAL 0x02 /* critical x509v3 object id */
202#define ASN1_OBJECT_FLAG_DYNAMIC_STRINGS 0x04 /* internal use */ 200#define ASN1_OBJECT_FLAG_DYNAMIC_STRINGS 0x04 /* internal use */
203#define ASN1_OBJECT_FLAG_DYNAMIC_DATA 0x08 /* internal use */ 201#define ASN1_OBJECT_FLAG_DYNAMIC_DATA 0x08 /* internal use */
204typedef struct asn1_object_st 202typedef struct asn1_object_st {
205 { 203 const char *sn, *ln;
206 const char *sn,*ln;
207 int nid; 204 int nid;
208 int length; 205 int length;
209 const unsigned char *data; /* data remains const after init */ 206 const unsigned char *data; /* data remains const after init */
210 int flags; /* Should we free this one */ 207 int flags; /* Should we free this one */
211 } ASN1_OBJECT; 208} ASN1_OBJECT;
212 209
213#define ASN1_STRING_FLAG_BITS_LEFT 0x08 /* Set if 0x07 has bits left value */ 210#define ASN1_STRING_FLAG_BITS_LEFT 0x08 /* Set if 0x07 has bits left value */
214/* This indicates that the ASN1_STRING is not a real value but just a place 211/* This indicates that the ASN1_STRING is not a real value but just a place
215 * holder for the location where indefinite length constructed data should 212 * holder for the location where indefinite length constructed data should
216 * be inserted in the memory buffer 213 * be inserted in the memory buffer
217 */ 214 */
218#define ASN1_STRING_FLAG_NDEF 0x010 215#define ASN1_STRING_FLAG_NDEF 0x010
219 216
220/* This flag is used by the CMS code to indicate that a string is not 217/* This flag is used by the CMS code to indicate that a string is not
221 * complete and is a place holder for content when it had all been 218 * complete and is a place holder for content when it had all been
222 * accessed. The flag will be reset when content has been written to it. 219 * accessed. The flag will be reset when content has been written to it.
223 */ 220 */
224 221
225#define ASN1_STRING_FLAG_CONT 0x020 222#define ASN1_STRING_FLAG_CONT 0x020
226/* This flag is used by ASN1 code to indicate an ASN1_STRING is an MSTRING 223/* This flag is used by ASN1 code to indicate an ASN1_STRING is an MSTRING
227 * type. 224 * type.
228 */ 225 */
229#define ASN1_STRING_FLAG_MSTRING 0x040 226#define ASN1_STRING_FLAG_MSTRING 0x040
230/* This is the base type that holds just about everything :-) */ 227/* This is the base type that holds just about everything :-) */
231struct asn1_string_st 228struct asn1_string_st {
232 {
233 int length; 229 int length;
234 int type; 230 int type;
235 unsigned char *data; 231 unsigned char *data;
@@ -238,19 +234,18 @@ struct asn1_string_st
238 * input data has a non-zero 'unused bits' value, it will be 234 * input data has a non-zero 'unused bits' value, it will be
239 * handled correctly */ 235 * handled correctly */
240 long flags; 236 long flags;
241 }; 237};
242 238
243/* ASN1_ENCODING structure: this is used to save the received 239/* ASN1_ENCODING structure: this is used to save the received
244 * encoding of an ASN1 type. This is useful to get round 240 * encoding of an ASN1 type. This is useful to get round
245 * problems with invalid encodings which can break signatures. 241 * problems with invalid encodings which can break signatures.
246 */ 242 */
247 243
248typedef struct ASN1_ENCODING_st 244typedef struct ASN1_ENCODING_st {
249 {
250 unsigned char *enc; /* DER encoding */ 245 unsigned char *enc; /* DER encoding */
251 long len; /* Length of encoding */ 246 long len; /* Length of encoding */
252 int modified; /* set to 1 if 'enc' is invalid */ 247 int modified; /* set to 1 if 'enc' is invalid */
253 } ASN1_ENCODING; 248} ASN1_ENCODING;
254 249
255/* Used with ASN1 LONG type: if a long is set to this it is omitted */ 250/* Used with ASN1 LONG type: if a long is set to this it is omitted */
256#define ASN1_LONG_UNDEF 0x7fffffffL 251#define ASN1_LONG_UNDEF 0x7fffffffL
@@ -373,7 +368,7 @@ TYPEDEF_D2I2D_OF(void);
373 * ... 368 * ...
374 * ASN1_ITEM_EXP *iptr; 369 * ASN1_ITEM_EXP *iptr;
375 * ... 370 * ...
376 * } SOMETHING; 371 * } SOMETHING;
377 * 372 *
378 * It would be initialised as e.g.: 373 * It would be initialised as e.g.:
379 * 374 *
@@ -461,7 +456,7 @@ typedef const ASN1_ITEM * ASN1_ITEM_EXP(void);
461 */ 456 */
462 457
463/* If this is set we convert all character strings 458/* If this is set we convert all character strings
464 * to UTF8 first 459 * to UTF8 first
465 */ 460 */
466 461
467#define ASN1_STRFLGS_UTF8_CONVERT 0x10 462#define ASN1_STRFLGS_UTF8_CONVERT 0x10
@@ -511,10 +506,9 @@ DECLARE_ASN1_SET_OF(ASN1_INTEGER)
511 506
512DECLARE_STACK_OF(ASN1_GENERALSTRING) 507DECLARE_STACK_OF(ASN1_GENERALSTRING)
513 508
514typedef struct asn1_type_st 509typedef struct asn1_type_st {
515 {
516 int type; 510 int type;
517 union { 511 union {
518 char *ptr; 512 char *ptr;
519 ASN1_BOOLEAN boolean; 513 ASN1_BOOLEAN boolean;
520 ASN1_STRING * asn1_string; 514 ASN1_STRING * asn1_string;
@@ -538,8 +532,8 @@ typedef struct asn1_type_st
538 ASN1_STRING * set; 532 ASN1_STRING * set;
539 ASN1_STRING * sequence; 533 ASN1_STRING * sequence;
540 ASN1_VALUE * asn1_value; 534 ASN1_VALUE * asn1_value;
541 } value; 535 } value;
542 } ASN1_TYPE; 536} ASN1_TYPE;
543 537
544DECLARE_STACK_OF(ASN1_TYPE) 538DECLARE_STACK_OF(ASN1_TYPE)
545DECLARE_ASN1_SET_OF(ASN1_TYPE) 539DECLARE_ASN1_SET_OF(ASN1_TYPE)
@@ -549,11 +543,10 @@ typedef STACK_OF(ASN1_TYPE) ASN1_SEQUENCE_ANY;
549DECLARE_ASN1_ENCODE_FUNCTIONS_const(ASN1_SEQUENCE_ANY, ASN1_SEQUENCE_ANY) 543DECLARE_ASN1_ENCODE_FUNCTIONS_const(ASN1_SEQUENCE_ANY, ASN1_SEQUENCE_ANY)
550DECLARE_ASN1_ENCODE_FUNCTIONS_const(ASN1_SEQUENCE_ANY, ASN1_SET_ANY) 544DECLARE_ASN1_ENCODE_FUNCTIONS_const(ASN1_SEQUENCE_ANY, ASN1_SET_ANY)
551 545
552typedef struct NETSCAPE_X509_st 546typedef struct NETSCAPE_X509_st {
553 {
554 ASN1_OCTET_STRING *header; 547 ASN1_OCTET_STRING *header;
555 X509 *cert; 548 X509 *cert;
556 } NETSCAPE_X509; 549} NETSCAPE_X509;
557 550
558/* This is used to contain a list of bit names */ 551/* This is used to contain a list of bit names */
559typedef struct BIT_STRING_BITNAME_st { 552typedef struct BIT_STRING_BITNAME_st {
@@ -760,7 +753,7 @@ typedef struct BIT_STRING_BITNAME_st {
760 (ASN1_UTF8STRING *)d2i_ASN1_type_bytes\ 753 (ASN1_UTF8STRING *)d2i_ASN1_type_bytes\
761 ((ASN1_STRING **)a,pp,l,B_ASN1_UTF8STRING) 754 ((ASN1_STRING **)a,pp,l,B_ASN1_UTF8STRING)
762 755
763 /* for the is_set parameter to i2d_ASN1_SET */ 756/* for the is_set parameter to i2d_ASN1_SET */
764#define IS_SEQUENCE 0 757#define IS_SEQUENCE 0
765#define IS_SET 1 758#define IS_SET 1
766 759
@@ -769,86 +762,88 @@ DECLARE_ASN1_FUNCTIONS_fname(ASN1_TYPE, ASN1_ANY, ASN1_TYPE)
769int ASN1_TYPE_get(ASN1_TYPE *a); 762int ASN1_TYPE_get(ASN1_TYPE *a);
770void ASN1_TYPE_set(ASN1_TYPE *a, int type, void *value); 763void ASN1_TYPE_set(ASN1_TYPE *a, int type, void *value);
771int ASN1_TYPE_set1(ASN1_TYPE *a, int type, const void *value); 764int ASN1_TYPE_set1(ASN1_TYPE *a, int type, const void *value);
772int ASN1_TYPE_cmp(ASN1_TYPE *a, ASN1_TYPE *b); 765int ASN1_TYPE_cmp(ASN1_TYPE *a, ASN1_TYPE *b);
773 766
774ASN1_OBJECT * ASN1_OBJECT_new(void ); 767ASN1_OBJECT *ASN1_OBJECT_new(void );
775void ASN1_OBJECT_free(ASN1_OBJECT *a); 768void ASN1_OBJECT_free(ASN1_OBJECT *a);
776int i2d_ASN1_OBJECT(ASN1_OBJECT *a,unsigned char **pp); 769int i2d_ASN1_OBJECT(ASN1_OBJECT *a, unsigned char **pp);
777ASN1_OBJECT * c2i_ASN1_OBJECT(ASN1_OBJECT **a,const unsigned char **pp, 770ASN1_OBJECT *c2i_ASN1_OBJECT(ASN1_OBJECT **a, const unsigned char **pp,
778 long length); 771 long length);
779ASN1_OBJECT * d2i_ASN1_OBJECT(ASN1_OBJECT **a,const unsigned char **pp, 772ASN1_OBJECT *d2i_ASN1_OBJECT(ASN1_OBJECT **a, const unsigned char **pp,
780 long length); 773 long length);
781 774
782DECLARE_ASN1_ITEM(ASN1_OBJECT) 775DECLARE_ASN1_ITEM(ASN1_OBJECT)
783 776
784DECLARE_STACK_OF(ASN1_OBJECT) 777DECLARE_STACK_OF(ASN1_OBJECT)
785DECLARE_ASN1_SET_OF(ASN1_OBJECT) 778DECLARE_ASN1_SET_OF(ASN1_OBJECT)
786 779
787ASN1_STRING * ASN1_STRING_new(void); 780ASN1_STRING *ASN1_STRING_new(void);
788void ASN1_STRING_free(ASN1_STRING *a); 781void ASN1_STRING_free(ASN1_STRING *a);
789int ASN1_STRING_copy(ASN1_STRING *dst, const ASN1_STRING *str); 782int ASN1_STRING_copy(ASN1_STRING *dst, const ASN1_STRING *str);
790ASN1_STRING * ASN1_STRING_dup(const ASN1_STRING *a); 783ASN1_STRING *ASN1_STRING_dup(const ASN1_STRING *a);
791ASN1_STRING * ASN1_STRING_type_new(int type ); 784ASN1_STRING *ASN1_STRING_type_new(int type );
792int ASN1_STRING_cmp(const ASN1_STRING *a, const ASN1_STRING *b); 785int ASN1_STRING_cmp(const ASN1_STRING *a, const ASN1_STRING *b);
793 /* Since this is used to store all sorts of things, via macros, for now, make 786 /* Since this is used to store all sorts of things, via macros, for now, make
794 its data void * */ 787 its data void * */
795int ASN1_STRING_set(ASN1_STRING *str, const void *data, int len); 788int ASN1_STRING_set(ASN1_STRING *str, const void *data, int len);
796void ASN1_STRING_set0(ASN1_STRING *str, void *data, int len); 789void ASN1_STRING_set0(ASN1_STRING *str, void *data, int len);
797int ASN1_STRING_length(const ASN1_STRING *x); 790int ASN1_STRING_length(const ASN1_STRING *x);
798void ASN1_STRING_length_set(ASN1_STRING *x, int n); 791void ASN1_STRING_length_set(ASN1_STRING *x, int n);
799int ASN1_STRING_type(ASN1_STRING *x); 792int ASN1_STRING_type(ASN1_STRING *x);
800unsigned char * ASN1_STRING_data(ASN1_STRING *x); 793unsigned char * ASN1_STRING_data(ASN1_STRING *x);
801 794
802DECLARE_ASN1_FUNCTIONS(ASN1_BIT_STRING) 795DECLARE_ASN1_FUNCTIONS(ASN1_BIT_STRING)
803int i2c_ASN1_BIT_STRING(ASN1_BIT_STRING *a,unsigned char **pp); 796int i2c_ASN1_BIT_STRING(ASN1_BIT_STRING *a, unsigned char **pp);
804ASN1_BIT_STRING *c2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a,const unsigned char **pp, 797ASN1_BIT_STRING *c2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a,
805 long length); 798 const unsigned char **pp, long length);
806int ASN1_BIT_STRING_set(ASN1_BIT_STRING *a, unsigned char *d, 799int ASN1_BIT_STRING_set(ASN1_BIT_STRING *a, unsigned char *d, int length );
807 int length ); 800int ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, int n, int value);
808int ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, int n, int value); 801int ASN1_BIT_STRING_get_bit(ASN1_BIT_STRING *a, int n);
809int ASN1_BIT_STRING_get_bit(ASN1_BIT_STRING *a, int n); 802int ASN1_BIT_STRING_check(ASN1_BIT_STRING *a,
810int ASN1_BIT_STRING_check(ASN1_BIT_STRING *a, 803 unsigned char *flags, int flags_len);
811 unsigned char *flags, int flags_len);
812 804
813#ifndef OPENSSL_NO_BIO 805#ifndef OPENSSL_NO_BIO
814int ASN1_BIT_STRING_name_print(BIO *out, ASN1_BIT_STRING *bs, 806int ASN1_BIT_STRING_name_print(BIO *out, ASN1_BIT_STRING *bs,
815 BIT_STRING_BITNAME *tbl, int indent); 807 BIT_STRING_BITNAME *tbl, int indent);
816#endif 808#endif
817int ASN1_BIT_STRING_num_asc(char *name, BIT_STRING_BITNAME *tbl); 809int ASN1_BIT_STRING_num_asc(char *name, BIT_STRING_BITNAME *tbl);
818int ASN1_BIT_STRING_set_asc(ASN1_BIT_STRING *bs, char *name, int value, 810int ASN1_BIT_STRING_set_asc(ASN1_BIT_STRING *bs, char *name, int value,
819 BIT_STRING_BITNAME *tbl); 811 BIT_STRING_BITNAME *tbl);
820 812
821int i2d_ASN1_BOOLEAN(int a,unsigned char **pp); 813int i2d_ASN1_BOOLEAN(int a, unsigned char **pp);
822int d2i_ASN1_BOOLEAN(int *a,const unsigned char **pp,long length); 814int d2i_ASN1_BOOLEAN(int *a, const unsigned char **pp, long length);
823 815
824DECLARE_ASN1_FUNCTIONS(ASN1_INTEGER) 816DECLARE_ASN1_FUNCTIONS(ASN1_INTEGER)
825int i2c_ASN1_INTEGER(ASN1_INTEGER *a,unsigned char **pp); 817int i2c_ASN1_INTEGER(ASN1_INTEGER *a, unsigned char **pp);
826ASN1_INTEGER *c2i_ASN1_INTEGER(ASN1_INTEGER **a,const unsigned char **pp, 818ASN1_INTEGER *c2i_ASN1_INTEGER(ASN1_INTEGER **a, const unsigned char **pp,
827 long length); 819 long length);
828ASN1_INTEGER *d2i_ASN1_UINTEGER(ASN1_INTEGER **a,const unsigned char **pp, 820ASN1_INTEGER *d2i_ASN1_UINTEGER(ASN1_INTEGER **a, const unsigned char **pp,
829 long length); 821 long length);
830ASN1_INTEGER * ASN1_INTEGER_dup(const ASN1_INTEGER *x); 822ASN1_INTEGER * ASN1_INTEGER_dup(const ASN1_INTEGER *x);
831int ASN1_INTEGER_cmp(const ASN1_INTEGER *x, const ASN1_INTEGER *y); 823int ASN1_INTEGER_cmp(const ASN1_INTEGER *x, const ASN1_INTEGER *y);
832 824
833DECLARE_ASN1_FUNCTIONS(ASN1_ENUMERATED) 825DECLARE_ASN1_FUNCTIONS(ASN1_ENUMERATED)
834 826
835int ASN1_UTCTIME_check(ASN1_UTCTIME *a); 827int ASN1_UTCTIME_check(ASN1_UTCTIME *a);
836ASN1_UTCTIME *ASN1_UTCTIME_set(ASN1_UTCTIME *s,time_t t); 828ASN1_UTCTIME *ASN1_UTCTIME_set(ASN1_UTCTIME *s, time_t t);
837ASN1_UTCTIME *ASN1_UTCTIME_adj(ASN1_UTCTIME *s, time_t t, 829ASN1_UTCTIME *ASN1_UTCTIME_adj(ASN1_UTCTIME *s, time_t t,
838 int offset_day, long offset_sec); 830 int offset_day, long offset_sec);
839int ASN1_UTCTIME_set_string(ASN1_UTCTIME *s, const char *str); 831int ASN1_UTCTIME_set_string(ASN1_UTCTIME *s, const char *str);
840int ASN1_UTCTIME_cmp_time_t(const ASN1_UTCTIME *s, time_t t); 832int ASN1_UTCTIME_cmp_time_t(const ASN1_UTCTIME *s, time_t t);
841 833
842int ASN1_GENERALIZEDTIME_check(ASN1_GENERALIZEDTIME *a); 834int ASN1_GENERALIZEDTIME_check(ASN1_GENERALIZEDTIME *a);
843ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_set(ASN1_GENERALIZEDTIME *s,time_t t); 835ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_set(ASN1_GENERALIZEDTIME *s,
836 time_t t);
844ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_adj(ASN1_GENERALIZEDTIME *s, 837ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_adj(ASN1_GENERALIZEDTIME *s,
845 time_t t, int offset_day, long offset_sec); 838 time_t t, int offset_day, long offset_sec);
846int ASN1_GENERALIZEDTIME_set_string(ASN1_GENERALIZEDTIME *s, const char *str); 839int ASN1_GENERALIZEDTIME_set_string(ASN1_GENERALIZEDTIME *s, const char *str);
847 840
848DECLARE_ASN1_FUNCTIONS(ASN1_OCTET_STRING) 841DECLARE_ASN1_FUNCTIONS(ASN1_OCTET_STRING)
849ASN1_OCTET_STRING * ASN1_OCTET_STRING_dup(const ASN1_OCTET_STRING *a); 842ASN1_OCTET_STRING *ASN1_OCTET_STRING_dup(const ASN1_OCTET_STRING *a);
850int ASN1_OCTET_STRING_cmp(const ASN1_OCTET_STRING *a, const ASN1_OCTET_STRING *b); 843int ASN1_OCTET_STRING_cmp(const ASN1_OCTET_STRING *a,
851int ASN1_OCTET_STRING_set(ASN1_OCTET_STRING *str, const unsigned char *data, int len); 844 const ASN1_OCTET_STRING *b);
845int ASN1_OCTET_STRING_set(ASN1_OCTET_STRING *str, const unsigned char *data,
846 int len);
852 847
853DECLARE_ASN1_FUNCTIONS(ASN1_VISIBLESTRING) 848DECLARE_ASN1_FUNCTIONS(ASN1_VISIBLESTRING)
854DECLARE_ASN1_FUNCTIONS(ASN1_UNIVERSALSTRING) 849DECLARE_ASN1_FUNCTIONS(ASN1_UNIVERSALSTRING)
@@ -870,46 +865,44 @@ DECLARE_ASN1_FUNCTIONS(ASN1_TIME)
870 865
871DECLARE_ASN1_ITEM(ASN1_OCTET_STRING_NDEF) 866DECLARE_ASN1_ITEM(ASN1_OCTET_STRING_NDEF)
872 867
873ASN1_TIME *ASN1_TIME_set(ASN1_TIME *s,time_t t); 868ASN1_TIME *ASN1_TIME_set(ASN1_TIME *s, time_t t);
874ASN1_TIME *ASN1_TIME_adj(ASN1_TIME *s,time_t t, 869ASN1_TIME *ASN1_TIME_adj(ASN1_TIME *s, time_t t, int offset_day,
875 int offset_day, long offset_sec); 870 long offset_sec);
876int ASN1_TIME_check(ASN1_TIME *t); 871int ASN1_TIME_check(ASN1_TIME *t);
877ASN1_GENERALIZEDTIME *ASN1_TIME_to_generalizedtime(ASN1_TIME *t, ASN1_GENERALIZEDTIME **out); 872ASN1_GENERALIZEDTIME *ASN1_TIME_to_generalizedtime(ASN1_TIME *t,
873 ASN1_GENERALIZEDTIME **out);
878int ASN1_TIME_set_string(ASN1_TIME *s, const char *str); 874int ASN1_TIME_set_string(ASN1_TIME *s, const char *str);
879 875
880int i2d_ASN1_SET(STACK_OF(OPENSSL_BLOCK) *a, unsigned char **pp, 876int i2d_ASN1_SET(STACK_OF(OPENSSL_BLOCK) *a, unsigned char **pp,
881 i2d_of_void *i2d, int ex_tag, int ex_class, 877 i2d_of_void *i2d, int ex_tag, int ex_class, int is_set);
882 int is_set);
883STACK_OF(OPENSSL_BLOCK) *d2i_ASN1_SET(STACK_OF(OPENSSL_BLOCK) **a, 878STACK_OF(OPENSSL_BLOCK) *d2i_ASN1_SET(STACK_OF(OPENSSL_BLOCK) **a,
884 const unsigned char **pp, 879 const unsigned char **pp, long length, d2i_of_void *d2i,
885 long length, d2i_of_void *d2i, 880 void (*free_func)(OPENSSL_BLOCK), int ex_tag, int ex_class);
886 void (*free_func)(OPENSSL_BLOCK), int ex_tag,
887 int ex_class);
888 881
889#ifndef OPENSSL_NO_BIO 882#ifndef OPENSSL_NO_BIO
890int i2a_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *a); 883int i2a_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *a);
891int a2i_ASN1_INTEGER(BIO *bp,ASN1_INTEGER *bs,char *buf,int size); 884int a2i_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *bs, char *buf, int size);
892int i2a_ASN1_ENUMERATED(BIO *bp, ASN1_ENUMERATED *a); 885int i2a_ASN1_ENUMERATED(BIO *bp, ASN1_ENUMERATED *a);
893int a2i_ASN1_ENUMERATED(BIO *bp,ASN1_ENUMERATED *bs,char *buf,int size); 886int a2i_ASN1_ENUMERATED(BIO *bp, ASN1_ENUMERATED *bs, char *buf, int size);
894int i2a_ASN1_OBJECT(BIO *bp,ASN1_OBJECT *a); 887int i2a_ASN1_OBJECT(BIO *bp, ASN1_OBJECT *a);
895int a2i_ASN1_STRING(BIO *bp,ASN1_STRING *bs,char *buf,int size); 888int a2i_ASN1_STRING(BIO *bp, ASN1_STRING *bs, char *buf, int size);
896int i2a_ASN1_STRING(BIO *bp, ASN1_STRING *a, int type); 889int i2a_ASN1_STRING(BIO *bp, ASN1_STRING *a, int type);
897#endif 890#endif
898int i2t_ASN1_OBJECT(char *buf,int buf_len,ASN1_OBJECT *a); 891int i2t_ASN1_OBJECT(char *buf, int buf_len, ASN1_OBJECT *a);
899 892
900int a2d_ASN1_OBJECT(unsigned char *out,int olen, const char *buf, int num); 893int a2d_ASN1_OBJECT(unsigned char *out, int olen, const char *buf, int num);
901ASN1_OBJECT *ASN1_OBJECT_create(int nid, unsigned char *data,int len, 894ASN1_OBJECT *ASN1_OBJECT_create(int nid, unsigned char *data, int len,
902 const char *sn, const char *ln); 895 const char *sn, const char *ln);
903 896
904int ASN1_INTEGER_set(ASN1_INTEGER *a, long v); 897int ASN1_INTEGER_set(ASN1_INTEGER *a, long v);
905long ASN1_INTEGER_get(const ASN1_INTEGER *a); 898long ASN1_INTEGER_get(const ASN1_INTEGER *a);
906ASN1_INTEGER *BN_to_ASN1_INTEGER(const BIGNUM *bn, ASN1_INTEGER *ai); 899ASN1_INTEGER *BN_to_ASN1_INTEGER(const BIGNUM *bn, ASN1_INTEGER *ai);
907BIGNUM *ASN1_INTEGER_to_BN(const ASN1_INTEGER *ai,BIGNUM *bn); 900BIGNUM *ASN1_INTEGER_to_BN(const ASN1_INTEGER *ai, BIGNUM *bn);
908 901
909int ASN1_ENUMERATED_set(ASN1_ENUMERATED *a, long v); 902int ASN1_ENUMERATED_set(ASN1_ENUMERATED *a, long v);
910long ASN1_ENUMERATED_get(ASN1_ENUMERATED *a); 903long ASN1_ENUMERATED_get(ASN1_ENUMERATED *a);
911ASN1_ENUMERATED *BN_to_ASN1_ENUMERATED(BIGNUM *bn, ASN1_ENUMERATED *ai); 904ASN1_ENUMERATED *BN_to_ASN1_ENUMERATED(BIGNUM *bn, ASN1_ENUMERATED *ai);
912BIGNUM *ASN1_ENUMERATED_to_BN(ASN1_ENUMERATED *ai,BIGNUM *bn); 905BIGNUM *ASN1_ENUMERATED_to_BN(ASN1_ENUMERATED *ai, BIGNUM *bn);
913 906
914/* General */ 907/* General */
915/* given a string, return the correct type, max is the maximum length */ 908/* given a string, return the correct type, max is the maximum length */
@@ -917,11 +910,11 @@ int ASN1_PRINTABLE_type(const unsigned char *s, int max);
917 910
918int i2d_ASN1_bytes(ASN1_STRING *a, unsigned char **pp, int tag, int xclass); 911int i2d_ASN1_bytes(ASN1_STRING *a, unsigned char **pp, int tag, int xclass);
919ASN1_STRING *d2i_ASN1_bytes(ASN1_STRING **a, const unsigned char **pp, 912ASN1_STRING *d2i_ASN1_bytes(ASN1_STRING **a, const unsigned char **pp,
920 long length, int Ptag, int Pclass); 913 long length, int Ptag, int Pclass);
921unsigned long ASN1_tag2bit(int tag); 914unsigned long ASN1_tag2bit(int tag);
922/* type is one or more of the B_ASN1_ values. */ 915/* type is one or more of the B_ASN1_ values. */
923ASN1_STRING *d2i_ASN1_type_bytes(ASN1_STRING **a,const unsigned char **pp, 916ASN1_STRING *d2i_ASN1_type_bytes(ASN1_STRING **a, const unsigned char **pp,
924 long length,int type); 917 long length, int type);
925 918
926/* PARSING */ 919/* PARSING */
927int asn1_Finish(ASN1_CTX *c); 920int asn1_Finish(ASN1_CTX *c);
@@ -929,11 +922,11 @@ int asn1_const_Finish(ASN1_const_CTX *c);
929 922
930/* SPECIALS */ 923/* SPECIALS */
931int ASN1_get_object(const unsigned char **pp, long *plength, int *ptag, 924int ASN1_get_object(const unsigned char **pp, long *plength, int *ptag,
932 int *pclass, long omax); 925 int *pclass, long omax);
933int ASN1_check_infinite_end(unsigned char **p,long len); 926int ASN1_check_infinite_end(unsigned char **p, long len);
934int ASN1_const_check_infinite_end(const unsigned char **p,long len); 927int ASN1_const_check_infinite_end(const unsigned char **p, long len);
935void ASN1_put_object(unsigned char **pp, int constructed, int length, 928void ASN1_put_object(unsigned char **pp, int constructed, int length, int tag,
936 int tag, int xclass); 929 int xclass);
937int ASN1_put_eoc(unsigned char **pp); 930int ASN1_put_eoc(unsigned char **pp);
938int ASN1_object_size(int constructed, int length, int tag); 931int ASN1_object_size(int constructed, int length, int tag);
939 932
@@ -968,7 +961,7 @@ void *ASN1_d2i_fp(void *(*xnew)(void), d2i_of_void *d2i, FILE *in, void **x);
968 CHECKED_PPTR_OF(type, x))) 961 CHECKED_PPTR_OF(type, x)))
969 962
970void *ASN1_item_d2i_fp(const ASN1_ITEM *it, FILE *in, void *x); 963void *ASN1_item_d2i_fp(const ASN1_ITEM *it, FILE *in, void *x);
971int ASN1_i2d_fp(i2d_of_void *i2d,FILE *out,void *x); 964int ASN1_i2d_fp(i2d_of_void *i2d, FILE *out, void *x);
972 965
973#define ASN1_i2d_fp_of(type,i2d,out,x) \ 966#define ASN1_i2d_fp_of(type,i2d,out,x) \
974 (ASN1_i2d_fp(CHECKED_I2D_OF(type, i2d), \ 967 (ASN1_i2d_fp(CHECKED_I2D_OF(type, i2d), \
@@ -996,7 +989,7 @@ void *ASN1_d2i_bio(void *(*xnew)(void), d2i_of_void *d2i, BIO *in, void **x);
996 CHECKED_PPTR_OF(type, x))) 989 CHECKED_PPTR_OF(type, x)))
997 990
998void *ASN1_item_d2i_bio(const ASN1_ITEM *it, BIO *in, void *x); 991void *ASN1_item_d2i_bio(const ASN1_ITEM *it, BIO *in, void *x);
999int ASN1_i2d_bio(i2d_of_void *i2d,BIO *out, unsigned char *x); 992int ASN1_i2d_bio(i2d_of_void *i2d, BIO *out, unsigned char *x);
1000 993
1001#define ASN1_i2d_bio_of(type,i2d,out,x) \ 994#define ASN1_i2d_bio_of(type,i2d,out,x) \
1002 (ASN1_i2d_bio(CHECKED_I2D_OF(type, i2d), \ 995 (ASN1_i2d_bio(CHECKED_I2D_OF(type, i2d), \
@@ -1015,9 +1008,9 @@ int ASN1_TIME_print(BIO *fp, const ASN1_TIME *a);
1015int ASN1_STRING_print(BIO *bp, const ASN1_STRING *v); 1008int ASN1_STRING_print(BIO *bp, const ASN1_STRING *v);
1016int ASN1_STRING_print_ex(BIO *out, ASN1_STRING *str, unsigned long flags); 1009int ASN1_STRING_print_ex(BIO *out, ASN1_STRING *str, unsigned long flags);
1017int ASN1_bn_print(BIO *bp, const char *number, const BIGNUM *num, 1010int ASN1_bn_print(BIO *bp, const char *number, const BIGNUM *num,
1018 unsigned char *buf, int off); 1011 unsigned char *buf, int off);
1019int ASN1_parse(BIO *bp,const unsigned char *pp,long len,int indent); 1012int ASN1_parse(BIO *bp, const unsigned char *pp, long len, int indent);
1020int ASN1_parse_dump(BIO *bp,const unsigned char *pp,long len,int indent,int dump); 1013int ASN1_parse_dump(BIO *bp, const unsigned char *pp, long len, int indent, int dump);
1021#endif 1014#endif
1022const char *ASN1_tag2str(int tag); 1015const char *ASN1_tag2str(int tag);
1023 1016
@@ -1027,37 +1020,35 @@ DECLARE_ASN1_FUNCTIONS(NETSCAPE_X509)
1027 1020
1028int ASN1_UNIVERSALSTRING_to_string(ASN1_UNIVERSALSTRING *s); 1021int ASN1_UNIVERSALSTRING_to_string(ASN1_UNIVERSALSTRING *s);
1029 1022
1030int ASN1_TYPE_set_octetstring(ASN1_TYPE *a, 1023int ASN1_TYPE_set_octetstring(ASN1_TYPE *a, unsigned char *data, int len);
1031 unsigned char *data, int len); 1024int ASN1_TYPE_get_octetstring(ASN1_TYPE *a, unsigned char *data, int max_len);
1032int ASN1_TYPE_get_octetstring(ASN1_TYPE *a, 1025int ASN1_TYPE_set_int_octetstring(ASN1_TYPE *a, long num, unsigned char *data,
1033 unsigned char *data, int max_len); 1026 int len);
1034int ASN1_TYPE_set_int_octetstring(ASN1_TYPE *a, long num, 1027int ASN1_TYPE_get_int_octetstring(ASN1_TYPE *a, long *num, unsigned char *data,
1035 unsigned char *data, int len); 1028 int max_len);
1036int ASN1_TYPE_get_int_octetstring(ASN1_TYPE *a,long *num,
1037 unsigned char *data, int max_len);
1038 1029
1039STACK_OF(OPENSSL_BLOCK) *ASN1_seq_unpack(const unsigned char *buf, int len, 1030STACK_OF(OPENSSL_BLOCK) *ASN1_seq_unpack(const unsigned char *buf, int len,
1040 d2i_of_void *d2i, void (*free_func)(OPENSSL_BLOCK)); 1031 d2i_of_void *d2i, void (*free_func)(OPENSSL_BLOCK));
1041unsigned char *ASN1_seq_pack(STACK_OF(OPENSSL_BLOCK) *safes, i2d_of_void *i2d, 1032unsigned char *ASN1_seq_pack(STACK_OF(OPENSSL_BLOCK) *safes, i2d_of_void *i2d,
1042 unsigned char **buf, int *len ); 1033 unsigned char **buf, int *len );
1043void *ASN1_unpack_string(ASN1_STRING *oct, d2i_of_void *d2i); 1034void *ASN1_unpack_string(ASN1_STRING *oct, d2i_of_void *d2i);
1044void *ASN1_item_unpack(ASN1_STRING *oct, const ASN1_ITEM *it); 1035void *ASN1_item_unpack(ASN1_STRING *oct, const ASN1_ITEM *it);
1045ASN1_STRING *ASN1_pack_string(void *obj, i2d_of_void *i2d, 1036ASN1_STRING *ASN1_pack_string(void *obj, i2d_of_void *i2d,
1046 ASN1_OCTET_STRING **oct); 1037 ASN1_OCTET_STRING **oct);
1047 1038
1048ASN1_STRING *ASN1_item_pack(void *obj, const ASN1_ITEM *it, ASN1_OCTET_STRING **oct); 1039ASN1_STRING *ASN1_item_pack(void *obj, const ASN1_ITEM *it,
1040 ASN1_OCTET_STRING **oct);
1049 1041
1050void ASN1_STRING_set_default_mask(unsigned long mask); 1042void ASN1_STRING_set_default_mask(unsigned long mask);
1051int ASN1_STRING_set_default_mask_asc(const char *p); 1043int ASN1_STRING_set_default_mask_asc(const char *p);
1052unsigned long ASN1_STRING_get_default_mask(void); 1044unsigned long ASN1_STRING_get_default_mask(void);
1053int ASN1_mbstring_copy(ASN1_STRING **out, const unsigned char *in, int len, 1045int ASN1_mbstring_copy(ASN1_STRING **out, const unsigned char *in, int len,
1054 int inform, unsigned long mask); 1046 int inform, unsigned long mask);
1055int ASN1_mbstring_ncopy(ASN1_STRING **out, const unsigned char *in, int len, 1047int ASN1_mbstring_ncopy(ASN1_STRING **out, const unsigned char *in, int len,
1056 int inform, unsigned long mask, 1048 int inform, unsigned long mask, long minsize, long maxsize);
1057 long minsize, long maxsize);
1058 1049
1059ASN1_STRING *ASN1_STRING_set_by_NID(ASN1_STRING **out, 1050ASN1_STRING *ASN1_STRING_set_by_NID(ASN1_STRING **out,
1060 const unsigned char *in, int inlen, int inform, int nid); 1051 const unsigned char *in, int inlen, int inform, int nid);
1061ASN1_STRING_TABLE *ASN1_STRING_TABLE_get(int nid); 1052ASN1_STRING_TABLE *ASN1_STRING_TABLE_get(int nid);
1062int ASN1_STRING_TABLE_add(int, long, long, unsigned long, unsigned long); 1053int ASN1_STRING_TABLE_add(int, long, long, unsigned long, unsigned long);
1063void ASN1_STRING_TABLE_cleanup(void); 1054void ASN1_STRING_TABLE_cleanup(void);
@@ -1067,7 +1058,8 @@ void ASN1_STRING_TABLE_cleanup(void);
1067/* Old API compatible functions */ 1058/* Old API compatible functions */
1068ASN1_VALUE *ASN1_item_new(const ASN1_ITEM *it); 1059ASN1_VALUE *ASN1_item_new(const ASN1_ITEM *it);
1069void ASN1_item_free(ASN1_VALUE *val, const ASN1_ITEM *it); 1060void ASN1_item_free(ASN1_VALUE *val, const ASN1_ITEM *it);
1070ASN1_VALUE * ASN1_item_d2i(ASN1_VALUE **val, const unsigned char **in, long len, const ASN1_ITEM *it); 1061ASN1_VALUE * ASN1_item_d2i(ASN1_VALUE **val, const unsigned char **in,
1062 long len, const ASN1_ITEM *it);
1071int ASN1_item_i2d(ASN1_VALUE *val, unsigned char **out, const ASN1_ITEM *it); 1063int ASN1_item_i2d(ASN1_VALUE *val, unsigned char **out, const ASN1_ITEM *it);
1072int ASN1_item_ndef_i2d(ASN1_VALUE *val, unsigned char **out, const ASN1_ITEM *it); 1064int ASN1_item_ndef_i2d(ASN1_VALUE *val, unsigned char **out, const ASN1_ITEM *it);
1073 1065
@@ -1079,7 +1071,7 @@ ASN1_TYPE *ASN1_generate_v3(char *str, X509V3_CTX *cnf);
1079/* ASN1 Print flags */ 1071/* ASN1 Print flags */
1080 1072
1081/* Indicate missing OPTIONAL fields */ 1073/* Indicate missing OPTIONAL fields */
1082#define ASN1_PCTX_FLAGS_SHOW_ABSENT 0x001 1074#define ASN1_PCTX_FLAGS_SHOW_ABSENT 0x001
1083/* Mark start and end of SEQUENCE */ 1075/* Mark start and end of SEQUENCE */
1084#define ASN1_PCTX_FLAGS_SHOW_SEQUENCE 0x002 1076#define ASN1_PCTX_FLAGS_SHOW_SEQUENCE 0x002
1085/* Mark start and end of SEQUENCE/SET OF */ 1077/* Mark start and end of SEQUENCE/SET OF */
@@ -1098,7 +1090,7 @@ ASN1_TYPE *ASN1_generate_v3(char *str, X509V3_CTX *cnf);
1098#define ASN1_PCTX_FLAGS_NO_STRUCT_NAME 0x100 1090#define ASN1_PCTX_FLAGS_NO_STRUCT_NAME 0x100
1099 1091
1100int ASN1_item_print(BIO *out, ASN1_VALUE *ifld, int indent, 1092int ASN1_item_print(BIO *out, ASN1_VALUE *ifld, int indent,
1101 const ASN1_ITEM *it, const ASN1_PCTX *pctx); 1093 const ASN1_ITEM *it, const ASN1_PCTX *pctx);
1102ASN1_PCTX *ASN1_PCTX_new(void); 1094ASN1_PCTX *ASN1_PCTX_new(void);
1103void ASN1_PCTX_free(ASN1_PCTX *p); 1095void ASN1_PCTX_free(ASN1_PCTX *p);
1104unsigned long ASN1_PCTX_get_flags(ASN1_PCTX *p); 1096unsigned long ASN1_PCTX_get_flags(ASN1_PCTX *p);
@@ -1117,14 +1109,12 @@ BIO_METHOD *BIO_f_asn1(void);
1117BIO *BIO_new_NDEF(BIO *out, ASN1_VALUE *val, const ASN1_ITEM *it); 1109BIO *BIO_new_NDEF(BIO *out, ASN1_VALUE *val, const ASN1_ITEM *it);
1118 1110
1119int i2d_ASN1_bio_stream(BIO *out, ASN1_VALUE *val, BIO *in, int flags, 1111int i2d_ASN1_bio_stream(BIO *out, ASN1_VALUE *val, BIO *in, int flags,
1120 const ASN1_ITEM *it); 1112 const ASN1_ITEM *it);
1121int PEM_write_bio_ASN1_stream(BIO *out, ASN1_VALUE *val, BIO *in, int flags, 1113int PEM_write_bio_ASN1_stream(BIO *out, ASN1_VALUE *val, BIO *in, int flags,
1122 const char *hdr, 1114 const char *hdr, const ASN1_ITEM *it);
1123 const ASN1_ITEM *it);
1124int SMIME_write_ASN1(BIO *bio, ASN1_VALUE *val, BIO *data, int flags, 1115int SMIME_write_ASN1(BIO *bio, ASN1_VALUE *val, BIO *data, int flags,
1125 int ctype_nid, int econt_nid, 1116 int ctype_nid, int econt_nid, STACK_OF(X509_ALGOR) *mdalgs,
1126 STACK_OF(X509_ALGOR) *mdalgs, 1117 const ASN1_ITEM *it);
1127 const ASN1_ITEM *it);
1128ASN1_VALUE *SMIME_read_ASN1(BIO *bio, BIO **bcont, const ASN1_ITEM *it); 1118ASN1_VALUE *SMIME_read_ASN1(BIO *bio, BIO **bcont, const ASN1_ITEM *it);
1129int SMIME_crlf_copy(BIO *in, BIO *out, int flags); 1119int SMIME_crlf_copy(BIO *in, BIO *out, int flags);
1130int SMIME_text(BIO *in, BIO *out); 1120int SMIME_text(BIO *in, BIO *out);
diff --git a/src/lib/libcrypto/asn1/asn1_locl.h b/src/lib/libcrypto/asn1/asn1_locl.h
index 64bf8ec2fa..bcbb605202 100644
--- a/src/lib/libcrypto/asn1/asn1_locl.h
+++ b/src/lib/libcrypto/asn1/asn1_locl.h
@@ -10,7 +10,7 @@
10 * are met: 10 * are met:
11 * 11 *
12 * 1. Redistributions of source code must retain the above copyright 12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer. 13 * notice, this list of conditions and the following disclaimer.
14 * 14 *
15 * 2. Redistributions in binary form must reproduce the above copyright 15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in 16 * notice, this list of conditions and the following disclaimer in
@@ -60,8 +60,7 @@
60 60
61/* ASN1 print context structure */ 61/* ASN1 print context structure */
62 62
63struct asn1_pctx_st 63struct asn1_pctx_st {
64{
65 unsigned long flags; 64 unsigned long flags;
66 unsigned long nm_flags; 65 unsigned long nm_flags;
67 unsigned long cert_flags; 66 unsigned long cert_flags;
@@ -71,8 +70,7 @@ struct asn1_pctx_st
71 70
72/* ASN1 public key method structure */ 71/* ASN1 public key method structure */
73 72
74struct evp_pkey_asn1_method_st 73struct evp_pkey_asn1_method_st {
75{
76 int pkey_id; 74 int pkey_id;
77 int pkey_base_id; 75 int pkey_base_id;
78 unsigned long pkey_flags; 76 unsigned long pkey_flags;
@@ -84,44 +82,40 @@ struct evp_pkey_asn1_method_st
84 int (*pub_encode)(X509_PUBKEY *pub, const EVP_PKEY *pk); 82 int (*pub_encode)(X509_PUBKEY *pub, const EVP_PKEY *pk);
85 int (*pub_cmp)(const EVP_PKEY *a, const EVP_PKEY *b); 83 int (*pub_cmp)(const EVP_PKEY *a, const EVP_PKEY *b);
86 int (*pub_print)(BIO *out, const EVP_PKEY *pkey, int indent, 84 int (*pub_print)(BIO *out, const EVP_PKEY *pkey, int indent,
87 ASN1_PCTX *pctx); 85 ASN1_PCTX *pctx);
88 86
89 int (*priv_decode)(EVP_PKEY *pk, PKCS8_PRIV_KEY_INFO *p8inf); 87 int (*priv_decode)(EVP_PKEY *pk, PKCS8_PRIV_KEY_INFO *p8inf);
90 int (*priv_encode)(PKCS8_PRIV_KEY_INFO *p8, const EVP_PKEY *pk); 88 int (*priv_encode)(PKCS8_PRIV_KEY_INFO *p8, const EVP_PKEY *pk);
91 int (*priv_print)(BIO *out, const EVP_PKEY *pkey, int indent, 89 int (*priv_print)(BIO *out, const EVP_PKEY *pkey, int indent,
92 ASN1_PCTX *pctx); 90 ASN1_PCTX *pctx);
93 91
94 int (*pkey_size)(const EVP_PKEY *pk); 92 int (*pkey_size)(const EVP_PKEY *pk);
95 int (*pkey_bits)(const EVP_PKEY *pk); 93 int (*pkey_bits)(const EVP_PKEY *pk);
96 94
97 int (*param_decode)(EVP_PKEY *pkey, 95 int (*param_decode)(EVP_PKEY *pkey, const unsigned char **pder,
98 const unsigned char **pder, int derlen); 96 int derlen);
99 int (*param_encode)(const EVP_PKEY *pkey, unsigned char **pder); 97 int (*param_encode)(const EVP_PKEY *pkey, unsigned char **pder);
100 int (*param_missing)(const EVP_PKEY *pk); 98 int (*param_missing)(const EVP_PKEY *pk);
101 int (*param_copy)(EVP_PKEY *to, const EVP_PKEY *from); 99 int (*param_copy)(EVP_PKEY *to, const EVP_PKEY *from);
102 int (*param_cmp)(const EVP_PKEY *a, const EVP_PKEY *b); 100 int (*param_cmp)(const EVP_PKEY *a, const EVP_PKEY *b);
103 int (*param_print)(BIO *out, const EVP_PKEY *pkey, int indent, 101 int (*param_print)(BIO *out, const EVP_PKEY *pkey, int indent,
104 ASN1_PCTX *pctx); 102 ASN1_PCTX *pctx);
105 int (*sig_print)(BIO *out, 103 int (*sig_print)(BIO *out, const X509_ALGOR *sigalg,
106 const X509_ALGOR *sigalg, const ASN1_STRING *sig, 104 const ASN1_STRING *sig, int indent, ASN1_PCTX *pctx);
107 int indent, ASN1_PCTX *pctx);
108
109 105
110 void (*pkey_free)(EVP_PKEY *pkey); 106 void (*pkey_free)(EVP_PKEY *pkey);
111 int (*pkey_ctrl)(EVP_PKEY *pkey, int op, long arg1, void *arg2); 107 int (*pkey_ctrl)(EVP_PKEY *pkey, int op, long arg1, void *arg2);
112 108
113 /* Legacy functions for old PEM */ 109 /* Legacy functions for old PEM */
114 110
115 int (*old_priv_decode)(EVP_PKEY *pkey, 111 int (*old_priv_decode)(EVP_PKEY *pkey, const unsigned char **pder,
116 const unsigned char **pder, int derlen); 112 int derlen);
117 int (*old_priv_encode)(const EVP_PKEY *pkey, unsigned char **pder); 113 int (*old_priv_encode)(const EVP_PKEY *pkey, unsigned char **pder);
118 /* Custom ASN1 signature verification */ 114 /* Custom ASN1 signature verification */
119 int (*item_verify)(EVP_MD_CTX *ctx, const ASN1_ITEM *it, void *asn, 115 int (*item_verify)(EVP_MD_CTX *ctx, const ASN1_ITEM *it, void *asn,
120 X509_ALGOR *a, ASN1_BIT_STRING *sig, 116 X509_ALGOR *a, ASN1_BIT_STRING *sig, EVP_PKEY *pkey);
121 EVP_PKEY *pkey);
122 int (*item_sign)(EVP_MD_CTX *ctx, const ASN1_ITEM *it, void *asn, 117 int (*item_sign)(EVP_MD_CTX *ctx, const ASN1_ITEM *it, void *asn,
123 X509_ALGOR *alg1, X509_ALGOR *alg2, 118 X509_ALGOR *alg1, X509_ALGOR *alg2, ASN1_BIT_STRING *sig);
124 ASN1_BIT_STRING *sig);
125 119
126} /* EVP_PKEY_ASN1_METHOD */; 120} /* EVP_PKEY_ASN1_METHOD */;
127 121
@@ -134,13 +128,12 @@ struct evp_pkey_asn1_method_st
134 128
135#define X509_CRL_METHOD_DYNAMIC 1 129#define X509_CRL_METHOD_DYNAMIC 1
136 130
137struct x509_crl_method_st 131struct x509_crl_method_st {
138{
139 int flags; 132 int flags;
140 int (*crl_init)(X509_CRL *crl); 133 int (*crl_init)(X509_CRL *crl);
141 int (*crl_free)(X509_CRL *crl); 134 int (*crl_free)(X509_CRL *crl);
142 int (*crl_lookup)(X509_CRL *crl, X509_REVOKED **ret, 135 int (*crl_lookup)(X509_CRL *crl, X509_REVOKED **ret,
143 ASN1_INTEGER *ser, X509_NAME *issuer); 136 ASN1_INTEGER *ser, X509_NAME *issuer);
144 int (*crl_verify)(X509_CRL *crl, EVP_PKEY *pk); 137 int (*crl_verify)(X509_CRL *crl, EVP_PKEY *pk);
145}; 138};
146 139
@@ -154,5 +147,5 @@ struct x509_crl_method_st
154#define UNICODE_IS_SURROGATE(x) \ 147#define UNICODE_IS_SURROGATE(x) \
155 ((x) >= UNICODE_SURROGATE_MIN && (x) <= UNICODE_SURROGATE_MAX) 148 ((x) >= UNICODE_SURROGATE_MIN && (x) <= UNICODE_SURROGATE_MAX)
156 149
157int UTF8_getc(const unsigned char *str, int len, unsigned long *val); 150int UTF8_getc(const unsigned char *str, int len, unsigned long *val);
158int UTF8_putc(unsigned char *str, int len, unsigned long value); 151int UTF8_putc(unsigned char *str, int len, unsigned long value);
diff --git a/src/lib/libcrypto/asn1/asn1_mac.h b/src/lib/libcrypto/asn1/asn1_mac.h
index ecc2c77228..da03a8cb92 100644
--- a/src/lib/libcrypto/asn1/asn1_mac.h
+++ b/src/lib/libcrypto/asn1/asn1_mac.h
@@ -5,21 +5,21 @@
5 * This package is an SSL implementation written 5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com). 6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL. 7 * The implementation was written so as to conform with Netscapes SSL.
8 * 8 *
9 * This library is free for commercial and non-commercial use as long as 9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions 10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA, 11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation 12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms 13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com). 14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 * 15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in 16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed. 17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution 18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used. 19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or 20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package. 21 * in documentation (online or textual) provided with the package.
22 * 22 *
23 * Redistribution and use in source and binary forms, with or without 23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions 24 * modification, are permitted provided that the following conditions
25 * are met: 25 * are met:
@@ -34,10 +34,10 @@
34 * Eric Young (eay@cryptsoft.com)" 34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library 35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-). 36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from 37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement: 38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" 39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 * 40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND 41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -49,7 +49,7 @@
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE. 51 * SUCH DAMAGE.
52 * 52 *
53 * The licence and distribution terms for any publically available version or 53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be 54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence 55 * copied and put under another distribution licence
@@ -67,7 +67,7 @@ extern "C" {
67 67
68#ifndef ASN1_MAC_ERR_LIB 68#ifndef ASN1_MAC_ERR_LIB
69#define ASN1_MAC_ERR_LIB ERR_LIB_ASN1 69#define ASN1_MAC_ERR_LIB ERR_LIB_ASN1
70#endif 70#endif
71 71
72#define ASN1_MAC_H_err(f,r,line) \ 72#define ASN1_MAC_H_err(f,r,line) \
73 ERR_PUT_error(ASN1_MAC_ERR_LIB,(f),(r),__FILE__,(line)) 73 ERR_PUT_error(ASN1_MAC_ERR_LIB,(f),(r),__FILE__,(line))
@@ -433,7 +433,7 @@ err:\
433 return(r); 433 return(r);
434 434
435int asn1_GetSequence(ASN1_const_CTX *c, long *length); 435int asn1_GetSequence(ASN1_const_CTX *c, long *length);
436void asn1_add_error(const unsigned char *address,int offset); 436void asn1_add_error(const unsigned char *address, int offset);
437#ifdef __cplusplus 437#ifdef __cplusplus
438} 438}
439#endif 439#endif
diff --git a/src/lib/libssl/src/crypto/asn1/asn1.h b/src/lib/libssl/src/crypto/asn1/asn1.h
index 7e0ee8eab0..f92816b6c3 100644
--- a/src/lib/libssl/src/crypto/asn1/asn1.h
+++ b/src/lib/libssl/src/crypto/asn1/asn1.h
@@ -5,21 +5,21 @@
5 * This package is an SSL implementation written 5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com). 6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL. 7 * The implementation was written so as to conform with Netscapes SSL.
8 * 8 *
9 * This library is free for commercial and non-commercial use as long as 9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions 10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA, 11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation 12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms 13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com). 14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 * 15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in 16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed. 17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution 18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used. 19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or 20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package. 21 * in documentation (online or textual) provided with the package.
22 * 22 *
23 * Redistribution and use in source and binary forms, with or without 23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions 24 * modification, are permitted provided that the following conditions
25 * are met: 25 * are met:
@@ -34,10 +34,10 @@
34 * Eric Young (eay@cryptsoft.com)" 34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library 35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-). 36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from 37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement: 38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" 39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 * 40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND 41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -49,7 +49,7 @@
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE. 51 * SUCH DAMAGE.
52 * 52 *
53 * The licence and distribution terms for any publically available version or 53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be 54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence 55 * copied and put under another distribution licence
@@ -165,8 +165,7 @@ DECLARE_STACK_OF(X509_ALGOR)
165 asn1_const_ctx are exactly the same. Fortunately, as soon as 165 asn1_const_ctx are exactly the same. Fortunately, as soon as
166 the old ASN1 parsing macros are gone, we can throw this away 166 the old ASN1 parsing macros are gone, we can throw this away
167 as well... */ 167 as well... */
168typedef struct asn1_ctx_st 168typedef struct asn1_ctx_st {
169 {
170 unsigned char *p;/* work char pointer */ 169 unsigned char *p;/* work char pointer */
171 int eos; /* end of sequence read for indefinite encoding */ 170 int eos; /* end of sequence read for indefinite encoding */
172 int error; /* error code to use when returning an error */ 171 int error; /* error code to use when returning an error */
@@ -178,10 +177,9 @@ typedef struct asn1_ctx_st
178 unsigned char *q;/* temporary variable */ 177 unsigned char *q;/* temporary variable */
179 unsigned char **pp;/* variable */ 178 unsigned char **pp;/* variable */
180 int line; /* used in error processing */ 179 int line; /* used in error processing */
181 } ASN1_CTX; 180} ASN1_CTX;
182 181
183typedef struct asn1_const_ctx_st 182typedef struct asn1_const_ctx_st {
184 {
185 const unsigned char *p;/* work char pointer */ 183 const unsigned char *p;/* work char pointer */
186 int eos; /* end of sequence read for indefinite encoding */ 184 int eos; /* end of sequence read for indefinite encoding */
187 int error; /* error code to use when returning an error */ 185 int error; /* error code to use when returning an error */
@@ -193,7 +191,7 @@ typedef struct asn1_const_ctx_st
193 const unsigned char *q;/* temporary variable */ 191 const unsigned char *q;/* temporary variable */
194 const unsigned char **pp;/* variable */ 192 const unsigned char **pp;/* variable */
195 int line; /* used in error processing */ 193 int line; /* used in error processing */
196 } ASN1_const_CTX; 194} ASN1_const_CTX;
197 195
198/* These are used internally in the ASN1_OBJECT to keep track of 196/* These are used internally in the ASN1_OBJECT to keep track of
199 * whether the names and data need to be free()ed */ 197 * whether the names and data need to be free()ed */
@@ -201,35 +199,33 @@ typedef struct asn1_const_ctx_st
201#define ASN1_OBJECT_FLAG_CRITICAL 0x02 /* critical x509v3 object id */ 199#define ASN1_OBJECT_FLAG_CRITICAL 0x02 /* critical x509v3 object id */
202#define ASN1_OBJECT_FLAG_DYNAMIC_STRINGS 0x04 /* internal use */ 200#define ASN1_OBJECT_FLAG_DYNAMIC_STRINGS 0x04 /* internal use */
203#define ASN1_OBJECT_FLAG_DYNAMIC_DATA 0x08 /* internal use */ 201#define ASN1_OBJECT_FLAG_DYNAMIC_DATA 0x08 /* internal use */
204typedef struct asn1_object_st 202typedef struct asn1_object_st {
205 { 203 const char *sn, *ln;
206 const char *sn,*ln;
207 int nid; 204 int nid;
208 int length; 205 int length;
209 const unsigned char *data; /* data remains const after init */ 206 const unsigned char *data; /* data remains const after init */
210 int flags; /* Should we free this one */ 207 int flags; /* Should we free this one */
211 } ASN1_OBJECT; 208} ASN1_OBJECT;
212 209
213#define ASN1_STRING_FLAG_BITS_LEFT 0x08 /* Set if 0x07 has bits left value */ 210#define ASN1_STRING_FLAG_BITS_LEFT 0x08 /* Set if 0x07 has bits left value */
214/* This indicates that the ASN1_STRING is not a real value but just a place 211/* This indicates that the ASN1_STRING is not a real value but just a place
215 * holder for the location where indefinite length constructed data should 212 * holder for the location where indefinite length constructed data should
216 * be inserted in the memory buffer 213 * be inserted in the memory buffer
217 */ 214 */
218#define ASN1_STRING_FLAG_NDEF 0x010 215#define ASN1_STRING_FLAG_NDEF 0x010
219 216
220/* This flag is used by the CMS code to indicate that a string is not 217/* This flag is used by the CMS code to indicate that a string is not
221 * complete and is a place holder for content when it had all been 218 * complete and is a place holder for content when it had all been
222 * accessed. The flag will be reset when content has been written to it. 219 * accessed. The flag will be reset when content has been written to it.
223 */ 220 */
224 221
225#define ASN1_STRING_FLAG_CONT 0x020 222#define ASN1_STRING_FLAG_CONT 0x020
226/* This flag is used by ASN1 code to indicate an ASN1_STRING is an MSTRING 223/* This flag is used by ASN1 code to indicate an ASN1_STRING is an MSTRING
227 * type. 224 * type.
228 */ 225 */
229#define ASN1_STRING_FLAG_MSTRING 0x040 226#define ASN1_STRING_FLAG_MSTRING 0x040
230/* This is the base type that holds just about everything :-) */ 227/* This is the base type that holds just about everything :-) */
231struct asn1_string_st 228struct asn1_string_st {
232 {
233 int length; 229 int length;
234 int type; 230 int type;
235 unsigned char *data; 231 unsigned char *data;
@@ -238,19 +234,18 @@ struct asn1_string_st
238 * input data has a non-zero 'unused bits' value, it will be 234 * input data has a non-zero 'unused bits' value, it will be
239 * handled correctly */ 235 * handled correctly */
240 long flags; 236 long flags;
241 }; 237};
242 238
243/* ASN1_ENCODING structure: this is used to save the received 239/* ASN1_ENCODING structure: this is used to save the received
244 * encoding of an ASN1 type. This is useful to get round 240 * encoding of an ASN1 type. This is useful to get round
245 * problems with invalid encodings which can break signatures. 241 * problems with invalid encodings which can break signatures.
246 */ 242 */
247 243
248typedef struct ASN1_ENCODING_st 244typedef struct ASN1_ENCODING_st {
249 {
250 unsigned char *enc; /* DER encoding */ 245 unsigned char *enc; /* DER encoding */
251 long len; /* Length of encoding */ 246 long len; /* Length of encoding */
252 int modified; /* set to 1 if 'enc' is invalid */ 247 int modified; /* set to 1 if 'enc' is invalid */
253 } ASN1_ENCODING; 248} ASN1_ENCODING;
254 249
255/* Used with ASN1 LONG type: if a long is set to this it is omitted */ 250/* Used with ASN1 LONG type: if a long is set to this it is omitted */
256#define ASN1_LONG_UNDEF 0x7fffffffL 251#define ASN1_LONG_UNDEF 0x7fffffffL
@@ -373,7 +368,7 @@ TYPEDEF_D2I2D_OF(void);
373 * ... 368 * ...
374 * ASN1_ITEM_EXP *iptr; 369 * ASN1_ITEM_EXP *iptr;
375 * ... 370 * ...
376 * } SOMETHING; 371 * } SOMETHING;
377 * 372 *
378 * It would be initialised as e.g.: 373 * It would be initialised as e.g.:
379 * 374 *
@@ -461,7 +456,7 @@ typedef const ASN1_ITEM * ASN1_ITEM_EXP(void);
461 */ 456 */
462 457
463/* If this is set we convert all character strings 458/* If this is set we convert all character strings
464 * to UTF8 first 459 * to UTF8 first
465 */ 460 */
466 461
467#define ASN1_STRFLGS_UTF8_CONVERT 0x10 462#define ASN1_STRFLGS_UTF8_CONVERT 0x10
@@ -511,10 +506,9 @@ DECLARE_ASN1_SET_OF(ASN1_INTEGER)
511 506
512DECLARE_STACK_OF(ASN1_GENERALSTRING) 507DECLARE_STACK_OF(ASN1_GENERALSTRING)
513 508
514typedef struct asn1_type_st 509typedef struct asn1_type_st {
515 {
516 int type; 510 int type;
517 union { 511 union {
518 char *ptr; 512 char *ptr;
519 ASN1_BOOLEAN boolean; 513 ASN1_BOOLEAN boolean;
520 ASN1_STRING * asn1_string; 514 ASN1_STRING * asn1_string;
@@ -538,8 +532,8 @@ typedef struct asn1_type_st
538 ASN1_STRING * set; 532 ASN1_STRING * set;
539 ASN1_STRING * sequence; 533 ASN1_STRING * sequence;
540 ASN1_VALUE * asn1_value; 534 ASN1_VALUE * asn1_value;
541 } value; 535 } value;
542 } ASN1_TYPE; 536} ASN1_TYPE;
543 537
544DECLARE_STACK_OF(ASN1_TYPE) 538DECLARE_STACK_OF(ASN1_TYPE)
545DECLARE_ASN1_SET_OF(ASN1_TYPE) 539DECLARE_ASN1_SET_OF(ASN1_TYPE)
@@ -549,11 +543,10 @@ typedef STACK_OF(ASN1_TYPE) ASN1_SEQUENCE_ANY;
549DECLARE_ASN1_ENCODE_FUNCTIONS_const(ASN1_SEQUENCE_ANY, ASN1_SEQUENCE_ANY) 543DECLARE_ASN1_ENCODE_FUNCTIONS_const(ASN1_SEQUENCE_ANY, ASN1_SEQUENCE_ANY)
550DECLARE_ASN1_ENCODE_FUNCTIONS_const(ASN1_SEQUENCE_ANY, ASN1_SET_ANY) 544DECLARE_ASN1_ENCODE_FUNCTIONS_const(ASN1_SEQUENCE_ANY, ASN1_SET_ANY)
551 545
552typedef struct NETSCAPE_X509_st 546typedef struct NETSCAPE_X509_st {
553 {
554 ASN1_OCTET_STRING *header; 547 ASN1_OCTET_STRING *header;
555 X509 *cert; 548 X509 *cert;
556 } NETSCAPE_X509; 549} NETSCAPE_X509;
557 550
558/* This is used to contain a list of bit names */ 551/* This is used to contain a list of bit names */
559typedef struct BIT_STRING_BITNAME_st { 552typedef struct BIT_STRING_BITNAME_st {
@@ -760,7 +753,7 @@ typedef struct BIT_STRING_BITNAME_st {
760 (ASN1_UTF8STRING *)d2i_ASN1_type_bytes\ 753 (ASN1_UTF8STRING *)d2i_ASN1_type_bytes\
761 ((ASN1_STRING **)a,pp,l,B_ASN1_UTF8STRING) 754 ((ASN1_STRING **)a,pp,l,B_ASN1_UTF8STRING)
762 755
763 /* for the is_set parameter to i2d_ASN1_SET */ 756/* for the is_set parameter to i2d_ASN1_SET */
764#define IS_SEQUENCE 0 757#define IS_SEQUENCE 0
765#define IS_SET 1 758#define IS_SET 1
766 759
@@ -769,86 +762,88 @@ DECLARE_ASN1_FUNCTIONS_fname(ASN1_TYPE, ASN1_ANY, ASN1_TYPE)
769int ASN1_TYPE_get(ASN1_TYPE *a); 762int ASN1_TYPE_get(ASN1_TYPE *a);
770void ASN1_TYPE_set(ASN1_TYPE *a, int type, void *value); 763void ASN1_TYPE_set(ASN1_TYPE *a, int type, void *value);
771int ASN1_TYPE_set1(ASN1_TYPE *a, int type, const void *value); 764int ASN1_TYPE_set1(ASN1_TYPE *a, int type, const void *value);
772int ASN1_TYPE_cmp(ASN1_TYPE *a, ASN1_TYPE *b); 765int ASN1_TYPE_cmp(ASN1_TYPE *a, ASN1_TYPE *b);
773 766
774ASN1_OBJECT * ASN1_OBJECT_new(void ); 767ASN1_OBJECT *ASN1_OBJECT_new(void );
775void ASN1_OBJECT_free(ASN1_OBJECT *a); 768void ASN1_OBJECT_free(ASN1_OBJECT *a);
776int i2d_ASN1_OBJECT(ASN1_OBJECT *a,unsigned char **pp); 769int i2d_ASN1_OBJECT(ASN1_OBJECT *a, unsigned char **pp);
777ASN1_OBJECT * c2i_ASN1_OBJECT(ASN1_OBJECT **a,const unsigned char **pp, 770ASN1_OBJECT *c2i_ASN1_OBJECT(ASN1_OBJECT **a, const unsigned char **pp,
778 long length); 771 long length);
779ASN1_OBJECT * d2i_ASN1_OBJECT(ASN1_OBJECT **a,const unsigned char **pp, 772ASN1_OBJECT *d2i_ASN1_OBJECT(ASN1_OBJECT **a, const unsigned char **pp,
780 long length); 773 long length);
781 774
782DECLARE_ASN1_ITEM(ASN1_OBJECT) 775DECLARE_ASN1_ITEM(ASN1_OBJECT)
783 776
784DECLARE_STACK_OF(ASN1_OBJECT) 777DECLARE_STACK_OF(ASN1_OBJECT)
785DECLARE_ASN1_SET_OF(ASN1_OBJECT) 778DECLARE_ASN1_SET_OF(ASN1_OBJECT)
786 779
787ASN1_STRING * ASN1_STRING_new(void); 780ASN1_STRING *ASN1_STRING_new(void);
788void ASN1_STRING_free(ASN1_STRING *a); 781void ASN1_STRING_free(ASN1_STRING *a);
789int ASN1_STRING_copy(ASN1_STRING *dst, const ASN1_STRING *str); 782int ASN1_STRING_copy(ASN1_STRING *dst, const ASN1_STRING *str);
790ASN1_STRING * ASN1_STRING_dup(const ASN1_STRING *a); 783ASN1_STRING *ASN1_STRING_dup(const ASN1_STRING *a);
791ASN1_STRING * ASN1_STRING_type_new(int type ); 784ASN1_STRING *ASN1_STRING_type_new(int type );
792int ASN1_STRING_cmp(const ASN1_STRING *a, const ASN1_STRING *b); 785int ASN1_STRING_cmp(const ASN1_STRING *a, const ASN1_STRING *b);
793 /* Since this is used to store all sorts of things, via macros, for now, make 786 /* Since this is used to store all sorts of things, via macros, for now, make
794 its data void * */ 787 its data void * */
795int ASN1_STRING_set(ASN1_STRING *str, const void *data, int len); 788int ASN1_STRING_set(ASN1_STRING *str, const void *data, int len);
796void ASN1_STRING_set0(ASN1_STRING *str, void *data, int len); 789void ASN1_STRING_set0(ASN1_STRING *str, void *data, int len);
797int ASN1_STRING_length(const ASN1_STRING *x); 790int ASN1_STRING_length(const ASN1_STRING *x);
798void ASN1_STRING_length_set(ASN1_STRING *x, int n); 791void ASN1_STRING_length_set(ASN1_STRING *x, int n);
799int ASN1_STRING_type(ASN1_STRING *x); 792int ASN1_STRING_type(ASN1_STRING *x);
800unsigned char * ASN1_STRING_data(ASN1_STRING *x); 793unsigned char * ASN1_STRING_data(ASN1_STRING *x);
801 794
802DECLARE_ASN1_FUNCTIONS(ASN1_BIT_STRING) 795DECLARE_ASN1_FUNCTIONS(ASN1_BIT_STRING)
803int i2c_ASN1_BIT_STRING(ASN1_BIT_STRING *a,unsigned char **pp); 796int i2c_ASN1_BIT_STRING(ASN1_BIT_STRING *a, unsigned char **pp);
804ASN1_BIT_STRING *c2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a,const unsigned char **pp, 797ASN1_BIT_STRING *c2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a,
805 long length); 798 const unsigned char **pp, long length);
806int ASN1_BIT_STRING_set(ASN1_BIT_STRING *a, unsigned char *d, 799int ASN1_BIT_STRING_set(ASN1_BIT_STRING *a, unsigned char *d, int length );
807 int length ); 800int ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, int n, int value);
808int ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, int n, int value); 801int ASN1_BIT_STRING_get_bit(ASN1_BIT_STRING *a, int n);
809int ASN1_BIT_STRING_get_bit(ASN1_BIT_STRING *a, int n); 802int ASN1_BIT_STRING_check(ASN1_BIT_STRING *a,
810int ASN1_BIT_STRING_check(ASN1_BIT_STRING *a, 803 unsigned char *flags, int flags_len);
811 unsigned char *flags, int flags_len);
812 804
813#ifndef OPENSSL_NO_BIO 805#ifndef OPENSSL_NO_BIO
814int ASN1_BIT_STRING_name_print(BIO *out, ASN1_BIT_STRING *bs, 806int ASN1_BIT_STRING_name_print(BIO *out, ASN1_BIT_STRING *bs,
815 BIT_STRING_BITNAME *tbl, int indent); 807 BIT_STRING_BITNAME *tbl, int indent);
816#endif 808#endif
817int ASN1_BIT_STRING_num_asc(char *name, BIT_STRING_BITNAME *tbl); 809int ASN1_BIT_STRING_num_asc(char *name, BIT_STRING_BITNAME *tbl);
818int ASN1_BIT_STRING_set_asc(ASN1_BIT_STRING *bs, char *name, int value, 810int ASN1_BIT_STRING_set_asc(ASN1_BIT_STRING *bs, char *name, int value,
819 BIT_STRING_BITNAME *tbl); 811 BIT_STRING_BITNAME *tbl);
820 812
821int i2d_ASN1_BOOLEAN(int a,unsigned char **pp); 813int i2d_ASN1_BOOLEAN(int a, unsigned char **pp);
822int d2i_ASN1_BOOLEAN(int *a,const unsigned char **pp,long length); 814int d2i_ASN1_BOOLEAN(int *a, const unsigned char **pp, long length);
823 815
824DECLARE_ASN1_FUNCTIONS(ASN1_INTEGER) 816DECLARE_ASN1_FUNCTIONS(ASN1_INTEGER)
825int i2c_ASN1_INTEGER(ASN1_INTEGER *a,unsigned char **pp); 817int i2c_ASN1_INTEGER(ASN1_INTEGER *a, unsigned char **pp);
826ASN1_INTEGER *c2i_ASN1_INTEGER(ASN1_INTEGER **a,const unsigned char **pp, 818ASN1_INTEGER *c2i_ASN1_INTEGER(ASN1_INTEGER **a, const unsigned char **pp,
827 long length); 819 long length);
828ASN1_INTEGER *d2i_ASN1_UINTEGER(ASN1_INTEGER **a,const unsigned char **pp, 820ASN1_INTEGER *d2i_ASN1_UINTEGER(ASN1_INTEGER **a, const unsigned char **pp,
829 long length); 821 long length);
830ASN1_INTEGER * ASN1_INTEGER_dup(const ASN1_INTEGER *x); 822ASN1_INTEGER * ASN1_INTEGER_dup(const ASN1_INTEGER *x);
831int ASN1_INTEGER_cmp(const ASN1_INTEGER *x, const ASN1_INTEGER *y); 823int ASN1_INTEGER_cmp(const ASN1_INTEGER *x, const ASN1_INTEGER *y);
832 824
833DECLARE_ASN1_FUNCTIONS(ASN1_ENUMERATED) 825DECLARE_ASN1_FUNCTIONS(ASN1_ENUMERATED)
834 826
835int ASN1_UTCTIME_check(ASN1_UTCTIME *a); 827int ASN1_UTCTIME_check(ASN1_UTCTIME *a);
836ASN1_UTCTIME *ASN1_UTCTIME_set(ASN1_UTCTIME *s,time_t t); 828ASN1_UTCTIME *ASN1_UTCTIME_set(ASN1_UTCTIME *s, time_t t);
837ASN1_UTCTIME *ASN1_UTCTIME_adj(ASN1_UTCTIME *s, time_t t, 829ASN1_UTCTIME *ASN1_UTCTIME_adj(ASN1_UTCTIME *s, time_t t,
838 int offset_day, long offset_sec); 830 int offset_day, long offset_sec);
839int ASN1_UTCTIME_set_string(ASN1_UTCTIME *s, const char *str); 831int ASN1_UTCTIME_set_string(ASN1_UTCTIME *s, const char *str);
840int ASN1_UTCTIME_cmp_time_t(const ASN1_UTCTIME *s, time_t t); 832int ASN1_UTCTIME_cmp_time_t(const ASN1_UTCTIME *s, time_t t);
841 833
842int ASN1_GENERALIZEDTIME_check(ASN1_GENERALIZEDTIME *a); 834int ASN1_GENERALIZEDTIME_check(ASN1_GENERALIZEDTIME *a);
843ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_set(ASN1_GENERALIZEDTIME *s,time_t t); 835ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_set(ASN1_GENERALIZEDTIME *s,
836 time_t t);
844ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_adj(ASN1_GENERALIZEDTIME *s, 837ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_adj(ASN1_GENERALIZEDTIME *s,
845 time_t t, int offset_day, long offset_sec); 838 time_t t, int offset_day, long offset_sec);
846int ASN1_GENERALIZEDTIME_set_string(ASN1_GENERALIZEDTIME *s, const char *str); 839int ASN1_GENERALIZEDTIME_set_string(ASN1_GENERALIZEDTIME *s, const char *str);
847 840
848DECLARE_ASN1_FUNCTIONS(ASN1_OCTET_STRING) 841DECLARE_ASN1_FUNCTIONS(ASN1_OCTET_STRING)
849ASN1_OCTET_STRING * ASN1_OCTET_STRING_dup(const ASN1_OCTET_STRING *a); 842ASN1_OCTET_STRING *ASN1_OCTET_STRING_dup(const ASN1_OCTET_STRING *a);
850int ASN1_OCTET_STRING_cmp(const ASN1_OCTET_STRING *a, const ASN1_OCTET_STRING *b); 843int ASN1_OCTET_STRING_cmp(const ASN1_OCTET_STRING *a,
851int ASN1_OCTET_STRING_set(ASN1_OCTET_STRING *str, const unsigned char *data, int len); 844 const ASN1_OCTET_STRING *b);
845int ASN1_OCTET_STRING_set(ASN1_OCTET_STRING *str, const unsigned char *data,
846 int len);
852 847
853DECLARE_ASN1_FUNCTIONS(ASN1_VISIBLESTRING) 848DECLARE_ASN1_FUNCTIONS(ASN1_VISIBLESTRING)
854DECLARE_ASN1_FUNCTIONS(ASN1_UNIVERSALSTRING) 849DECLARE_ASN1_FUNCTIONS(ASN1_UNIVERSALSTRING)
@@ -870,46 +865,44 @@ DECLARE_ASN1_FUNCTIONS(ASN1_TIME)
870 865
871DECLARE_ASN1_ITEM(ASN1_OCTET_STRING_NDEF) 866DECLARE_ASN1_ITEM(ASN1_OCTET_STRING_NDEF)
872 867
873ASN1_TIME *ASN1_TIME_set(ASN1_TIME *s,time_t t); 868ASN1_TIME *ASN1_TIME_set(ASN1_TIME *s, time_t t);
874ASN1_TIME *ASN1_TIME_adj(ASN1_TIME *s,time_t t, 869ASN1_TIME *ASN1_TIME_adj(ASN1_TIME *s, time_t t, int offset_day,
875 int offset_day, long offset_sec); 870 long offset_sec);
876int ASN1_TIME_check(ASN1_TIME *t); 871int ASN1_TIME_check(ASN1_TIME *t);
877ASN1_GENERALIZEDTIME *ASN1_TIME_to_generalizedtime(ASN1_TIME *t, ASN1_GENERALIZEDTIME **out); 872ASN1_GENERALIZEDTIME *ASN1_TIME_to_generalizedtime(ASN1_TIME *t,
873 ASN1_GENERALIZEDTIME **out);
878int ASN1_TIME_set_string(ASN1_TIME *s, const char *str); 874int ASN1_TIME_set_string(ASN1_TIME *s, const char *str);
879 875
880int i2d_ASN1_SET(STACK_OF(OPENSSL_BLOCK) *a, unsigned char **pp, 876int i2d_ASN1_SET(STACK_OF(OPENSSL_BLOCK) *a, unsigned char **pp,
881 i2d_of_void *i2d, int ex_tag, int ex_class, 877 i2d_of_void *i2d, int ex_tag, int ex_class, int is_set);
882 int is_set);
883STACK_OF(OPENSSL_BLOCK) *d2i_ASN1_SET(STACK_OF(OPENSSL_BLOCK) **a, 878STACK_OF(OPENSSL_BLOCK) *d2i_ASN1_SET(STACK_OF(OPENSSL_BLOCK) **a,
884 const unsigned char **pp, 879 const unsigned char **pp, long length, d2i_of_void *d2i,
885 long length, d2i_of_void *d2i, 880 void (*free_func)(OPENSSL_BLOCK), int ex_tag, int ex_class);
886 void (*free_func)(OPENSSL_BLOCK), int ex_tag,
887 int ex_class);
888 881
889#ifndef OPENSSL_NO_BIO 882#ifndef OPENSSL_NO_BIO
890int i2a_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *a); 883int i2a_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *a);
891int a2i_ASN1_INTEGER(BIO *bp,ASN1_INTEGER *bs,char *buf,int size); 884int a2i_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *bs, char *buf, int size);
892int i2a_ASN1_ENUMERATED(BIO *bp, ASN1_ENUMERATED *a); 885int i2a_ASN1_ENUMERATED(BIO *bp, ASN1_ENUMERATED *a);
893int a2i_ASN1_ENUMERATED(BIO *bp,ASN1_ENUMERATED *bs,char *buf,int size); 886int a2i_ASN1_ENUMERATED(BIO *bp, ASN1_ENUMERATED *bs, char *buf, int size);
894int i2a_ASN1_OBJECT(BIO *bp,ASN1_OBJECT *a); 887int i2a_ASN1_OBJECT(BIO *bp, ASN1_OBJECT *a);
895int a2i_ASN1_STRING(BIO *bp,ASN1_STRING *bs,char *buf,int size); 888int a2i_ASN1_STRING(BIO *bp, ASN1_STRING *bs, char *buf, int size);
896int i2a_ASN1_STRING(BIO *bp, ASN1_STRING *a, int type); 889int i2a_ASN1_STRING(BIO *bp, ASN1_STRING *a, int type);
897#endif 890#endif
898int i2t_ASN1_OBJECT(char *buf,int buf_len,ASN1_OBJECT *a); 891int i2t_ASN1_OBJECT(char *buf, int buf_len, ASN1_OBJECT *a);
899 892
900int a2d_ASN1_OBJECT(unsigned char *out,int olen, const char *buf, int num); 893int a2d_ASN1_OBJECT(unsigned char *out, int olen, const char *buf, int num);
901ASN1_OBJECT *ASN1_OBJECT_create(int nid, unsigned char *data,int len, 894ASN1_OBJECT *ASN1_OBJECT_create(int nid, unsigned char *data, int len,
902 const char *sn, const char *ln); 895 const char *sn, const char *ln);
903 896
904int ASN1_INTEGER_set(ASN1_INTEGER *a, long v); 897int ASN1_INTEGER_set(ASN1_INTEGER *a, long v);
905long ASN1_INTEGER_get(const ASN1_INTEGER *a); 898long ASN1_INTEGER_get(const ASN1_INTEGER *a);
906ASN1_INTEGER *BN_to_ASN1_INTEGER(const BIGNUM *bn, ASN1_INTEGER *ai); 899ASN1_INTEGER *BN_to_ASN1_INTEGER(const BIGNUM *bn, ASN1_INTEGER *ai);
907BIGNUM *ASN1_INTEGER_to_BN(const ASN1_INTEGER *ai,BIGNUM *bn); 900BIGNUM *ASN1_INTEGER_to_BN(const ASN1_INTEGER *ai, BIGNUM *bn);
908 901
909int ASN1_ENUMERATED_set(ASN1_ENUMERATED *a, long v); 902int ASN1_ENUMERATED_set(ASN1_ENUMERATED *a, long v);
910long ASN1_ENUMERATED_get(ASN1_ENUMERATED *a); 903long ASN1_ENUMERATED_get(ASN1_ENUMERATED *a);
911ASN1_ENUMERATED *BN_to_ASN1_ENUMERATED(BIGNUM *bn, ASN1_ENUMERATED *ai); 904ASN1_ENUMERATED *BN_to_ASN1_ENUMERATED(BIGNUM *bn, ASN1_ENUMERATED *ai);
912BIGNUM *ASN1_ENUMERATED_to_BN(ASN1_ENUMERATED *ai,BIGNUM *bn); 905BIGNUM *ASN1_ENUMERATED_to_BN(ASN1_ENUMERATED *ai, BIGNUM *bn);
913 906
914/* General */ 907/* General */
915/* given a string, return the correct type, max is the maximum length */ 908/* given a string, return the correct type, max is the maximum length */
@@ -917,11 +910,11 @@ int ASN1_PRINTABLE_type(const unsigned char *s, int max);
917 910
918int i2d_ASN1_bytes(ASN1_STRING *a, unsigned char **pp, int tag, int xclass); 911int i2d_ASN1_bytes(ASN1_STRING *a, unsigned char **pp, int tag, int xclass);
919ASN1_STRING *d2i_ASN1_bytes(ASN1_STRING **a, const unsigned char **pp, 912ASN1_STRING *d2i_ASN1_bytes(ASN1_STRING **a, const unsigned char **pp,
920 long length, int Ptag, int Pclass); 913 long length, int Ptag, int Pclass);
921unsigned long ASN1_tag2bit(int tag); 914unsigned long ASN1_tag2bit(int tag);
922/* type is one or more of the B_ASN1_ values. */ 915/* type is one or more of the B_ASN1_ values. */
923ASN1_STRING *d2i_ASN1_type_bytes(ASN1_STRING **a,const unsigned char **pp, 916ASN1_STRING *d2i_ASN1_type_bytes(ASN1_STRING **a, const unsigned char **pp,
924 long length,int type); 917 long length, int type);
925 918
926/* PARSING */ 919/* PARSING */
927int asn1_Finish(ASN1_CTX *c); 920int asn1_Finish(ASN1_CTX *c);
@@ -929,11 +922,11 @@ int asn1_const_Finish(ASN1_const_CTX *c);
929 922
930/* SPECIALS */ 923/* SPECIALS */
931int ASN1_get_object(const unsigned char **pp, long *plength, int *ptag, 924int ASN1_get_object(const unsigned char **pp, long *plength, int *ptag,
932 int *pclass, long omax); 925 int *pclass, long omax);
933int ASN1_check_infinite_end(unsigned char **p,long len); 926int ASN1_check_infinite_end(unsigned char **p, long len);
934int ASN1_const_check_infinite_end(const unsigned char **p,long len); 927int ASN1_const_check_infinite_end(const unsigned char **p, long len);
935void ASN1_put_object(unsigned char **pp, int constructed, int length, 928void ASN1_put_object(unsigned char **pp, int constructed, int length, int tag,
936 int tag, int xclass); 929 int xclass);
937int ASN1_put_eoc(unsigned char **pp); 930int ASN1_put_eoc(unsigned char **pp);
938int ASN1_object_size(int constructed, int length, int tag); 931int ASN1_object_size(int constructed, int length, int tag);
939 932
@@ -968,7 +961,7 @@ void *ASN1_d2i_fp(void *(*xnew)(void), d2i_of_void *d2i, FILE *in, void **x);
968 CHECKED_PPTR_OF(type, x))) 961 CHECKED_PPTR_OF(type, x)))
969 962
970void *ASN1_item_d2i_fp(const ASN1_ITEM *it, FILE *in, void *x); 963void *ASN1_item_d2i_fp(const ASN1_ITEM *it, FILE *in, void *x);
971int ASN1_i2d_fp(i2d_of_void *i2d,FILE *out,void *x); 964int ASN1_i2d_fp(i2d_of_void *i2d, FILE *out, void *x);
972 965
973#define ASN1_i2d_fp_of(type,i2d,out,x) \ 966#define ASN1_i2d_fp_of(type,i2d,out,x) \
974 (ASN1_i2d_fp(CHECKED_I2D_OF(type, i2d), \ 967 (ASN1_i2d_fp(CHECKED_I2D_OF(type, i2d), \
@@ -996,7 +989,7 @@ void *ASN1_d2i_bio(void *(*xnew)(void), d2i_of_void *d2i, BIO *in, void **x);
996 CHECKED_PPTR_OF(type, x))) 989 CHECKED_PPTR_OF(type, x)))
997 990
998void *ASN1_item_d2i_bio(const ASN1_ITEM *it, BIO *in, void *x); 991void *ASN1_item_d2i_bio(const ASN1_ITEM *it, BIO *in, void *x);
999int ASN1_i2d_bio(i2d_of_void *i2d,BIO *out, unsigned char *x); 992int ASN1_i2d_bio(i2d_of_void *i2d, BIO *out, unsigned char *x);
1000 993
1001#define ASN1_i2d_bio_of(type,i2d,out,x) \ 994#define ASN1_i2d_bio_of(type,i2d,out,x) \
1002 (ASN1_i2d_bio(CHECKED_I2D_OF(type, i2d), \ 995 (ASN1_i2d_bio(CHECKED_I2D_OF(type, i2d), \
@@ -1015,9 +1008,9 @@ int ASN1_TIME_print(BIO *fp, const ASN1_TIME *a);
1015int ASN1_STRING_print(BIO *bp, const ASN1_STRING *v); 1008int ASN1_STRING_print(BIO *bp, const ASN1_STRING *v);
1016int ASN1_STRING_print_ex(BIO *out, ASN1_STRING *str, unsigned long flags); 1009int ASN1_STRING_print_ex(BIO *out, ASN1_STRING *str, unsigned long flags);
1017int ASN1_bn_print(BIO *bp, const char *number, const BIGNUM *num, 1010int ASN1_bn_print(BIO *bp, const char *number, const BIGNUM *num,
1018 unsigned char *buf, int off); 1011 unsigned char *buf, int off);
1019int ASN1_parse(BIO *bp,const unsigned char *pp,long len,int indent); 1012int ASN1_parse(BIO *bp, const unsigned char *pp, long len, int indent);
1020int ASN1_parse_dump(BIO *bp,const unsigned char *pp,long len,int indent,int dump); 1013int ASN1_parse_dump(BIO *bp, const unsigned char *pp, long len, int indent, int dump);
1021#endif 1014#endif
1022const char *ASN1_tag2str(int tag); 1015const char *ASN1_tag2str(int tag);
1023 1016
@@ -1027,37 +1020,35 @@ DECLARE_ASN1_FUNCTIONS(NETSCAPE_X509)
1027 1020
1028int ASN1_UNIVERSALSTRING_to_string(ASN1_UNIVERSALSTRING *s); 1021int ASN1_UNIVERSALSTRING_to_string(ASN1_UNIVERSALSTRING *s);
1029 1022
1030int ASN1_TYPE_set_octetstring(ASN1_TYPE *a, 1023int ASN1_TYPE_set_octetstring(ASN1_TYPE *a, unsigned char *data, int len);
1031 unsigned char *data, int len); 1024int ASN1_TYPE_get_octetstring(ASN1_TYPE *a, unsigned char *data, int max_len);
1032int ASN1_TYPE_get_octetstring(ASN1_TYPE *a, 1025int ASN1_TYPE_set_int_octetstring(ASN1_TYPE *a, long num, unsigned char *data,
1033 unsigned char *data, int max_len); 1026 int len);
1034int ASN1_TYPE_set_int_octetstring(ASN1_TYPE *a, long num, 1027int ASN1_TYPE_get_int_octetstring(ASN1_TYPE *a, long *num, unsigned char *data,
1035 unsigned char *data, int len); 1028 int max_len);
1036int ASN1_TYPE_get_int_octetstring(ASN1_TYPE *a,long *num,
1037 unsigned char *data, int max_len);
1038 1029
1039STACK_OF(OPENSSL_BLOCK) *ASN1_seq_unpack(const unsigned char *buf, int len, 1030STACK_OF(OPENSSL_BLOCK) *ASN1_seq_unpack(const unsigned char *buf, int len,
1040 d2i_of_void *d2i, void (*free_func)(OPENSSL_BLOCK)); 1031 d2i_of_void *d2i, void (*free_func)(OPENSSL_BLOCK));
1041unsigned char *ASN1_seq_pack(STACK_OF(OPENSSL_BLOCK) *safes, i2d_of_void *i2d, 1032unsigned char *ASN1_seq_pack(STACK_OF(OPENSSL_BLOCK) *safes, i2d_of_void *i2d,
1042 unsigned char **buf, int *len ); 1033 unsigned char **buf, int *len );
1043void *ASN1_unpack_string(ASN1_STRING *oct, d2i_of_void *d2i); 1034void *ASN1_unpack_string(ASN1_STRING *oct, d2i_of_void *d2i);
1044void *ASN1_item_unpack(ASN1_STRING *oct, const ASN1_ITEM *it); 1035void *ASN1_item_unpack(ASN1_STRING *oct, const ASN1_ITEM *it);
1045ASN1_STRING *ASN1_pack_string(void *obj, i2d_of_void *i2d, 1036ASN1_STRING *ASN1_pack_string(void *obj, i2d_of_void *i2d,
1046 ASN1_OCTET_STRING **oct); 1037 ASN1_OCTET_STRING **oct);
1047 1038
1048ASN1_STRING *ASN1_item_pack(void *obj, const ASN1_ITEM *it, ASN1_OCTET_STRING **oct); 1039ASN1_STRING *ASN1_item_pack(void *obj, const ASN1_ITEM *it,
1040 ASN1_OCTET_STRING **oct);
1049 1041
1050void ASN1_STRING_set_default_mask(unsigned long mask); 1042void ASN1_STRING_set_default_mask(unsigned long mask);
1051int ASN1_STRING_set_default_mask_asc(const char *p); 1043int ASN1_STRING_set_default_mask_asc(const char *p);
1052unsigned long ASN1_STRING_get_default_mask(void); 1044unsigned long ASN1_STRING_get_default_mask(void);
1053int ASN1_mbstring_copy(ASN1_STRING **out, const unsigned char *in, int len, 1045int ASN1_mbstring_copy(ASN1_STRING **out, const unsigned char *in, int len,
1054 int inform, unsigned long mask); 1046 int inform, unsigned long mask);
1055int ASN1_mbstring_ncopy(ASN1_STRING **out, const unsigned char *in, int len, 1047int ASN1_mbstring_ncopy(ASN1_STRING **out, const unsigned char *in, int len,
1056 int inform, unsigned long mask, 1048 int inform, unsigned long mask, long minsize, long maxsize);
1057 long minsize, long maxsize);
1058 1049
1059ASN1_STRING *ASN1_STRING_set_by_NID(ASN1_STRING **out, 1050ASN1_STRING *ASN1_STRING_set_by_NID(ASN1_STRING **out,
1060 const unsigned char *in, int inlen, int inform, int nid); 1051 const unsigned char *in, int inlen, int inform, int nid);
1061ASN1_STRING_TABLE *ASN1_STRING_TABLE_get(int nid); 1052ASN1_STRING_TABLE *ASN1_STRING_TABLE_get(int nid);
1062int ASN1_STRING_TABLE_add(int, long, long, unsigned long, unsigned long); 1053int ASN1_STRING_TABLE_add(int, long, long, unsigned long, unsigned long);
1063void ASN1_STRING_TABLE_cleanup(void); 1054void ASN1_STRING_TABLE_cleanup(void);
@@ -1067,7 +1058,8 @@ void ASN1_STRING_TABLE_cleanup(void);
1067/* Old API compatible functions */ 1058/* Old API compatible functions */
1068ASN1_VALUE *ASN1_item_new(const ASN1_ITEM *it); 1059ASN1_VALUE *ASN1_item_new(const ASN1_ITEM *it);
1069void ASN1_item_free(ASN1_VALUE *val, const ASN1_ITEM *it); 1060void ASN1_item_free(ASN1_VALUE *val, const ASN1_ITEM *it);
1070ASN1_VALUE * ASN1_item_d2i(ASN1_VALUE **val, const unsigned char **in, long len, const ASN1_ITEM *it); 1061ASN1_VALUE * ASN1_item_d2i(ASN1_VALUE **val, const unsigned char **in,
1062 long len, const ASN1_ITEM *it);
1071int ASN1_item_i2d(ASN1_VALUE *val, unsigned char **out, const ASN1_ITEM *it); 1063int ASN1_item_i2d(ASN1_VALUE *val, unsigned char **out, const ASN1_ITEM *it);
1072int ASN1_item_ndef_i2d(ASN1_VALUE *val, unsigned char **out, const ASN1_ITEM *it); 1064int ASN1_item_ndef_i2d(ASN1_VALUE *val, unsigned char **out, const ASN1_ITEM *it);
1073 1065
@@ -1079,7 +1071,7 @@ ASN1_TYPE *ASN1_generate_v3(char *str, X509V3_CTX *cnf);
1079/* ASN1 Print flags */ 1071/* ASN1 Print flags */
1080 1072
1081/* Indicate missing OPTIONAL fields */ 1073/* Indicate missing OPTIONAL fields */
1082#define ASN1_PCTX_FLAGS_SHOW_ABSENT 0x001 1074#define ASN1_PCTX_FLAGS_SHOW_ABSENT 0x001
1083/* Mark start and end of SEQUENCE */ 1075/* Mark start and end of SEQUENCE */
1084#define ASN1_PCTX_FLAGS_SHOW_SEQUENCE 0x002 1076#define ASN1_PCTX_FLAGS_SHOW_SEQUENCE 0x002
1085/* Mark start and end of SEQUENCE/SET OF */ 1077/* Mark start and end of SEQUENCE/SET OF */
@@ -1098,7 +1090,7 @@ ASN1_TYPE *ASN1_generate_v3(char *str, X509V3_CTX *cnf);
1098#define ASN1_PCTX_FLAGS_NO_STRUCT_NAME 0x100 1090#define ASN1_PCTX_FLAGS_NO_STRUCT_NAME 0x100
1099 1091
1100int ASN1_item_print(BIO *out, ASN1_VALUE *ifld, int indent, 1092int ASN1_item_print(BIO *out, ASN1_VALUE *ifld, int indent,
1101 const ASN1_ITEM *it, const ASN1_PCTX *pctx); 1093 const ASN1_ITEM *it, const ASN1_PCTX *pctx);
1102ASN1_PCTX *ASN1_PCTX_new(void); 1094ASN1_PCTX *ASN1_PCTX_new(void);
1103void ASN1_PCTX_free(ASN1_PCTX *p); 1095void ASN1_PCTX_free(ASN1_PCTX *p);
1104unsigned long ASN1_PCTX_get_flags(ASN1_PCTX *p); 1096unsigned long ASN1_PCTX_get_flags(ASN1_PCTX *p);
@@ -1117,14 +1109,12 @@ BIO_METHOD *BIO_f_asn1(void);
1117BIO *BIO_new_NDEF(BIO *out, ASN1_VALUE *val, const ASN1_ITEM *it); 1109BIO *BIO_new_NDEF(BIO *out, ASN1_VALUE *val, const ASN1_ITEM *it);
1118 1110
1119int i2d_ASN1_bio_stream(BIO *out, ASN1_VALUE *val, BIO *in, int flags, 1111int i2d_ASN1_bio_stream(BIO *out, ASN1_VALUE *val, BIO *in, int flags,
1120 const ASN1_ITEM *it); 1112 const ASN1_ITEM *it);
1121int PEM_write_bio_ASN1_stream(BIO *out, ASN1_VALUE *val, BIO *in, int flags, 1113int PEM_write_bio_ASN1_stream(BIO *out, ASN1_VALUE *val, BIO *in, int flags,
1122 const char *hdr, 1114 const char *hdr, const ASN1_ITEM *it);
1123 const ASN1_ITEM *it);
1124int SMIME_write_ASN1(BIO *bio, ASN1_VALUE *val, BIO *data, int flags, 1115int SMIME_write_ASN1(BIO *bio, ASN1_VALUE *val, BIO *data, int flags,
1125 int ctype_nid, int econt_nid, 1116 int ctype_nid, int econt_nid, STACK_OF(X509_ALGOR) *mdalgs,
1126 STACK_OF(X509_ALGOR) *mdalgs, 1117 const ASN1_ITEM *it);
1127 const ASN1_ITEM *it);
1128ASN1_VALUE *SMIME_read_ASN1(BIO *bio, BIO **bcont, const ASN1_ITEM *it); 1118ASN1_VALUE *SMIME_read_ASN1(BIO *bio, BIO **bcont, const ASN1_ITEM *it);
1129int SMIME_crlf_copy(BIO *in, BIO *out, int flags); 1119int SMIME_crlf_copy(BIO *in, BIO *out, int flags);
1130int SMIME_text(BIO *in, BIO *out); 1120int SMIME_text(BIO *in, BIO *out);
diff --git a/src/lib/libssl/src/crypto/asn1/asn1_locl.h b/src/lib/libssl/src/crypto/asn1/asn1_locl.h
index 64bf8ec2fa..bcbb605202 100644
--- a/src/lib/libssl/src/crypto/asn1/asn1_locl.h
+++ b/src/lib/libssl/src/crypto/asn1/asn1_locl.h
@@ -10,7 +10,7 @@
10 * are met: 10 * are met:
11 * 11 *
12 * 1. Redistributions of source code must retain the above copyright 12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer. 13 * notice, this list of conditions and the following disclaimer.
14 * 14 *
15 * 2. Redistributions in binary form must reproduce the above copyright 15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in 16 * notice, this list of conditions and the following disclaimer in
@@ -60,8 +60,7 @@
60 60
61/* ASN1 print context structure */ 61/* ASN1 print context structure */
62 62
63struct asn1_pctx_st 63struct asn1_pctx_st {
64{
65 unsigned long flags; 64 unsigned long flags;
66 unsigned long nm_flags; 65 unsigned long nm_flags;
67 unsigned long cert_flags; 66 unsigned long cert_flags;
@@ -71,8 +70,7 @@ struct asn1_pctx_st
71 70
72/* ASN1 public key method structure */ 71/* ASN1 public key method structure */
73 72
74struct evp_pkey_asn1_method_st 73struct evp_pkey_asn1_method_st {
75{
76 int pkey_id; 74 int pkey_id;
77 int pkey_base_id; 75 int pkey_base_id;
78 unsigned long pkey_flags; 76 unsigned long pkey_flags;
@@ -84,44 +82,40 @@ struct evp_pkey_asn1_method_st
84 int (*pub_encode)(X509_PUBKEY *pub, const EVP_PKEY *pk); 82 int (*pub_encode)(X509_PUBKEY *pub, const EVP_PKEY *pk);
85 int (*pub_cmp)(const EVP_PKEY *a, const EVP_PKEY *b); 83 int (*pub_cmp)(const EVP_PKEY *a, const EVP_PKEY *b);
86 int (*pub_print)(BIO *out, const EVP_PKEY *pkey, int indent, 84 int (*pub_print)(BIO *out, const EVP_PKEY *pkey, int indent,
87 ASN1_PCTX *pctx); 85 ASN1_PCTX *pctx);
88 86
89 int (*priv_decode)(EVP_PKEY *pk, PKCS8_PRIV_KEY_INFO *p8inf); 87 int (*priv_decode)(EVP_PKEY *pk, PKCS8_PRIV_KEY_INFO *p8inf);
90 int (*priv_encode)(PKCS8_PRIV_KEY_INFO *p8, const EVP_PKEY *pk); 88 int (*priv_encode)(PKCS8_PRIV_KEY_INFO *p8, const EVP_PKEY *pk);
91 int (*priv_print)(BIO *out, const EVP_PKEY *pkey, int indent, 89 int (*priv_print)(BIO *out, const EVP_PKEY *pkey, int indent,
92 ASN1_PCTX *pctx); 90 ASN1_PCTX *pctx);
93 91
94 int (*pkey_size)(const EVP_PKEY *pk); 92 int (*pkey_size)(const EVP_PKEY *pk);
95 int (*pkey_bits)(const EVP_PKEY *pk); 93 int (*pkey_bits)(const EVP_PKEY *pk);
96 94
97 int (*param_decode)(EVP_PKEY *pkey, 95 int (*param_decode)(EVP_PKEY *pkey, const unsigned char **pder,
98 const unsigned char **pder, int derlen); 96 int derlen);
99 int (*param_encode)(const EVP_PKEY *pkey, unsigned char **pder); 97 int (*param_encode)(const EVP_PKEY *pkey, unsigned char **pder);
100 int (*param_missing)(const EVP_PKEY *pk); 98 int (*param_missing)(const EVP_PKEY *pk);
101 int (*param_copy)(EVP_PKEY *to, const EVP_PKEY *from); 99 int (*param_copy)(EVP_PKEY *to, const EVP_PKEY *from);
102 int (*param_cmp)(const EVP_PKEY *a, const EVP_PKEY *b); 100 int (*param_cmp)(const EVP_PKEY *a, const EVP_PKEY *b);
103 int (*param_print)(BIO *out, const EVP_PKEY *pkey, int indent, 101 int (*param_print)(BIO *out, const EVP_PKEY *pkey, int indent,
104 ASN1_PCTX *pctx); 102 ASN1_PCTX *pctx);
105 int (*sig_print)(BIO *out, 103 int (*sig_print)(BIO *out, const X509_ALGOR *sigalg,
106 const X509_ALGOR *sigalg, const ASN1_STRING *sig, 104 const ASN1_STRING *sig, int indent, ASN1_PCTX *pctx);
107 int indent, ASN1_PCTX *pctx);
108
109 105
110 void (*pkey_free)(EVP_PKEY *pkey); 106 void (*pkey_free)(EVP_PKEY *pkey);
111 int (*pkey_ctrl)(EVP_PKEY *pkey, int op, long arg1, void *arg2); 107 int (*pkey_ctrl)(EVP_PKEY *pkey, int op, long arg1, void *arg2);
112 108
113 /* Legacy functions for old PEM */ 109 /* Legacy functions for old PEM */
114 110
115 int (*old_priv_decode)(EVP_PKEY *pkey, 111 int (*old_priv_decode)(EVP_PKEY *pkey, const unsigned char **pder,
116 const unsigned char **pder, int derlen); 112 int derlen);
117 int (*old_priv_encode)(const EVP_PKEY *pkey, unsigned char **pder); 113 int (*old_priv_encode)(const EVP_PKEY *pkey, unsigned char **pder);
118 /* Custom ASN1 signature verification */ 114 /* Custom ASN1 signature verification */
119 int (*item_verify)(EVP_MD_CTX *ctx, const ASN1_ITEM *it, void *asn, 115 int (*item_verify)(EVP_MD_CTX *ctx, const ASN1_ITEM *it, void *asn,
120 X509_ALGOR *a, ASN1_BIT_STRING *sig, 116 X509_ALGOR *a, ASN1_BIT_STRING *sig, EVP_PKEY *pkey);
121 EVP_PKEY *pkey);
122 int (*item_sign)(EVP_MD_CTX *ctx, const ASN1_ITEM *it, void *asn, 117 int (*item_sign)(EVP_MD_CTX *ctx, const ASN1_ITEM *it, void *asn,
123 X509_ALGOR *alg1, X509_ALGOR *alg2, 118 X509_ALGOR *alg1, X509_ALGOR *alg2, ASN1_BIT_STRING *sig);
124 ASN1_BIT_STRING *sig);
125 119
126} /* EVP_PKEY_ASN1_METHOD */; 120} /* EVP_PKEY_ASN1_METHOD */;
127 121
@@ -134,13 +128,12 @@ struct evp_pkey_asn1_method_st
134 128
135#define X509_CRL_METHOD_DYNAMIC 1 129#define X509_CRL_METHOD_DYNAMIC 1
136 130
137struct x509_crl_method_st 131struct x509_crl_method_st {
138{
139 int flags; 132 int flags;
140 int (*crl_init)(X509_CRL *crl); 133 int (*crl_init)(X509_CRL *crl);
141 int (*crl_free)(X509_CRL *crl); 134 int (*crl_free)(X509_CRL *crl);
142 int (*crl_lookup)(X509_CRL *crl, X509_REVOKED **ret, 135 int (*crl_lookup)(X509_CRL *crl, X509_REVOKED **ret,
143 ASN1_INTEGER *ser, X509_NAME *issuer); 136 ASN1_INTEGER *ser, X509_NAME *issuer);
144 int (*crl_verify)(X509_CRL *crl, EVP_PKEY *pk); 137 int (*crl_verify)(X509_CRL *crl, EVP_PKEY *pk);
145}; 138};
146 139
@@ -154,5 +147,5 @@ struct x509_crl_method_st
154#define UNICODE_IS_SURROGATE(x) \ 147#define UNICODE_IS_SURROGATE(x) \
155 ((x) >= UNICODE_SURROGATE_MIN && (x) <= UNICODE_SURROGATE_MAX) 148 ((x) >= UNICODE_SURROGATE_MIN && (x) <= UNICODE_SURROGATE_MAX)
156 149
157int UTF8_getc(const unsigned char *str, int len, unsigned long *val); 150int UTF8_getc(const unsigned char *str, int len, unsigned long *val);
158int UTF8_putc(unsigned char *str, int len, unsigned long value); 151int UTF8_putc(unsigned char *str, int len, unsigned long value);
diff --git a/src/lib/libssl/src/crypto/asn1/asn1_mac.h b/src/lib/libssl/src/crypto/asn1/asn1_mac.h
index ecc2c77228..da03a8cb92 100644
--- a/src/lib/libssl/src/crypto/asn1/asn1_mac.h
+++ b/src/lib/libssl/src/crypto/asn1/asn1_mac.h
@@ -5,21 +5,21 @@
5 * This package is an SSL implementation written 5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com). 6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL. 7 * The implementation was written so as to conform with Netscapes SSL.
8 * 8 *
9 * This library is free for commercial and non-commercial use as long as 9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions 10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA, 11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation 12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms 13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com). 14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 * 15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in 16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed. 17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution 18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used. 19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or 20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package. 21 * in documentation (online or textual) provided with the package.
22 * 22 *
23 * Redistribution and use in source and binary forms, with or without 23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions 24 * modification, are permitted provided that the following conditions
25 * are met: 25 * are met:
@@ -34,10 +34,10 @@
34 * Eric Young (eay@cryptsoft.com)" 34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library 35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-). 36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from 37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement: 38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" 39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 * 40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND 41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -49,7 +49,7 @@
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE. 51 * SUCH DAMAGE.
52 * 52 *
53 * The licence and distribution terms for any publically available version or 53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be 54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence 55 * copied and put under another distribution licence
@@ -67,7 +67,7 @@ extern "C" {
67 67
68#ifndef ASN1_MAC_ERR_LIB 68#ifndef ASN1_MAC_ERR_LIB
69#define ASN1_MAC_ERR_LIB ERR_LIB_ASN1 69#define ASN1_MAC_ERR_LIB ERR_LIB_ASN1
70#endif 70#endif
71 71
72#define ASN1_MAC_H_err(f,r,line) \ 72#define ASN1_MAC_H_err(f,r,line) \
73 ERR_PUT_error(ASN1_MAC_ERR_LIB,(f),(r),__FILE__,(line)) 73 ERR_PUT_error(ASN1_MAC_ERR_LIB,(f),(r),__FILE__,(line))
@@ -433,7 +433,7 @@ err:\
433 return(r); 433 return(r);
434 434
435int asn1_GetSequence(ASN1_const_CTX *c, long *length); 435int asn1_GetSequence(ASN1_const_CTX *c, long *length);
436void asn1_add_error(const unsigned char *address,int offset); 436void asn1_add_error(const unsigned char *address, int offset);
437#ifdef __cplusplus 437#ifdef __cplusplus
438} 438}
439#endif 439#endif