Commit 8119d07c8566dd5c7549e5f7ae7d5f878818b9d6

Authored by David René
1 parent e742e5e6

update to openssl 0.9.8b

Showing 62 changed files with 5032 additions and 808 deletions   Show diff stats
third_dev/openssl/include/openssl/aes.h
... ... @@ -52,6 +52,8 @@
52 52 #ifndef HEADER_AES_H
53 53 #define HEADER_AES_H
54 54  
  55 +#include <openssl/opensslconf.h>
  56 +
55 57 #ifdef OPENSSL_NO_AES
56 58 #error AES is disabled.
57 59 #endif
... ... @@ -70,7 +72,11 @@ extern &quot;C&quot; {
70 72  
71 73 /* This should be a hidden type, but EVP requires that the size be known */
72 74 struct aes_key_st {
  75 +#ifdef AES_LONG
73 76 unsigned long rd_key[4 *(AES_MAXNR + 1)];
  77 +#else
  78 + unsigned int rd_key[4 *(AES_MAXNR + 1)];
  79 +#endif
74 80 int rounds;
75 81 };
76 82 typedef struct aes_key_st AES_KEY;
... ... @@ -95,6 +101,15 @@ void AES_cbc_encrypt(const unsigned char *in, unsigned char *out,
95 101 void AES_cfb128_encrypt(const unsigned char *in, unsigned char *out,
96 102 const unsigned long length, const AES_KEY *key,
97 103 unsigned char *ivec, int *num, const int enc);
  104 +void AES_cfb1_encrypt(const unsigned char *in, unsigned char *out,
  105 + const unsigned long length, const AES_KEY *key,
  106 + unsigned char *ivec, int *num, const int enc);
  107 +void AES_cfb8_encrypt(const unsigned char *in, unsigned char *out,
  108 + const unsigned long length, const AES_KEY *key,
  109 + unsigned char *ivec, int *num, const int enc);
  110 +void AES_cfbr_encrypt_block(const unsigned char *in,unsigned char *out,
  111 + const int nbits,const AES_KEY *key,
  112 + unsigned char *ivec,const int enc);
98 113 void AES_ofb128_encrypt(const unsigned char *in, unsigned char *out,
99 114 const unsigned long length, const AES_KEY *key,
100 115 unsigned char *ivec, int *num);
... ...
third_dev/openssl/include/openssl/asn1.h
... ... @@ -60,17 +60,19 @@
60 60 #define HEADER_ASN1_H
61 61  
62 62 #include <time.h>
  63 +#include <openssl/e_os2.h>
63 64 #ifndef OPENSSL_NO_BIO
64 65 #include <openssl/bio.h>
65 66 #endif
66   -#include <openssl/e_os2.h>
67   -#include <openssl/bn.h>
68 67 #include <openssl/stack.h>
69 68 #include <openssl/safestack.h>
70 69  
71 70 #include <openssl/symhacks.h>
72 71  
73 72 #include <openssl/ossl_typ.h>
  73 +#ifndef OPENSSL_NO_DEPRECATED
  74 +#include <openssl/bn.h>
  75 +#endif
74 76  
75 77 #ifdef OPENSSL_BUILD_SHLIBCRYPTO
76 78 # undef OPENSSL_EXTERN
... ... @@ -147,19 +149,24 @@ extern &quot;C&quot; {
147 149 #define B_ASN1_UTF8STRING 0x2000
148 150 #define B_ASN1_UTCTIME 0x4000
149 151 #define B_ASN1_GENERALIZEDTIME 0x8000
  152 +#define B_ASN1_SEQUENCE 0x10000
150 153  
151 154 /* For use with ASN1_mbstring_copy() */
152 155 #define MBSTRING_FLAG 0x1000
  156 +#define MBSTRING_UTF8 (MBSTRING_FLAG)
153 157 #define MBSTRING_ASC (MBSTRING_FLAG|1)
154 158 #define MBSTRING_BMP (MBSTRING_FLAG|2)
155   -#define MBSTRING_UNIV (MBSTRING_FLAG|3)
156   -#define MBSTRING_UTF8 (MBSTRING_FLAG|4)
  159 +#define MBSTRING_UNIV (MBSTRING_FLAG|4)
157 160  
158 161 struct X509_algor_st;
159 162  
160 163 #define DECLARE_ASN1_SET_OF(type) /* filled in by mkstack.pl */
161 164 #define IMPLEMENT_ASN1_SET_OF(type) /* nothing, no longer needed */
162 165  
  166 +/* We MUST make sure that, except for constness, asn1_ctx_st and
  167 + asn1_const_ctx are exactly the same. Fortunately, as soon as
  168 + the old ASN1 parsing macros are gone, we can throw this away
  169 + as well... */
163 170 typedef struct asn1_ctx_st
164 171 {
165 172 unsigned char *p;/* work char pointer */
... ... @@ -175,6 +182,21 @@ typedef struct asn1_ctx_st
175 182 int line; /* used in error processing */
176 183 } ASN1_CTX;
177 184  
  185 +typedef struct asn1_const_ctx_st
  186 + {
  187 + const unsigned char *p;/* work char pointer */
  188 + int eos; /* end of sequence read for indefinite encoding */
  189 + int error; /* error code to use when returning an error */
  190 + int inf; /* constructed if 0x20, indefinite is 0x21 */
  191 + int tag; /* tag from last 'get object' */
  192 + int xclass; /* class from last 'get object' */
  193 + long slen; /* length of last 'get object' */
  194 + const unsigned char *max; /* largest value of p allowed */
  195 + const unsigned char *q;/* temporary variable */
  196 + const unsigned char **pp;/* variable */
  197 + int line; /* used in error processing */
  198 + } ASN1_const_CTX;
  199 +
178 200 /* These are used internally in the ASN1_OBJECT to keep track of
179 201 * whether the names and data need to be free()ed */
180 202 #define ASN1_OBJECT_FLAG_DYNAMIC 0x01 /* internal use */
... ... @@ -191,6 +213,11 @@ typedef struct asn1_object_st
191 213 } ASN1_OBJECT;
192 214  
193 215 #define ASN1_STRING_FLAG_BITS_LEFT 0x08 /* Set if 0x07 has bits left value */
  216 +/* This indicates that the ASN1_STRING is not a real value but just a place
  217 + * holder for the location where indefinite length constructed data should
  218 + * be inserted in the memory buffer
  219 + */
  220 +#define ASN1_STRING_FLAG_NDEF 0x010
194 221 /* This is the base type that holds just about everything :-) */
195 222 typedef struct asn1_string_st
196 223 {
... ... @@ -259,18 +286,19 @@ typedef struct ASN1_VALUE_st ASN1_VALUE;
259 286  
260 287 #define DECLARE_ASN1_FUNCTIONS(type) DECLARE_ASN1_FUNCTIONS_name(type, type)
261 288  
  289 +#define DECLARE_ASN1_ALLOC_FUNCTIONS(type) \
  290 + DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, type)
  291 +
262 292 #define DECLARE_ASN1_FUNCTIONS_name(type, name) \
263   - type *name##_new(void); \
264   - void name##_free(type *a); \
  293 + DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, name) \
265 294 DECLARE_ASN1_ENCODE_FUNCTIONS(type, name, name)
266 295  
267 296 #define DECLARE_ASN1_FUNCTIONS_fname(type, itname, name) \
268   - type *name##_new(void); \
269   - void name##_free(type *a); \
  297 + DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, name) \
270 298 DECLARE_ASN1_ENCODE_FUNCTIONS(type, itname, name)
271 299  
272 300 #define DECLARE_ASN1_ENCODE_FUNCTIONS(type, itname, name) \
273   - type *d2i_##name(type **a, unsigned char **in, long len); \
  301 + type *d2i_##name(type **a, const unsigned char **in, long len); \
274 302 int i2d_##name(type *a, unsigned char **out); \
275 303 DECLARE_ASN1_ITEM(itname)
276 304  
... ... @@ -279,10 +307,26 @@ typedef struct ASN1_VALUE_st ASN1_VALUE;
279 307 int i2d_##name(const type *a, unsigned char **out); \
280 308 DECLARE_ASN1_ITEM(name)
281 309  
  310 +#define DECLARE_ASN1_NDEF_FUNCTION(name) \
  311 + int i2d_##name##_NDEF(name *a, unsigned char **out);
  312 +
282 313 #define DECLARE_ASN1_FUNCTIONS_const(name) \
283 314 name *name##_new(void); \
284 315 void name##_free(name *a);
285 316  
  317 +#define DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, name) \
  318 + type *name##_new(void); \
  319 + void name##_free(type *a);
  320 +
  321 +#define D2I_OF(type) type *(*)(type **,const unsigned char **,long)
  322 +#define I2D_OF(type) int (*)(type *,unsigned char **)
  323 +#define I2D_OF_const(type) int (*)(const type *,unsigned char **)
  324 +
  325 +#define TYPEDEF_D2I_OF(type) typedef type *d2i_of_##type(type **,const unsigned char **,long)
  326 +#define TYPEDEF_I2D_OF(type) typedef int i2d_of_##type(type *,unsigned char **)
  327 +#define TYPEDEF_D2I2D_OF(type) TYPEDEF_D2I_OF(type); TYPEDEF_I2D_OF(type)
  328 +
  329 +TYPEDEF_D2I2D_OF(void);
286 330  
287 331 /* The following macros and typedefs allow an ASN1_ITEM
288 332 * to be embedded in a structure and referenced. Since
... ... @@ -475,17 +519,17 @@ DECLARE_ASN1_SET_OF(ASN1_TYPE)
475 519  
476 520 typedef struct asn1_method_st
477 521 {
478   - int (*i2d)();
479   - char *(*d2i)();
480   - char *(*create)();
481   - void (*destroy)();
  522 + i2d_of_void *i2d;
  523 + d2i_of_void *d2i;
  524 + void *(*create)(void);
  525 + void (*destroy)(void *);
482 526 } ASN1_METHOD;
483 527  
484 528 /* This is used when parsing some Netscape objects */
485 529 typedef struct asn1_header_st
486 530 {
487 531 ASN1_OCTET_STRING *header;
488   - char *data;
  532 + void *data;
489 533 ASN1_METHOD *meth;
490 534 } ASN1_HEADER;
491 535  
... ... @@ -551,6 +595,7 @@ typedef struct BIT_STRING_BITNAME_st {
551 595 B_ASN1_UNIVERSALSTRING|\
552 596 B_ASN1_BMPSTRING|\
553 597 B_ASN1_UTF8STRING|\
  598 + B_ASN1_SEQUENCE|\
554 599 B_ASN1_UNKNOWN
555 600  
556 601 #define B_ASN1_DIRECTORYSTRING \
... ... @@ -700,9 +745,9 @@ void ASN1_TYPE_set(ASN1_TYPE *a, int type, void *value);
700 745 ASN1_OBJECT * ASN1_OBJECT_new(void );
701 746 void ASN1_OBJECT_free(ASN1_OBJECT *a);
702 747 int i2d_ASN1_OBJECT(ASN1_OBJECT *a,unsigned char **pp);
703   -ASN1_OBJECT * c2i_ASN1_OBJECT(ASN1_OBJECT **a,unsigned char **pp,
  748 +ASN1_OBJECT * c2i_ASN1_OBJECT(ASN1_OBJECT **a,const unsigned char **pp,
704 749 long length);
705   -ASN1_OBJECT * d2i_ASN1_OBJECT(ASN1_OBJECT **a,unsigned char **pp,
  750 +ASN1_OBJECT * d2i_ASN1_OBJECT(ASN1_OBJECT **a,const unsigned char **pp,
706 751 long length);
707 752  
708 753 DECLARE_ASN1_ITEM(ASN1_OBJECT)
... ... @@ -725,7 +770,7 @@ unsigned char * ASN1_STRING_data(ASN1_STRING *x);
725 770  
726 771 DECLARE_ASN1_FUNCTIONS(ASN1_BIT_STRING)
727 772 int i2c_ASN1_BIT_STRING(ASN1_BIT_STRING *a,unsigned char **pp);
728   -ASN1_BIT_STRING *c2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a,unsigned char **pp,
  773 +ASN1_BIT_STRING *c2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a,const unsigned char **pp,
729 774 long length);
730 775 int ASN1_BIT_STRING_set(ASN1_BIT_STRING *a, unsigned char *d,
731 776 int length );
... ... @@ -741,13 +786,13 @@ int ASN1_BIT_STRING_set_asc(ASN1_BIT_STRING *bs, char *name, int value,
741 786 BIT_STRING_BITNAME *tbl);
742 787  
743 788 int i2d_ASN1_BOOLEAN(int a,unsigned char **pp);
744   -int d2i_ASN1_BOOLEAN(int *a,unsigned char **pp,long length);
  789 +int d2i_ASN1_BOOLEAN(int *a,const unsigned char **pp,long length);
745 790  
746 791 DECLARE_ASN1_FUNCTIONS(ASN1_INTEGER)
747 792 int i2c_ASN1_INTEGER(ASN1_INTEGER *a,unsigned char **pp);
748   -ASN1_INTEGER *c2i_ASN1_INTEGER(ASN1_INTEGER **a,unsigned char **pp,
  793 +ASN1_INTEGER *c2i_ASN1_INTEGER(ASN1_INTEGER **a,const unsigned char **pp,
749 794 long length);
750   -ASN1_INTEGER *d2i_ASN1_UINTEGER(ASN1_INTEGER **a,unsigned char **pp,
  795 +ASN1_INTEGER *d2i_ASN1_UINTEGER(ASN1_INTEGER **a,const unsigned char **pp,
751 796 long length);
752 797 ASN1_INTEGER * ASN1_INTEGER_dup(ASN1_INTEGER *x);
753 798 int ASN1_INTEGER_cmp(ASN1_INTEGER *x, ASN1_INTEGER *y);
... ... @@ -756,7 +801,7 @@ DECLARE_ASN1_FUNCTIONS(ASN1_ENUMERATED)
756 801  
757 802 int ASN1_UTCTIME_check(ASN1_UTCTIME *a);
758 803 ASN1_UTCTIME *ASN1_UTCTIME_set(ASN1_UTCTIME *s,time_t t);
759   -int ASN1_UTCTIME_set_string(ASN1_UTCTIME *s, char *str);
  804 +int ASN1_UTCTIME_set_string(ASN1_UTCTIME *s, const char *str);
760 805 int ASN1_UTCTIME_cmp_time_t(const ASN1_UTCTIME *s, time_t t);
761 806 #if 0
762 807 time_t ASN1_UTCTIME_get(const ASN1_UTCTIME *s);
... ... @@ -764,12 +809,12 @@ time_t ASN1_UTCTIME_get(const ASN1_UTCTIME *s);
764 809  
765 810 int ASN1_GENERALIZEDTIME_check(ASN1_GENERALIZEDTIME *a);
766 811 ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_set(ASN1_GENERALIZEDTIME *s,time_t t);
767   -int ASN1_GENERALIZEDTIME_set_string(ASN1_GENERALIZEDTIME *s, char *str);
  812 +int ASN1_GENERALIZEDTIME_set_string(ASN1_GENERALIZEDTIME *s, const char *str);
768 813  
769 814 DECLARE_ASN1_FUNCTIONS(ASN1_OCTET_STRING)
770 815 ASN1_OCTET_STRING * ASN1_OCTET_STRING_dup(ASN1_OCTET_STRING *a);
771 816 int ASN1_OCTET_STRING_cmp(ASN1_OCTET_STRING *a, ASN1_OCTET_STRING *b);
772   -int ASN1_OCTET_STRING_set(ASN1_OCTET_STRING *str, unsigned char *data, int len);
  817 +int ASN1_OCTET_STRING_set(ASN1_OCTET_STRING *str, const unsigned char *data, int len);
773 818  
774 819 DECLARE_ASN1_FUNCTIONS(ASN1_VISIBLESTRING)
775 820 DECLARE_ASN1_FUNCTIONS(ASN1_UNIVERSALSTRING)
... ... @@ -792,15 +837,17 @@ DECLARE_ASN1_FUNCTIONS(ASN1_UTCTIME)
792 837 DECLARE_ASN1_FUNCTIONS(ASN1_GENERALIZEDTIME)
793 838 DECLARE_ASN1_FUNCTIONS(ASN1_TIME)
794 839  
  840 +DECLARE_ASN1_ITEM(ASN1_OCTET_STRING_NDEF)
  841 +
795 842 ASN1_TIME *ASN1_TIME_set(ASN1_TIME *s,time_t t);
796 843 int ASN1_TIME_check(ASN1_TIME *t);
797 844 ASN1_GENERALIZEDTIME *ASN1_TIME_to_generalizedtime(ASN1_TIME *t, ASN1_GENERALIZEDTIME **out);
798 845  
799   -int i2d_ASN1_SET(STACK *a, unsigned char **pp,
800   - int (*func)(), int ex_tag, int ex_class, int is_set);
801   -STACK * d2i_ASN1_SET(STACK **a, unsigned char **pp, long length,
802   - char *(*func)(), void (*free_func)(void *),
803   - int ex_tag, int ex_class);
  846 +int i2d_ASN1_SET(STACK *a, unsigned char **pp,
  847 + i2d_of_void *i2d, int ex_tag, int ex_class, int is_set);
  848 +STACK * d2i_ASN1_SET(STACK **a, const unsigned char **pp, long length,
  849 + d2i_of_void *d2i, void (*free_func)(void *),
  850 + int ex_tag, int ex_class);
804 851  
805 852 #ifndef OPENSSL_NO_BIO
806 853 int i2a_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *a);
... ... @@ -829,36 +876,49 @@ BIGNUM *ASN1_ENUMERATED_to_BN(ASN1_ENUMERATED *ai,BIGNUM *bn);
829 876  
830 877 /* General */
831 878 /* given a string, return the correct type, max is the maximum length */
832   -int ASN1_PRINTABLE_type(unsigned char *s, int max);
  879 +int ASN1_PRINTABLE_type(const unsigned char *s, int max);
833 880  
834 881 int i2d_ASN1_bytes(ASN1_STRING *a, unsigned char **pp, int tag, int xclass);
835   -ASN1_STRING *d2i_ASN1_bytes(ASN1_STRING **a, unsigned char **pp,
  882 +ASN1_STRING *d2i_ASN1_bytes(ASN1_STRING **a, const unsigned char **pp,
836 883 long length, int Ptag, int Pclass);
837 884 unsigned long ASN1_tag2bit(int tag);
838 885 /* type is one or more of the B_ASN1_ values. */
839   -ASN1_STRING *d2i_ASN1_type_bytes(ASN1_STRING **a,unsigned char **pp,
  886 +ASN1_STRING *d2i_ASN1_type_bytes(ASN1_STRING **a,const unsigned char **pp,
840 887 long length,int type);
841 888  
842 889 /* PARSING */
843 890 int asn1_Finish(ASN1_CTX *c);
  891 +int asn1_const_Finish(ASN1_const_CTX *c);
844 892  
845 893 /* SPECIALS */
846   -int ASN1_get_object(unsigned char **pp, long *plength, int *ptag,
  894 +int ASN1_get_object(const unsigned char **pp, long *plength, int *ptag,
847 895 int *pclass, long omax);
848 896 int ASN1_check_infinite_end(unsigned char **p,long len);
  897 +int ASN1_const_check_infinite_end(const unsigned char **p,long len);
849 898 void ASN1_put_object(unsigned char **pp, int constructed, int length,
850 899 int tag, int xclass);
  900 +int ASN1_put_eoc(unsigned char **pp);
851 901 int ASN1_object_size(int constructed, int length, int tag);
852 902  
853 903 /* Used to implement other functions */
854   -char *ASN1_dup(int (*i2d)(),char *(*d2i)(),char *x);
  904 +void *ASN1_dup(i2d_of_void *i2d, d2i_of_void *d2i, char *x);
  905 +#define ASN1_dup_of(type,i2d,d2i,x) \
  906 + ((type *(*)(I2D_OF(type),D2I_OF(type),type *))openssl_fcast(ASN1_dup))(i2d,d2i,x)
  907 +#define ASN1_dup_of_const(type,i2d,d2i,x) \
  908 + ((type *(*)(I2D_OF_const(type),D2I_OF(type),type *))openssl_fcast(ASN1_dup))(i2d,d2i,x)
855 909  
856 910 void *ASN1_item_dup(const ASN1_ITEM *it, void *x);
857 911  
858 912 #ifndef OPENSSL_NO_FP_API
859   -char *ASN1_d2i_fp(char *(*xnew)(),char *(*d2i)(),FILE *fp,unsigned char **x);
  913 +void *ASN1_d2i_fp(void *(*xnew)(void), d2i_of_void *d2i, FILE *in, void **x);
  914 +#define ASN1_d2i_fp_of(type,xnew,d2i,in,x) \
  915 + ((type *(*)(type *(*)(void),D2I_OF(type),FILE *,type **))openssl_fcast(ASN1_d2i_fp))(xnew,d2i,in,x)
860 916 void *ASN1_item_d2i_fp(const ASN1_ITEM *it, FILE *in, void *x);
861   -int ASN1_i2d_fp(int (*i2d)(),FILE *out,unsigned char *x);
  917 +int ASN1_i2d_fp(i2d_of_void *i2d,FILE *out,void *x);
  918 +#define ASN1_i2d_fp_of(type,i2d,out,x) \
  919 + ((int (*)(I2D_OF(type),FILE *,type *))openssl_fcast(ASN1_i2d_fp))(i2d,out,x)
  920 +#define ASN1_i2d_fp_of_const(type,i2d,out,x) \
  921 + ((int (*)(I2D_OF_const(type),FILE *,type *))openssl_fcast(ASN1_i2d_fp))(i2d,out,x)
862 922 int ASN1_item_i2d_fp(const ASN1_ITEM *it, FILE *out, void *x);
863 923 int ASN1_STRING_print_ex_fp(FILE *fp, ASN1_STRING *str, unsigned long flags);
864 924 #endif
... ... @@ -866,23 +926,29 @@ int ASN1_STRING_print_ex_fp(FILE *fp, ASN1_STRING *str, unsigned long flags);
866 926 int ASN1_STRING_to_UTF8(unsigned char **out, ASN1_STRING *in);
867 927  
868 928 #ifndef OPENSSL_NO_BIO
869   -char *ASN1_d2i_bio(char *(*xnew)(),char *(*d2i)(),BIO *bp,unsigned char **x);
  929 +void *ASN1_d2i_bio(void *(*xnew)(void), d2i_of_void *d2i, BIO *in, void **x);
  930 +#define ASN1_d2i_bio_of(type,xnew,d2i,in,x) \
  931 + ((type *(*)(type *(*)(void),D2I_OF(type),BIO *,type **))openssl_fcast(ASN1_d2i_bio))(xnew,d2i,in,x)
870 932 void *ASN1_item_d2i_bio(const ASN1_ITEM *it, BIO *in, void *x);
871   -int ASN1_i2d_bio(int (*i2d)(),BIO *out,unsigned char *x);
  933 +int ASN1_i2d_bio(i2d_of_void *i2d,BIO *out, unsigned char *x);
  934 +#define ASN1_i2d_bio_of(type,i2d,out,x) \
  935 + ((int (*)(I2D_OF(type),BIO *,type *))openssl_fcast(ASN1_i2d_bio))(i2d,out,x)
  936 +#define ASN1_i2d_bio_of_const(type,i2d,out,x) \
  937 + ((int (*)(I2D_OF_const(type),BIO *,const type *))openssl_fcast(ASN1_i2d_bio))(i2d,out,x)
872 938 int ASN1_item_i2d_bio(const ASN1_ITEM *it, BIO *out, void *x);
873 939 int ASN1_UTCTIME_print(BIO *fp,ASN1_UTCTIME *a);
874 940 int ASN1_GENERALIZEDTIME_print(BIO *fp,ASN1_GENERALIZEDTIME *a);
875 941 int ASN1_TIME_print(BIO *fp,ASN1_TIME *a);
876 942 int ASN1_STRING_print(BIO *bp,ASN1_STRING *v);
877 943 int ASN1_STRING_print_ex(BIO *out, ASN1_STRING *str, unsigned long flags);
878   -int ASN1_parse(BIO *bp,unsigned char *pp,long len,int indent);
879   -int ASN1_parse_dump(BIO *bp,unsigned char *pp,long len,int indent,int dump);
  944 +int ASN1_parse(BIO *bp,const unsigned char *pp,long len,int indent);
  945 +int ASN1_parse_dump(BIO *bp,const unsigned char *pp,long len,int indent,int dump);
880 946 #endif
881 947 const char *ASN1_tag2str(int tag);
882 948  
883 949 /* Used to load and write netscape format cert/key */
884 950 int i2d_ASN1_HEADER(ASN1_HEADER *a,unsigned char **pp);
885   -ASN1_HEADER *d2i_ASN1_HEADER(ASN1_HEADER **a,unsigned char **pp, long length);
  951 +ASN1_HEADER *d2i_ASN1_HEADER(ASN1_HEADER **a,const unsigned char **pp, long length);
886 952 ASN1_HEADER *ASN1_HEADER_new(void );
887 953 void ASN1_HEADER_free(ASN1_HEADER *a);
888 954  
... ... @@ -903,13 +969,16 @@ int ASN1_TYPE_set_int_octetstring(ASN1_TYPE *a, long num,
903 969 int ASN1_TYPE_get_int_octetstring(ASN1_TYPE *a,long *num,
904 970 unsigned char *data, int max_len);
905 971  
906   -STACK *ASN1_seq_unpack(unsigned char *buf, int len, char *(*d2i)(),
907   - void (*free_func)(void *) );
908   -unsigned char *ASN1_seq_pack(STACK *safes, int (*i2d)(), unsigned char **buf,
909   - int *len );
910   -void *ASN1_unpack_string(ASN1_STRING *oct, char *(*d2i)());
  972 +STACK *ASN1_seq_unpack(const unsigned char *buf, int len,
  973 + d2i_of_void *d2i, void (*free_func)(void *));
  974 +unsigned char *ASN1_seq_pack(STACK *safes, i2d_of_void *i2d,
  975 + unsigned char **buf, int *len );
  976 +void *ASN1_unpack_string(ASN1_STRING *oct, d2i_of_void *d2i);
911 977 void *ASN1_item_unpack(ASN1_STRING *oct, const ASN1_ITEM *it);
912   -ASN1_STRING *ASN1_pack_string(void *obj, int (*i2d)(), ASN1_OCTET_STRING **oct);
  978 +ASN1_STRING *ASN1_pack_string(void *obj, i2d_of_void *i2d,
  979 + ASN1_OCTET_STRING **oct);
  980 +#define ASN1_pack_string_of(type,obj,i2d,oct) \
  981 + ((ASN1_STRING *(*)(type *,I2D_OF(type),ASN1_OCTET_STRING **))openssl_fcast(ASN1_pack_string))(obj,i2d,oct)
913 982 ASN1_STRING *ASN1_item_pack(void *obj, const ASN1_ITEM *it, ASN1_OCTET_STRING **oct);
914 983  
915 984 void ASN1_STRING_set_default_mask(unsigned long mask);
... ... @@ -932,11 +1001,15 @@ void ASN1_STRING_TABLE_cleanup(void);
932 1001 /* Old API compatible functions */
933 1002 ASN1_VALUE *ASN1_item_new(const ASN1_ITEM *it);
934 1003 void ASN1_item_free(ASN1_VALUE *val, const ASN1_ITEM *it);
935   -ASN1_VALUE * ASN1_item_d2i(ASN1_VALUE **val, unsigned char **in, long len, const ASN1_ITEM *it);
  1004 +ASN1_VALUE * ASN1_item_d2i(ASN1_VALUE **val, const unsigned char **in, long len, const ASN1_ITEM *it);
936 1005 int ASN1_item_i2d(ASN1_VALUE *val, unsigned char **out, const ASN1_ITEM *it);
  1006 +int ASN1_item_ndef_i2d(ASN1_VALUE *val, unsigned char **out, const ASN1_ITEM *it);
937 1007  
938 1008 void ASN1_add_oid_module(void);
939 1009  
  1010 +ASN1_TYPE *ASN1_generate_nconf(char *str, CONF *nconf);
  1011 +ASN1_TYPE *ASN1_generate_v3(char *str, X509V3_CTX *cnf);
  1012 +
940 1013 /* BEGIN ERROR CODES */
941 1014 /* The following lines are auto generated by the script mkerr.pl. Any changes
942 1015 * made after this point may be overwritten when the script is next run.
... ... @@ -950,43 +1023,67 @@ void ERR_load_ASN1_strings(void);
950 1023 #define ASN1_F_A2I_ASN1_ENUMERATED 101
951 1024 #define ASN1_F_A2I_ASN1_INTEGER 102
952 1025 #define ASN1_F_A2I_ASN1_STRING 103
  1026 +#define ASN1_F_APPEND_EXP 176
  1027 +#define ASN1_F_ASN1_BIT_STRING_SET_BIT 183
  1028 +#define ASN1_F_ASN1_CB 177
953 1029 #define ASN1_F_ASN1_CHECK_TLEN 104
954 1030 #define ASN1_F_ASN1_COLLATE_PRIMITIVE 105
955 1031 #define ASN1_F_ASN1_COLLECT 106
956   -#define ASN1_F_ASN1_D2I_BIO 107
957 1032 #define ASN1_F_ASN1_D2I_EX_PRIMITIVE 108
958 1033 #define ASN1_F_ASN1_D2I_FP 109
  1034 +#define ASN1_F_ASN1_D2I_READ_BIO 107
  1035 +#define ASN1_F_ASN1_DIGEST 184
959 1036 #define ASN1_F_ASN1_DO_ADB 110
960 1037 #define ASN1_F_ASN1_DUP 111
961 1038 #define ASN1_F_ASN1_ENUMERATED_SET 112
962 1039 #define ASN1_F_ASN1_ENUMERATED_TO_BN 113
  1040 +#define ASN1_F_ASN1_EX_C2I 204
  1041 +#define ASN1_F_ASN1_FIND_END 190
  1042 +#define ASN1_F_ASN1_GENERALIZEDTIME_SET 185
  1043 +#define ASN1_F_ASN1_GENERATE_V3 178
963 1044 #define ASN1_F_ASN1_GET_OBJECT 114
964 1045 #define ASN1_F_ASN1_HEADER_NEW 115
965 1046 #define ASN1_F_ASN1_I2D_BIO 116
966 1047 #define ASN1_F_ASN1_I2D_FP 117
967 1048 #define ASN1_F_ASN1_INTEGER_SET 118
968 1049 #define ASN1_F_ASN1_INTEGER_TO_BN 119
  1050 +#define ASN1_F_ASN1_ITEM_D2I_FP 206
  1051 +#define ASN1_F_ASN1_ITEM_DUP 191
  1052 +#define ASN1_F_ASN1_ITEM_EX_COMBINE_NEW 121
969 1053 #define ASN1_F_ASN1_ITEM_EX_D2I 120
970   -#define ASN1_F_ASN1_ITEM_NEW 121
971   -#define ASN1_F_ASN1_MBSTRING_COPY 122
  1054 +#define ASN1_F_ASN1_ITEM_I2D_BIO 192
  1055 +#define ASN1_F_ASN1_ITEM_I2D_FP 193
  1056 +#define ASN1_F_ASN1_ITEM_PACK 198
  1057 +#define ASN1_F_ASN1_ITEM_SIGN 195
  1058 +#define ASN1_F_ASN1_ITEM_UNPACK 199
  1059 +#define ASN1_F_ASN1_ITEM_VERIFY 197
  1060 +#define ASN1_F_ASN1_MBSTRING_NCOPY 122
972 1061 #define ASN1_F_ASN1_OBJECT_NEW 123
973 1062 #define ASN1_F_ASN1_PACK_STRING 124
974   -#define ASN1_F_ASN1_PBE_SET 125
  1063 +#define ASN1_F_ASN1_PCTX_NEW 205
  1064 +#define ASN1_F_ASN1_PKCS5_PBE_SET 125
975 1065 #define ASN1_F_ASN1_SEQ_PACK 126
976 1066 #define ASN1_F_ASN1_SEQ_UNPACK 127
977 1067 #define ASN1_F_ASN1_SIGN 128
  1068 +#define ASN1_F_ASN1_STR2TYPE 179
  1069 +#define ASN1_F_ASN1_STRING_SET 186
978 1070 #define ASN1_F_ASN1_STRING_TABLE_ADD 129
979 1071 #define ASN1_F_ASN1_STRING_TYPE_NEW 130
980   -#define ASN1_F_ASN1_TEMPLATE_D2I 131
981 1072 #define ASN1_F_ASN1_TEMPLATE_EX_D2I 132
982 1073 #define ASN1_F_ASN1_TEMPLATE_NEW 133
  1074 +#define ASN1_F_ASN1_TEMPLATE_NOEXP_D2I 131
983 1075 #define ASN1_F_ASN1_TIME_SET 175
984 1076 #define ASN1_F_ASN1_TYPE_GET_INT_OCTETSTRING 134
985 1077 #define ASN1_F_ASN1_TYPE_GET_OCTETSTRING 135
986 1078 #define ASN1_F_ASN1_UNPACK_STRING 136
  1079 +#define ASN1_F_ASN1_UTCTIME_SET 187
987 1080 #define ASN1_F_ASN1_VERIFY 137
  1081 +#define ASN1_F_BITSTR_CB 180
988 1082 #define ASN1_F_BN_TO_ASN1_ENUMERATED 138
989 1083 #define ASN1_F_BN_TO_ASN1_INTEGER 139
  1084 +#define ASN1_F_C2I_ASN1_BIT_STRING 189
  1085 +#define ASN1_F_C2I_ASN1_INTEGER 194
  1086 +#define ASN1_F_C2I_ASN1_OBJECT 196
990 1087 #define ASN1_F_COLLECT_DATA 140
991 1088 #define ASN1_F_D2I_ASN1_BIT_STRING 141
992 1089 #define ASN1_F_D2I_ASN1_BOOLEAN 142
... ... @@ -1003,23 +1100,30 @@ void ERR_load_ASN1_strings(void);
1003 1100 #define ASN1_F_D2I_NETSCAPE_RSA_2 153
1004 1101 #define ASN1_F_D2I_PRIVATEKEY 154
1005 1102 #define ASN1_F_D2I_PUBLICKEY 155
  1103 +#define ASN1_F_D2I_RSA_NET 200
  1104 +#define ASN1_F_D2I_RSA_NET_2 201
1006 1105 #define ASN1_F_D2I_X509 156
1007 1106 #define ASN1_F_D2I_X509_CINF 157
1008   -#define ASN1_F_D2I_X509_NAME 158
1009 1107 #define ASN1_F_D2I_X509_PKEY 159
  1108 +#define ASN1_F_I2D_ASN1_SET 188
1010 1109 #define ASN1_F_I2D_ASN1_TIME 160
1011 1110 #define ASN1_F_I2D_DSA_PUBKEY 161
1012   -#define ASN1_F_I2D_NETSCAPE_RSA 162
  1111 +#define ASN1_F_I2D_EC_PUBKEY 181
1013 1112 #define ASN1_F_I2D_PRIVATEKEY 163
1014 1113 #define ASN1_F_I2D_PUBLICKEY 164
  1114 +#define ASN1_F_I2D_RSA_NET 162
1015 1115 #define ASN1_F_I2D_RSA_PUBKEY 165
1016 1116 #define ASN1_F_LONG_C2I 166
1017 1117 #define ASN1_F_OID_MODULE_INIT 174
  1118 +#define ASN1_F_PARSE_TAGGING 182
1018 1119 #define ASN1_F_PKCS5_PBE2_SET 167
  1120 +#define ASN1_F_PKCS5_PBE_SET 202
1019 1121 #define ASN1_F_X509_CINF_NEW 168
1020 1122 #define ASN1_F_X509_CRL_ADD0_REVOKED 169
1021 1123 #define ASN1_F_X509_INFO_NEW 170
1022   -#define ASN1_F_X509_NAME_NEW 171
  1124 +#define ASN1_F_X509_NAME_ENCODE 203
  1125 +#define ASN1_F_X509_NAME_EX_D2I 158
  1126 +#define ASN1_F_X509_NAME_EX_NEW 171
1023 1127 #define ASN1_F_X509_NEW 172
1024 1128 #define ASN1_F_X509_PKEY_NEW 173
1025 1129  
... ... @@ -1037,6 +1141,7 @@ void ERR_load_ASN1_strings(void);
1037 1141 #define ASN1_R_DATA_IS_WRONG 109
1038 1142 #define ASN1_R_DECODE_ERROR 110
1039 1143 #define ASN1_R_DECODING_ERROR 111
  1144 +#define ASN1_R_DEPTH_EXCEEDED 174
1040 1145 #define ASN1_R_ENCODE_ERROR 112
1041 1146 #define ASN1_R_ERROR_GETTING_TIME 173
1042 1147 #define ASN1_R_ERROR_LOADING_SECTION 172
... ... @@ -1051,38 +1156,58 @@ void ERR_load_ASN1_strings(void);
1051 1156 #define ASN1_R_FIELD_MISSING 121
1052 1157 #define ASN1_R_FIRST_NUM_TOO_LARGE 122
1053 1158 #define ASN1_R_HEADER_TOO_LONG 123
  1159 +#define ASN1_R_ILLEGAL_BITSTRING_FORMAT 175
  1160 +#define ASN1_R_ILLEGAL_BOOLEAN 176
1054 1161 #define ASN1_R_ILLEGAL_CHARACTERS 124
  1162 +#define ASN1_R_ILLEGAL_FORMAT 177
  1163 +#define ASN1_R_ILLEGAL_HEX 178
  1164 +#define ASN1_R_ILLEGAL_IMPLICIT_TAG 179
  1165 +#define ASN1_R_ILLEGAL_INTEGER 180
  1166 +#define ASN1_R_ILLEGAL_NESTED_TAGGING 181
1055 1167 #define ASN1_R_ILLEGAL_NULL 125
  1168 +#define ASN1_R_ILLEGAL_NULL_VALUE 182
  1169 +#define ASN1_R_ILLEGAL_OBJECT 183
1056 1170 #define ASN1_R_ILLEGAL_OPTIONAL_ANY 126
1057 1171 #define ASN1_R_ILLEGAL_OPTIONS_ON_ITEM_TEMPLATE 170
1058 1172 #define ASN1_R_ILLEGAL_TAGGED_ANY 127
  1173 +#define ASN1_R_ILLEGAL_TIME_VALUE 184
  1174 +#define ASN1_R_INTEGER_NOT_ASCII_FORMAT 185
1059 1175 #define ASN1_R_INTEGER_TOO_LARGE_FOR_LONG 128
1060 1176 #define ASN1_R_INVALID_BMPSTRING_LENGTH 129
1061 1177 #define ASN1_R_INVALID_DIGIT 130
  1178 +#define ASN1_R_INVALID_MODIFIER 186
  1179 +#define ASN1_R_INVALID_NUMBER 187
1062 1180 #define ASN1_R_INVALID_SEPARATOR 131
1063 1181 #define ASN1_R_INVALID_TIME_FORMAT 132
1064 1182 #define ASN1_R_INVALID_UNIVERSALSTRING_LENGTH 133
1065 1183 #define ASN1_R_INVALID_UTF8STRING 134
1066 1184 #define ASN1_R_IV_TOO_LARGE 135
1067 1185 #define ASN1_R_LENGTH_ERROR 136
  1186 +#define ASN1_R_LIST_ERROR 188
1068 1187 #define ASN1_R_MISSING_EOC 137
1069 1188 #define ASN1_R_MISSING_SECOND_NUMBER 138
  1189 +#define ASN1_R_MISSING_VALUE 189
1070 1190 #define ASN1_R_MSTRING_NOT_UNIVERSAL 139
1071 1191 #define ASN1_R_MSTRING_WRONG_TAG 140
  1192 +#define ASN1_R_NESTED_ASN1_STRING 197
1072 1193 #define ASN1_R_NON_HEX_CHARACTERS 141
  1194 +#define ASN1_R_NOT_ASCII_FORMAT 190
1073 1195 #define ASN1_R_NOT_ENOUGH_DATA 142
1074 1196 #define ASN1_R_NO_MATCHING_CHOICE_TYPE 143
1075 1197 #define ASN1_R_NULL_IS_WRONG_LENGTH 144
  1198 +#define ASN1_R_OBJECT_NOT_ASCII_FORMAT 191
1076 1199 #define ASN1_R_ODD_NUMBER_OF_CHARS 145
1077 1200 #define ASN1_R_PRIVATE_KEY_HEADER_MISSING 146
1078 1201 #define ASN1_R_SECOND_NUMBER_TOO_LARGE 147
1079 1202 #define ASN1_R_SEQUENCE_LENGTH_MISMATCH 148
1080 1203 #define ASN1_R_SEQUENCE_NOT_CONSTRUCTED 149
  1204 +#define ASN1_R_SEQUENCE_OR_SET_NEEDS_CONFIG 192
1081 1205 #define ASN1_R_SHORT_LINE 150
1082 1206 #define ASN1_R_STRING_TOO_LONG 151
1083 1207 #define ASN1_R_STRING_TOO_SHORT 152
1084 1208 #define ASN1_R_TAG_VALUE_TOO_HIGH 153
1085 1209 #define ASN1_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD 154
  1210 +#define ASN1_R_TIME_NOT_ASCII_FORMAT 193
1086 1211 #define ASN1_R_TOO_LONG 155
1087 1212 #define ASN1_R_TYPE_NOT_CONSTRUCTED 156
1088 1213 #define ASN1_R_UNABLE_TO_DECODE_RSA_KEY 157
... ... @@ -1092,10 +1217,13 @@ void ERR_load_ASN1_strings(void);
1092 1217 #define ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM 161
1093 1218 #define ASN1_R_UNKNOWN_OBJECT_TYPE 162
1094 1219 #define ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE 163
  1220 +#define ASN1_R_UNKNOWN_TAG 194
  1221 +#define ASN1_R_UNKOWN_FORMAT 195
1095 1222 #define ASN1_R_UNSUPPORTED_ANY_DEFINED_BY_TYPE 164
1096 1223 #define ASN1_R_UNSUPPORTED_CIPHER 165
1097 1224 #define ASN1_R_UNSUPPORTED_ENCRYPTION_ALGORITHM 166
1098 1225 #define ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE 167
  1226 +#define ASN1_R_UNSUPPORTED_TYPE 196
1099 1227 #define ASN1_R_WRONG_TAG 168
1100 1228 #define ASN1_R_WRONG_TYPE 169
1101 1229  
... ...
third_dev/openssl/include/openssl/asn1_mac.h
... ... @@ -73,11 +73,11 @@ extern &quot;C&quot; {
73 73 ERR_PUT_error(ASN1_MAC_ERR_LIB,(f),(r),__FILE__,(line))
74 74  
75 75 #define M_ASN1_D2I_vars(a,type,func) \
76   - ASN1_CTX c; \
  76 + ASN1_const_CTX c; \
77 77 type ret=NULL; \
78 78 \
79   - c.pp=(unsigned char **)pp; \
80   - c.q= *(unsigned char **)pp; \
  79 + c.pp=(const unsigned char **)pp; \
  80 + c.q= *(const unsigned char **)pp; \
81 81 c.error=ERR_R_NESTED_ASN1_ERROR; \
82 82 if ((a == NULL) || ((*a) == NULL)) \
83 83 { if ((ret=(type)func()) == NULL) \
... ... @@ -85,13 +85,13 @@ extern &quot;C&quot; {
85 85 else ret=(*a);
86 86  
87 87 #define M_ASN1_D2I_Init() \
88   - c.p= *(unsigned char **)pp; \
  88 + c.p= *(const unsigned char **)pp; \
89 89 c.max=(length == 0)?0:(c.p+length);
90 90  
91 91 #define M_ASN1_D2I_Finish_2(a) \
92   - if (!asn1_Finish(&c)) \
  92 + if (!asn1_const_Finish(&c)) \
93 93 { c.line=__LINE__; goto err; } \
94   - *(unsigned char **)pp=c.p; \
  94 + *(const unsigned char **)pp=c.p; \
95 95 if (a != NULL) (*a)=ret; \
96 96 return(ret);
97 97  
... ... @@ -99,7 +99,7 @@ extern &quot;C&quot; {
99 99 M_ASN1_D2I_Finish_2(a); \
100 100 err:\
101 101 ASN1_MAC_H_err((e),c.error,c.line); \
102   - asn1_add_error(*(unsigned char **)pp,(int)(c.q- *pp)); \
  102 + asn1_add_error(*(const unsigned char **)pp,(int)(c.q- *pp)); \
103 103 if ((ret != NULL) && ((a == NULL) || (*a != ret))) func(ret); \
104 104 return(NULL)
105 105  
... ... @@ -123,15 +123,22 @@ err:\
123 123  
124 124 #define M_ASN1_D2I_end_sequence() \
125 125 (((c.inf&1) == 0)?(c.slen <= 0): \
126   - (c.eos=ASN1_check_infinite_end(&c.p,c.slen)))
  126 + (c.eos=ASN1_const_check_infinite_end(&c.p,c.slen)))
127 127  
128 128 /* Don't use this with d2i_ASN1_BOOLEAN() */
129   -#define M_ASN1_D2I_get(b,func) \
  129 +#define M_ASN1_D2I_get(b, func) \
130 130 c.q=c.p; \
131 131 if (func(&(b),&c.p,c.slen) == NULL) \
132 132 {c.line=__LINE__; goto err; } \
133 133 c.slen-=(c.p-c.q);
134 134  
  135 +/* Don't use this with d2i_ASN1_BOOLEAN() */
  136 +#define M_ASN1_D2I_get_x(type,b,func) \
  137 + c.q=c.p; \
  138 + if (((D2I_OF(type))func)(&(b),&c.p,c.slen) == NULL) \
  139 + {c.line=__LINE__; goto err; } \
  140 + c.slen-=(c.p-c.q);
  141 +
135 142 /* use this instead () */
136 143 #define M_ASN1_D2I_get_int(b,func) \
137 144 c.q=c.p; \
... ... @@ -278,7 +285,7 @@ err:\
278 285 { c.line=__LINE__; goto err; } \
279 286 if (Tinf == (V_ASN1_CONSTRUCTED+1)) { \
280 287 Tlen = c.slen - (c.p - c.q); \
281   - if(!ASN1_check_infinite_end(&c.p, Tlen)) \
  288 + if(!ASN1_const_check_infinite_end(&c.p, Tlen)) \
282 289 { c.error=ERR_R_MISSING_ASN1_EOS; \
283 290 c.line=__LINE__; goto err; } \
284 291 }\
... ... @@ -353,8 +360,12 @@ err:\
353 360 return(NULL)
354 361  
355 362  
356   -#define M_ASN1_next (*c.p)
357   -#define M_ASN1_next_prev (*c.q)
  363 +/* BIG UGLY WARNING! This is so damn ugly I wanna puke. Unfortunately,
  364 + some macros that use ASN1_const_CTX still insist on writing in the input
  365 + stream. ARGH! ARGH! ARGH! Let's get rid of this macro package.
  366 + Please? -- Richard Levitte */
  367 +#define M_ASN1_next (*((unsigned char *)(c.p)))
  368 +#define M_ASN1_next_prev (*((unsigned char *)(c.q)))
358 369  
359 370 /*************************************************/
360 371  
... ... @@ -551,8 +562,8 @@ err:\
551 562 #define M_ASN1_I2D_finish() *pp=p; \
552 563 return(r);
553 564  
554   -int asn1_GetSequence(ASN1_CTX *c, long *length);
555   -void asn1_add_error(unsigned char *address,int offset);
  565 +int asn1_GetSequence(ASN1_const_CTX *c, long *length);
  566 +void asn1_add_error(const unsigned char *address,int offset);
556 567 #ifdef __cplusplus
557 568 }
558 569 #endif
... ...
third_dev/openssl/include/openssl/asn1t.h
... ... @@ -112,7 +112,7 @@ extern &quot;C&quot; {
112 112 /* Macros to aid ASN1 template writing */
113 113  
114 114 #define ASN1_ITEM_TEMPLATE(tname) \
115   - const static ASN1_TEMPLATE tname##_item_tt
  115 + static const ASN1_TEMPLATE tname##_item_tt
116 116  
117 117 #define ASN1_ITEM_TEMPLATE_END(tname) \
118 118 ;\
... ... @@ -150,7 +150,7 @@ extern &quot;C&quot; {
150 150 */
151 151  
152 152 #define ASN1_SEQUENCE(tname) \
153   - const static ASN1_TEMPLATE tname##_seq_tt[]
  153 + static const ASN1_TEMPLATE tname##_seq_tt[]
154 154  
155 155 #define ASN1_SEQUENCE_END(stname) ASN1_SEQUENCE_END_name(stname, stname)
156 156  
... ... @@ -166,22 +166,37 @@ extern &quot;C&quot; {
166 166 #stname \
167 167 ASN1_ITEM_end(tname)
168 168  
  169 +#define ASN1_NDEF_SEQUENCE(tname) \
  170 + ASN1_SEQUENCE(tname)
  171 +
169 172 #define ASN1_SEQUENCE_cb(tname, cb) \
170   - const static ASN1_AUX tname##_aux = {NULL, 0, 0, 0, cb, 0}; \
  173 + static const ASN1_AUX tname##_aux = {NULL, 0, 0, 0, cb, 0}; \
171 174 ASN1_SEQUENCE(tname)
172 175  
173 176 #define ASN1_BROKEN_SEQUENCE(tname) \
174   - const static ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_BROKEN, 0, 0, 0, 0}; \
  177 + static const ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_BROKEN, 0, 0, 0, 0}; \
175 178 ASN1_SEQUENCE(tname)
176 179  
177 180 #define ASN1_SEQUENCE_ref(tname, cb, lck) \
178   - const static ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_REFCOUNT, offsetof(tname, references), lck, cb, 0}; \
  181 + static const ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_REFCOUNT, offsetof(tname, references), lck, cb, 0}; \
179 182 ASN1_SEQUENCE(tname)
180 183  
181 184 #define ASN1_SEQUENCE_enc(tname, enc, cb) \
182   - const static ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_ENCODING, 0, 0, cb, offsetof(tname, enc)}; \
  185 + static const ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_ENCODING, 0, 0, cb, offsetof(tname, enc)}; \
183 186 ASN1_SEQUENCE(tname)
184 187  
  188 +#define ASN1_NDEF_SEQUENCE_END(tname) \
  189 + ;\
  190 + ASN1_ITEM_start(tname) \
  191 + ASN1_ITYPE_NDEF_SEQUENCE,\
  192 + V_ASN1_SEQUENCE,\
  193 + tname##_seq_tt,\
  194 + sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\
  195 + NULL,\
  196 + sizeof(tname),\
  197 + #tname \
  198 + ASN1_ITEM_end(tname)
  199 +
185 200 #define ASN1_BROKEN_SEQUENCE_END(stname) ASN1_SEQUENCE_END_ref(stname, stname)
186 201  
187 202 #define ASN1_SEQUENCE_END_enc(stname, tname) ASN1_SEQUENCE_END_ref(stname, tname)
... ... @@ -224,10 +239,10 @@ extern &quot;C&quot; {
224 239 */
225 240  
226 241 #define ASN1_CHOICE(tname) \
227   - const static ASN1_TEMPLATE tname##_ch_tt[]
  242 + static const ASN1_TEMPLATE tname##_ch_tt[]
228 243  
229 244 #define ASN1_CHOICE_cb(tname, cb) \
230   - const static ASN1_AUX tname##_aux = {NULL, 0, 0, 0, cb, 0}; \
  245 + static const ASN1_AUX tname##_aux = {NULL, 0, 0, 0, cb, 0}; \
231 246 ASN1_CHOICE(tname)
232 247  
233 248 #define ASN1_CHOICE_END(stname) ASN1_CHOICE_END_name(stname, stname)
... ... @@ -353,16 +368,20 @@ extern &quot;C&quot; {
353 368 #define ASN1_EXP_SEQUENCE_OF_OPT(stname, field, type, tag) \
354 369 ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF|ASN1_TFLG_OPTIONAL)
355 370  
  371 +/* EXPLICIT OPTIONAL using indefinite length constructed form */
  372 +#define ASN1_NDEF_EXP_OPT(stname, field, type, tag) \
  373 + ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL|ASN1_TFLG_NDEF)
  374 +
356 375 /* Macros for the ASN1_ADB structure */
357 376  
358 377 #define ASN1_ADB(name) \
359   - const static ASN1_ADB_TABLE name##_adbtbl[]
  378 + static const ASN1_ADB_TABLE name##_adbtbl[]
360 379  
361 380 #ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION
362 381  
363 382 #define ASN1_ADB_END(name, flags, field, app_table, def, none) \
364 383 ;\
365   - const static ASN1_ADB name##_adb = {\
  384 + static const ASN1_ADB name##_adb = {\
366 385 flags,\
367 386 offsetof(name, field),\
368 387 app_table,\
... ... @@ -376,9 +395,9 @@ extern &quot;C&quot; {
376 395  
377 396 #define ASN1_ADB_END(name, flags, field, app_table, def, none) \
378 397 ;\
379   - const static ASN1_ITEM *name##_adb(void) \
  398 + static const ASN1_ITEM *name##_adb(void) \
380 399 { \
381   - const static ASN1_ADB internal_adb = \
  400 + static const ASN1_ADB internal_adb = \
382 401 {\
383 402 flags,\
384 403 offsetof(name, field),\
... ... @@ -397,7 +416,7 @@ extern &quot;C&quot; {
397 416 #define ADB_ENTRY(val, template) {val, template}
398 417  
399 418 #define ASN1_ADB_TEMPLATE(name) \
400   - const static ASN1_TEMPLATE name##_tt
  419 + static const ASN1_TEMPLATE name##_tt
401 420  
402 421 /* This is the ASN1 template structure that defines
403 422 * a wrapper round the actual type. It determines the
... ... @@ -410,7 +429,7 @@ unsigned long flags; /* Various flags */
410 429 long tag; /* tag, not used if no tagging */
411 430 unsigned long offset; /* Offset of this field in structure */
412 431 #ifndef NO_ASN1_FIELD_NAMES
413   -char *field_name; /* Field name */
  432 +const char *field_name; /* Field name */
414 433 #endif
415 434 ASN1_ITEM_EXP *item; /* Relevant ASN1_ITEM or ASN1_ADB */
416 435 };
... ... @@ -518,6 +537,13 @@ struct ASN1_ADB_TABLE_st {
518 537  
519 538 #define ASN1_TFLG_COMBINE (0x1<<10)
520 539  
  540 +/* This flag when present in a SEQUENCE OF, SET OF
  541 + * or EXPLICIT causes indefinite length constructed
  542 + * encoding to be used if required.
  543 + */
  544 +
  545 +#define ASN1_TFLG_NDEF (0x1<<11)
  546 +
521 547 /* This is the actual ASN1 item itself */
522 548  
523 549 struct ASN1_ITEM_st {
... ... @@ -570,19 +596,25 @@ const char *sname; /* Structure name */
570 596 * has a special meaning, it is used as a mask
571 597 * of acceptable types using the B_ASN1 constants.
572 598 *
  599 + * NDEF_SEQUENCE is the same as SEQUENCE except
  600 + * that it will use indefinite length constructed
  601 + * encoding if requested.
  602 + *
573 603 */
574 604  
575   -#define ASN1_ITYPE_PRIMITIVE 0x0
  605 +#define ASN1_ITYPE_PRIMITIVE 0x0
  606 +
  607 +#define ASN1_ITYPE_SEQUENCE 0x1
576 608  
577   -#define ASN1_ITYPE_SEQUENCE 0x1
  609 +#define ASN1_ITYPE_CHOICE 0x2
578 610  
579   -#define ASN1_ITYPE_CHOICE 0x2
  611 +#define ASN1_ITYPE_COMPAT 0x3
580 612  
581   -#define ASN1_ITYPE_COMPAT 0x3
  613 +#define ASN1_ITYPE_EXTERN 0x4
582 614  
583   -#define ASN1_ITYPE_EXTERN 0x4
  615 +#define ASN1_ITYPE_MSTRING 0x5
584 616  
585   -#define ASN1_ITYPE_MSTRING 0x5
  617 +#define ASN1_ITYPE_NDEF_SEQUENCE 0x6
586 618  
587 619 /* Cache for ASN1 tag and length, so we
588 620 * don't keep re-reading it for things
... ... @@ -602,10 +634,10 @@ struct ASN1_TLC_st{
602 634  
603 635 typedef ASN1_VALUE * ASN1_new_func(void);
604 636 typedef void ASN1_free_func(ASN1_VALUE *a);
605   -typedef ASN1_VALUE * ASN1_d2i_func(ASN1_VALUE **a, unsigned char ** in, long length);
  637 +typedef ASN1_VALUE * ASN1_d2i_func(ASN1_VALUE **a, const unsigned char ** in, long length);
606 638 typedef int ASN1_i2d_func(ASN1_VALUE * a, unsigned char **in);
607 639  
608   -typedef int ASN1_ex_d2i(ASN1_VALUE **pval, unsigned char **in, long len, const ASN1_ITEM *it,
  640 +typedef int ASN1_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len, const ASN1_ITEM *it,
609 641 int tag, int aclass, char opt, ASN1_TLC *ctx);
610 642  
611 643 typedef int ASN1_ex_i2d(ASN1_VALUE **pval, unsigned char **out, const ASN1_ITEM *it, int tag, int aclass);
... ... @@ -613,7 +645,7 @@ typedef int ASN1_ex_new_func(ASN1_VALUE **pval, const ASN1_ITEM *it);
613 645 typedef void ASN1_ex_free_func(ASN1_VALUE **pval, const ASN1_ITEM *it);
614 646  
615 647 typedef int ASN1_primitive_i2c(ASN1_VALUE **pval, unsigned char *cont, int *putype, const ASN1_ITEM *it);
616   -typedef int ASN1_primitive_c2i(ASN1_VALUE **pval, unsigned char *cont, int len, int utype, char *free_cont, const ASN1_ITEM *it);
  648 +typedef int ASN1_primitive_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len, int utype, char *free_cont, const ASN1_ITEM *it);
617 649  
618 650 typedef struct ASN1_COMPAT_FUNCS_st {
619 651 ASN1_new_func *asn1_new;
... ... @@ -743,6 +775,9 @@ typedef struct ASN1_AUX_st {
743 775 #define IMPLEMENT_ASN1_FUNCTIONS_ENCODE_name(stname, itname) \
744 776 IMPLEMENT_ASN1_FUNCTIONS_ENCODE_fname(stname, itname, itname)
745 777  
  778 +#define IMPLEMENT_ASN1_ALLOC_FUNCTIONS(stname) \
  779 + IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, stname, stname)
  780 +
746 781 #define IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, itname, fname) \
747 782 stname *fname##_new(void) \
748 783 { \
... ... @@ -758,7 +793,7 @@ typedef struct ASN1_AUX_st {
758 793 IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, itname, fname)
759 794  
760 795 #define IMPLEMENT_ASN1_ENCODE_FUNCTIONS_fname(stname, itname, fname) \
761   - stname *d2i_##fname(stname **a, unsigned char **in, long len) \
  796 + stname *d2i_##fname(stname **a, const unsigned char **in, long len) \
762 797 { \
763 798 return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, ASN1_ITEM_rptr(itname));\
764 799 } \
... ... @@ -767,13 +802,19 @@ typedef struct ASN1_AUX_st {
767 802 return ASN1_item_i2d((ASN1_VALUE *)a, out, ASN1_ITEM_rptr(itname));\
768 803 }
769 804  
  805 +#define IMPLEMENT_ASN1_NDEF_FUNCTION(stname) \
  806 + int i2d_##stname##_NDEF(stname *a, unsigned char **out) \
  807 + { \
  808 + return ASN1_item_ndef_i2d((ASN1_VALUE *)a, out, ASN1_ITEM_rptr(stname));\
  809 + }
  810 +
770 811 /* This includes evil casts to remove const: they will go away when full
771 812 * ASN1 constification is done.
772 813 */
773 814 #define IMPLEMENT_ASN1_ENCODE_FUNCTIONS_const_fname(stname, itname, fname) \
774 815 stname *d2i_##fname(stname **a, const unsigned char **in, long len) \
775 816 { \
776   - return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, (unsigned char **)in, len, ASN1_ITEM_rptr(itname));\
  817 + return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, ASN1_ITEM_rptr(itname));\
777 818 } \
778 819 int i2d_##fname(const stname *a, unsigned char **out) \
779 820 { \
... ... @@ -798,7 +839,6 @@ typedef struct ASN1_AUX_st {
798 839 DECLARE_ASN1_ITEM(ASN1_BOOLEAN)
799 840 DECLARE_ASN1_ITEM(ASN1_TBOOLEAN)
800 841 DECLARE_ASN1_ITEM(ASN1_FBOOLEAN)
801   -DECLARE_ASN1_ITEM(ASN1_ANY)
802 842 DECLARE_ASN1_ITEM(ASN1_SEQUENCE)
803 843 DECLARE_ASN1_ITEM(CBIGNUM)
804 844 DECLARE_ASN1_ITEM(BIGNUM)
... ... @@ -815,8 +855,8 @@ int ASN1_template_new(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt);
815 855 int ASN1_primitive_new(ASN1_VALUE **pval, const ASN1_ITEM *it);
816 856  
817 857 void ASN1_template_free(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt);
818   -int ASN1_template_d2i(ASN1_VALUE **pval, unsigned char **in, long len, const ASN1_TEMPLATE *tt);
819   -int ASN1_item_ex_d2i(ASN1_VALUE **pval, unsigned char **in, long len, const ASN1_ITEM *it,
  858 +int ASN1_template_d2i(ASN1_VALUE **pval, const unsigned char **in, long len, const ASN1_TEMPLATE *tt);
  859 +int ASN1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len, const ASN1_ITEM *it,
820 860 int tag, int aclass, char opt, ASN1_TLC *ctx);
821 861  
822 862 int ASN1_item_ex_i2d(ASN1_VALUE **pval, unsigned char **out, const ASN1_ITEM *it, int tag, int aclass);
... ... @@ -824,7 +864,7 @@ int ASN1_template_i2d(ASN1_VALUE **pval, unsigned char **out, const ASN1_TEMPLAT
824 864 void ASN1_primitive_free(ASN1_VALUE **pval, const ASN1_ITEM *it);
825 865  
826 866 int asn1_ex_i2c(ASN1_VALUE **pval, unsigned char *cont, int *putype, const ASN1_ITEM *it);
827   -int asn1_ex_c2i(ASN1_VALUE **pval, unsigned char *cont, int len, int utype, char *free_cont, const ASN1_ITEM *it);
  867 +int asn1_ex_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len, int utype, char *free_cont, const ASN1_ITEM *it);
828 868  
829 869 int asn1_get_choice_selector(ASN1_VALUE **pval, const ASN1_ITEM *it);
830 870 int asn1_set_choice_selector(ASN1_VALUE **pval, int value, const ASN1_ITEM *it);
... ... @@ -838,7 +878,7 @@ int asn1_do_lock(ASN1_VALUE **pval, int op, const ASN1_ITEM *it);
838 878 void asn1_enc_init(ASN1_VALUE **pval, const ASN1_ITEM *it);
839 879 void asn1_enc_free(ASN1_VALUE **pval, const ASN1_ITEM *it);
840 880 int asn1_enc_restore(int *len, unsigned char **out, ASN1_VALUE **pval, const ASN1_ITEM *it);
841   -int asn1_enc_save(ASN1_VALUE **pval, unsigned char *in, int inlen, const ASN1_ITEM *it);
  881 +int asn1_enc_save(ASN1_VALUE **pval, const unsigned char *in, int inlen, const ASN1_ITEM *it);
842 882  
843 883 #ifdef __cplusplus
844 884 }
... ...
third_dev/openssl/include/openssl/bio.h
... ... @@ -59,13 +59,14 @@
59 59 #ifndef HEADER_BIO_H
60 60 #define HEADER_BIO_H
61 61  
  62 +#include <openssl/e_os2.h>
  63 +
62 64 #ifndef OPENSSL_NO_FP_API
63 65 # include <stdio.h>
64 66 #endif
65 67 #include <stdarg.h>
66 68  
67 69 #include <openssl/crypto.h>
68   -#include <openssl/e_os2.h>
69 70  
70 71 #ifdef __cplusplus
71 72 extern "C" {
... ... @@ -93,6 +94,7 @@ extern &quot;C&quot; {
93 94 #define BIO_TYPE_BER (18|0x0200) /* BER -> bin filter */
94 95 #define BIO_TYPE_BIO (19|0x0400) /* (half a) BIO pair */
95 96 #define BIO_TYPE_LINEBUFFER (20|0x0200) /* filter */
  97 +#define BIO_TYPE_DGRAM (21|0x0400|0x0100)
96 98  
97 99 #define BIO_TYPE_DESCRIPTOR 0x0100 /* socket, fd, connect or accept */
98 100 #define BIO_TYPE_FILTER 0x0200
... ... @@ -124,6 +126,38 @@ extern &quot;C&quot; {
124 126  
125 127 #define BIO_CTRL_SET_FILENAME 30 /* BIO_s_file special */
126 128  
  129 +/* dgram BIO stuff */
  130 +#define BIO_CTRL_DGRAM_CONNECT 31 /* BIO dgram special */
  131 +#define BIO_CTRL_DGRAM_SET_CONNECTED 32 /* allow for an externally
  132 + * connected socket to be
  133 + * passed in */
  134 +#define BIO_CTRL_DGRAM_SET_RECV_TIMEOUT 33 /* setsockopt, essentially */
  135 +#define BIO_CTRL_DGRAM_GET_RECV_TIMEOUT 34 /* getsockopt, essentially */
  136 +#define BIO_CTRL_DGRAM_SET_SEND_TIMEOUT 35 /* setsockopt, essentially */
  137 +#define BIO_CTRL_DGRAM_GET_SEND_TIMEOUT 36 /* getsockopt, essentially */
  138 +
  139 +#define BIO_CTRL_DGRAM_GET_RECV_TIMER_EXP 37 /* flag whether the last */
  140 +#define BIO_CTRL_DGRAM_GET_SEND_TIMER_EXP 38 /* I/O operation tiemd out */
  141 +
  142 +/* #ifdef IP_MTU_DISCOVER */
  143 +#define BIO_CTRL_DGRAM_MTU_DISCOVER 39 /* set DF bit on egress packets */
  144 +/* #endif */
  145 +
  146 +#define BIO_CTRL_DGRAM_QUERY_MTU 40 /* as kernel for current MTU */
  147 +#define BIO_CTRL_DGRAM_GET_MTU 41 /* get cached value for MTU */
  148 +#define BIO_CTRL_DGRAM_SET_MTU 42 /* set cached value for
  149 + * MTU. want to use this
  150 + * if asking the kernel
  151 + * fails */
  152 +
  153 +#define BIO_CTRL_DGRAM_MTU_EXCEEDED 43 /* check whether the MTU
  154 + * was exceed in the
  155 + * previous write
  156 + * operation */
  157 +
  158 +#define BIO_CTRL_DGRAM_SET_PEER 44 /* Destination for the data */
  159 +
  160 +
127 161 /* modifiers */
128 162 #define BIO_FP_READ 0x02
129 163 #define BIO_FP_WRITE 0x04
... ... @@ -135,6 +169,11 @@ extern &quot;C&quot; {
135 169 #define BIO_FLAGS_IO_SPECIAL 0x04
136 170 #define BIO_FLAGS_RWS (BIO_FLAGS_READ|BIO_FLAGS_WRITE|BIO_FLAGS_IO_SPECIAL)
137 171 #define BIO_FLAGS_SHOULD_RETRY 0x08
  172 +#ifndef BIO_FLAGS_UPLINK
  173 +/* "UPLINK" flag denotes file descriptors provided by application.
  174 + It defaults to 0, as most platforms don't require UPLINK interface. */
  175 +#define BIO_FLAGS_UPLINK 0
  176 +#endif
138 177  
139 178 /* Used in BIO_gethostbyname() */
140 179 #define BIO_GHBN_CTRL_HITS 1
... ... @@ -487,6 +526,18 @@ size_t BIO_ctrl_get_write_guarantee(BIO *b);
487 526 size_t BIO_ctrl_get_read_request(BIO *b);
488 527 int BIO_ctrl_reset_read_request(BIO *b);
489 528  
  529 +/* ctrl macros for dgram */
  530 +#define BIO_ctrl_dgram_connect(b,peer) \
  531 + (int)BIO_ctrl(b,BIO_CTRL_DGRAM_CONNECT,0, (char *)peer)
  532 +#define BIO_ctrl_set_connected(b, state, peer) \
  533 + (int)BIO_ctrl(b, BIO_CTRL_DGRAM_SET_CONNECTED, state, (char *)peer)
  534 +#define BIO_dgram_recv_timedout(b) \
  535 + (int)BIO_ctrl(b, BIO_CTRL_DGRAM_GET_RECV_TIMER_EXP, 0, NULL)
  536 +#define BIO_dgram_send_timedout(b) \
  537 + (int)BIO_ctrl(b, BIO_CTRL_DGRAM_GET_SEND_TIMER_EXP, 0, NULL)
  538 +#define BIO_dgram_set_peer(b,peer) \
  539 + (int)BIO_ctrl(b, BIO_CTRL_DGRAM_SET_PEER, 0, (char *)peer)
  540 +
490 541 /* These two aren't currently implemented */
491 542 /* int BIO_get_ex_num(BIO *bio); */
492 543 /* void BIO_set_ex_free_func(BIO *bio,int idx,void (*cb)()); */
... ... @@ -566,15 +617,28 @@ BIO_METHOD *BIO_f_buffer(void);
566 617 BIO_METHOD *BIO_f_linebuffer(void);
567 618 #endif
568 619 BIO_METHOD *BIO_f_nbio_test(void);
  620 +#ifndef OPENSSL_NO_DGRAM
  621 +BIO_METHOD *BIO_s_datagram(void);
  622 +#endif
  623 +
569 624 /* BIO_METHOD *BIO_f_ber(void); */
570 625  
571 626 int BIO_sock_should_retry(int i);
572 627 int BIO_sock_non_fatal_error(int error);
  628 +int BIO_dgram_non_fatal_error(int error);
  629 +
573 630 int BIO_fd_should_retry(int i);
574 631 int BIO_fd_non_fatal_error(int error);
  632 +int BIO_dump_cb(int (*cb)(const void *data, size_t len, void *u),
  633 + void *u, const char *s, int len);
  634 +int BIO_dump_indent_cb(int (*cb)(const void *data, size_t len, void *u),
  635 + void *u, const char *s, int len, int indent);
575 636 int BIO_dump(BIO *b,const char *bytes,int len);
576 637 int BIO_dump_indent(BIO *b,const char *bytes,int len,int indent);
577   -
  638 +#ifndef OPENSSL_NO_FP_API
  639 +int BIO_dump_fp(FILE *fp, const char *s, int len);
  640 +int BIO_dump_indent_fp(FILE *fp, const char *s, int len, int indent);
  641 +#endif
578 642 struct hostent *BIO_gethostbyname(const char *name);
579 643 /* We might want a thread-safe interface too:
580 644 * struct hostent *BIO_gethostbyname_r(const char *name,
... ... @@ -596,6 +660,7 @@ void BIO_sock_cleanup(void);
596 660 int BIO_set_tcp_ndelay(int sock,int turn_on);
597 661  
598 662 BIO *BIO_new_socket(int sock, int close_flag);
  663 +BIO *BIO_new_dgram(int fd, int close_flag);
599 664 BIO *BIO_new_fd(int fd, int close_flag);
600 665 BIO *BIO_new_connect(char *host_port);
601 666 BIO *BIO_new_accept(char *host_port);
... ... @@ -611,10 +676,20 @@ void BIO_copy_next_retry(BIO *b);
611 676  
612 677 /*long BIO_ghbn_ctrl(int cmd,int iarg,char *parg);*/
613 678  
614   -int BIO_printf(BIO *bio, const char *format, ...);
615   -int BIO_vprintf(BIO *bio, const char *format, va_list args);
616   -int BIO_snprintf(char *buf, size_t n, const char *format, ...);
617   -int BIO_vsnprintf(char *buf, size_t n, const char *format, va_list args);
  679 +#ifdef __GNUC__
  680 +# define __bio_h__attr__ __attribute__
  681 +#else
  682 +# define __bio_h__attr__(x)
  683 +#endif
  684 +int BIO_printf(BIO *bio, const char *format, ...)
  685 + __bio_h__attr__((__format__(__printf__,2,3)));
  686 +int BIO_vprintf(BIO *bio, const char *format, va_list args)
  687 + __bio_h__attr__((__format__(__printf__,2,0)));
  688 +int BIO_snprintf(char *buf, size_t n, const char *format, ...)
  689 + __bio_h__attr__((__format__(__printf__,3,4)));
  690 +int BIO_vsnprintf(char *buf, size_t n, const char *format, va_list args)
  691 + __bio_h__attr__((__format__(__printf__,3,0)));
  692 +#undef __bio_h__attr__
618 693  
619 694 /* BEGIN ERROR CODES */
620 695 /* The following lines are auto generated by the script mkerr.pl. Any changes
... ... @@ -628,6 +703,7 @@ void ERR_load_BIO_strings(void);
628 703 #define BIO_F_ACPT_STATE 100
629 704 #define BIO_F_BIO_ACCEPT 101
630 705 #define BIO_F_BIO_BER_GET_HEADER 102
  706 +#define BIO_F_BIO_CALLBACK_CTRL 131
631 707 #define BIO_F_BIO_CTRL 103
632 708 #define BIO_F_BIO_GETHOSTBYNAME 120
633 709 #define BIO_F_BIO_GETS 104
... ...
third_dev/openssl/include/openssl/bn.h
... ... @@ -55,6 +55,19 @@
55 55 * copied and put under another distribution licence
56 56 * [including the GNU Public Licence.]
57 57 */
  58 +/* ====================================================================
  59 + * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
  60 + *
  61 + * Portions of the attached software ("Contribution") are developed by
  62 + * SUN MICROSYSTEMS, INC., and are contributed to the OpenSSL project.
  63 + *
  64 + * The Contribution is licensed pursuant to the Eric Young open source
  65 + * license provided above.
  66 + *
  67 + * The binary polynomial arithmetic software is originally written by
  68 + * Sheueling Chang Shantz and Douglas Stebila of Sun Microsystems Laboratories.
  69 + *
  70 + */
58 71  
59 72 #ifndef HEADER_BN_H
60 73 #define HEADER_BN_H
... ... @@ -63,14 +76,23 @@
63 76 #ifndef OPENSSL_NO_FP_API
64 77 #include <stdio.h> /* FILE */
65 78 #endif
  79 +#include <openssl/ossl_typ.h>
66 80  
67 81 #ifdef __cplusplus
68 82 extern "C" {
69 83 #endif
70 84  
71   -#ifdef OPENSSL_SYS_VMS
72   -#undef BN_LLONG /* experimental, so far... */
73   -#endif
  85 +/* These preprocessor symbols control various aspects of the bignum headers and
  86 + * library code. They're not defined by any "normal" configuration, as they are
  87 + * intended for development and testing purposes. NB: defining all three can be
  88 + * useful for debugging application code as well as openssl itself.
  89 + *
  90 + * BN_DEBUG - turn on various debugging alterations to the bignum code
  91 + * BN_DEBUG_RAND - uses random poisoning of unused words to trip up
  92 + * mismanagement of bignum internals. You must also define BN_DEBUG.
  93 + */
  94 +/* #define BN_DEBUG */
  95 +/* #define BN_DEBUG_RAND */
74 96  
75 97 #define BN_MUL_COMBA
76 98 #define BN_SQR_COMBA
... ... @@ -143,10 +165,12 @@ extern &quot;C&quot; {
143 165 #endif
144 166  
145 167 #ifdef THIRTY_TWO_BIT
146   -#if defined(OPENSSL_SYS_WIN32) && !defined(__GNUC__)
147   -#define BN_ULLONG unsigned _int64
148   -#else
149   -#define BN_ULLONG unsigned long long
  168 +#ifdef BN_LLONG
  169 +# if defined(OPENSSL_SYS_WIN32) && !defined(__GNUC__)
  170 +# define BN_ULLONG unsigned __int64
  171 +# else
  172 +# define BN_ULLONG unsigned long long
  173 +# endif
150 174 #endif
151 175 #define BN_ULONG unsigned long
152 176 #define BN_LONG long
... ... @@ -219,17 +243,39 @@ extern &quot;C&quot; {
219 243  
220 244 #define BN_DEFAULT_BITS 1280
221 245  
222   -#ifdef BIGNUM
223   -#undef BIGNUM
224   -#endif
225   -
226 246 #define BN_FLG_MALLOCED 0x01
227 247 #define BN_FLG_STATIC_DATA 0x02
  248 +#define BN_FLG_EXP_CONSTTIME 0x04 /* avoid leaking exponent information through timings
  249 + * (BN_mod_exp_mont() will call BN_mod_exp_mont_consttime) */
  250 +#ifndef OPENSSL_NO_DEPRECATED
228 251 #define BN_FLG_FREE 0x8000 /* used for debuging */
  252 +#endif
229 253 #define BN_set_flags(b,n) ((b)->flags|=(n))
230 254 #define BN_get_flags(b,n) ((b)->flags&(n))
231 255  
232   -typedef struct bignum_st
  256 +/* get a clone of a BIGNUM with changed flags, for *temporary* use only
  257 + * (the two BIGNUMs cannot not be used in parallel!) */
  258 +#define BN_with_flags(dest,b,n) ((dest)->d=(b)->d, \
  259 + (dest)->top=(b)->top, \
  260 + (dest)->dmax=(b)->dmax, \
  261 + (dest)->neg=(b)->neg, \
  262 + (dest)->flags=(((dest)->flags & BN_FLG_MALLOCED) \
  263 + | ((b)->flags & ~BN_FLG_MALLOCED) \
  264 + | BN_FLG_STATIC_DATA \
  265 + | (n)))
  266 +
  267 +/* Already declared in ossl_typ.h */
  268 +#if 0
  269 +typedef struct bignum_st BIGNUM;
  270 +/* Used for temp variables (declaration hidden in bn_lcl.h) */
  271 +typedef struct bignum_ctx BN_CTX;
  272 +typedef struct bn_blinding_st BN_BLINDING;
  273 +typedef struct bn_mont_ctx_st BN_MONT_CTX;
  274 +typedef struct bn_recp_ctx_st BN_RECP_CTX;
  275 +typedef struct bn_gencb_st BN_GENCB;
  276 +#endif
  277 +
  278 +struct bignum_st
233 279 {
234 280 BN_ULONG *d; /* Pointer to an array of 'BN_BITS2' bit chunks. */
235 281 int top; /* Index of last used d +1. */
... ... @@ -237,23 +283,10 @@ typedef struct bignum_st
237 283 int dmax; /* Size of the d array. */
238 284 int neg; /* one if the number is negative */
239 285 int flags;
240   - } BIGNUM;
241   -
242   -/* Used for temp variables (declaration hidden in bn_lcl.h) */
243   -typedef struct bignum_ctx BN_CTX;
244   -
245   -typedef struct bn_blinding_st
246   - {
247   - int init;
248   - BIGNUM *A;
249   - BIGNUM *Ai;
250   - BIGNUM *mod; /* just a reference */
251   - unsigned long thread_id; /* added in OpenSSL 0.9.6j and 0.9.7b;
252   - * used only by crypto/rsa/rsa_eay.c, rsa_lib.c */
253   - } BN_BLINDING;
  286 + };
254 287  
255 288 /* Used for montgomery multiplication */
256   -typedef struct bn_mont_ctx_st
  289 +struct bn_mont_ctx_st
257 290 {
258 291 int ri; /* number of bits in R */
259 292 BIGNUM RR; /* used to convert to montgomery form */
... ... @@ -262,19 +295,47 @@ typedef struct bn_mont_ctx_st
262 295 * (Ni is only stored for bignum algorithm) */
263 296 BN_ULONG n0; /* least significant word of Ni */
264 297 int flags;
265   - } BN_MONT_CTX;
  298 + };
266 299  
267 300 /* Used for reciprocal division/mod functions
268 301 * It cannot be shared between threads
269 302 */
270   -typedef struct bn_recp_ctx_st
  303 +struct bn_recp_ctx_st
271 304 {
272 305 BIGNUM N; /* the divisor */
273 306 BIGNUM Nr; /* the reciprocal */
274 307 int num_bits;
275 308 int shift;
276 309 int flags;
277   - } BN_RECP_CTX;
  310 + };
  311 +
  312 +/* Used for slow "generation" functions. */
  313 +struct bn_gencb_st
  314 + {
  315 + unsigned int ver; /* To handle binary (in)compatibility */
  316 + void *arg; /* callback-specific data */
  317 + union
  318 + {
  319 + /* if(ver==1) - handles old style callbacks */
  320 + void (*cb_1)(int, int, void *);
  321 + /* if(ver==2) - new callback style */
  322 + int (*cb_2)(int, int, BN_GENCB *);
  323 + } cb;
  324 + };
  325 +/* Wrapper function to make using BN_GENCB easier, */
  326 +int BN_GENCB_call(BN_GENCB *cb, int a, int b);
  327 +/* Macro to populate a BN_GENCB structure with an "old"-style callback */
  328 +#define BN_GENCB_set_old(gencb, callback, cb_arg) { \
  329 + BN_GENCB *tmp_gencb = (gencb); \
  330 + tmp_gencb->ver = 1; \
  331 + tmp_gencb->arg = (cb_arg); \
  332 + tmp_gencb->cb.cb_1 = (callback); }
  333 +/* Macro to populate a BN_GENCB structure with a "new"-style callback */
  334 +#define BN_GENCB_set(gencb, callback, cb_arg) { \
  335 + BN_GENCB *tmp_gencb = (gencb); \
  336 + tmp_gencb->ver = 2; \
  337 + tmp_gencb->arg = (cb_arg); \
  338 + tmp_gencb->cb.cb_2 = (callback); }
278 339  
279 340 #define BN_prime_checks 0 /* default: select number of iterations
280 341 based on the size of the number */
... ... @@ -299,24 +360,33 @@ typedef struct bn_recp_ctx_st
299 360  
300 361 #define BN_num_bytes(a) ((BN_num_bits(a)+7)/8)
301 362  
302   -/* Note that BN_abs_is_word does not work reliably for w == 0 */
303   -#define BN_abs_is_word(a,w) (((a)->top == 1) && ((a)->d[0] == (BN_ULONG)(w)))
304   -#define BN_is_zero(a) (((a)->top == 0) || BN_abs_is_word(a,0))
  363 +/* Note that BN_abs_is_word didn't work reliably for w == 0 until 0.9.8 */
  364 +#define BN_abs_is_word(a,w) ((((a)->top == 1) && ((a)->d[0] == (BN_ULONG)(w))) || \
  365 + (((w) == 0) && ((a)->top == 0)))
  366 +#define BN_is_zero(a) ((a)->top == 0)
305 367 #define BN_is_one(a) (BN_abs_is_word((a),1) && !(a)->neg)
306   -#define BN_is_word(a,w) ((w) ? BN_abs_is_word((a),(w)) && !(a)->neg : \
307   - BN_is_zero((a)))
  368 +#define BN_is_word(a,w) (BN_abs_is_word((a),(w)) && (!(w) || !(a)->neg))
308 369 #define BN_is_odd(a) (((a)->top > 0) && ((a)->d[0] & 1))
309 370  
310 371 #define BN_one(a) (BN_set_word((a),1))
  372 +#define BN_zero_ex(a) \
  373 + do { \
  374 + BIGNUM *_tmp_bn = (a); \
  375 + _tmp_bn->top = 0; \
  376 + _tmp_bn->neg = 0; \
  377 + } while(0)
  378 +#ifdef OPENSSL_NO_DEPRECATED
  379 +#define BN_zero(a) BN_zero_ex(a)
  380 +#else
311 381 #define BN_zero(a) (BN_set_word((a),0))
312   -
313   -/*#define BN_ascii2bn(a) BN_hex2bn(a) */
314   -/*#define BN_bn2ascii(a) BN_bn2hex(a) */
  382 +#endif
315 383  
316 384 const BIGNUM *BN_value_one(void);
317 385 char * BN_options(void);
318 386 BN_CTX *BN_CTX_new(void);
  387 +#ifndef OPENSSL_NO_DEPRECATED
319 388 void BN_CTX_init(BN_CTX *c);
  389 +#endif
320 390 void BN_CTX_free(BN_CTX *c);
321 391 void BN_CTX_start(BN_CTX *ctx);
322 392 BIGNUM *BN_CTX_get(BN_CTX *ctx);
... ... @@ -342,6 +412,16 @@ int BN_uadd(BIGNUM *r, const BIGNUM *a, const BIGNUM *b);
342 412 int BN_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b);
343 413 int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx);
344 414 int BN_sqr(BIGNUM *r, const BIGNUM *a,BN_CTX *ctx);
  415 +/** BN_set_negative sets sign of a BIGNUM
  416 + * \param b pointer to the BIGNUM object
  417 + * \param n 0 if the BIGNUM b should be positive and a value != 0 otherwise
  418 + */
  419 +void BN_set_negative(BIGNUM *b, int n);
  420 +/** BN_is_negative returns 1 if the BIGNUM is negative
  421 + * \param a pointer to the BIGNUM object
  422 + * \return 1 if a < 0 and 0 otherwise
  423 + */
  424 +#define BN_is_negative(a) ((a)->neg != 0)
345 425  
346 426 int BN_div(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m, const BIGNUM *d,
347 427 BN_CTX *ctx);
... ... @@ -378,6 +458,8 @@ int BN_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
378 458 const BIGNUM *m,BN_CTX *ctx);
379 459 int BN_mod_exp_mont(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
380 460 const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx);
  461 +int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,
  462 + const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont);
381 463 int BN_mod_exp_mont_word(BIGNUM *r, BN_ULONG a, const BIGNUM *p,
382 464 const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx);
383 465 int BN_mod_exp2_mont(BIGNUM *r, const BIGNUM *a1, const BIGNUM *p1,
... ... @@ -413,6 +495,9 @@ BIGNUM *BN_mod_inverse(BIGNUM *ret,
413 495 const BIGNUM *a, const BIGNUM *n,BN_CTX *ctx);
414 496 BIGNUM *BN_mod_sqrt(BIGNUM *ret,
415 497 const BIGNUM *a, const BIGNUM *n,BN_CTX *ctx);
  498 +
  499 +/* Deprecated versions */
  500 +#ifndef OPENSSL_NO_DEPRECATED
416 501 BIGNUM *BN_generate_prime(BIGNUM *ret,int bits,int safe,
417 502 const BIGNUM *add, const BIGNUM *rem,
418 503 void (*callback)(int,int,void *),void *cb_arg);
... ... @@ -422,6 +507,14 @@ int BN_is_prime(const BIGNUM *p,int nchecks,
422 507 int BN_is_prime_fasttest(const BIGNUM *p,int nchecks,
423 508 void (*callback)(int,int,void *),BN_CTX *ctx,void *cb_arg,
424 509 int do_trial_division);
  510 +#endif /* !defined(OPENSSL_NO_DEPRECATED) */
  511 +
  512 +/* Newer versions */
  513 +int BN_generate_prime_ex(BIGNUM *ret,int bits,int safe, const BIGNUM *add,
  514 + const BIGNUM *rem, BN_GENCB *cb);
  515 +int BN_is_prime_ex(const BIGNUM *p,int nchecks, BN_CTX *ctx, BN_GENCB *cb);
  516 +int BN_is_prime_fasttest_ex(const BIGNUM *p,int nchecks, BN_CTX *ctx,
  517 + int do_trial_division, BN_GENCB *cb);
425 518  
426 519 BN_MONT_CTX *BN_MONT_CTX_new(void );
427 520 void BN_MONT_CTX_init(BN_MONT_CTX *ctx);
... ... @@ -434,15 +527,34 @@ int BN_from_montgomery(BIGNUM *r,const BIGNUM *a,
434 527 void BN_MONT_CTX_free(BN_MONT_CTX *mont);
435 528 int BN_MONT_CTX_set(BN_MONT_CTX *mont,const BIGNUM *mod,BN_CTX *ctx);
436 529 BN_MONT_CTX *BN_MONT_CTX_copy(BN_MONT_CTX *to,BN_MONT_CTX *from);
  530 +BN_MONT_CTX *BN_MONT_CTX_set_locked(BN_MONT_CTX **pmont, int lock,
  531 + const BIGNUM *mod, BN_CTX *ctx);
  532 +
  533 +/* BN_BLINDING flags */
  534 +#define BN_BLINDING_NO_UPDATE 0x00000001
  535 +#define BN_BLINDING_NO_RECREATE 0x00000002
437 536  
438   -BN_BLINDING *BN_BLINDING_new(BIGNUM *A,BIGNUM *Ai,BIGNUM *mod);
  537 +BN_BLINDING *BN_BLINDING_new(const BIGNUM *A, const BIGNUM *Ai, BIGNUM *mod);
439 538 void BN_BLINDING_free(BN_BLINDING *b);
440 539 int BN_BLINDING_update(BN_BLINDING *b,BN_CTX *ctx);
441   -int BN_BLINDING_convert(BIGNUM *n, BN_BLINDING *r, BN_CTX *ctx);
  540 +int BN_BLINDING_convert(BIGNUM *n, BN_BLINDING *b, BN_CTX *ctx);
442 541 int BN_BLINDING_invert(BIGNUM *n, BN_BLINDING *b, BN_CTX *ctx);
443   -
  542 +int BN_BLINDING_convert_ex(BIGNUM *n, BIGNUM *r, BN_BLINDING *b, BN_CTX *);
  543 +int BN_BLINDING_invert_ex(BIGNUM *n, const BIGNUM *r, BN_BLINDING *b, BN_CTX *);
  544 +unsigned long BN_BLINDING_get_thread_id(const BN_BLINDING *);
  545 +void BN_BLINDING_set_thread_id(BN_BLINDING *, unsigned long);
  546 +unsigned long BN_BLINDING_get_flags(const BN_BLINDING *);
  547 +void BN_BLINDING_set_flags(BN_BLINDING *, unsigned long);
  548 +BN_BLINDING *BN_BLINDING_create_param(BN_BLINDING *b,
  549 + const BIGNUM *e, BIGNUM *m, BN_CTX *ctx,
  550 + int (*bn_mod_exp)(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
  551 + const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx),
  552 + BN_MONT_CTX *m_ctx);
  553 +
  554 +#ifndef OPENSSL_NO_DEPRECATED
444 555 void BN_set_params(int mul,int high,int low,int mont);
445 556 int BN_get_params(int which); /* 0, mul, 1 high, 2 low, 3 mont */
  557 +#endif
446 558  
447 559 void BN_RECP_CTX_init(BN_RECP_CTX *recp);
448 560 BN_RECP_CTX *BN_RECP_CTX_new(void);
... ... @@ -455,15 +567,162 @@ int BN_mod_exp_recp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
455 567 int BN_div_recp(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m,
456 568 BN_RECP_CTX *recp, BN_CTX *ctx);
457 569  
  570 +/* Functions for arithmetic over binary polynomials represented by BIGNUMs.
  571 + *
  572 + * The BIGNUM::neg property of BIGNUMs representing binary polynomials is
  573 + * ignored.
  574 + *
  575 + * Note that input arguments are not const so that their bit arrays can
  576 + * be expanded to the appropriate size if needed.
  577 + */
  578 +
  579 +int BN_GF2m_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b); /*r = a + b*/
  580 +#define BN_GF2m_sub(r, a, b) BN_GF2m_add(r, a, b)
  581 +int BN_GF2m_mod(BIGNUM *r, const BIGNUM *a, const BIGNUM *p); /*r=a mod p*/
  582 +int BN_GF2m_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
  583 + const BIGNUM *p, BN_CTX *ctx); /* r = (a * b) mod p */
  584 +int BN_GF2m_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
  585 + BN_CTX *ctx); /* r = (a * a) mod p */
  586 +int BN_GF2m_mod_inv(BIGNUM *r, const BIGNUM *b, const BIGNUM *p,
  587 + BN_CTX *ctx); /* r = (1 / b) mod p */
  588 +int BN_GF2m_mod_div(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
  589 + const BIGNUM *p, BN_CTX *ctx); /* r = (a / b) mod p */
  590 +int BN_GF2m_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
  591 + const BIGNUM *p, BN_CTX *ctx); /* r = (a ^ b) mod p */
  592 +int BN_GF2m_mod_sqrt(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
  593 + BN_CTX *ctx); /* r = sqrt(a) mod p */
  594 +int BN_GF2m_mod_solve_quad(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
  595 + BN_CTX *ctx); /* r^2 + r = a mod p */
  596 +#define BN_GF2m_cmp(a, b) BN_ucmp((a), (b))
  597 +/* Some functions allow for representation of the irreducible polynomials
  598 + * as an unsigned int[], say p. The irreducible f(t) is then of the form:
  599 + * t^p[0] + t^p[1] + ... + t^p[k]
  600 + * where m = p[0] > p[1] > ... > p[k] = 0.
  601 + */
  602 +int BN_GF2m_mod_arr(BIGNUM *r, const BIGNUM *a, const unsigned int p[]);
  603 + /* r = a mod p */
  604 +int BN_GF2m_mod_mul_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
  605 + const unsigned int p[], BN_CTX *ctx); /* r = (a * b) mod p */
  606 +int BN_GF2m_mod_sqr_arr(BIGNUM *r, const BIGNUM *a, const unsigned int p[],
  607 + BN_CTX *ctx); /* r = (a * a) mod p */
  608 +int BN_GF2m_mod_inv_arr(BIGNUM *r, const BIGNUM *b, const unsigned int p[],
  609 + BN_CTX *ctx); /* r = (1 / b) mod p */
  610 +int BN_GF2m_mod_div_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
  611 + const unsigned int p[], BN_CTX *ctx); /* r = (a / b) mod p */
  612 +int BN_GF2m_mod_exp_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
  613 + const unsigned int p[], BN_CTX *ctx); /* r = (a ^ b) mod p */
  614 +int BN_GF2m_mod_sqrt_arr(BIGNUM *r, const BIGNUM *a,
  615 + const unsigned int p[], BN_CTX *ctx); /* r = sqrt(a) mod p */
  616 +int BN_GF2m_mod_solve_quad_arr(BIGNUM *r, const BIGNUM *a,
  617 + const unsigned int p[], BN_CTX *ctx); /* r^2 + r = a mod p */
  618 +int BN_GF2m_poly2arr(const BIGNUM *a, unsigned int p[], int max);
  619 +int BN_GF2m_arr2poly(const unsigned int p[], BIGNUM *a);
  620 +
  621 +/* faster mod functions for the 'NIST primes'
  622 + * 0 <= a < p^2 */
  623 +int BN_nist_mod_192(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx);
  624 +int BN_nist_mod_224(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx);
  625 +int BN_nist_mod_256(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx);
  626 +int BN_nist_mod_384(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx);
  627 +int BN_nist_mod_521(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx);
  628 +
  629 +const BIGNUM *BN_get0_nist_prime_192(void);
  630 +const BIGNUM *BN_get0_nist_prime_224(void);
  631 +const BIGNUM *BN_get0_nist_prime_256(void);
  632 +const BIGNUM *BN_get0_nist_prime_384(void);
  633 +const BIGNUM *BN_get0_nist_prime_521(void);
  634 +
458 635 /* library internal functions */
459 636  
460 637 #define bn_expand(a,bits) ((((((bits+BN_BITS2-1))/BN_BITS2)) <= (a)->dmax)?\
461   - (a):bn_expand2((a),(bits)/BN_BITS2+1))
  638 + (a):bn_expand2((a),(bits+BN_BITS2-1)/BN_BITS2))
462 639 #define bn_wexpand(a,words) (((words) <= (a)->dmax)?(a):bn_expand2((a),(words)))
463 640 BIGNUM *bn_expand2(BIGNUM *a, int words);
464   -BIGNUM *bn_dup_expand(const BIGNUM *a, int words);
  641 +#ifndef OPENSSL_NO_DEPRECATED
  642 +BIGNUM *bn_dup_expand(const BIGNUM *a, int words); /* unused */
  643 +#endif
  644 +
  645 +/* Bignum consistency macros
  646 + * There is one "API" macro, bn_fix_top(), for stripping leading zeroes from
  647 + * bignum data after direct manipulations on the data. There is also an
  648 + * "internal" macro, bn_check_top(), for verifying that there are no leading
  649 + * zeroes. Unfortunately, some auditing is required due to the fact that
  650 + * bn_fix_top() has become an overabused duct-tape because bignum data is
  651 + * occasionally passed around in an inconsistent state. So the following
  652 + * changes have been made to sort this out;
  653 + * - bn_fix_top()s implementation has been moved to bn_correct_top()
  654 + * - if BN_DEBUG isn't defined, bn_fix_top() maps to bn_correct_top(), and
  655 + * bn_check_top() is as before.
  656 + * - if BN_DEBUG *is* defined;
  657 + * - bn_check_top() tries to pollute unused words even if the bignum 'top' is
  658 + * consistent. (ed: only if BN_DEBUG_RAND is defined)
  659 + * - bn_fix_top() maps to bn_check_top() rather than "fixing" anything.
  660 + * The idea is to have debug builds flag up inconsistent bignums when they
  661 + * occur. If that occurs in a bn_fix_top(), we examine the code in question; if
  662 + * the use of bn_fix_top() was appropriate (ie. it follows directly after code
  663 + * that manipulates the bignum) it is converted to bn_correct_top(), and if it
  664 + * was not appropriate, we convert it permanently to bn_check_top() and track
  665 + * down the cause of the bug. Eventually, no internal code should be using the
  666 + * bn_fix_top() macro. External applications and libraries should try this with
  667 + * their own code too, both in terms of building against the openssl headers
  668 + * with BN_DEBUG defined *and* linking with a version of OpenSSL built with it
  669 + * defined. This not only improves external code, it provides more test
  670 + * coverage for openssl's own code.
  671 + */
  672 +
  673 +#ifdef BN_DEBUG
  674 +
  675 +/* We only need assert() when debugging */
  676 +#include <assert.h>
465 677  
466   -#define bn_fix_top(a) \
  678 +#ifdef BN_DEBUG_RAND
  679 +/* To avoid "make update" cvs wars due to BN_DEBUG, use some tricks */
  680 +#ifndef RAND_pseudo_bytes
  681 +int RAND_pseudo_bytes(unsigned char *buf,int num);
  682 +#define BN_DEBUG_TRIX
  683 +#endif
  684 +#define bn_pollute(a) \
  685 + do { \
  686 + const BIGNUM *_bnum1 = (a); \
  687 + if(_bnum1->top < _bnum1->dmax) { \
  688 + unsigned char _tmp_char; \
  689 + /* We cast away const without the compiler knowing, any \
  690 + * *genuinely* constant variables that aren't mutable \
  691 + * wouldn't be constructed with top!=dmax. */ \
  692 + BN_ULONG *_not_const; \
  693 + memcpy(&_not_const, &_bnum1->d, sizeof(BN_ULONG*)); \
  694 + RAND_pseudo_bytes(&_tmp_char, 1); \
  695 + memset((unsigned char *)(_not_const + _bnum1->top), _tmp_char, \
  696 + (_bnum1->dmax - _bnum1->top) * sizeof(BN_ULONG)); \
  697 + } \
  698 + } while(0)
  699 +#ifdef BN_DEBUG_TRIX
  700 +#undef RAND_pseudo_bytes
  701 +#endif
  702 +#else
  703 +#define bn_pollute(a)
  704 +#endif
  705 +#define bn_check_top(a) \
  706 + do { \
  707 + const BIGNUM *_bnum2 = (a); \
  708 + if (_bnum2 != NULL) { \
  709 + assert((_bnum2->top == 0) || \
  710 + (_bnum2->d[_bnum2->top - 1] != 0)); \
  711 + bn_pollute(_bnum2); \
  712 + } \
  713 + } while(0)
  714 +
  715 +#define bn_fix_top(a) bn_check_top(a)
  716 +
  717 +#else /* !BN_DEBUG */
  718 +
  719 +#define bn_pollute(a)
  720 +#define bn_check_top(a)
  721 +#define bn_fix_top(a) bn_correct_top(a)
  722 +
  723 +#endif
  724 +
  725 +#define bn_correct_top(a) \
467 726 { \
468 727 BN_ULONG *ftl; \
469 728 if ((a)->top > 0) \
... ... @@ -471,6 +730,7 @@ BIGNUM *bn_dup_expand(const BIGNUM *a, int words);
471 730 for (ftl= &((a)->d[(a)->top-1]); (a)->top > 0; (a)->top--) \
472 731 if (*(ftl--)) break; \
473 732 } \
  733 + bn_pollute(a); \
474 734 }
475 735  
476 736 BN_ULONG bn_mul_add_words(BN_ULONG *rp, const BN_ULONG *ap, int num, BN_ULONG w);
... ... @@ -480,15 +740,17 @@ BN_ULONG bn_div_words(BN_ULONG h, BN_ULONG l, BN_ULONG d);
480 740 BN_ULONG bn_add_words(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp,int num);
481 741 BN_ULONG bn_sub_words(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp,int num);
482 742  
483   -#ifdef BN_DEBUG
484   -void bn_dump1(FILE *o, const char *a, const BN_ULONG *b,int n);
485   -# define bn_print(a) {fprintf(stderr, #a "="); BN_print_fp(stderr,a); \
486   - fprintf(stderr,"\n");}
487   -# define bn_dump(a,n) bn_dump1(stderr,#a,a,n);
488   -#else
489   -# define bn_print(a)
490   -# define bn_dump(a,b)
491   -#endif
  743 +/* Primes from RFC 2409 */
  744 +BIGNUM *get_rfc2409_prime_768(BIGNUM *bn);
  745 +BIGNUM *get_rfc2409_prime_1024(BIGNUM *bn);
  746 +
  747 +/* Primes from RFC 3526 */
  748 +BIGNUM *get_rfc3526_prime_1536(BIGNUM *bn);
  749 +BIGNUM *get_rfc3526_prime_2048(BIGNUM *bn);
  750 +BIGNUM *get_rfc3526_prime_3072(BIGNUM *bn);
  751 +BIGNUM *get_rfc3526_prime_4096(BIGNUM *bn);
  752 +BIGNUM *get_rfc3526_prime_6144(BIGNUM *bn);
  753 +BIGNUM *get_rfc3526_prime_8192(BIGNUM *bn);
492 754  
493 755 int BN_bntest_rand(BIGNUM *rnd, int bits, int top,int bottom);
494 756  
... ... @@ -501,20 +763,35 @@ void ERR_load_BN_strings(void);
501 763 /* Error codes for the BN functions. */
502 764  
503 765 /* Function codes. */
504   -#define BN_F_BN_BLINDING_CONVERT 100
505   -#define BN_F_BN_BLINDING_INVERT 101
  766 +#define BN_F_BNRAND 127
  767 +#define BN_F_BN_BLINDING_CONVERT_EX 100
  768 +#define BN_F_BN_BLINDING_CREATE_PARAM 128
  769 +#define BN_F_BN_BLINDING_INVERT_EX 101
506 770 #define BN_F_BN_BLINDING_NEW 102
507 771 #define BN_F_BN_BLINDING_UPDATE 103
508 772 #define BN_F_BN_BN2DEC 104
509 773 #define BN_F_BN_BN2HEX 105
510 774 #define BN_F_BN_CTX_GET 116
511 775 #define BN_F_BN_CTX_NEW 106
  776 +#define BN_F_BN_CTX_START 129
512 777 #define BN_F_BN_DIV 107
  778 +#define BN_F_BN_DIV_RECP 130
  779 +#define BN_F_BN_EXP 123
513 780 #define BN_F_BN_EXPAND2 108
514 781 #define BN_F_BN_EXPAND_INTERNAL 120
  782 +#define BN_F_BN_GF2M_MOD 131
  783 +#define BN_F_BN_GF2M_MOD_EXP 132
  784 +#define BN_F_BN_GF2M_MOD_MUL 133
  785 +#define BN_F_BN_GF2M_MOD_SOLVE_QUAD 134
  786 +#define BN_F_BN_GF2M_MOD_SOLVE_QUAD_ARR 135
  787 +#define BN_F_BN_GF2M_MOD_SQR 136
  788 +#define BN_F_BN_GF2M_MOD_SQRT 137
515 789 #define BN_F_BN_MOD_EXP2_MONT 118
516 790 #define BN_F_BN_MOD_EXP_MONT 109
  791 +#define BN_F_BN_MOD_EXP_MONT_CONSTTIME 124
517 792 #define BN_F_BN_MOD_EXP_MONT_WORD 117
  793 +#define BN_F_BN_MOD_EXP_RECP 125
  794 +#define BN_F_BN_MOD_EXP_SIMPLE 126
518 795 #define BN_F_BN_MOD_INVERSE 110
519 796 #define BN_F_BN_MOD_LSHIFT_QUICK 119
520 797 #define BN_F_BN_MOD_MUL_RECIPROCAL 111
... ... @@ -539,6 +816,7 @@ void ERR_load_BN_strings(void);
539 816 #define BN_R_NOT_A_SQUARE 111
540 817 #define BN_R_NOT_INITIALIZED 107
541 818 #define BN_R_NO_INVERSE 108
  819 +#define BN_R_NO_SOLUTION 116
542 820 #define BN_R_P_IS_NOT_PRIME 112
543 821 #define BN_R_TOO_MANY_ITERATIONS 113
544 822 #define BN_R_TOO_MANY_TEMPORARY_VARIABLES 109
... ...
third_dev/openssl/include/openssl/buffer.h
... ... @@ -59,25 +59,35 @@
59 59 #ifndef HEADER_BUFFER_H
60 60 #define HEADER_BUFFER_H
61 61  
  62 +#include <openssl/ossl_typ.h>
  63 +
62 64 #ifdef __cplusplus
63 65 extern "C" {
64 66 #endif
65 67  
66 68 #include <stddef.h>
  69 +
  70 +#if !defined(NO_SYS_TYPES_H)
67 71 #include <sys/types.h>
  72 +#endif
  73 +
  74 +/* Already declared in ossl_typ.h */
  75 +/* typedef struct buf_mem_st BUF_MEM; */
68 76  
69   -typedef struct buf_mem_st
  77 +struct buf_mem_st
70 78 {
71 79 int length; /* current number of bytes */
72 80 char *data;
73 81 int max; /* size of buffer */
74   - } BUF_MEM;
  82 + };
75 83  
76 84 BUF_MEM *BUF_MEM_new(void);
77 85 void BUF_MEM_free(BUF_MEM *a);
78 86 int BUF_MEM_grow(BUF_MEM *str, int len);
79 87 int BUF_MEM_grow_clean(BUF_MEM *str, int len);
80 88 char * BUF_strdup(const char *str);
  89 +char * BUF_strndup(const char *str, size_t siz);
  90 +void * BUF_memdup(const void *data, size_t siz);
81 91  
82 92 /* safe string functions */
83 93 size_t BUF_strlcpy(char *dst,const char *src,size_t siz);
... ... @@ -93,9 +103,12 @@ void ERR_load_BUF_strings(void);
93 103 /* Error codes for the BUF functions. */
94 104  
95 105 /* Function codes. */
  106 +#define BUF_F_BUF_MEMDUP 103
96 107 #define BUF_F_BUF_MEM_GROW 100
  108 +#define BUF_F_BUF_MEM_GROW_CLEAN 105
97 109 #define BUF_F_BUF_MEM_NEW 101
98 110 #define BUF_F_BUF_STRDUP 102
  111 +#define BUF_F_BUF_STRNDUP 104
99 112  
100 113 /* Reason codes. */
101 114  
... ...
third_dev/openssl/include/openssl/cast.h
... ... @@ -63,6 +63,8 @@
63 63 extern "C" {
64 64 #endif
65 65  
  66 +#include <openssl/opensslconf.h>
  67 +
66 68 #ifdef OPENSSL_NO_CAST
67 69 #error CAST is disabled.
68 70 #endif
... ...
third_dev/openssl/include/openssl/comp.h
... ... @@ -8,19 +8,26 @@
8 8 extern "C" {
9 9 #endif
10 10  
  11 +typedef struct comp_ctx_st COMP_CTX;
  12 +
11 13 typedef struct comp_method_st
12 14 {
13 15 int type; /* NID for compression library */
14 16 const char *name; /* A text string to identify the library */
15   - int (*init)();
16   - void (*finish)();
17   - int (*compress)();
18   - int (*expand)();
19   - long (*ctrl)();
20   - long (*callback_ctrl)();
  17 + int (*init)(COMP_CTX *ctx);
  18 + void (*finish)(COMP_CTX *ctx);
  19 + int (*compress)(COMP_CTX *ctx,
  20 + unsigned char *out, unsigned int olen,
  21 + unsigned char *in, unsigned int ilen);
  22 + int (*expand)(COMP_CTX *ctx,
  23 + unsigned char *out, unsigned int olen,
  24 + unsigned char *in, unsigned int ilen);
  25 + /* The following two do NOTHING, but are kept for backward compatibility */
  26 + long (*ctrl)(void);
  27 + long (*callback_ctrl)(void);
21 28 } COMP_METHOD;
22 29  
23   -typedef struct comp_ctx_st
  30 +struct comp_ctx_st
24 31 {
25 32 COMP_METHOD *meth;
26 33 unsigned long compress_in;
... ... @@ -29,7 +36,7 @@ typedef struct comp_ctx_st
29 36 unsigned long expand_out;
30 37  
31 38 CRYPTO_EX_DATA ex_data;
32   - } COMP_CTX;
  39 + };
33 40  
34 41  
35 42 COMP_CTX *COMP_CTX_new(COMP_METHOD *meth);
... ...
third_dev/openssl/include/openssl/conf.h
... ... @@ -65,6 +65,8 @@
65 65 #include <openssl/safestack.h>
66 66 #include <openssl/e_os2.h>
67 67  
  68 +#include <openssl/ossl_typ.h>
  69 +
68 70 #ifdef __cplusplus
69 71 extern "C" {
70 72 #endif
... ... @@ -81,7 +83,6 @@ DECLARE_STACK_OF(CONF_MODULE)
81 83 DECLARE_STACK_OF(CONF_IMODULE)
82 84  
83 85 struct conf_st;
84   -typedef struct conf_st CONF;
85 86 struct conf_method_st;
86 87 typedef struct conf_method_st CONF_METHOD;
87 88  
... ... @@ -212,6 +213,8 @@ void ERR_load_CONF_strings(void);
212 213 #define CONF_F_CONF_LOAD_BIO 102
213 214 #define CONF_F_CONF_LOAD_FP 103
214 215 #define CONF_F_CONF_MODULES_LOAD 116
  216 +#define CONF_F_DEF_LOAD 120
  217 +#define CONF_F_DEF_LOAD_BIO 121
215 218 #define CONF_F_MODULE_INIT 115
216 219 #define CONF_F_MODULE_LOAD_DSO 117
217 220 #define CONF_F_MODULE_RUN 118
... ...
third_dev/openssl/include/openssl/crypto.h
1 1 /* crypto/crypto.h */
  2 +/* ====================================================================
  3 + * Copyright (c) 1998-2003 The OpenSSL Project. All rights reserved.
  4 + *
  5 + * Redistribution and use in source and binary forms, with or without
  6 + * modification, are permitted provided that the following conditions
  7 + * are met:
  8 + *
  9 + * 1. Redistributions of source code must retain the above copyright
  10 + * notice, this list of conditions and the following disclaimer.
  11 + *
  12 + * 2. Redistributions in binary form must reproduce the above copyright
  13 + * notice, this list of conditions and the following disclaimer in
  14 + * the documentation and/or other materials provided with the
  15 + * distribution.
  16 + *
  17 + * 3. All advertising materials mentioning features or use of this
  18 + * software must display the following acknowledgment:
  19 + * "This product includes software developed by the OpenSSL Project
  20 + * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
  21 + *
  22 + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
  23 + * endorse or promote products derived from this software without
  24 + * prior written permission. For written permission, please contact
  25 + * openssl-core@openssl.org.
  26 + *
  27 + * 5. Products derived from this software may not be called "OpenSSL"
  28 + * nor may "OpenSSL" appear in their names without prior written
  29 + * permission of the OpenSSL Project.
  30 + *
  31 + * 6. Redistributions of any form whatsoever must retain the following
  32 + * acknowledgment:
  33 + * "This product includes software developed by the OpenSSL Project
  34 + * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
  35 + *
  36 + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
  37 + * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  38 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  39 + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
  40 + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  41 + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  42 + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  43 + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  44 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  45 + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  46 + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
  47 + * OF THE POSSIBILITY OF SUCH DAMAGE.
  48 + * ====================================================================
  49 + *
  50 + * This product includes cryptographic software written by Eric Young
  51 + * (eay@cryptsoft.com). This product includes software written by Tim
  52 + * Hudson (tjh@cryptsoft.com).
  53 + *
  54 + */
2 55 /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 56 * All rights reserved.
4 57 *
... ... @@ -55,12 +108,19 @@
55 108 * copied and put under another distribution licence
56 109 * [including the GNU Public Licence.]
57 110 */
  111 +/* ====================================================================
  112 + * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
  113 + * ECDH support in OpenSSL originally developed by
  114 + * SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project.
  115 + */
58 116  
59 117 #ifndef HEADER_CRYPTO_H
60 118 #define HEADER_CRYPTO_H
61 119  
62 120 #include <stdlib.h>
63 121  
  122 +#include <openssl/e_os2.h>
  123 +
64 124 #ifndef OPENSSL_NO_FP_API
65 125 #include <stdio.h>
66 126 #endif
... ... @@ -68,6 +128,7 @@
68 128 #include <openssl/stack.h>
69 129 #include <openssl/safestack.h>
70 130 #include <openssl/opensslv.h>
  131 +#include <openssl/ossl_typ.h>
71 132  
72 133 #ifdef CHARSET_EBCDIC
73 134 #include <openssl/ebcdic.h>
... ... @@ -92,15 +153,39 @@ extern &quot;C&quot; {
92 153 #define SSLEAY_PLATFORM 4
93 154 #define SSLEAY_DIR 5
94 155  
  156 +/* Already declared in ossl_typ.h */
  157 +#if 0
  158 +typedef struct crypto_ex_data_st CRYPTO_EX_DATA;
  159 +/* Called when a new object is created */
  160 +typedef int CRYPTO_EX_new(void *parent, void *ptr, CRYPTO_EX_DATA *ad,
  161 + int idx, long argl, void *argp);
  162 +/* Called when an object is free()ed */
  163 +typedef void CRYPTO_EX_free(void *parent, void *ptr, CRYPTO_EX_DATA *ad,
  164 + int idx, long argl, void *argp);
  165 +/* Called when we need to dup an object */
  166 +typedef int CRYPTO_EX_dup(CRYPTO_EX_DATA *to, CRYPTO_EX_DATA *from, void *from_d,
  167 + int idx, long argl, void *argp);
  168 +#endif
  169 +
  170 +/* A generic structure to pass assorted data in a expandable way */
  171 +typedef struct openssl_item_st
  172 + {
  173 + int code;
  174 + void *value; /* Not used for flag attributes */
  175 + size_t value_size; /* Max size of value for output, length for input */
  176 + size_t *value_length; /* Returned length of value for output */
  177 + } OPENSSL_ITEM;
  178 +
  179 +
95 180 /* When changing the CRYPTO_LOCK_* list, be sure to maintin the text lock
96 181 * names in cryptlib.c
97 182 */
98 183  
99   -#define CRYPTO_LOCK_ERR 1
100   -#define CRYPTO_LOCK_EX_DATA 2
101   -#define CRYPTO_LOCK_X509 3
102   -#define CRYPTO_LOCK_X509_INFO 4
103   -#define CRYPTO_LOCK_X509_PKEY 5
  184 +#define CRYPTO_LOCK_ERR 1
  185 +#define CRYPTO_LOCK_EX_DATA 2
  186 +#define CRYPTO_LOCK_X509 3
  187 +#define CRYPTO_LOCK_X509_INFO 4
  188 +#define CRYPTO_LOCK_X509_PKEY 5
104 189 #define CRYPTO_LOCK_X509_CRL 6
105 190 #define CRYPTO_LOCK_X509_REQ 7
106 191 #define CRYPTO_LOCK_DSA 8
... ... @@ -127,8 +212,14 @@ extern &quot;C&quot; {
127 212 #define CRYPTO_LOCK_DYNLOCK 29
128 213 #define CRYPTO_LOCK_ENGINE 30
129 214 #define CRYPTO_LOCK_UI 31
130   -#define CRYPTO_LOCK_HWCRHK 32 /* This is a HACK which will disappear in 0.9.8 */
131   -#define CRYPTO_NUM_LOCKS 33
  215 +#define CRYPTO_LOCK_ECDSA 32
  216 +#define CRYPTO_LOCK_EC 33
  217 +#define CRYPTO_LOCK_ECDH 34
  218 +#define CRYPTO_LOCK_BN 35
  219 +#define CRYPTO_LOCK_EC_PRE_COMP 36
  220 +#define CRYPTO_LOCK_STORE 37
  221 +#define CRYPTO_LOCK_COMP 38
  222 +#define CRYPTO_NUM_LOCKS 39
132 223  
133 224 #define CRYPTO_LOCK 1
134 225 #define CRYPTO_UNLOCK 2
... ... @@ -189,21 +280,11 @@ typedef struct
189 280 /* predec of the BIO type */
190 281 typedef struct bio_st BIO_dummy;
191 282  
192   -typedef struct crypto_ex_data_st
  283 +struct crypto_ex_data_st
193 284 {
194 285 STACK *sk;
195 286 int dummy; /* gcc is screwing up this data structure :-( */
196   - } CRYPTO_EX_DATA;
197   -
198   -/* Called when a new object is created */
199   -typedef int CRYPTO_EX_new(void *parent, void *ptr, CRYPTO_EX_DATA *ad,
200   - int idx, long argl, void *argp);
201   -/* Called when an object is free()ed */
202   -typedef void CRYPTO_EX_free(void *parent, void *ptr, CRYPTO_EX_DATA *ad,
203   - int idx, long argl, void *argp);
204   -/* Called when we need to dup an object */
205   -typedef int CRYPTO_EX_dup(CRYPTO_EX_DATA *to, CRYPTO_EX_DATA *from, void *from_d,
206   - int idx, long argl, void *argp);
  287 + };
207 288  
208 289 /* This stuff is basically class callback functions
209 290 * The current classes are SSL_CTX, SSL, SSL_SESSION, and a few more */
... ... @@ -235,6 +316,10 @@ DECLARE_STACK_OF(CRYPTO_EX_DATA_FUNCS)
235 316 #define CRYPTO_EX_INDEX_ENGINE 9
236 317 #define CRYPTO_EX_INDEX_X509 10
237 318 #define CRYPTO_EX_INDEX_UI 11
  319 +#define CRYPTO_EX_INDEX_ECDSA 12
  320 +#define CRYPTO_EX_INDEX_ECDH 13
  321 +#define CRYPTO_EX_INDEX_COMP 14
  322 +#define CRYPTO_EX_INDEX_STORE 15
238 323  
239 324 /* Dynamically assigned indexes start from this value (don't use directly, use
240 325 * via CRYPTO_ex_data_new_class). */
... ... @@ -432,7 +517,10 @@ void CRYPTO_mem_leaks_cb(CRYPTO_MEM_LEAK_CB *cb);
432 517  
433 518 /* die if we have to */
434 519 void OpenSSLDie(const char *file,int line,const char *assertion);
435   -#define OPENSSL_assert(e) ((e) ? (void)0 : OpenSSLDie(__FILE__, __LINE__, #e))
  520 +#define OPENSSL_assert(e) (void)((e) ? 0 : (OpenSSLDie(__FILE__, __LINE__, #e),1))
  521 +
  522 +unsigned long *OPENSSL_ia32cap_loc(void);
  523 +#define OPENSSL_ia32cap (*(OPENSSL_ia32cap_loc()))
436 524  
437 525 /* BEGIN ERROR CODES */
438 526 /* The following lines are auto generated by the script mkerr.pl. Any changes
... ...
third_dev/openssl/include/openssl/des.h
... ... @@ -59,13 +59,13 @@
59 59 #ifndef HEADER_NEW_DES_H
60 60 #define HEADER_NEW_DES_H
61 61  
  62 +#include <openssl/e_os2.h> /* OPENSSL_EXTERN, OPENSSL_NO_DES,
  63 + DES_LONG (via openssl/opensslconf.h */
  64 +
62 65 #ifdef OPENSSL_NO_DES
63 66 #error DES is disabled.
64 67 #endif
65 68  
66   -#include <openssl/opensslconf.h> /* DES_LONG */
67   -#include <openssl/e_os2.h> /* OPENSSL_EXTERN */
68   -
69 69 #ifdef OPENSSL_BUILD_SHLIBCRYPTO
70 70 # undef OPENSSL_EXTERN
71 71 # define OPENSSL_EXTERN OPENSSL_EXPORT
... ... @@ -187,6 +187,10 @@ void DES_ede3_cfb64_encrypt(const unsigned char *in,unsigned char *out,
187 187 long length,DES_key_schedule *ks1,
188 188 DES_key_schedule *ks2,DES_key_schedule *ks3,
189 189 DES_cblock *ivec,int *num,int enc);
  190 +void DES_ede3_cfb_encrypt(const unsigned char *in,unsigned char *out,
  191 + int numbits,long length,DES_key_schedule *ks1,
  192 + DES_key_schedule *ks2,DES_key_schedule *ks3,
  193 + DES_cblock *ivec,int enc);
190 194 void DES_ede3_ofb64_encrypt(const unsigned char *in,unsigned char *out,
191 195 long length,DES_key_schedule *ks1,
192 196 DES_key_schedule *ks2,DES_key_schedule *ks3,
... ...
third_dev/openssl/include/openssl/des_old.h
... ... @@ -91,6 +91,8 @@
91 91 #ifndef HEADER_DES_H
92 92 #define HEADER_DES_H
93 93  
  94 +#include <openssl/e_os2.h> /* OPENSSL_EXTERN, OPENSSL_NO_DES, DES_LONG */
  95 +
94 96 #ifdef OPENSSL_NO_DES
95 97 #error DES is disabled.
96 98 #endif
... ... @@ -103,8 +105,6 @@
103 105 #error <openssl/des_old.h> replaces <kerberos/des.h>.
104 106 #endif
105 107  
106   -#include <openssl/opensslconf.h> /* DES_LONG */
107   -#include <openssl/e_os2.h> /* OPENSSL_EXTERN */
108 108 #include <openssl/symhacks.h>
109 109  
110 110 #ifdef OPENSSL_BUILD_SHLIBCRYPTO
... ... @@ -116,6 +116,10 @@
116 116 extern "C" {
117 117 #endif
118 118  
  119 +#ifdef _
  120 +#undef _
  121 +#endif
  122 +
119 123 typedef unsigned char _ossl_old_des_cblock[8];
120 124 typedef struct _ossl_old_des_ks_struct
121 125 {
... ... @@ -171,9 +175,9 @@ typedef struct _ossl_old_des_ks_struct
171 175 DES_enc_write((f),(b),(l),&(k),(iv))
172 176 #define des_fcrypt(b,s,r)\
173 177 DES_fcrypt((b),(s),(r))
  178 +#if 0
174 179 #define des_crypt(b,s)\
175 180 DES_crypt((b),(s))
176   -#if 0
177 181 #if !defined(PERL5) && !defined(__FreeBSD__) && !defined(NeXT) && !defined(__OpenBSD__)
178 182 #define crypt(b,s)\
179 183 DES_crypt((b),(s))
... ...
third_dev/openssl/include/openssl/dh.h
... ... @@ -59,6 +59,8 @@
59 59 #ifndef HEADER_DH_H
60 60 #define HEADER_DH_H
61 61  
  62 +#include <openssl/e_os2.h>
  63 +
62 64 #ifdef OPENSSL_NO_DH
63 65 #error DH is disabled.
64 66 #endif
... ... @@ -66,19 +68,30 @@
66 68 #ifndef OPENSSL_NO_BIO
67 69 #include <openssl/bio.h>
68 70 #endif
69   -#include <openssl/bn.h>
70   -#include <openssl/crypto.h>
71 71 #include <openssl/ossl_typ.h>
  72 +#ifndef OPENSSL_NO_DEPRECATED
  73 +#include <openssl/bn.h>
  74 +#endif
72 75  
73   -#define DH_FLAG_CACHE_MONT_P 0x01
  76 +#define DH_FLAG_CACHE_MONT_P 0x01
  77 +#define DH_FLAG_NO_EXP_CONSTTIME 0x02 /* new with 0.9.7h; the built-in DH
  78 + * implementation now uses constant time
  79 + * modular exponentiation for secret exponents
  80 + * by default. This flag causes the
  81 + * faster variable sliding window method to
  82 + * be used for all exponents.
  83 + */
74 84  
75 85 #ifdef __cplusplus
76 86 extern "C" {
77 87 #endif
78 88  
79   -typedef struct dh_st DH;
  89 +/* Already defined in ossl_typ.h */
  90 +/* typedef struct dh_st DH; */
  91 +/* typedef struct dh_method DH_METHOD; */
80 92  
81   -typedef struct dh_method {
  93 +struct dh_method
  94 + {
82 95 const char *name;
83 96 /* Methods here */
84 97 int (*generate_key)(DH *dh);
... ... @@ -91,7 +104,9 @@ typedef struct dh_method {
91 104 int (*finish)(DH *dh);
92 105 int flags;
93 106 char *app_data;
94   -} DH_METHOD;
  107 + /* If this is non-NULL, it will be used to generate parameters */
  108 + int (*generate_params)(DH *dh, int prime_len, int generator, BN_GENCB *cb);
  109 + };
95 110  
96 111 struct dh_st
97 112 {
... ... @@ -106,7 +121,7 @@ struct dh_st
106 121 BIGNUM *priv_key; /* x */
107 122  
108 123 int flags;
109   - char *method_mont_p;
  124 + BN_MONT_CTX *method_mont_p;
110 125 /* Place holders if we want to do X9.42 DH */
111 126 BIGNUM *q;
112 127 BIGNUM *j;
... ... @@ -130,25 +145,21 @@ struct dh_st
130 145 #define DH_UNABLE_TO_CHECK_GENERATOR 0x04
131 146 #define DH_NOT_SUITABLE_GENERATOR 0x08
132 147  
  148 +/* DH_check_pub_key error codes */
  149 +#define DH_CHECK_PUBKEY_TOO_SMALL 0x01
  150 +#define DH_CHECK_PUBKEY_TOO_LARGE 0x02
  151 +
133 152 /* primes p where (p-1)/2 is prime too are called "safe"; we define
134 153 this for backward compatibility: */
135 154 #define DH_CHECK_P_NOT_STRONG_PRIME DH_CHECK_P_NOT_SAFE_PRIME
136 155  
137   -#define DHparams_dup(x) (DH *)ASN1_dup((int (*)())i2d_DHparams, \
138   - (char *(*)())d2i_DHparams,(char *)(x))
  156 +#define DHparams_dup(x) ASN1_dup_of_const(DH,i2d_DHparams,d2i_DHparams,x)
139 157 #define d2i_DHparams_fp(fp,x) (DH *)ASN1_d2i_fp((char *(*)())DH_new, \
140 158 (char *(*)())d2i_DHparams,(fp),(unsigned char **)(x))
141 159 #define i2d_DHparams_fp(fp,x) ASN1_i2d_fp(i2d_DHparams,(fp), \
142 160 (unsigned char *)(x))
143   -#define d2i_DHparams_bio(bp,x) (DH *)ASN1_d2i_bio((char *(*)())DH_new, \
144   - (char *(*)())d2i_DHparams,(bp),(unsigned char **)(x))
145   -#ifdef __cplusplus
146   -#define i2d_DHparams_bio(bp,x) ASN1_i2d_bio((int (*)())i2d_DHparams,(bp), \
147   - (unsigned char *)(x))
148   -#else
149   -#define i2d_DHparams_bio(bp,x) ASN1_i2d_bio(i2d_DHparams,(bp), \
150   - (unsigned char *)(x))
151   -#endif
  161 +#define d2i_DHparams_bio(bp,x) ASN1_d2i_bio_of(DH,DH_new,d2i_DHparams,bp,x)
  162 +#define i2d_DHparams_bio(bp,x) ASN1_i2d_bio_of_const(DH,i2d_DHparams,bp,x)
152 163  
153 164 const DH_METHOD *DH_OpenSSL(void);
154 165  
... ... @@ -165,9 +176,18 @@ int DH_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
165 176 CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
166 177 int DH_set_ex_data(DH *d, int idx, void *arg);
167 178 void *DH_get_ex_data(DH *d, int idx);
  179 +
  180 +/* Deprecated version */
  181 +#ifndef OPENSSL_NO_DEPRECATED
168 182 DH * DH_generate_parameters(int prime_len,int generator,
169 183 void (*callback)(int,int,void *),void *cb_arg);
  184 +#endif /* !defined(OPENSSL_NO_DEPRECATED) */
  185 +
  186 +/* New version */
  187 +int DH_generate_parameters_ex(DH *dh, int prime_len,int generator, BN_GENCB *cb);
  188 +
170 189 int DH_check(const DH *dh,int *codes);
  190 +int DH_check_pub_key(const DH *dh,const BIGNUM *pub_key, int *codes);
171 191 int DH_generate_key(DH *dh);
172 192 int DH_compute_key(unsigned char *key,const BIGNUM *pub_key,DH *dh);
173 193 DH * d2i_DHparams(DH **a,const unsigned char **pp, long length);
... ... @@ -190,15 +210,17 @@ void ERR_load_DH_strings(void);
190 210 /* Error codes for the DH functions. */
191 211  
192 212 /* Function codes. */
  213 +#define DH_F_COMPUTE_KEY 102
193 214 #define DH_F_DHPARAMS_PRINT 100
194 215 #define DH_F_DHPARAMS_PRINT_FP 101
195   -#define DH_F_DH_COMPUTE_KEY 102
196   -#define DH_F_DH_GENERATE_KEY 103
197   -#define DH_F_DH_GENERATE_PARAMETERS 104
  216 +#define DH_F_DH_BUILTIN_GENPARAMS 106
198 217 #define DH_F_DH_NEW_METHOD 105
  218 +#define DH_F_GENERATE_KEY 103
  219 +#define DH_F_GENERATE_PARAMETERS 104
199 220  
200 221 /* Reason codes. */
201 222 #define DH_R_BAD_GENERATOR 101
  223 +#define DH_R_INVALID_PUBKEY 102
202 224 #define DH_R_NO_PRIVATE_VALUE 100
203 225  
204 226 #ifdef __cplusplus
... ...
third_dev/openssl/include/openssl/dsa.h
... ... @@ -65,6 +65,8 @@
65 65 #ifndef HEADER_DSA_H
66 66 #define HEADER_DSA_H
67 67  
  68 +#include <openssl/e_os2.h>
  69 +
68 70 #ifdef OPENSSL_NO_DSA
69 71 #error DSA is disabled.
70 72 #endif
... ... @@ -72,20 +74,32 @@
72 74 #ifndef OPENSSL_NO_BIO
73 75 #include <openssl/bio.h>
74 76 #endif
75   -#include <openssl/bn.h>
76 77 #include <openssl/crypto.h>
77 78 #include <openssl/ossl_typ.h>
  79 +
  80 +#ifndef OPENSSL_NO_DEPRECATED
  81 +#include <openssl/bn.h>
78 82 #ifndef OPENSSL_NO_DH
79 83 # include <openssl/dh.h>
80 84 #endif
  85 +#endif
81 86  
82 87 #define DSA_FLAG_CACHE_MONT_P 0x01
  88 +#define DSA_FLAG_NO_EXP_CONSTTIME 0x02 /* new with 0.9.7h; the built-in DSA
  89 + * implementation now uses constant time
  90 + * modular exponentiation for secret exponents
  91 + * by default. This flag causes the
  92 + * faster variable sliding window method to
  93 + * be used for all exponents.
  94 + */
83 95  
84 96 #ifdef __cplusplus
85 97 extern "C" {
86 98 #endif
87 99  
88   -typedef struct dsa_st DSA;
  100 +/* Already defined in ossl_typ.h */
  101 +/* typedef struct dsa_st DSA; */
  102 +/* typedef struct dsa_method DSA_METHOD; */
89 103  
90 104 typedef struct DSA_SIG_st
91 105 {
... ... @@ -93,7 +107,8 @@ typedef struct DSA_SIG_st
93 107 BIGNUM *s;
94 108 } DSA_SIG;
95 109  
96   -typedef struct dsa_method {
  110 +struct dsa_method
  111 + {
97 112 const char *name;
98 113 DSA_SIG * (*dsa_do_sign)(const unsigned char *dgst, int dlen, DSA *dsa);
99 114 int (*dsa_sign_setup)(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp,
... ... @@ -110,7 +125,14 @@ typedef struct dsa_method {
110 125 int (*finish)(DSA *dsa);
111 126 int flags;
112 127 char *app_data;
113   -} DSA_METHOD;
  128 + /* If this is non-NULL, it is used to generate DSA parameters */
  129 + int (*dsa_paramgen)(DSA *dsa, int bits,
  130 + unsigned char *seed, int seed_len,
  131 + int *counter_ret, unsigned long *h_ret,
  132 + BN_GENCB *cb);
  133 + /* If this is non-NULL, it is used to generate DSA keys */
  134 + int (*dsa_keygen)(DSA *dsa);
  135 + };
114 136  
115 137 struct dsa_st
116 138 {
... ... @@ -131,7 +153,7 @@ struct dsa_st
131 153  
132 154 int flags;
133 155 /* Normally used to cache montgomery values */
134   - char *method_mont_p;
  156 + BN_MONT_CTX *method_mont_p;
135 157 int references;
136 158 CRYPTO_EX_DATA ex_data;
137 159 const DSA_METHOD *meth;
... ... @@ -139,16 +161,13 @@ struct dsa_st
139 161 ENGINE *engine;
140 162 };
141 163  
142   -#define DSAparams_dup(x) (DSA *)ASN1_dup((int (*)())i2d_DSAparams, \
143   - (char *(*)())d2i_DSAparams,(char *)(x))
  164 +#define DSAparams_dup(x) ASN1_dup_of_const(DSA,i2d_DSAparams,d2i_DSAparams,x)
144 165 #define d2i_DSAparams_fp(fp,x) (DSA *)ASN1_d2i_fp((char *(*)())DSA_new, \
145 166 (char *(*)())d2i_DSAparams,(fp),(unsigned char **)(x))
146 167 #define i2d_DSAparams_fp(fp,x) ASN1_i2d_fp(i2d_DSAparams,(fp), \
147 168 (unsigned char *)(x))
148   -#define d2i_DSAparams_bio(bp,x) (DSA *)ASN1_d2i_bio((char *(*)())DSA_new, \
149   - (char *(*)())d2i_DSAparams,(bp),(unsigned char **)(x))
150   -#define i2d_DSAparams_bio(bp,x) ASN1_i2d_bio(i2d_DSAparams,(bp), \
151   - (unsigned char *)(x))
  169 +#define d2i_DSAparams_bio(bp,x) ASN1_d2i_bio_of(DSA,DSA_new,d2i_DSAparams,bp,x)
  170 +#define i2d_DSAparams_bio(bp,x) ASN1_i2d_bio_of_const(DSA,i2d_DSAparams,bp,x)
152 171  
153 172  
154 173 DSA_SIG * DSA_SIG_new(void);
... ... @@ -186,10 +205,20 @@ void *DSA_get_ex_data(DSA *d, int idx);
186 205 DSA * d2i_DSAPublicKey(DSA **a, const unsigned char **pp, long length);
187 206 DSA * d2i_DSAPrivateKey(DSA **a, const unsigned char **pp, long length);
188 207 DSA * d2i_DSAparams(DSA **a, const unsigned char **pp, long length);
  208 +
  209 +/* Deprecated version */
  210 +#ifndef OPENSSL_NO_DEPRECATED
189 211 DSA * DSA_generate_parameters(int bits,
190 212 unsigned char *seed,int seed_len,
191 213 int *counter_ret, unsigned long *h_ret,void
192 214 (*callback)(int, int, void *),void *cb_arg);
  215 +#endif /* !defined(OPENSSL_NO_DEPRECATED) */
  216 +
  217 +/* New version */
  218 +int DSA_generate_parameters_ex(DSA *dsa, int bits,
  219 + unsigned char *seed,int seed_len,
  220 + int *counter_ret, unsigned long *h_ret, BN_GENCB *cb);
  221 +
193 222 int DSA_generate_key(DSA *a);
194 223 int i2d_DSAPublicKey(const DSA *a, unsigned char **pp);
195 224 int i2d_DSAPrivateKey(const DSA *a, unsigned char **pp);
... ...
third_dev/openssl/include/openssl/dso.h
1   -/* dso.h */
  1 +/* dso.h -*- mode:C; c-file-style: "eay" -*- */
2 2 /* Written by Geoff Thorpe (geoff@geoffthorpe.net) for the OpenSSL
3 3 * project 2000.
4 4 */
... ... @@ -95,6 +95,13 @@ extern &quot;C&quot; {
95 95 */
96 96 #define DSO_FLAG_UPCASE_SYMBOL 0x10
97 97  
  98 +/* This flag loads the library with public symbols.
  99 + * Meaning: The exported symbols of this library are public
  100 + * to all libraries loaded after this library.
  101 + * At the moment only implemented in unix.
  102 + */
  103 +#define DSO_FLAG_GLOBAL_SYMBOLS 0x20
  104 +
98 105  
99 106 typedef void (*DSO_FUNC_TYPE)(void);
100 107  
... ... @@ -107,6 +114,22 @@ typedef struct dso_st DSO;
107 114 * condition) or a newly allocated string containing the transformed form that
108 115 * the caller will need to free with OPENSSL_free() when done. */
109 116 typedef char* (*DSO_NAME_CONVERTER_FUNC)(DSO *, const char *);
  117 +/* The function prototype used for method functions (or caller-provided
  118 + * callbacks) that merge two file specifications. They are passed a
  119 + * DSO structure pointer (or NULL if they are to be used independantly of
  120 + * a DSO object) and two file specifications to merge. They should
  121 + * either return NULL (if there is an error condition) or a newly allocated
  122 + * string containing the result of merging that the caller will need
  123 + * to free with OPENSSL_free() when done.
  124 + * Here, merging means that bits and pieces are taken from each of the
  125 + * file specifications and added together in whatever fashion that is
  126 + * sensible for the DSO method in question. The only rule that really
  127 + * applies is that if the two specification contain pieces of the same
  128 + * type, the copy from the first string takes priority. One could see
  129 + * it as the first specification is the one given by the user and the
  130 + * second being a bunch of defaults to add on if they're missing in the
  131 + * first. */
  132 +typedef char* (*DSO_MERGER_FUNC)(DSO *, const char *, const char *);
110 133  
111 134 typedef struct dso_meth_st
112 135 {
... ... @@ -140,6 +163,9 @@ typedef struct dso_meth_st
140 163 /* The default DSO_METHOD-specific function for converting filenames to
141 164 * a canonical native form. */
142 165 DSO_NAME_CONVERTER_FUNC dso_name_converter;
  166 + /* The default DSO_METHOD-specific function for converting filenames to
  167 + * a canonical native form. */
  168 + DSO_MERGER_FUNC dso_merger;
143 169  
144 170 /* [De]Initialisation handlers. */
145 171 int (*init)(DSO *dso);
... ... @@ -164,9 +190,13 @@ struct dso_st
164 190 * don't touch meth_data! */
165 191 CRYPTO_EX_DATA ex_data;
166 192 /* If this callback function pointer is set to non-NULL, then it will
167   - * be used on DSO_load() in place of meth->dso_name_converter. NB: This
  193 + * be used in DSO_load() in place of meth->dso_name_converter. NB: This
168 194 * should normally set using DSO_set_name_converter(). */
169 195 DSO_NAME_CONVERTER_FUNC name_converter;
  196 + /* If this callback function pointer is set to non-NULL, then it will
  197 + * be used in DSO_load() in place of meth->dso_merger. NB: This
  198 + * should normally set using DSO_set_merger(). */
  199 + DSO_MERGER_FUNC merger;
170 200 /* This is populated with (a copy of) the platform-independant
171 201 * filename used for this DSO. */
172 202 char *filename;
... ... @@ -209,6 +239,11 @@ int DSO_set_filename(DSO *dso, const char *filename);
209 239 * caller-created DSO_METHODs can do the same thing. A non-NULL return value
210 240 * will need to be OPENSSL_free()'d. */
211 241 char *DSO_convert_filename(DSO *dso, const char *filename);
  242 +/* This function will invoke the DSO's merger callback to merge two file
  243 + * specifications, or if the callback isn't set it will instead use the
  244 + * DSO_METHOD's merger. A non-NULL return value will need to be
  245 + * OPENSSL_free()'d. */
  246 +char *DSO_merge(DSO *dso, const char *filespec1, const char *filespec2);
212 247 /* If the DSO is currently loaded, this returns the filename that it was loaded
213 248 * under, otherwise it returns NULL. So it is also useful as a test as to
214 249 * whether the DSO is currently loaded. NB: This will not necessarily return
... ... @@ -273,11 +308,13 @@ void ERR_load_DSO_strings(void);
273 308 #define DSO_F_DLFCN_BIND_FUNC 100
274 309 #define DSO_F_DLFCN_BIND_VAR 101
275 310 #define DSO_F_DLFCN_LOAD 102
  311 +#define DSO_F_DLFCN_MERGER 130
276 312 #define DSO_F_DLFCN_NAME_CONVERTER 123
277 313 #define DSO_F_DLFCN_UNLOAD 103
278 314 #define DSO_F_DL_BIND_FUNC 104
279 315 #define DSO_F_DL_BIND_VAR 105
280 316 #define DSO_F_DL_LOAD 106
  317 +#define DSO_F_DL_MERGER 131
281 318 #define DSO_F_DL_NAME_CONVERTER 124
282 319 #define DSO_F_DL_UNLOAD 107
283 320 #define DSO_F_DSO_BIND_FUNC 108
... ... @@ -288,27 +325,36 @@ void ERR_load_DSO_strings(void);
288 325 #define DSO_F_DSO_GET_FILENAME 127
289 326 #define DSO_F_DSO_GET_LOADED_FILENAME 128
290 327 #define DSO_F_DSO_LOAD 112
  328 +#define DSO_F_DSO_MERGE 132
291 329 #define DSO_F_DSO_NEW_METHOD 113
292 330 #define DSO_F_DSO_SET_FILENAME 129
293 331 #define DSO_F_DSO_SET_NAME_CONVERTER 122
294 332 #define DSO_F_DSO_UP_REF 114
295   -#define DSO_F_VMS_BIND_VAR 115
  333 +#define DSO_F_VMS_BIND_SYM 115
296 334 #define DSO_F_VMS_LOAD 116
  335 +#define DSO_F_VMS_MERGER 133
297 336 #define DSO_F_VMS_UNLOAD 117
298 337 #define DSO_F_WIN32_BIND_FUNC 118
299 338 #define DSO_F_WIN32_BIND_VAR 119
  339 +#define DSO_F_WIN32_JOINER 135
300 340 #define DSO_F_WIN32_LOAD 120
  341 +#define DSO_F_WIN32_MERGER 134
301 342 #define DSO_F_WIN32_NAME_CONVERTER 125
  343 +#define DSO_F_WIN32_SPLITTER 136
302 344 #define DSO_F_WIN32_UNLOAD 121
303 345  
304 346 /* Reason codes. */
305 347 #define DSO_R_CTRL_FAILED 100
306 348 #define DSO_R_DSO_ALREADY_LOADED 110
  349 +#define DSO_R_EMPTY_FILE_STRUCTURE 113
  350 +#define DSO_R_FAILURE 114
307 351 #define DSO_R_FILENAME_TOO_BIG 101
308 352 #define DSO_R_FINISH_FAILED 102
  353 +#define DSO_R_INCORRECT_FILE_SYNTAX 115
309 354 #define DSO_R_LOAD_FAILED 103
310 355 #define DSO_R_NAME_TRANSLATION_FAILED 109
311 356 #define DSO_R_NO_FILENAME 111
  357 +#define DSO_R_NO_FILE_SPECIFICATION 116
312 358 #define DSO_R_NULL_HANDLE 104
313 359 #define DSO_R_SET_FILENAME_FAILED 112
314 360 #define DSO_R_STACK_ERROR 105
... ...
third_dev/openssl/include/openssl/dtls1.h 0 → 100644
  1 +/* ssl/dtls1.h */
  2 +/*
  3 + * DTLS implementation written by Nagendra Modadugu
  4 + * (nagendra@cs.stanford.edu) for the OpenSSL project 2005.
  5 + */
  6 +/* ====================================================================
  7 + * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved.
  8 + *
  9 + * Redistribution and use in source and binary forms, with or without
  10 + * modification, are permitted provided that the following conditions
  11 + * are met:
  12 + *
  13 + * 1. Redistributions of source code must retain the above copyright
  14 + * notice, this list of conditions and the following disclaimer.
  15 + *
  16 + * 2. Redistributions in binary form must reproduce the above copyright
  17 + * notice, this list of conditions and the following disclaimer in
  18 + * the documentation and/or other materials provided with the
  19 + * distribution.
  20 + *
  21 + * 3. All advertising materials mentioning features or use of this
  22 + * software must display the following acknowledgment:
  23 + * "This product includes software developed by the OpenSSL Project
  24 + * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
  25 + *
  26 + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
  27 + * endorse or promote products derived from this software without
  28 + * prior written permission. For written permission, please contact
  29 + * openssl-core@OpenSSL.org.
  30 + *
  31 + * 5. Products derived from this software may not be called "OpenSSL"
  32 + * nor may "OpenSSL" appear in their names without prior written
  33 + * permission of the OpenSSL Project.
  34 + *
  35 + * 6. Redistributions of any form whatsoever must retain the following
  36 + * acknowledgment:
  37 + * "This product includes software developed by the OpenSSL Project
  38 + * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
  39 + *
  40 + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
  41 + * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  42 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  43 + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
  44 + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  45 + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  46 + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  47 + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  48 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  49 + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  50 + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
  51 + * OF THE POSSIBILITY OF SUCH DAMAGE.
  52 + * ====================================================================
  53 + *
  54 + * This product includes cryptographic software written by Eric Young
  55 + * (eay@cryptsoft.com). This product includes software written by Tim
  56 + * Hudson (tjh@cryptsoft.com).
  57 + *
  58 + */
  59 +
  60 +#ifndef HEADER_DTLS1_H
  61 +#define HEADER_DTLS1_H
  62 +
  63 +#include <openssl/buffer.h>
  64 +#include <openssl/pqueue.h>
  65 +
  66 +#ifdef __cplusplus
  67 +extern "C" {
  68 +#endif
  69 +
  70 +#define DTLS1_VERSION 0x0100
  71 +#define DTLS1_VERSION_MAJOR 0x01
  72 +#define DTLS1_VERSION_MINOR 0x00
  73 +
  74 +#define DTLS1_AD_MISSING_HANDSHAKE_MESSAGE 110
  75 +
  76 +/* lengths of messages */
  77 +#define DTLS1_COOKIE_LENGTH 32
  78 +
  79 +#define DTLS1_RT_HEADER_LENGTH 13
  80 +
  81 +#define DTLS1_HM_HEADER_LENGTH 12
  82 +
  83 +#define DTLS1_HM_BAD_FRAGMENT -2
  84 +#define DTLS1_HM_FRAGMENT_RETRY -3
  85 +
  86 +#define DTLS1_CCS_HEADER_LENGTH 3
  87 +
  88 +#define DTLS1_AL_HEADER_LENGTH 7
  89 +
  90 +
  91 +typedef struct dtls1_bitmap_st
  92 + {
  93 + PQ_64BIT map;
  94 + unsigned long length; /* sizeof the bitmap in bits */
  95 + PQ_64BIT max_seq_num; /* max record number seen so far */
  96 + } DTLS1_BITMAP;
  97 +
  98 +struct hm_header_st
  99 + {
  100 + unsigned char type;
  101 + unsigned long msg_len;
  102 + unsigned short seq;
  103 + unsigned long frag_off;
  104 + unsigned long frag_len;
  105 + unsigned int is_ccs;
  106 + };
  107 +
  108 +struct ccs_header_st
  109 + {
  110 + unsigned char type;
  111 + unsigned short seq;
  112 + };
  113 +
  114 +struct dtls1_timeout_st
  115 + {
  116 + /* Number of read timeouts so far */
  117 + unsigned int read_timeouts;
  118 +
  119 + /* Number of write timeouts so far */
  120 + unsigned int write_timeouts;
  121 +
  122 + /* Number of alerts received so far */
  123 + unsigned int num_alerts;
  124 + };
  125 +
  126 +typedef struct record_pqueue_st
  127 + {
  128 + unsigned short epoch;
  129 + pqueue q;
  130 + } record_pqueue;
  131 +
  132 +typedef struct hm_fragment_st
  133 + {
  134 + struct hm_header_st msg_header;
  135 + unsigned char *fragment;
  136 + } hm_fragment;
  137 +
  138 +typedef struct dtls1_state_st
  139 + {
  140 + unsigned int send_cookie;
  141 + unsigned char cookie[DTLS1_COOKIE_LENGTH];
  142 + unsigned char rcvd_cookie[DTLS1_COOKIE_LENGTH];
  143 + unsigned int cookie_len;
  144 +
  145 + /*
  146 + * The current data and handshake epoch. This is initially
  147 + * undefined, and starts at zero once the initial handshake is
  148 + * completed
  149 + */
  150 + unsigned short r_epoch;
  151 + unsigned short w_epoch;
  152 +
  153 + /* records being received in the current epoch */
  154 + DTLS1_BITMAP bitmap;
  155 +
  156 + /* renegotiation starts a new set of sequence numbers */
  157 + DTLS1_BITMAP next_bitmap;
  158 +
  159 + /* handshake message numbers */
  160 + unsigned short handshake_write_seq;
  161 + unsigned short next_handshake_write_seq;
  162 +
  163 + unsigned short handshake_read_seq;
  164 +
  165 + /* Received handshake records (processed and unprocessed) */
  166 + record_pqueue unprocessed_rcds;
  167 + record_pqueue processed_rcds;
  168 +
  169 + /* Buffered handshake messages */
  170 + pqueue buffered_messages;
  171 +
  172 + /* Buffered (sent) handshake records */
  173 + pqueue sent_messages;
  174 +
  175 + unsigned int mtu; /* max wire packet size */
  176 +
  177 + struct hm_header_st w_msg_hdr;
  178 + struct hm_header_st r_msg_hdr;
  179 +
  180 + struct dtls1_timeout_st timeout;
  181 +
  182 + /* storage for Alert/Handshake protocol data received but not
  183 + * yet processed by ssl3_read_bytes: */
  184 + unsigned char alert_fragment[DTLS1_AL_HEADER_LENGTH];
  185 + unsigned int alert_fragment_len;
  186 + unsigned char handshake_fragment[DTLS1_HM_HEADER_LENGTH];
  187 + unsigned int handshake_fragment_len;
  188 +
  189 + unsigned int retransmitting;
  190 +
  191 + } DTLS1_STATE;
  192 +
  193 +typedef struct dtls1_record_data_st
  194 + {
  195 + unsigned char *packet;
  196 + unsigned int packet_length;
  197 + SSL3_BUFFER rbuf;
  198 + SSL3_RECORD rrec;
  199 + } DTLS1_RECORD_DATA;
  200 +
  201 +
  202 +/* Timeout multipliers (timeout slice is defined in apps/timeouts.h */
  203 +#define DTLS1_TMO_READ_COUNT 2
  204 +#define DTLS1_TMO_WRITE_COUNT 2
  205 +
  206 +#define DTLS1_TMO_ALERT_COUNT 12
  207 +
  208 +#ifdef __cplusplus
  209 +}
  210 +#endif
  211 +#endif
  212 +
... ...
third_dev/openssl/include/openssl/e_os2.h
... ... @@ -76,17 +76,20 @@ extern &quot;C&quot; {
76 76 # define OPENSSL_SYS_MACINTOSH_CLASSIC
77 77 #endif
78 78  
  79 +/* ----------------------- NetWare ----------------------------------------- */
  80 +#if defined(NETWARE) || defined(OPENSSL_SYSNAME_NETWARE)
  81 +# undef OPENSSL_SYS_UNIX
  82 +# define OPENSSL_SYS_NETWARE
  83 +#endif
  84 +
79 85 /* ---------------------- Microsoft operating systems ---------------------- */
80 86  
81   -/* The 16 bit environments are pretty straightforward */
82   -#if defined(OPENSSL_SYSNAME_WIN16) || defined(OPENSSL_SYSNAME_MSDOS)
  87 +/* Note that MSDOS actually denotes 32-bit environments running on top of
  88 + MS-DOS, such as DJGPP one. */
  89 +#if defined(OPENSSL_SYSNAME_MSDOS)
83 90 # undef OPENSSL_SYS_UNIX
84 91 # define OPENSSL_SYS_MSDOS
85 92 #endif
86   -#if defined(OPENSSL_SYSNAME_WIN16)
87   -# undef OPENSSL_SYS_UNIX
88   -# define OPENSSL_SYS_WIN16
89   -#endif
90 93  
91 94 /* For 32 bit environment, there seems to be the CygWin environment and then
92 95 all the others that try to do the same thing Microsoft does... */
... ... @@ -114,7 +117,7 @@ extern &quot;C&quot; {
114 117 #endif
115 118  
116 119 /* Anything that tries to look like Microsoft is "Windows" */
117   -#if defined(OPENSSL_SYS_WIN16) || defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_WINNT) || defined(OPENSSL_SYS_WINCE)
  120 +#if defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_WINNT) || defined(OPENSSL_SYS_WINCE)
118 121 # undef OPENSSL_SYS_UNIX
119 122 # define OPENSSL_SYS_WINDOWS
120 123 # ifndef OPENSSL_SYS_MSDOS
... ... @@ -189,6 +192,11 @@ extern &quot;C&quot; {
189 192 # endif
190 193 #endif
191 194  
  195 +/* --------------------------------- VOS ----------------------------------- */
  196 +#ifdef OPENSSL_SYSNAME_VOS
  197 +# define OPENSSL_SYS_VOS
  198 +#endif
  199 +
192 200 /* ------------------------------- VxWorks --------------------------------- */
193 201 #ifdef OPENSSL_SYSNAME_VXWORKS
194 202 # define OPENSSL_SYS_VXWORKS
... ... @@ -232,8 +240,8 @@ extern &quot;C&quot; {
232 240 # define OPENSSL_IMPORT globalref
233 241 # define OPENSSL_GLOBAL globaldef
234 242 #elif defined(OPENSSL_SYS_WINDOWS) && defined(OPENSSL_OPT_WINDLL)
235   -# define OPENSSL_EXPORT extern _declspec(dllexport)
236   -# define OPENSSL_IMPORT extern _declspec(dllimport)
  243 +# define OPENSSL_EXPORT extern __declspec(dllexport)
  244 +# define OPENSSL_IMPORT extern __declspec(dllimport)
237 245 # define OPENSSL_GLOBAL
238 246 #else
239 247 # define OPENSSL_EXPORT extern
... ... @@ -253,9 +261,10 @@ extern &quot;C&quot; {
253 261 #define foobar OPENSSL_GLOBAL_REF(foobar)
254 262 */
255 263 #ifdef OPENSSL_EXPORT_VAR_AS_FUNCTION
256   -# define OPENSSL_IMPLEMENT_GLOBAL(type,name) static type _hide_##name; \
257   - type *_shadow_##name(void) { return &_hide_##name; } \
258   - static type _hide_##name
  264 +# define OPENSSL_IMPLEMENT_GLOBAL(type,name) \
  265 + extern type _hide_##name; \
  266 + type *_shadow_##name(void) { return &_hide_##name; } \
  267 + static type _hide_##name
259 268 # define OPENSSL_DECLARE_GLOBAL(type,name) type *_shadow_##name(void)
260 269 # define OPENSSL_GLOBAL_REF(name) (*(_shadow_##name()))
261 270 #else
... ...
third_dev/openssl/include/openssl/ec.h
1 1 /* crypto/ec/ec.h */
  2 +/*
  3 + * Originally written by Bodo Moeller for the OpenSSL project.
  4 + */
2 5 /* ====================================================================
3   - * Copyright (c) 1998-2001 The OpenSSL Project. All rights reserved.
  6 + * Copyright (c) 1998-2003 The OpenSSL Project. All rights reserved.
4 7 *
5 8 * Redistribution and use in source and binary forms, with or without
6 9 * modification, are permitted provided that the following conditions
... ... @@ -52,19 +55,41 @@
52 55 * Hudson (tjh@cryptsoft.com).
53 56 *
54 57 */
  58 +/* ====================================================================
  59 + * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
  60 + *
  61 + * Portions of the attached software ("Contribution") are developed by
  62 + * SUN MICROSYSTEMS, INC., and are contributed to the OpenSSL project.
  63 + *
  64 + * The Contribution is licensed pursuant to the OpenSSL open source
  65 + * license provided above.
  66 + *
  67 + * The elliptic curve binary polynomial software is originally written by
  68 + * Sheueling Chang Shantz and Douglas Stebila of Sun Microsystems Laboratories.
  69 + *
  70 + */
55 71  
56 72 #ifndef HEADER_EC_H
57 73 #define HEADER_EC_H
58 74  
  75 +#include <openssl/opensslconf.h>
  76 +
59 77 #ifdef OPENSSL_NO_EC
60 78 #error EC is disabled.
61 79 #endif
62 80  
63   -#include <openssl/bn.h>
  81 +#include <openssl/asn1.h>
64 82 #include <openssl/symhacks.h>
  83 +#ifndef OPENSSL_NO_DEPRECATED
  84 +#include <openssl/bn.h>
  85 +#endif
65 86  
66 87 #ifdef __cplusplus
67 88 extern "C" {
  89 +#elif defined(__SUNPRO_C)
  90 +# if __SUNPRO_C >= 0x520
  91 +# pragma error_messages (off,E_ARRAY_OF_INCOMPLETE_NONAME,E_ARRAY_OF_INCOMPLETE)
  92 +# endif
68 93 #endif
69 94  
70 95  
... ... @@ -84,7 +109,8 @@ typedef struct ec_group_st
84 109 -- field definition
85 110 -- curve coefficients
86 111 -- optional generator with associated information (order, cofactor)
87   - -- optional extra data (TODO: precomputed table for fast computation of multiples of generator)
  112 + -- optional extra data (precomputed table for fast computation of multiples of generator)
  113 + -- ASN1 stuff
88 114 */
89 115 EC_GROUP;
90 116  
... ... @@ -96,40 +122,84 @@ typedef struct ec_point_st EC_POINT;
96 122 */
97 123 const EC_METHOD *EC_GFp_simple_method(void);
98 124 const EC_METHOD *EC_GFp_mont_method(void);
99   -#if 0
100   -const EC_METHOD *EC_GFp_recp_method(void); /* TODO */
101   -const EC_METHOD *EC_GFp_nist_method(void); /* TODO */
102   -#endif
  125 +const EC_METHOD *EC_GFp_nist_method(void);
  126 +
  127 +/* EC_METHOD for curves over GF(2^m).
  128 + */
  129 +const EC_METHOD *EC_GF2m_simple_method(void);
103 130  
104 131  
105 132 EC_GROUP *EC_GROUP_new(const EC_METHOD *);
106 133 void EC_GROUP_free(EC_GROUP *);
107 134 void EC_GROUP_clear_free(EC_GROUP *);
108 135 int EC_GROUP_copy(EC_GROUP *, const EC_GROUP *);
  136 +EC_GROUP *EC_GROUP_dup(const EC_GROUP *);
109 137  
110 138 const EC_METHOD *EC_GROUP_method_of(const EC_GROUP *);
111   -
  139 +int EC_METHOD_get_field_type(const EC_METHOD *);
  140 +
  141 +int EC_GROUP_set_generator(EC_GROUP *, const EC_POINT *generator, const BIGNUM *order, const BIGNUM *cofactor);
  142 +const EC_POINT *EC_GROUP_get0_generator(const EC_GROUP *);
  143 +int EC_GROUP_get_order(const EC_GROUP *, BIGNUM *order, BN_CTX *);
  144 +int EC_GROUP_get_cofactor(const EC_GROUP *, BIGNUM *cofactor, BN_CTX *);
  145 +
  146 +void EC_GROUP_set_curve_name(EC_GROUP *, int nid);
  147 +int EC_GROUP_get_curve_name(const EC_GROUP *);
  148 +
  149 +void EC_GROUP_set_asn1_flag(EC_GROUP *, int flag);
  150 +int EC_GROUP_get_asn1_flag(const EC_GROUP *);
  151 +
  152 +void EC_GROUP_set_point_conversion_form(EC_GROUP *, point_conversion_form_t);
  153 +point_conversion_form_t EC_GROUP_get_point_conversion_form(const EC_GROUP *);
  154 +
  155 +unsigned char *EC_GROUP_get0_seed(const EC_GROUP *);
  156 +size_t EC_GROUP_get_seed_len(const EC_GROUP *);
  157 +size_t EC_GROUP_set_seed(EC_GROUP *, const unsigned char *, size_t len);
112 158  
113   -/* We don't have types for field specifications and field elements in general.
114   - * Otherwise we could declare
115   - * int EC_GROUP_set_curve(EC_GROUP *, .....);
116   - */
117 159 int EC_GROUP_set_curve_GFp(EC_GROUP *, const BIGNUM *p, const BIGNUM *a, const BIGNUM *b, BN_CTX *);
118 160 int EC_GROUP_get_curve_GFp(const EC_GROUP *, BIGNUM *p, BIGNUM *a, BIGNUM *b, BN_CTX *);
  161 +int EC_GROUP_set_curve_GF2m(EC_GROUP *, const BIGNUM *p, const BIGNUM *a, const BIGNUM *b, BN_CTX *);
  162 +int EC_GROUP_get_curve_GF2m(const EC_GROUP *, BIGNUM *p, BIGNUM *a, BIGNUM *b, BN_CTX *);
  163 +
  164 +/* returns the number of bits needed to represent a field element */
  165 +int EC_GROUP_get_degree(const EC_GROUP *);
  166 +
  167 +/* EC_GROUP_check() returns 1 if 'group' defines a valid group, 0 otherwise */
  168 +int EC_GROUP_check(const EC_GROUP *group, BN_CTX *ctx);
  169 +/* EC_GROUP_check_discriminant() returns 1 if the discriminant of the
  170 + * elliptic curve is not zero, 0 otherwise */
  171 +int EC_GROUP_check_discriminant(const EC_GROUP *, BN_CTX *);
  172 +
  173 +/* EC_GROUP_cmp() returns 0 if both groups are equal and 1 otherwise */
  174 +int EC_GROUP_cmp(const EC_GROUP *, const EC_GROUP *, BN_CTX *);
119 175  
120   -/* EC_GROUP_new_GFp() calls EC_GROUP_new() and EC_GROUP_set_GFp()
  176 +/* EC_GROUP_new_GF*() calls EC_GROUP_new() and EC_GROUP_set_GF*()
121 177 * after choosing an appropriate EC_METHOD */
122 178 EC_GROUP *EC_GROUP_new_curve_GFp(const BIGNUM *p, const BIGNUM *a, const BIGNUM *b, BN_CTX *);
  179 +EC_GROUP *EC_GROUP_new_curve_GF2m(const BIGNUM *p, const BIGNUM *a, const BIGNUM *b, BN_CTX *);
  180 +
  181 +/* EC_GROUP_new_by_curve_name() creates a EC_GROUP structure
  182 + * specified by a curve name (in form of a NID) */
  183 +EC_GROUP *EC_GROUP_new_by_curve_name(int nid);
  184 +/* handling of internal curves */
  185 +typedef struct {
  186 + int nid;
  187 + const char *comment;
  188 + } EC_builtin_curve;
  189 +/* EC_builtin_curves(EC_builtin_curve *r, size_t size) returns number
  190 + * of all available curves or zero if a error occurred.
  191 + * In case r ist not zero nitems EC_builtin_curve structures
  192 + * are filled with the data of the first nitems internal groups */
  193 +size_t EC_get_builtin_curves(EC_builtin_curve *r, size_t nitems);
123 194  
124   -int EC_GROUP_set_generator(EC_GROUP *, const EC_POINT *generator, const BIGNUM *order, const BIGNUM *cofactor);
125   -EC_POINT *EC_GROUP_get0_generator(const EC_GROUP *);
126   -int EC_GROUP_get_order(const EC_GROUP *, BIGNUM *order, BN_CTX *);
127   -int EC_GROUP_get_cofactor(const EC_GROUP *, BIGNUM *cofactor, BN_CTX *);
  195 +
  196 +/* EC_POINT functions */
128 197  
129 198 EC_POINT *EC_POINT_new(const EC_GROUP *);
130 199 void EC_POINT_free(EC_POINT *);
131 200 void EC_POINT_clear_free(EC_POINT *);
132 201 int EC_POINT_copy(EC_POINT *, const EC_POINT *);
  202 +EC_POINT *EC_POINT_dup(const EC_POINT *, const EC_GROUP *);
133 203  
134 204 const EC_METHOD *EC_POINT_method_of(const EC_POINT *);
135 205  
... ... @@ -145,11 +215,28 @@ int EC_POINT_get_affine_coordinates_GFp(const EC_GROUP *, const EC_POINT *,
145 215 int EC_POINT_set_compressed_coordinates_GFp(const EC_GROUP *, EC_POINT *,
146 216 const BIGNUM *x, int y_bit, BN_CTX *);
147 217  
  218 +int EC_POINT_set_affine_coordinates_GF2m(const EC_GROUP *, EC_POINT *,
  219 + const BIGNUM *x, const BIGNUM *y, BN_CTX *);
  220 +int EC_POINT_get_affine_coordinates_GF2m(const EC_GROUP *, const EC_POINT *,
  221 + BIGNUM *x, BIGNUM *y, BN_CTX *);
  222 +int EC_POINT_set_compressed_coordinates_GF2m(const EC_GROUP *, EC_POINT *,
  223 + const BIGNUM *x, int y_bit, BN_CTX *);
  224 +
148 225 size_t EC_POINT_point2oct(const EC_GROUP *, const EC_POINT *, point_conversion_form_t form,
149 226 unsigned char *buf, size_t len, BN_CTX *);
150 227 int EC_POINT_oct2point(const EC_GROUP *, EC_POINT *,
151 228 const unsigned char *buf, size_t len, BN_CTX *);
152 229  
  230 +/* other interfaces to point2oct/oct2point: */
  231 +BIGNUM *EC_POINT_point2bn(const EC_GROUP *, const EC_POINT *,
  232 + point_conversion_form_t form, BIGNUM *, BN_CTX *);
  233 +EC_POINT *EC_POINT_bn2point(const EC_GROUP *, const BIGNUM *,
  234 + EC_POINT *, BN_CTX *);
  235 +char *EC_POINT_point2hex(const EC_GROUP *, const EC_POINT *,
  236 + point_conversion_form_t form, BN_CTX *);
  237 +EC_POINT *EC_POINT_hex2point(const EC_GROUP *, const char *,
  238 + EC_POINT *, BN_CTX *);
  239 +
153 240 int EC_POINT_add(const EC_GROUP *, EC_POINT *r, const EC_POINT *a, const EC_POINT *b, BN_CTX *);
154 241 int EC_POINT_dbl(const EC_GROUP *, EC_POINT *r, const EC_POINT *a, BN_CTX *);
155 242 int EC_POINT_invert(const EC_GROUP *, EC_POINT *, BN_CTX *);
... ... @@ -164,9 +251,112 @@ int EC_POINTs_make_affine(const EC_GROUP *, size_t num, EC_POINT *[], BN_CTX *);
164 251  
165 252 int EC_POINTs_mul(const EC_GROUP *, EC_POINT *r, const BIGNUM *, size_t num, const EC_POINT *[], const BIGNUM *[], BN_CTX *);
166 253 int EC_POINT_mul(const EC_GROUP *, EC_POINT *r, const BIGNUM *, const EC_POINT *, const BIGNUM *, BN_CTX *);
  254 +
  255 +/* EC_GROUP_precompute_mult() stores multiples of generator for faster point multiplication */
167 256 int EC_GROUP_precompute_mult(EC_GROUP *, BN_CTX *);
  257 +/* EC_GROUP_have_precompute_mult() reports whether such precomputation has been done */
  258 +int EC_GROUP_have_precompute_mult(const EC_GROUP *);
  259 +
  260 +
168 261  
  262 +/* ASN1 stuff */
169 263  
  264 +/* EC_GROUP_get_basis_type() returns the NID of the basis type
  265 + * used to represent the field elements */
  266 +int EC_GROUP_get_basis_type(const EC_GROUP *);
  267 +int EC_GROUP_get_trinomial_basis(const EC_GROUP *, unsigned int *k);
  268 +int EC_GROUP_get_pentanomial_basis(const EC_GROUP *, unsigned int *k1,
  269 + unsigned int *k2, unsigned int *k3);
  270 +
  271 +#define OPENSSL_EC_NAMED_CURVE 0x001
  272 +
  273 +typedef struct ecpk_parameters_st ECPKPARAMETERS;
  274 +
  275 +EC_GROUP *d2i_ECPKParameters(EC_GROUP **, const unsigned char **in, long len);
  276 +int i2d_ECPKParameters(const EC_GROUP *, unsigned char **out);
  277 +
  278 +#define d2i_ECPKParameters_bio(bp,x) ASN1_d2i_bio_of(EC_GROUP,NULL,d2i_ECPKParameters,bp,x)
  279 +#define i2d_ECPKParameters_bio(bp,x) ASN1_i2d_bio_of_const(EC_GROUP,i2d_ECPKParameters,bp,x)
  280 +#define d2i_ECPKParameters_fp(fp,x) (EC_GROUP *)ASN1_d2i_fp(NULL, \
  281 + (char *(*)())d2i_ECPKParameters,(fp),(unsigned char **)(x))
  282 +#define i2d_ECPKParameters_fp(fp,x) ASN1_i2d_fp(i2d_ECPKParameters,(fp), \
  283 + (unsigned char *)(x))
  284 +
  285 +#ifndef OPENSSL_NO_BIO
  286 +int ECPKParameters_print(BIO *bp, const EC_GROUP *x, int off);
  287 +#endif
  288 +#ifndef OPENSSL_NO_FP_API
  289 +int ECPKParameters_print_fp(FILE *fp, const EC_GROUP *x, int off);
  290 +#endif
  291 +
  292 +/* the EC_KEY stuff */
  293 +typedef struct ec_key_st EC_KEY;
  294 +
  295 +/* some values for the encoding_flag */
  296 +#define EC_PKEY_NO_PARAMETERS 0x001
  297 +#define EC_PKEY_NO_PUBKEY 0x002
  298 +
  299 +EC_KEY *EC_KEY_new(void);
  300 +EC_KEY *EC_KEY_new_by_curve_name(int nid);
  301 +void EC_KEY_free(EC_KEY *);
  302 +EC_KEY *EC_KEY_copy(EC_KEY *, const EC_KEY *);
  303 +EC_KEY *EC_KEY_dup(const EC_KEY *);
  304 +
  305 +int EC_KEY_up_ref(EC_KEY *);
  306 +
  307 +const EC_GROUP *EC_KEY_get0_group(const EC_KEY *);
  308 +int EC_KEY_set_group(EC_KEY *, const EC_GROUP *);
  309 +const BIGNUM *EC_KEY_get0_private_key(const EC_KEY *);
  310 +int EC_KEY_set_private_key(EC_KEY *, const BIGNUM *);
  311 +const EC_POINT *EC_KEY_get0_public_key(const EC_KEY *);
  312 +int EC_KEY_set_public_key(EC_KEY *, const EC_POINT *);
  313 +unsigned EC_KEY_get_enc_flags(const EC_KEY *);
  314 +void EC_KEY_set_enc_flags(EC_KEY *, unsigned int);
  315 +point_conversion_form_t EC_KEY_get_conv_form(const EC_KEY *);
  316 +void EC_KEY_set_conv_form(EC_KEY *, point_conversion_form_t);
  317 +/* functions to set/get method specific data */
  318 +void *EC_KEY_get_key_method_data(EC_KEY *,
  319 + void *(*dup_func)(void *), void (*free_func)(void *), void (*clear_free_func)(void *));
  320 +void EC_KEY_insert_key_method_data(EC_KEY *, void *data,
  321 + void *(*dup_func)(void *), void (*free_func)(void *), void (*clear_free_func)(void *));
  322 +/* wrapper functions for the underlying EC_GROUP object */
  323 +void EC_KEY_set_asn1_flag(EC_KEY *, int);
  324 +int EC_KEY_precompute_mult(EC_KEY *, BN_CTX *ctx);
  325 +
  326 +/* EC_KEY_generate_key() creates a ec private (public) key */
  327 +int EC_KEY_generate_key(EC_KEY *);
  328 +/* EC_KEY_check_key() */
  329 +int EC_KEY_check_key(const EC_KEY *);
  330 +
  331 +/* de- and encoding functions for SEC1 ECPrivateKey */
  332 +EC_KEY *d2i_ECPrivateKey(EC_KEY **a, const unsigned char **in, long len);
  333 +int i2d_ECPrivateKey(EC_KEY *a, unsigned char **out);
  334 +/* de- and encoding functions for EC parameters */
  335 +EC_KEY *d2i_ECParameters(EC_KEY **a, const unsigned char **in, long len);
  336 +int i2d_ECParameters(EC_KEY *a, unsigned char **out);
  337 +/* de- and encoding functions for EC public key
  338 + * (octet string, not DER -- hence 'o2i' and 'i2o') */
  339 +EC_KEY *o2i_ECPublicKey(EC_KEY **a, const unsigned char **in, long len);
  340 +int i2o_ECPublicKey(EC_KEY *a, unsigned char **out);
  341 +
  342 +#ifndef OPENSSL_NO_BIO
  343 +int ECParameters_print(BIO *bp, const EC_KEY *x);
  344 +int EC_KEY_print(BIO *bp, const EC_KEY *x, int off);
  345 +#endif
  346 +#ifndef OPENSSL_NO_FP_API
  347 +int ECParameters_print_fp(FILE *fp, const EC_KEY *x);
  348 +int EC_KEY_print_fp(FILE *fp, const EC_KEY *x, int off);
  349 +#endif
  350 +
  351 +#define ECParameters_dup(x) ASN1_dup_of(EC_KEY,i2d_ECParameters,d2i_ECParameters,x)
  352 +
  353 +#ifndef __cplusplus
  354 +#if defined(__SUNPRO_C)
  355 +# if __SUNPRO_C >= 0x520
  356 +# pragma error_messages (default,E_ARRAY_OF_INCOMPLETE_NONAME,E_ARRAY_OF_INCOMPLETE)
  357 +# endif
  358 +# endif
  359 +#endif
170 360  
171 361 /* BEGIN ERROR CODES */
172 362 /* The following lines are auto generated by the script mkerr.pl. Any changes
... ... @@ -178,51 +368,122 @@ void ERR_load_EC_strings(void);
178 368  
179 369 /* Function codes. */
180 370 #define EC_F_COMPUTE_WNAF 143
  371 +#define EC_F_D2I_ECPARAMETERS 144
  372 +#define EC_F_D2I_ECPKPARAMETERS 145
  373 +#define EC_F_D2I_ECPRIVATEKEY 146
  374 +#define EC_F_ECPARAMETERS_PRINT 147
  375 +#define EC_F_ECPARAMETERS_PRINT_FP 148
  376 +#define EC_F_ECPKPARAMETERS_PRINT 149
  377 +#define EC_F_ECPKPARAMETERS_PRINT_FP 150
  378 +#define EC_F_ECP_NIST_MOD_192 203
  379 +#define EC_F_ECP_NIST_MOD_224 204
  380 +#define EC_F_ECP_NIST_MOD_256 205
  381 +#define EC_F_ECP_NIST_MOD_521 206
  382 +#define EC_F_EC_ASN1_GROUP2CURVE 153
  383 +#define EC_F_EC_ASN1_GROUP2FIELDID 154
  384 +#define EC_F_EC_ASN1_GROUP2PARAMETERS 155
  385 +#define EC_F_EC_ASN1_GROUP2PKPARAMETERS 156
  386 +#define EC_F_EC_ASN1_PARAMETERS2GROUP 157
  387 +#define EC_F_EC_ASN1_PKPARAMETERS2GROUP 158
  388 +#define EC_F_EC_EX_DATA_SET_DATA 211
  389 +#define EC_F_EC_GF2M_MONTGOMERY_POINT_MULTIPLY 208
  390 +#define EC_F_EC_GF2M_SIMPLE_GROUP_CHECK_DISCRIMINANT 159
  391 +#define EC_F_EC_GF2M_SIMPLE_GROUP_SET_CURVE 195
  392 +#define EC_F_EC_GF2M_SIMPLE_OCT2POINT 160
  393 +#define EC_F_EC_GF2M_SIMPLE_POINT2OCT 161
  394 +#define EC_F_EC_GF2M_SIMPLE_POINT_GET_AFFINE_COORDINATES 162
  395 +#define EC_F_EC_GF2M_SIMPLE_POINT_SET_AFFINE_COORDINATES 163
  396 +#define EC_F_EC_GF2M_SIMPLE_SET_COMPRESSED_COORDINATES 164
181 397 #define EC_F_EC_GFP_MONT_FIELD_DECODE 133
182 398 #define EC_F_EC_GFP_MONT_FIELD_ENCODE 134
183 399 #define EC_F_EC_GFP_MONT_FIELD_MUL 131
  400 +#define EC_F_EC_GFP_MONT_FIELD_SET_TO_ONE 209
184 401 #define EC_F_EC_GFP_MONT_FIELD_SQR 132
  402 +#define EC_F_EC_GFP_MONT_GROUP_SET_CURVE 189
  403 +#define EC_F_EC_GFP_MONT_GROUP_SET_CURVE_GFP 135
  404 +#define EC_F_EC_GFP_NIST_FIELD_MUL 200
  405 +#define EC_F_EC_GFP_NIST_FIELD_SQR 201
  406 +#define EC_F_EC_GFP_NIST_GROUP_SET_CURVE 202
  407 +#define EC_F_EC_GFP_SIMPLE_GROUP_CHECK_DISCRIMINANT 165
  408 +#define EC_F_EC_GFP_SIMPLE_GROUP_SET_CURVE 166
185 409 #define EC_F_EC_GFP_SIMPLE_GROUP_SET_CURVE_GFP 100
186 410 #define EC_F_EC_GFP_SIMPLE_GROUP_SET_GENERATOR 101
187 411 #define EC_F_EC_GFP_SIMPLE_MAKE_AFFINE 102
188 412 #define EC_F_EC_GFP_SIMPLE_OCT2POINT 103
189 413 #define EC_F_EC_GFP_SIMPLE_POINT2OCT 104
190 414 #define EC_F_EC_GFP_SIMPLE_POINTS_MAKE_AFFINE 137
  415 +#define EC_F_EC_GFP_SIMPLE_POINT_GET_AFFINE_COORDINATES 167
191 416 #define EC_F_EC_GFP_SIMPLE_POINT_GET_AFFINE_COORDINATES_GFP 105
  417 +#define EC_F_EC_GFP_SIMPLE_POINT_SET_AFFINE_COORDINATES 168
192 418 #define EC_F_EC_GFP_SIMPLE_POINT_SET_AFFINE_COORDINATES_GFP 128
  419 +#define EC_F_EC_GFP_SIMPLE_SET_COMPRESSED_COORDINATES 169
193 420 #define EC_F_EC_GFP_SIMPLE_SET_COMPRESSED_COORDINATES_GFP 129
  421 +#define EC_F_EC_GROUP_CHECK 170
  422 +#define EC_F_EC_GROUP_CHECK_DISCRIMINANT 171
194 423 #define EC_F_EC_GROUP_COPY 106
195 424 #define EC_F_EC_GROUP_GET0_GENERATOR 139
196 425 #define EC_F_EC_GROUP_GET_COFACTOR 140
  426 +#define EC_F_EC_GROUP_GET_CURVE_GF2M 172
197 427 #define EC_F_EC_GROUP_GET_CURVE_GFP 130
  428 +#define EC_F_EC_GROUP_GET_DEGREE 173
198 429 #define EC_F_EC_GROUP_GET_ORDER 141
  430 +#define EC_F_EC_GROUP_GET_PENTANOMIAL_BASIS 193
  431 +#define EC_F_EC_GROUP_GET_TRINOMIAL_BASIS 194
199 432 #define EC_F_EC_GROUP_NEW 108
  433 +#define EC_F_EC_GROUP_NEW_BY_CURVE_NAME 174
  434 +#define EC_F_EC_GROUP_NEW_FROM_DATA 175
200 435 #define EC_F_EC_GROUP_PRECOMPUTE_MULT 142
  436 +#define EC_F_EC_GROUP_SET_CURVE_GF2M 176
201 437 #define EC_F_EC_GROUP_SET_CURVE_GFP 109
202 438 #define EC_F_EC_GROUP_SET_EXTRA_DATA 110
203 439 #define EC_F_EC_GROUP_SET_GENERATOR 111
  440 +#define EC_F_EC_KEY_CHECK_KEY 177
  441 +#define EC_F_EC_KEY_COPY 178
  442 +#define EC_F_EC_KEY_GENERATE_KEY 179
  443 +#define EC_F_EC_KEY_NEW 182
  444 +#define EC_F_EC_KEY_PRINT 180
  445 +#define EC_F_EC_KEY_PRINT_FP 181
204 446 #define EC_F_EC_POINTS_MAKE_AFFINE 136
205 447 #define EC_F_EC_POINTS_MUL 138
206 448 #define EC_F_EC_POINT_ADD 112
207 449 #define EC_F_EC_POINT_CMP 113
208 450 #define EC_F_EC_POINT_COPY 114
209 451 #define EC_F_EC_POINT_DBL 115
  452 +#define EC_F_EC_POINT_GET_AFFINE_COORDINATES_GF2M 183
210 453 #define EC_F_EC_POINT_GET_AFFINE_COORDINATES_GFP 116
211 454 #define EC_F_EC_POINT_GET_JPROJECTIVE_COORDINATES_GFP 117
  455 +#define EC_F_EC_POINT_INVERT 210
212 456 #define EC_F_EC_POINT_IS_AT_INFINITY 118
213 457 #define EC_F_EC_POINT_IS_ON_CURVE 119
214 458 #define EC_F_EC_POINT_MAKE_AFFINE 120
  459 +#define EC_F_EC_POINT_MUL 184
215 460 #define EC_F_EC_POINT_NEW 121
216 461 #define EC_F_EC_POINT_OCT2POINT 122
217 462 #define EC_F_EC_POINT_POINT2OCT 123
  463 +#define EC_F_EC_POINT_SET_AFFINE_COORDINATES_GF2M 185
218 464 #define EC_F_EC_POINT_SET_AFFINE_COORDINATES_GFP 124
  465 +#define EC_F_EC_POINT_SET_COMPRESSED_COORDINATES_GF2M 186
219 466 #define EC_F_EC_POINT_SET_COMPRESSED_COORDINATES_GFP 125
220 467 #define EC_F_EC_POINT_SET_JPROJECTIVE_COORDINATES_GFP 126
221 468 #define EC_F_EC_POINT_SET_TO_INFINITY 127
222   -#define EC_F_GFP_MONT_GROUP_SET_CURVE_GFP 135
  469 +#define EC_F_EC_PRE_COMP_DUP 207
  470 +#define EC_F_EC_WNAF_MUL 187
  471 +#define EC_F_EC_WNAF_PRECOMPUTE_MULT 188
  472 +#define EC_F_I2D_ECPARAMETERS 190
  473 +#define EC_F_I2D_ECPKPARAMETERS 191
  474 +#define EC_F_I2D_ECPRIVATEKEY 192
  475 +#define EC_F_I2O_ECPUBLICKEY 151
  476 +#define EC_F_O2I_ECPUBLICKEY 152
223 477  
224 478 /* Reason codes. */
  479 +#define EC_R_ASN1_ERROR 115
  480 +#define EC_R_ASN1_UNKNOWN_FIELD 116
225 481 #define EC_R_BUFFER_TOO_SMALL 100
  482 +#define EC_R_D2I_ECPKPARAMETERS_FAILURE 117
  483 +#define EC_R_DISCRIMINANT_IS_ZERO 118
  484 +#define EC_R_EC_GROUP_NEW_BY_NAME_FAILURE 119
  485 +#define EC_R_GROUP2PKPARAMETERS_FAILURE 120
  486 +#define EC_R_I2D_ECPKPARAMETERS_FAILURE 121
226 487 #define EC_R_INCOMPATIBLE_OBJECTS 101
227 488 #define EC_R_INVALID_ARGUMENT 112
228 489 #define EC_R_INVALID_COMPRESSED_POINT 110
... ... @@ -230,12 +491,26 @@ void ERR_load_EC_strings(void);
230 491 #define EC_R_INVALID_ENCODING 102
231 492 #define EC_R_INVALID_FIELD 103
232 493 #define EC_R_INVALID_FORM 104
  494 +#define EC_R_INVALID_GROUP_ORDER 122
  495 +#define EC_R_INVALID_PRIVATE_KEY 123
  496 +#define EC_R_MISSING_PARAMETERS 124
  497 +#define EC_R_MISSING_PRIVATE_KEY 125
  498 +#define EC_R_NOT_A_NIST_PRIME 135
  499 +#define EC_R_NOT_A_SUPPORTED_NIST_PRIME 136
  500 +#define EC_R_NOT_IMPLEMENTED 126
233 501 #define EC_R_NOT_INITIALIZED 111
  502 +#define EC_R_NO_FIELD_MOD 133
  503 +#define EC_R_PASSED_NULL_PARAMETER 134
  504 +#define EC_R_PKPARAMETERS2GROUP_FAILURE 127
234 505 #define EC_R_POINT_AT_INFINITY 106
235 506 #define EC_R_POINT_IS_NOT_ON_CURVE 107
236 507 #define EC_R_SLOT_FULL 108
237 508 #define EC_R_UNDEFINED_GENERATOR 113
  509 +#define EC_R_UNDEFINED_ORDER 128
  510 +#define EC_R_UNKNOWN_GROUP 129
238 511 #define EC_R_UNKNOWN_ORDER 114
  512 +#define EC_R_UNSUPPORTED_FIELD 131
  513 +#define EC_R_WRONG_ORDER 130
239 514  
240 515 #ifdef __cplusplus
241 516 }
... ...
third_dev/openssl/include/openssl/ecdh.h 0 → 100644
  1 +/* crypto/ecdh/ecdh.h */
  2 +/* ====================================================================
  3 + * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
  4 + *
  5 + * The Elliptic Curve Public-Key Crypto Library (ECC Code) included
  6 + * herein is developed by SUN MICROSYSTEMS, INC., and is contributed
  7 + * to the OpenSSL project.
  8 + *
  9 + * The ECC Code is licensed pursuant to the OpenSSL open source
  10 + * license provided below.
  11 + *
  12 + * The ECDH software is originally written by Douglas Stebila of
  13 + * Sun Microsystems Laboratories.
  14 + *
  15 + */
  16 +/* ====================================================================
  17 + * Copyright (c) 2000-2002 The OpenSSL Project. All rights reserved.
  18 + *
  19 + * Redistribution and use in source and binary forms, with or without
  20 + * modification, are permitted provided that the following conditions
  21 + * are met:
  22 + *
  23 + * 1. Redistributions of source code must retain the above copyright
  24 + * notice, this list of conditions and the following disclaimer.
  25 + *
  26 + * 2. Redistributions in binary form must reproduce the above copyright
  27 + * notice, this list of conditions and the following disclaimer in
  28 + * the documentation and/or other materials provided with the
  29 + * distribution.
  30 + *
  31 + * 3. All advertising materials mentioning features or use of this
  32 + * software must display the following acknowledgment:
  33 + * "This product includes software developed by the OpenSSL Project
  34 + * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
  35 + *
  36 + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
  37 + * endorse or promote products derived from this software without
  38 + * prior written permission. For written permission, please contact
  39 + * licensing@OpenSSL.org.
  40 + *
  41 + * 5. Products derived from this software may not be called "OpenSSL"
  42 + * nor may "OpenSSL" appear in their names without prior written
  43 + * permission of the OpenSSL Project.
  44 + *
  45 + * 6. Redistributions of any form whatsoever must retain the following
  46 + * acknowledgment:
  47 + * "This product includes software developed by the OpenSSL Project
  48 + * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
  49 + *
  50 + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
  51 + * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  52 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  53 + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
  54 + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  55 + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  56 + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  57 + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  58 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  59 + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  60 + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
  61 + * OF THE POSSIBILITY OF SUCH DAMAGE.
  62 + * ====================================================================
  63 + *
  64 + * This product includes cryptographic software written by Eric Young
  65 + * (eay@cryptsoft.com). This product includes software written by Tim
  66 + * Hudson (tjh@cryptsoft.com).
  67 + *
  68 + */
  69 +#ifndef HEADER_ECDH_H
  70 +#define HEADER_ECDH_H
  71 +
  72 +#include <openssl/opensslconf.h>
  73 +
  74 +#ifdef OPENSSL_NO_ECDH
  75 +#error ECDH is disabled.
  76 +#endif
  77 +
  78 +#include <openssl/ec.h>
  79 +#include <openssl/ossl_typ.h>
  80 +#ifndef OPENSSL_NO_DEPRECATED
  81 +#include <openssl/bn.h>
  82 +#endif
  83 +
  84 +#ifdef __cplusplus
  85 +extern "C" {
  86 +#endif
  87 +
  88 +const ECDH_METHOD *ECDH_OpenSSL(void);
  89 +
  90 +void ECDH_set_default_method(const ECDH_METHOD *);
  91 +const ECDH_METHOD *ECDH_get_default_method(void);
  92 +int ECDH_set_method(EC_KEY *, const ECDH_METHOD *);
  93 +
  94 +int ECDH_compute_key(void *out, size_t outlen, const EC_POINT *pub_key, EC_KEY *ecdh,
  95 + void *(*KDF)(const void *in, size_t inlen, void *out, size_t *outlen));
  96 +
  97 +int ECDH_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new
  98 + *new_func, CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
  99 +int ECDH_set_ex_data(EC_KEY *d, int idx, void *arg);
  100 +void *ECDH_get_ex_data(EC_KEY *d, int idx);
  101 +
  102 +
  103 +/* BEGIN ERROR CODES */
  104 +/* The following lines are auto generated by the script mkerr.pl. Any changes
  105 + * made after this point may be overwritten when the script is next run.
  106 + */
  107 +void ERR_load_ECDH_strings(void);
  108 +
  109 +/* Error codes for the ECDH functions. */
  110 +
  111 +/* Function codes. */
  112 +#define ECDH_F_ECDH_COMPUTE_KEY 100
  113 +#define ECDH_F_ECDH_DATA_NEW_METHOD 101
  114 +
  115 +/* Reason codes. */
  116 +#define ECDH_R_KDF_FAILED 102
  117 +#define ECDH_R_NO_PRIVATE_VALUE 100
  118 +#define ECDH_R_POINT_ARITHMETIC_FAILURE 101
  119 +
  120 +#ifdef __cplusplus
  121 +}
  122 +#endif
  123 +#endif
... ...
third_dev/openssl/include/openssl/ecdsa.h 0 → 100644
  1 +/* crypto/ecdsa/ecdsa.h */
  2 +/**
  3 + * \file crypto/ecdsa/ecdsa.h Include file for the OpenSSL ECDSA functions
  4 + * \author Written by Nils Larsch for the OpenSSL project
  5 + */
  6 +/* ====================================================================
  7 + * Copyright (c) 2000-2003 The OpenSSL Project. All rights reserved.
  8 + *
  9 + * Redistribution and use in source and binary forms, with or without
  10 + * modification, are permitted provided that the following conditions
  11 + * are met:
  12 + *
  13 + * 1. Redistributions of source code must retain the above copyright
  14 + * notice, this list of conditions and the following disclaimer.
  15 + *
  16 + * 2. Redistributions in binary form must reproduce the above copyright
  17 + * notice, this list of conditions and the following disclaimer in
  18 + * the documentation and/or other materials provided with the
  19 + * distribution.
  20 + *
  21 + * 3. All advertising materials mentioning features or use of this
  22 + * software must display the following acknowledgment:
  23 + * "This product includes software developed by the OpenSSL Project
  24 + * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
  25 + *
  26 + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
  27 + * endorse or promote products derived from this software without
  28 + * prior written permission. For written permission, please contact
  29 + * licensing@OpenSSL.org.
  30 + *
  31 + * 5. Products derived from this software may not be called "OpenSSL"
  32 + * nor may "OpenSSL" appear in their names without prior written
  33 + * permission of the OpenSSL Project.
  34 + *
  35 + * 6. Redistributions of any form whatsoever must retain the following
  36 + * acknowledgment:
  37 + * "This product includes software developed by the OpenSSL Project
  38 + * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
  39 + *
  40 + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
  41 + * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  42 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  43 + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
  44 + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  45 + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  46 + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  47 + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  48 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  49 + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  50 + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
  51 + * OF THE POSSIBILITY OF SUCH DAMAGE.
  52 + * ====================================================================
  53 + *
  54 + * This product includes cryptographic software written by Eric Young
  55 + * (eay@cryptsoft.com). This product includes software written by Tim
  56 + * Hudson (tjh@cryptsoft.com).
  57 + *
  58 + */
  59 +#ifndef HEADER_ECDSA_H
  60 +#define HEADER_ECDSA_H
  61 +
  62 +#include <openssl/opensslconf.h>
  63 +
  64 +#ifdef OPENSSL_NO_ECDSA
  65 +#error ECDSA is disabled.
  66 +#endif
  67 +
  68 +#include <openssl/ec.h>
  69 +#include <openssl/ossl_typ.h>
  70 +#ifndef OPENSSL_NO_DEPRECATED
  71 +#include <openssl/bn.h>
  72 +#endif
  73 +
  74 +#ifdef __cplusplus
  75 +extern "C" {
  76 +#endif
  77 +
  78 +typedef struct ECDSA_SIG_st
  79 + {
  80 + BIGNUM *r;
  81 + BIGNUM *s;
  82 + } ECDSA_SIG;
  83 +
  84 +/** ECDSA_SIG *ECDSA_SIG_new(void)
  85 + * allocates and initialize a ECDSA_SIG structure
  86 + * \return pointer to a ECDSA_SIG structure or NULL if an error occurred
  87 + */
  88 +ECDSA_SIG *ECDSA_SIG_new(void);
  89 +
  90 +/** ECDSA_SIG_free
  91 + * frees a ECDSA_SIG structure
  92 + * \param a pointer to the ECDSA_SIG structure
  93 + */
  94 +void ECDSA_SIG_free(ECDSA_SIG *a);
  95 +
  96 +/** i2d_ECDSA_SIG
  97 + * DER encode content of ECDSA_SIG object (note: this function modifies *pp
  98 + * (*pp += length of the DER encoded signature)).
  99 + * \param a pointer to the ECDSA_SIG object
  100 + * \param pp pointer to a unsigned char pointer for the output or NULL
  101 + * \return the length of the DER encoded ECDSA_SIG object or 0
  102 + */
  103 +int i2d_ECDSA_SIG(const ECDSA_SIG *a, unsigned char **pp);
  104 +
  105 +/** d2i_ECDSA_SIG
  106 + * decodes a DER encoded ECDSA signature (note: this function changes *pp
  107 + * (*pp += len)).
  108 + * \param v pointer to ECDSA_SIG pointer (may be NULL)
  109 + * \param pp buffer with the DER encoded signature
  110 + * \param len bufferlength
  111 + * \return pointer to the decoded ECDSA_SIG structure (or NULL)
  112 + */
  113 +ECDSA_SIG *d2i_ECDSA_SIG(ECDSA_SIG **v, const unsigned char **pp, long len);
  114 +
  115 +/** ECDSA_do_sign
  116 + * computes the ECDSA signature of the given hash value using
  117 + * the supplied private key and returns the created signature.
  118 + * \param dgst pointer to the hash value
  119 + * \param dgst_len length of the hash value
  120 + * \param eckey pointer to the EC_KEY object containing a private EC key
  121 + * \return pointer to a ECDSA_SIG structure or NULL
  122 + */
  123 +ECDSA_SIG *ECDSA_do_sign(const unsigned char *dgst,int dgst_len,EC_KEY *eckey);
  124 +
  125 +/** ECDSA_do_sign_ex
  126 + * computes ECDSA signature of a given hash value using the supplied
  127 + * private key (note: sig must point to ECDSA_size(eckey) bytes of memory).
  128 + * \param dgst pointer to the hash value to sign
  129 + * \param dgstlen length of the hash value
  130 + * \param kinv optional pointer to a pre-computed inverse k
  131 + * \param rp optional pointer to the pre-computed rp value (see
  132 + * ECDSA_sign_setup
  133 + * \param eckey pointer to the EC_KEY object containing a private EC key
  134 + * \return pointer to a ECDSA_SIG structure or NULL
  135 + */
  136 +ECDSA_SIG *ECDSA_do_sign_ex(const unsigned char *dgst, int dgstlen,
  137 + const BIGNUM *kinv, const BIGNUM *rp, EC_KEY *eckey);
  138 +
  139 +/** ECDSA_do_verify
  140 + * verifies that the supplied signature is a valid ECDSA
  141 + * signature of the supplied hash value using the supplied public key.
  142 + * \param dgst pointer to the hash value
  143 + * \param dgst_len length of the hash value
  144 + * \param sig pointer to the ECDSA_SIG structure
  145 + * \param eckey pointer to the EC_KEY object containing a public EC key
  146 + * \return 1 if the signature is valid, 0 if the signature is invalid and -1 on error
  147 + */
  148 +int ECDSA_do_verify(const unsigned char *dgst, int dgst_len,
  149 + const ECDSA_SIG *sig, EC_KEY* eckey);
  150 +
  151 +const ECDSA_METHOD *ECDSA_OpenSSL(void);
  152 +
  153 +/** ECDSA_set_default_method
  154 + * sets the default ECDSA method
  155 + * \param meth the new default ECDSA_METHOD
  156 + */
  157 +void ECDSA_set_default_method(const ECDSA_METHOD *meth);
  158 +
  159 +/** ECDSA_get_default_method
  160 + * returns the default ECDSA method
  161 + * \return pointer to ECDSA_METHOD structure containing the default method
  162 + */
  163 +const ECDSA_METHOD *ECDSA_get_default_method(void);
  164 +
  165 +/** ECDSA_set_method
  166 + * sets method to be used for the ECDSA operations
  167 + * \param eckey pointer to the EC_KEY object
  168 + * \param meth pointer to the new method
  169 + * \return 1 on success and 0 otherwise
  170 + */
  171 +int ECDSA_set_method(EC_KEY *eckey, const ECDSA_METHOD *meth);
  172 +
  173 +/** ECDSA_size
  174 + * returns the maximum length of the DER encoded signature
  175 + * \param eckey pointer to a EC_KEY object
  176 + * \return numbers of bytes required for the DER encoded signature
  177 + */
  178 +int ECDSA_size(const EC_KEY *eckey);
  179 +
  180 +/** ECDSA_sign_setup
  181 + * precompute parts of the signing operation.
  182 + * \param eckey pointer to the EC_KEY object containing a private EC key
  183 + * \param ctx pointer to a BN_CTX object (may be NULL)
  184 + * \param kinv pointer to a BIGNUM pointer for the inverse of k
  185 + * \param rp pointer to a BIGNUM pointer for x coordinate of k * generator
  186 + * \return 1 on success and 0 otherwise
  187 + */
  188 +int ECDSA_sign_setup(EC_KEY *eckey, BN_CTX *ctx, BIGNUM **kinv,
  189 + BIGNUM **rp);
  190 +
  191 +/** ECDSA_sign
  192 + * computes ECDSA signature of a given hash value using the supplied
  193 + * private key (note: sig must point to ECDSA_size(eckey) bytes of memory).
  194 + * \param type this parameter is ignored
  195 + * \param dgst pointer to the hash value to sign
  196 + * \param dgstlen length of the hash value
  197 + * \param sig buffer to hold the DER encoded signature
  198 + * \param siglen pointer to the length of the returned signature
  199 + * \param eckey pointer to the EC_KEY object containing a private EC key
  200 + * \return 1 on success and 0 otherwise
  201 + */
  202 +int ECDSA_sign(int type, const unsigned char *dgst, int dgstlen,
  203 + unsigned char *sig, unsigned int *siglen, EC_KEY *eckey);
  204 +
  205 +
  206 +/** ECDSA_sign_ex
  207 + * computes ECDSA signature of a given hash value using the supplied
  208 + * private key (note: sig must point to ECDSA_size(eckey) bytes of memory).
  209 + * \param type this parameter is ignored
  210 + * \param dgst pointer to the hash value to sign
  211 + * \param dgstlen length of the hash value
  212 + * \param sig buffer to hold the DER encoded signature
  213 + * \param siglen pointer to the length of the returned signature
  214 + * \param kinv optional pointer to a pre-computed inverse k
  215 + * \param rp optional pointer to the pre-computed rp value (see
  216 + * ECDSA_sign_setup
  217 + * \param eckey pointer to the EC_KEY object containing a private EC key
  218 + * \return 1 on success and 0 otherwise
  219 + */
  220 +int ECDSA_sign_ex(int type, const unsigned char *dgst, int dgstlen,
  221 + unsigned char *sig, unsigned int *siglen, const BIGNUM *kinv,
  222 + const BIGNUM *rp, EC_KEY *eckey);
  223 +
  224 +/** ECDSA_verify
  225 + * verifies that the given signature is valid ECDSA signature
  226 + * of the supplied hash value using the specified public key.
  227 + * \param type this parameter is ignored
  228 + * \param dgst pointer to the hash value
  229 + * \param dgstlen length of the hash value
  230 + * \param sig pointer to the DER encoded signature
  231 + * \param siglen length of the DER encoded signature
  232 + * \param eckey pointer to the EC_KEY object containing a public EC key
  233 + * \return 1 if the signature is valid, 0 if the signature is invalid and -1 on error
  234 + */
  235 +int ECDSA_verify(int type, const unsigned char *dgst, int dgstlen,
  236 + const unsigned char *sig, int siglen, EC_KEY *eckey);
  237 +
  238 +/* the standard ex_data functions */
  239 +int ECDSA_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new
  240 + *new_func, CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
  241 +int ECDSA_set_ex_data(EC_KEY *d, int idx, void *arg);
  242 +void *ECDSA_get_ex_data(EC_KEY *d, int idx);
  243 +
  244 +
  245 +/* BEGIN ERROR CODES */
  246 +/* The following lines are auto generated by the script mkerr.pl. Any changes
  247 + * made after this point may be overwritten when the script is next run.
  248 + */
  249 +void ERR_load_ECDSA_strings(void);
  250 +
  251 +/* Error codes for the ECDSA functions. */
  252 +
  253 +/* Function codes. */
  254 +#define ECDSA_F_ECDSA_DATA_NEW_METHOD 100
  255 +#define ECDSA_F_ECDSA_DO_SIGN 101
  256 +#define ECDSA_F_ECDSA_DO_VERIFY 102
  257 +#define ECDSA_F_ECDSA_SIGN_SETUP 103
  258 +
  259 +/* Reason codes. */
  260 +#define ECDSA_R_BAD_SIGNATURE 100
  261 +#define ECDSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE 101
  262 +#define ECDSA_R_ERR_EC_LIB 102
  263 +#define ECDSA_R_MISSING_PARAMETERS 103
  264 +#define ECDSA_R_RANDOM_NUMBER_GENERATION_FAILED 104
  265 +#define ECDSA_R_SIGNATURE_MALLOC_FAILED 105
  266 +
  267 +#ifdef __cplusplus
  268 +}
  269 +#endif
  270 +#endif
... ...
third_dev/openssl/include/openssl/engine.h
... ... @@ -3,7 +3,7 @@
3 3 * project 2000.
4 4 */
5 5 /* ====================================================================
6   - * Copyright (c) 1999-2001 The OpenSSL Project. All rights reserved.
  6 + * Copyright (c) 1999-2004 The OpenSSL Project. All rights reserved.
7 7 *
8 8 * Redistribution and use in source and binary forms, with or without
9 9 * modification, are permitted provided that the following conditions
... ... @@ -55,6 +55,11 @@
55 55 * Hudson (tjh@cryptsoft.com).
56 56 *
57 57 */
  58 +/* ====================================================================
  59 + * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
  60 + * ECDH support in OpenSSL originally developed by
  61 + * SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project.
  62 + */
58 63  
59 64 #ifndef HEADER_ENGINE_H
60 65 #define HEADER_ENGINE_H
... ... @@ -65,7 +70,7 @@
65 70 #error ENGINE is disabled.
66 71 #endif
67 72  
68   -#include <openssl/ossl_typ.h>
  73 +#ifndef OPENSSL_NO_DEPRECATED
69 74 #include <openssl/bn.h>
70 75 #ifndef OPENSSL_NO_RSA
71 76 #include <openssl/rsa.h>
... ... @@ -76,34 +81,36 @@
76 81 #ifndef OPENSSL_NO_DH
77 82 #include <openssl/dh.h>
78 83 #endif
  84 +#ifndef OPENSSL_NO_ECDH
  85 +#include <openssl/ecdh.h>
  86 +#endif
  87 +#ifndef OPENSSL_NO_ECDSA
  88 +#include <openssl/ecdsa.h>
  89 +#endif
79 90 #include <openssl/rand.h>
  91 +#include <openssl/store.h>
80 92 #include <openssl/ui.h>
81   -#include <openssl/symhacks.h>
82 93 #include <openssl/err.h>
  94 +#endif
  95 +
  96 +#include <openssl/ossl_typ.h>
  97 +#include <openssl/symhacks.h>
83 98  
84 99 #ifdef __cplusplus
85 100 extern "C" {
86 101 #endif
87 102  
88   -/* Fixups for missing algorithms */
89   -#ifdef OPENSSL_NO_RSA
90   -typedef void RSA_METHOD;
91   -#endif
92   -#ifdef OPENSSL_NO_DSA
93   -typedef void DSA_METHOD;
94   -#endif
95   -#ifdef OPENSSL_NO_DH
96   -typedef void DH_METHOD;
97   -#endif
98   -
99 103 /* These flags are used to control combinations of algorithm (methods)
100 104 * by bitwise "OR"ing. */
101 105 #define ENGINE_METHOD_RSA (unsigned int)0x0001
102 106 #define ENGINE_METHOD_DSA (unsigned int)0x0002
103 107 #define ENGINE_METHOD_DH (unsigned int)0x0004
104 108 #define ENGINE_METHOD_RAND (unsigned int)0x0008
  109 +#define ENGINE_METHOD_ECDH (unsigned int)0x0010
  110 +#define ENGINE_METHOD_ECDSA (unsigned int)0x0020
105 111 #define ENGINE_METHOD_CIPHERS (unsigned int)0x0040
106 112 #define ENGINE_METHOD_DIGESTS (unsigned int)0x0080
  113 +#define ENGINE_METHOD_STORE (unsigned int)0x0100
107 114 /* Obvious all-or-nothing cases. */
108 115 #define ENGINE_METHOD_ALL (unsigned int)0xFFFF
109 116 #define ENGINE_METHOD_NONE (unsigned int)0x0000
... ... @@ -173,9 +180,15 @@ typedef void DH_METHOD;
173 180 handles/connections etc. */
174 181 #define ENGINE_CTRL_SET_USER_INTERFACE 4 /* Alternative to callback */
175 182 #define ENGINE_CTRL_SET_CALLBACK_DATA 5 /* User-specific data, used
176   - when calling the password
177   - callback and the user
178   - interface */
  183 + when calling the password
  184 + callback and the user
  185 + interface */
  186 +#define ENGINE_CTRL_LOAD_CONFIGURATION 6 /* Load a configuration, given
  187 + a string that represents a
  188 + file name or so */
  189 +#define ENGINE_CTRL_LOAD_SECTION 7 /* Load data from a given
  190 + section in the already loaded
  191 + configuration */
179 192  
180 193 /* These control commands allow an application to deal with an arbitrary engine
181 194 * in a dynamic way. Warn: Negative return values indicate errors FOR THESE
... ... @@ -222,7 +235,7 @@ typedef void DH_METHOD;
222 235  
223 236 /* ENGINE implementations should start the numbering of their own control
224 237 * commands from this value. (ie. ENGINE_CMD_BASE, ENGINE_CMD_BASE + 1, etc). */
225   -#define ENGINE_CMD_BASE 200
  238 +#define ENGINE_CMD_BASE 200
226 239  
227 240 /* NB: These 2 nCipher "chil" control commands are deprecated, and their
228 241 * functionality is now available through ENGINE-specific control commands
... ... @@ -257,11 +270,11 @@ typedef struct ENGINE_CMD_DEFN_st
257 270 } ENGINE_CMD_DEFN;
258 271  
259 272 /* Generic function pointer */
260   -typedef int (*ENGINE_GEN_FUNC_PTR)();
  273 +typedef int (*ENGINE_GEN_FUNC_PTR)(void);
261 274 /* Generic function pointer taking no arguments */
262 275 typedef int (*ENGINE_GEN_INT_FUNC_PTR)(ENGINE *);
263 276 /* Specific control function pointer */
264   -typedef int (*ENGINE_CTRL_FUNC_PTR)(ENGINE *, int, long, void *, void (*f)());
  277 +typedef int (*ENGINE_CTRL_FUNC_PTR)(ENGINE *, int, long, void *, void (*f)(void));
265 278 /* Generic load_key function pointer */
266 279 typedef EVP_PKEY * (*ENGINE_LOAD_KEY_PTR)(ENGINE *, const char *,
267 280 UI_METHOD *ui_method, void *callback_data);
... ... @@ -305,15 +318,21 @@ ENGINE *ENGINE_by_id(const char *id);
305 318 /* Add all the built-in engines. */
306 319 void ENGINE_load_openssl(void);
307 320 void ENGINE_load_dynamic(void);
308   -void ENGINE_load_cswift(void);
309   -void ENGINE_load_chil(void);
  321 +#ifndef OPENSSL_NO_STATIC_ENGINE
  322 +void ENGINE_load_4758cca(void);
  323 +void ENGINE_load_aep(void);
310 324 void ENGINE_load_atalla(void);
  325 +void ENGINE_load_chil(void);
  326 +void ENGINE_load_cswift(void);
  327 +#ifndef OPENSSL_NO_GMP
  328 +void ENGINE_load_gmp(void);
  329 +#endif
311 330 void ENGINE_load_nuron(void);
312   -void ENGINE_load_ubsec(void);
313   -void ENGINE_load_aep(void);
314 331 void ENGINE_load_sureware(void);
315   -void ENGINE_load_4758cca(void);
  332 +void ENGINE_load_ubsec(void);
  333 +#endif
316 334 void ENGINE_load_cryptodev(void);
  335 +void ENGINE_load_padlock(void);
317 336 void ENGINE_load_builtin_engines(void);
318 337  
319 338 /* Get and set global flags (ENGINE_TABLE_FLAG_***) for the implementation
... ... @@ -337,6 +356,14 @@ int ENGINE_register_DSA(ENGINE *e);
337 356 void ENGINE_unregister_DSA(ENGINE *e);
338 357 void ENGINE_register_all_DSA(void);
339 358  
  359 +int ENGINE_register_ECDH(ENGINE *e);
  360 +void ENGINE_unregister_ECDH(ENGINE *e);
  361 +void ENGINE_register_all_ECDH(void);
  362 +
  363 +int ENGINE_register_ECDSA(ENGINE *e);
  364 +void ENGINE_unregister_ECDSA(ENGINE *e);
  365 +void ENGINE_register_all_ECDSA(void);
  366 +
340 367 int ENGINE_register_DH(ENGINE *e);
341 368 void ENGINE_unregister_DH(ENGINE *e);
342 369 void ENGINE_register_all_DH(void);
... ... @@ -345,6 +372,10 @@ int ENGINE_register_RAND(ENGINE *e);
345 372 void ENGINE_unregister_RAND(ENGINE *e);
346 373 void ENGINE_register_all_RAND(void);
347 374  
  375 +int ENGINE_register_STORE(ENGINE *e);
  376 +void ENGINE_unregister_STORE(ENGINE *e);
  377 +void ENGINE_register_all_STORE(void);
  378 +
348 379 int ENGINE_register_ciphers(ENGINE *e);
349 380 void ENGINE_unregister_ciphers(ENGINE *e);
350 381 void ENGINE_register_all_ciphers(void);
... ... @@ -367,7 +398,7 @@ int ENGINE_register_all_complete(void);
367 398 * reference to an engine, but many control commands may require the engine be
368 399 * functional. The caller should be aware of trying commands that require an
369 400 * operational ENGINE, and only use functional references in such situations. */
370   -int ENGINE_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)());
  401 +int ENGINE_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)(void));
371 402  
372 403 /* This function tests if an ENGINE-specific command is usable as a "setting".
373 404 * Eg. in an application's config file that gets processed through
... ... @@ -380,7 +411,7 @@ int ENGINE_cmd_is_executable(ENGINE *e, int cmd);
380 411 * See the comment on ENGINE_ctrl_cmd_string() for an explanation on how to
381 412 * use the cmd_name and cmd_optional. */
382 413 int ENGINE_ctrl_cmd(ENGINE *e, const char *cmd_name,
383   - long i, void *p, void (*f)(), int cmd_optional);
  414 + long i, void *p, void (*f)(void), int cmd_optional);
384 415  
385 416 /* This function passes a command-name and argument to an ENGINE. The cmd_name
386 417 * is converted to a command number and the control command is called using
... ... @@ -417,8 +448,11 @@ int ENGINE_set_id(ENGINE *e, const char *id);
417 448 int ENGINE_set_name(ENGINE *e, const char *name);
418 449 int ENGINE_set_RSA(ENGINE *e, const RSA_METHOD *rsa_meth);
419 450 int ENGINE_set_DSA(ENGINE *e, const DSA_METHOD *dsa_meth);
  451 +int ENGINE_set_ECDH(ENGINE *e, const ECDH_METHOD *ecdh_meth);
  452 +int ENGINE_set_ECDSA(ENGINE *e, const ECDSA_METHOD *ecdsa_meth);
420 453 int ENGINE_set_DH(ENGINE *e, const DH_METHOD *dh_meth);
421 454 int ENGINE_set_RAND(ENGINE *e, const RAND_METHOD *rand_meth);
  455 +int ENGINE_set_STORE(ENGINE *e, const STORE_METHOD *store_meth);
422 456 int ENGINE_set_destroy_function(ENGINE *e, ENGINE_GEN_INT_FUNC_PTR destroy_f);
423 457 int ENGINE_set_init_function(ENGINE *e, ENGINE_GEN_INT_FUNC_PTR init_f);
424 458 int ENGINE_set_finish_function(ENGINE *e, ENGINE_GEN_INT_FUNC_PTR finish_f);
... ... @@ -429,11 +463,11 @@ int ENGINE_set_ciphers(ENGINE *e, ENGINE_CIPHERS_PTR f);
429 463 int ENGINE_set_digests(ENGINE *e, ENGINE_DIGESTS_PTR f);
430 464 int ENGINE_set_flags(ENGINE *e, int flags);
431 465 int ENGINE_set_cmd_defns(ENGINE *e, const ENGINE_CMD_DEFN *defns);
432   -/* These functions (and the "get" function lower down) allow control over any
433   - * per-structure ENGINE data. */
  466 +/* These functions allow control over any per-structure ENGINE data. */
434 467 int ENGINE_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
435 468 CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
436 469 int ENGINE_set_ex_data(ENGINE *e, int idx, void *arg);
  470 +void *ENGINE_get_ex_data(const ENGINE *e, int idx);
437 471  
438 472 /* This function cleans up anything that needs it. Eg. the ENGINE_add() function
439 473 * automatically ensures the list cleanup function is registered to be called
... ... @@ -449,8 +483,11 @@ const char *ENGINE_get_id(const ENGINE *e);
449 483 const char *ENGINE_get_name(const ENGINE *e);
450 484 const RSA_METHOD *ENGINE_get_RSA(const ENGINE *e);
451 485 const DSA_METHOD *ENGINE_get_DSA(const ENGINE *e);
  486 +const ECDH_METHOD *ENGINE_get_ECDH(const ENGINE *e);
  487 +const ECDSA_METHOD *ENGINE_get_ECDSA(const ENGINE *e);
452 488 const DH_METHOD *ENGINE_get_DH(const ENGINE *e);
453 489 const RAND_METHOD *ENGINE_get_RAND(const ENGINE *e);
  490 +const STORE_METHOD *ENGINE_get_STORE(const ENGINE *e);
454 491 ENGINE_GEN_INT_FUNC_PTR ENGINE_get_destroy_function(const ENGINE *e);
455 492 ENGINE_GEN_INT_FUNC_PTR ENGINE_get_init_function(const ENGINE *e);
456 493 ENGINE_GEN_INT_FUNC_PTR ENGINE_get_finish_function(const ENGINE *e);
... ... @@ -463,7 +500,6 @@ const EVP_CIPHER *ENGINE_get_cipher(ENGINE *e, int nid);
463 500 const EVP_MD *ENGINE_get_digest(ENGINE *e, int nid);
464 501 const ENGINE_CMD_DEFN *ENGINE_get_cmd_defns(const ENGINE *e);
465 502 int ENGINE_get_flags(const ENGINE *e);
466   -void *ENGINE_get_ex_data(const ENGINE *e, int idx);
467 503  
468 504 /* FUNCTIONAL functions. These functions deal with ENGINE structures
469 505 * that have (or will) be initialised for use. Broadly speaking, the
... ... @@ -501,6 +537,8 @@ EVP_PKEY *ENGINE_load_public_key(ENGINE *e, const char *key_id,
501 537 ENGINE *ENGINE_get_default_RSA(void);
502 538 /* Same for the other "methods" */
503 539 ENGINE *ENGINE_get_default_DSA(void);
  540 +ENGINE *ENGINE_get_default_ECDH(void);
  541 +ENGINE *ENGINE_get_default_ECDSA(void);
504 542 ENGINE *ENGINE_get_default_DH(void);
505 543 ENGINE *ENGINE_get_default_RAND(void);
506 544 /* These functions can be used to get a functional reference to perform
... ... @@ -516,6 +554,8 @@ int ENGINE_set_default_RSA(ENGINE *e);
516 554 int ENGINE_set_default_string(ENGINE *e, const char *def_list);
517 555 /* Same for the other "methods" */
518 556 int ENGINE_set_default_DSA(ENGINE *e);
  557 +int ENGINE_set_default_ECDH(ENGINE *e);
  558 +int ENGINE_set_default_ECDSA(ENGINE *e);
519 559 int ENGINE_set_default_DH(ENGINE *e);
520 560 int ENGINE_set_default_RAND(ENGINE *e);
521 561 int ENGINE_set_default_ciphers(ENGINE *e);
... ... @@ -538,17 +578,20 @@ void ENGINE_add_conf_module(void);
538 578 /**************************/
539 579  
540 580 /* Binary/behaviour compatibility levels */
541   -#define OSSL_DYNAMIC_VERSION (unsigned long)0x00010200
  581 +#define OSSL_DYNAMIC_VERSION (unsigned long)0x00020000
542 582 /* Binary versions older than this are too old for us (whether we're a loader or
543 583 * a loadee) */
544   -#define OSSL_DYNAMIC_OLDEST (unsigned long)0x00010200
  584 +#define OSSL_DYNAMIC_OLDEST (unsigned long)0x00020000
545 585  
546 586 /* When compiling an ENGINE entirely as an external shared library, loadable by
547 587 * the "dynamic" ENGINE, these types are needed. The 'dynamic_fns' structure
548 588 * type provides the calling application's (or library's) error functionality
549 589 * and memory management function pointers to the loaded library. These should
550 590 * be used/set in the loaded library code so that the loading application's
551   - * 'state' will be used/changed in all operations. */
  591 + * 'state' will be used/changed in all operations. The 'static_state' pointer
  592 + * allows the loaded library to know if it shares the same static data as the
  593 + * calling application (or library), and thus whether these callbacks need to be
  594 + * set or not. */
552 595 typedef void *(*dyn_MEM_malloc_cb)(size_t);
553 596 typedef void *(*dyn_MEM_realloc_cb)(void *, size_t);
554 597 typedef void (*dyn_MEM_free_cb)(void *);
... ... @@ -576,6 +619,7 @@ typedef struct st_dynamic_LOCK_fns {
576 619 } dynamic_LOCK_fns;
577 620 /* The top-level structure */
578 621 typedef struct st_dynamic_fns {
  622 + void *static_state;
579 623 const ERR_FNS *err_fns;
580 624 const CRYPTO_EX_DATA_IMPL *ex_data_fns;
581 625 dynamic_MEM_fns mem_fns;
... ... @@ -593,7 +637,7 @@ typedef struct st_dynamic_fns {
593 637 * can be fully instantiated with IMPLEMENT_DYNAMIC_CHECK_FN(). */
594 638 typedef unsigned long (*dynamic_v_check_fn)(unsigned long ossl_version);
595 639 #define IMPLEMENT_DYNAMIC_CHECK_FN() \
596   - unsigned long v_check(unsigned long v) { \
  640 + OPENSSL_EXPORT unsigned long v_check(unsigned long v) { \
597 641 if(v >= OSSL_DYNAMIC_OLDEST) return OSSL_DYNAMIC_VERSION; \
598 642 return 0; }
599 643  
... ... @@ -615,24 +659,35 @@ typedef unsigned long (*dynamic_v_check_fn)(unsigned long ossl_version);
615 659 typedef int (*dynamic_bind_engine)(ENGINE *e, const char *id,
616 660 const dynamic_fns *fns);
617 661 #define IMPLEMENT_DYNAMIC_BIND_FN(fn) \
  662 + OPENSSL_EXPORT \
618 663 int bind_engine(ENGINE *e, const char *id, const dynamic_fns *fns) { \
619   - if (ERR_get_implementation() != fns->err_fns) \
620   - { \
621   - if(!CRYPTO_set_mem_functions(fns->mem_fns.malloc_cb, \
622   - fns->mem_fns.realloc_cb, fns->mem_fns.free_cb)) \
623   - return 0; \
624   - CRYPTO_set_locking_callback(fns->lock_fns.lock_locking_cb); \
625   - CRYPTO_set_add_lock_callback(fns->lock_fns.lock_add_lock_cb); \
626   - CRYPTO_set_dynlock_create_callback(fns->lock_fns.dynlock_create_cb); \
627   - CRYPTO_set_dynlock_lock_callback(fns->lock_fns.dynlock_lock_cb); \
628   - CRYPTO_set_dynlock_destroy_callback(fns->lock_fns.dynlock_destroy_cb); \
629   - if(!CRYPTO_set_ex_data_implementation(fns->ex_data_fns)) \
630   - return 0; \
631   - if(!ERR_set_implementation(fns->err_fns)) return 0; \
632   - } \
  664 + if(ENGINE_get_static_state() == fns->static_state) goto skip_cbs; \
  665 + if(!CRYPTO_set_mem_functions(fns->mem_fns.malloc_cb, \
  666 + fns->mem_fns.realloc_cb, fns->mem_fns.free_cb)) \
  667 + return 0; \
  668 + CRYPTO_set_locking_callback(fns->lock_fns.lock_locking_cb); \
  669 + CRYPTO_set_add_lock_callback(fns->lock_fns.lock_add_lock_cb); \
  670 + CRYPTO_set_dynlock_create_callback(fns->lock_fns.dynlock_create_cb); \
  671 + CRYPTO_set_dynlock_lock_callback(fns->lock_fns.dynlock_lock_cb); \
  672 + CRYPTO_set_dynlock_destroy_callback(fns->lock_fns.dynlock_destroy_cb); \
  673 + if(!CRYPTO_set_ex_data_implementation(fns->ex_data_fns)) \
  674 + return 0; \
  675 + if(!ERR_set_implementation(fns->err_fns)) return 0; \
  676 + skip_cbs: \
633 677 if(!fn(e,id)) return 0; \
634 678 return 1; }
635 679  
  680 +/* If the loading application (or library) and the loaded ENGINE library share
  681 + * the same static data (eg. they're both dynamically linked to the same
  682 + * libcrypto.so) we need a way to avoid trying to set system callbacks - this
  683 + * would fail, and for the same reason that it's unnecessary to try. If the
  684 + * loaded ENGINE has (or gets from through the loader) its own copy of the
  685 + * libcrypto static data, we will need to set the callbacks. The easiest way to
  686 + * detect this is to have a function that returns a pointer to some static data
  687 + * and let the loading application and loaded ENGINE compare their respective
  688 + * values. */
  689 +void *ENGINE_get_static_state(void);
  690 +
636 691 #if defined(__OpenBSD__) || defined(__FreeBSD__)
637 692 void ENGINE_setup_bsd_cryptodev(void);
638 693 #endif
... ... @@ -649,6 +704,7 @@ void ERR_load_ENGINE_strings(void);
649 704 #define ENGINE_F_DYNAMIC_CTRL 180
650 705 #define ENGINE_F_DYNAMIC_GET_DATA_CTX 181
651 706 #define ENGINE_F_DYNAMIC_LOAD 182
  707 +#define ENGINE_F_DYNAMIC_SET_DATA_CTX 183
652 708 #define ENGINE_F_ENGINE_ADD 105
653 709 #define ENGINE_F_ENGINE_BY_ID 106
654 710 #define ENGINE_F_ENGINE_CMD_IS_EXECUTABLE 170
... ... @@ -656,7 +712,7 @@ void ERR_load_ENGINE_strings(void);
656 712 #define ENGINE_F_ENGINE_CTRL_CMD 178
657 713 #define ENGINE_F_ENGINE_CTRL_CMD_STRING 171
658 714 #define ENGINE_F_ENGINE_FINISH 107
659   -#define ENGINE_F_ENGINE_FREE 108
  715 +#define ENGINE_F_ENGINE_FREE_UTIL 108
660 716 #define ENGINE_F_ENGINE_GET_CIPHER 185
661 717 #define ENGINE_F_ENGINE_GET_DEFAULT_TYPE 177
662 718 #define ENGINE_F_ENGINE_GET_DIGEST 186
... ... @@ -667,7 +723,6 @@ void ERR_load_ENGINE_strings(void);
667 723 #define ENGINE_F_ENGINE_LIST_REMOVE 121
668 724 #define ENGINE_F_ENGINE_LOAD_PRIVATE_KEY 150
669 725 #define ENGINE_F_ENGINE_LOAD_PUBLIC_KEY 151
670   -#define ENGINE_F_ENGINE_MODULE_INIT 187
671 726 #define ENGINE_F_ENGINE_NEW 122
672 727 #define ENGINE_F_ENGINE_REMOVE 123
673 728 #define ENGINE_F_ENGINE_SET_DEFAULT_STRING 189
... ... @@ -676,11 +731,12 @@ void ERR_load_ENGINE_strings(void);
676 731 #define ENGINE_F_ENGINE_SET_NAME 130
677 732 #define ENGINE_F_ENGINE_TABLE_REGISTER 184
678 733 #define ENGINE_F_ENGINE_UNLOAD_KEY 152
  734 +#define ENGINE_F_ENGINE_UNLOCKED_FINISH 191
679 735 #define ENGINE_F_ENGINE_UP_REF 190
680 736 #define ENGINE_F_INT_CTRL_HELPER 172
681 737 #define ENGINE_F_INT_ENGINE_CONFIGURE 188
  738 +#define ENGINE_F_INT_ENGINE_MODULE_INIT 187
682 739 #define ENGINE_F_LOG_MESSAGE 141
683   -#define ENGINE_F_SET_DATA_CTX 183
684 740  
685 741 /* Reason codes. */
686 742 #define ENGINE_R_ALREADY_LOADED 100
... ...
third_dev/openssl/include/openssl/err.h
... ... @@ -59,11 +59,14 @@
59 59 #ifndef HEADER_ERR_H
60 60 #define HEADER_ERR_H
61 61  
  62 +#include <openssl/e_os2.h>
  63 +
62 64 #ifndef OPENSSL_NO_FP_API
63 65 #include <stdio.h>
64 66 #include <stdlib.h>
65 67 #endif
66 68  
  69 +#include <openssl/ossl_typ.h>
67 70 #ifndef OPENSSL_NO_BIO
68 71 #include <openssl/bio.h>
69 72 #endif
... ... @@ -86,10 +89,13 @@ extern &quot;C&quot; {
86 89 #define ERR_TXT_MALLOCED 0x01
87 90 #define ERR_TXT_STRING 0x02
88 91  
  92 +#define ERR_FLAG_MARK 0x01
  93 +
89 94 #define ERR_NUM_ERRORS 16
90 95 typedef struct err_state_st
91 96 {
92 97 unsigned long pid;
  98 + int err_flags[ERR_NUM_ERRORS];
93 99 unsigned long err_buffer[ERR_NUM_ERRORS];
94 100 char *err_data[ERR_NUM_ERRORS];
95 101 int err_data_flags[ERR_NUM_ERRORS];
... ... @@ -131,6 +137,9 @@ typedef struct err_state_st
131 137 #define ERR_LIB_OCSP 39
132 138 #define ERR_LIB_UI 40
133 139 #define ERR_LIB_COMP 41
  140 +#define ERR_LIB_ECDSA 42
  141 +#define ERR_LIB_ECDH 43
  142 +#define ERR_LIB_STORE 44
134 143  
135 144 #define ERR_LIB_USER 128
136 145  
... ... @@ -159,6 +168,9 @@ typedef struct err_state_st
159 168 #define OCSPerr(f,r) ERR_PUT_error(ERR_LIB_OCSP,(f),(r),__FILE__,__LINE__)
160 169 #define UIerr(f,r) ERR_PUT_error(ERR_LIB_UI,(f),(r),__FILE__,__LINE__)
161 170 #define COMPerr(f,r) ERR_PUT_error(ERR_LIB_COMP,(f),(r),__FILE__,__LINE__)
  171 +#define ECDSAerr(f,r) ERR_PUT_error(ERR_LIB_ECDSA,(f),(r),__FILE__,__LINE__)
  172 +#define ECDHerr(f,r) ERR_PUT_error(ERR_LIB_ECDH,(f),(r),__FILE__,__LINE__)
  173 +#define STOREerr(f,r) ERR_PUT_error(ERR_LIB_STORE,(f),(r),__FILE__,__LINE__)
162 174  
163 175 /* Borland C seems too stupid to be able to shift and do longs in
164 176 * the pre-processor :-( */
... ... @@ -211,6 +223,9 @@ typedef struct err_state_st
211 223 #define ERR_R_OCSP_LIB ERR_LIB_OCSP /* 39 */
212 224 #define ERR_R_UI_LIB ERR_LIB_UI /* 40 */
213 225 #define ERR_R_COMP_LIB ERR_LIB_COMP /* 41 */
  226 +#define ERR_R_ECDSA_LIB ERR_LIB_ECDSA /* 42 */
  227 +#define ERR_R_ECDH_LIB ERR_LIB_ECDH /* 43 */
  228 +#define ERR_R_STORE_LIB ERR_LIB_STORE /* 44 */
214 229  
215 230 #define ERR_R_NESTED_ASN1_ERROR 58
216 231 #define ERR_R_BAD_ASN1_OBJECT_HEADER 59
... ... @@ -225,6 +240,7 @@ typedef struct err_state_st
225 240 #define ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED (2|ERR_R_FATAL)
226 241 #define ERR_R_PASSED_NULL_PARAMETER (3|ERR_R_FATAL)
227 242 #define ERR_R_INTERNAL_ERROR (4|ERR_R_FATAL)
  243 +#define ERR_R_DISABLED (5|ERR_R_FATAL)
228 244  
229 245 /* 99 is the maximum possible ERR_R_... code, higher values
230 246 * are reserved for the individual libraries */
... ... @@ -283,8 +299,11 @@ void ERR_release_err_state_table(LHASH **hash);
283 299  
284 300 int ERR_get_next_error_library(void);
285 301  
286   -/* This opaque type encapsulates the low-level error-state functions */
287   -typedef struct st_ERR_FNS ERR_FNS;
  302 +int ERR_set_mark(void);
  303 +int ERR_pop_to_mark(void);
  304 +
  305 +/* Already defined in ossl_typ.h */
  306 +/* typedef struct st_ERR_FNS ERR_FNS; */
288 307 /* An application can use this function and provide the return value to loaded
289 308 * modules that should use the application's ERR state/functionality */
290 309 const ERR_FNS *ERR_get_implementation(void);
... ...
third_dev/openssl/include/openssl/evp.h
... ... @@ -74,48 +74,6 @@
74 74 #ifndef OPENSSL_NO_BIO
75 75 #include <openssl/bio.h>
76 76 #endif
77   -#ifndef OPENSSL_NO_MD2
78   -#include <openssl/md2.h>
79   -#endif
80   -#ifndef OPENSSL_NO_MD4
81   -#include <openssl/md4.h>
82   -#endif
83   -#ifndef OPENSSL_NO_MD5
84   -#include <openssl/md5.h>
85   -#endif
86   -#ifndef OPENSSL_NO_SHA
87   -#include <openssl/sha.h>
88   -#endif
89   -#ifndef OPENSSL_NO_RIPEMD
90   -#include <openssl/ripemd.h>
91   -#endif
92   -#ifndef OPENSSL_NO_DES
93   -#include <openssl/des.h>
94   -#endif
95   -#ifndef OPENSSL_NO_RC4
96   -#include <openssl/rc4.h>
97   -#endif
98   -#ifndef OPENSSL_NO_RC2
99   -#include <openssl/rc2.h>
100   -#endif
101   -#ifndef OPENSSL_NO_RC5
102   -#include <openssl/rc5.h>
103   -#endif
104   -#ifndef OPENSSL_NO_BF
105   -#include <openssl/blowfish.h>
106   -#endif
107   -#ifndef OPENSSL_NO_CAST
108   -#include <openssl/cast.h>
109   -#endif
110   -#ifndef OPENSSL_NO_IDEA
111   -#include <openssl/idea.h>
112   -#endif
113   -#ifndef OPENSSL_NO_MDC2
114   -#include <openssl/mdc2.h>
115   -#endif
116   -#ifndef OPENSSL_NO_AES
117   -#include <openssl/aes.h>
118   -#endif
119 77  
120 78 /*
121 79 #define EVP_RC2_KEY_SIZE 16
... ... @@ -124,7 +82,7 @@
124 82 #define EVP_CAST5_KEY_SIZE 16
125 83 #define EVP_RC5_32_12_16_KEY_SIZE 16
126 84 */
127   -#define EVP_MAX_MD_SIZE (16+20) /* The SSLv3 md5+sha1 type */
  85 +#define EVP_MAX_MD_SIZE 64 /* longest known is SHA512 */
128 86 #define EVP_MAX_KEY_LENGTH 32
129 87 #define EVP_MAX_IV_LENGTH 16
130 88 #define EVP_MAX_BLOCK_LENGTH 32
... ... @@ -133,28 +91,18 @@
133 91 /* Default PKCS#5 iteration count */
134 92 #define PKCS5_DEFAULT_ITER 2048
135 93  
136   -#ifndef OPENSSL_NO_RSA
137   -#include <openssl/rsa.h>
138   -#endif
139   -
140   -#ifndef OPENSSL_NO_DSA
141   -#include <openssl/dsa.h>
142   -#endif
143   -
144   -#ifndef OPENSSL_NO_DH
145   -#include <openssl/dh.h>
146   -#endif
147   -
148 94 #include <openssl/objects.h>
149 95  
150 96 #define EVP_PK_RSA 0x0001
151 97 #define EVP_PK_DSA 0x0002
152 98 #define EVP_PK_DH 0x0004
  99 +#define EVP_PK_EC 0x0008
153 100 #define EVP_PKT_SIGN 0x0010
154 101 #define EVP_PKT_ENC 0x0020
155 102 #define EVP_PKT_EXCH 0x0040
156 103 #define EVP_PKS_RSA 0x0100
157 104 #define EVP_PKS_DSA 0x0200
  105 +#define EVP_PKS_EC 0x0400
158 106 #define EVP_PKT_EXP 0x1000 /* <= 512 bit key */
159 107  
160 108 #define EVP_PKEY_NONE NID_undef
... ... @@ -166,6 +114,7 @@
166 114 #define EVP_PKEY_DSA3 NID_dsaWithSHA1
167 115 #define EVP_PKEY_DSA4 NID_dsaWithSHA1_2
168 116 #define EVP_PKEY_DH NID_dhKeyAgreement
  117 +#define EVP_PKEY_EC NID_X9_62_id_ecPublicKey
169 118  
170 119 #ifdef __cplusplus
171 120 extern "C" {
... ... @@ -190,6 +139,9 @@ struct evp_pkey_st
190 139 #ifndef OPENSSL_NO_DH
191 140 struct dh_st *dh; /* DH */
192 141 #endif
  142 +#ifndef OPENSSL_NO_EC
  143 + struct ec_key_st *ec; /* ECC */
  144 +#endif
193 145 } pkey;
194 146 int save_parameters;
195 147 STACK_OF(X509_ATTRIBUTE) *attributes; /* [ 0 ] */
... ... @@ -275,38 +227,58 @@ struct env_md_st
275 227 int md_size;
276 228 unsigned long flags;
277 229 int (*init)(EVP_MD_CTX *ctx);
278   - int (*update)(EVP_MD_CTX *ctx,const void *data,unsigned long count);
  230 + int (*update)(EVP_MD_CTX *ctx,const void *data,size_t count);
279 231 int (*final)(EVP_MD_CTX *ctx,unsigned char *md);
280 232 int (*copy)(EVP_MD_CTX *to,const EVP_MD_CTX *from);
281 233 int (*cleanup)(EVP_MD_CTX *ctx);
282 234  
283 235 /* FIXME: prototype these some day */
284   - int (*sign)();
285   - int (*verify)();
  236 + int (*sign)(int type, const unsigned char *m, unsigned int m_length,
  237 + unsigned char *sigret, unsigned int *siglen, void *key);
  238 + int (*verify)(int type, const unsigned char *m, unsigned int m_length,
  239 + const unsigned char *sigbuf, unsigned int siglen,
  240 + void *key);
286 241 int required_pkey_type[5]; /*EVP_PKEY_xxx */
287 242 int block_size;
288 243 int ctx_size; /* how big does the ctx->md_data need to be */
289 244 } /* EVP_MD */;
290 245  
  246 +typedef int evp_sign_method(int type,const unsigned char *m,
  247 + unsigned int m_length,unsigned char *sigret,
  248 + unsigned int *siglen, void *key);
  249 +typedef int evp_verify_method(int type,const unsigned char *m,
  250 + unsigned int m_length,const unsigned char *sigbuf,
  251 + unsigned int siglen, void *key);
  252 +
291 253 #define EVP_MD_FLAG_ONESHOT 0x0001 /* digest can only handle a single
292 254 * block */
293 255  
294 256 #define EVP_PKEY_NULL_method NULL,NULL,{0,0,0,0}
295 257  
296 258 #ifndef OPENSSL_NO_DSA
297   -#define EVP_PKEY_DSA_method DSA_sign,DSA_verify, \
  259 +#define EVP_PKEY_DSA_method (evp_sign_method *)DSA_sign, \
  260 + (evp_verify_method *)DSA_verify, \
298 261 {EVP_PKEY_DSA,EVP_PKEY_DSA2,EVP_PKEY_DSA3, \
299 262 EVP_PKEY_DSA4,0}
300 263 #else
301 264 #define EVP_PKEY_DSA_method EVP_PKEY_NULL_method
302 265 #endif
303 266  
  267 +#ifndef OPENSSL_NO_ECDSA
  268 +#define EVP_PKEY_ECDSA_method (evp_sign_method *)ECDSA_sign, \
  269 + (evp_verify_method *)ECDSA_verify, \
  270 + {EVP_PKEY_EC,0,0,0}
  271 +#else
  272 +#define EVP_PKEY_ECDSA_method EVP_PKEY_NULL_method
  273 +#endif
  274 +
304 275 #ifndef OPENSSL_NO_RSA
305   -#define EVP_PKEY_RSA_method RSA_sign,RSA_verify, \
  276 +#define EVP_PKEY_RSA_method (evp_sign_method *)RSA_sign, \
  277 + (evp_verify_method *)RSA_verify, \
306 278 {EVP_PKEY_RSA,EVP_PKEY_RSA2,0,0}
307 279 #define EVP_PKEY_RSA_ASN1_OCTET_STRING_method \
308   - RSA_sign_ASN1_OCTET_STRING, \
309   - RSA_verify_ASN1_OCTET_STRING, \
  280 + (evp_sign_method *)RSA_sign_ASN1_OCTET_STRING, \
  281 + (evp_verify_method *)RSA_verify_ASN1_OCTET_STRING, \
310 282 {EVP_PKEY_RSA,EVP_PKEY_RSA2,0,0}
311 283 #else
312 284 #define EVP_PKEY_RSA_method EVP_PKEY_NULL_method
... ... @@ -373,6 +345,8 @@ struct evp_cipher_st
373 345 #define EVP_CIPH_CUSTOM_KEY_LENGTH 0x80
374 346 /* Don't use standard block padding */
375 347 #define EVP_CIPH_NO_PADDING 0x100
  348 +/* cipher handles random key generation */
  349 +#define EVP_CIPH_RAND_KEY 0x200
376 350  
377 351 /* ctrl() values */
378 352  
... ... @@ -382,6 +356,7 @@ struct evp_cipher_st
382 356 #define EVP_CTRL_SET_RC2_KEY_BITS 0x3
383 357 #define EVP_CTRL_GET_RC5_ROUNDS 0x4
384 358 #define EVP_CTRL_SET_RC5_ROUNDS 0x5
  359 +#define EVP_CTRL_RAND_KEY 0x6
385 360  
386 361 typedef struct evp_cipher_info_st
387 362 {
... ... @@ -443,6 +418,11 @@ typedef int (EVP_PBE_KEYGEN)(EVP_CIPHER_CTX *ctx, const char *pass, int passlen,
443 418 (char *)(dh))
444 419 #endif
445 420  
  421 +#ifndef OPENSSL_NO_EC
  422 +#define EVP_PKEY_assign_EC_KEY(pkey,eckey) EVP_PKEY_assign((pkey),EVP_PKEY_EC,\
  423 + (char *)(eckey))
  424 +#endif
  425 +
446 426 /* Add some extra combinations */
447 427 #define EVP_get_digestbynid(a) EVP_get_digestbyname(OBJ_nid2sn(a))
448 428 #define EVP_get_digestbyobj(a) EVP_get_digestbynid(OBJ_obj2nid(a))
... ... @@ -523,9 +503,9 @@ int EVP_MD_CTX_copy_ex(EVP_MD_CTX *out,const EVP_MD_CTX *in);
523 503 #define EVP_MD_CTX_test_flags(ctx,flgs) ((ctx)->flags&(flgs))
524 504 int EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl);
525 505 int EVP_DigestUpdate(EVP_MD_CTX *ctx,const void *d,
526   - unsigned int cnt);
  506 + size_t cnt);
527 507 int EVP_DigestFinal_ex(EVP_MD_CTX *ctx,unsigned char *md,unsigned int *s);
528   -int EVP_Digest(void *data, unsigned int count,
  508 +int EVP_Digest(const void *data, size_t count,
529 509 unsigned char *md, unsigned int *size, const EVP_MD *type, ENGINE *impl);
530 510  
531 511 int EVP_MD_CTX_copy(EVP_MD_CTX *out,const EVP_MD_CTX *in);
... ... @@ -533,7 +513,7 @@ int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type);
533 513 int EVP_DigestFinal(EVP_MD_CTX *ctx,unsigned char *md,unsigned int *s);
534 514  
535 515 int EVP_read_pw_string(char *buf,int length,const char *prompt,int verify);
536   -void EVP_set_pw_prompt(char *prompt);
  516 +void EVP_set_pw_prompt(const char *prompt);
537 517 char * EVP_get_pw_prompt(void);
538 518  
539 519 int EVP_BytesToKey(const EVP_CIPHER *type,const EVP_MD *md,
... ... @@ -572,43 +552,48 @@ int EVP_CipherFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl);
572 552 int EVP_SignFinal(EVP_MD_CTX *ctx,unsigned char *md,unsigned int *s,
573 553 EVP_PKEY *pkey);
574 554  
575   -int EVP_VerifyFinal(EVP_MD_CTX *ctx,unsigned char *sigbuf,
  555 +int EVP_VerifyFinal(EVP_MD_CTX *ctx,const unsigned char *sigbuf,
576 556 unsigned int siglen,EVP_PKEY *pkey);
577 557  
578   -int EVP_OpenInit(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *type,unsigned char *ek,
579   - int ekl,unsigned char *iv,EVP_PKEY *priv);
  558 +int EVP_OpenInit(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *type,
  559 + const unsigned char *ek, int ekl, const unsigned char *iv,
  560 + EVP_PKEY *priv);
580 561 int EVP_OpenFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl);
581 562  
582   -int EVP_SealInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, unsigned char **ek,
583   - int *ekl, unsigned char *iv,EVP_PKEY **pubk, int npubk);
  563 +int EVP_SealInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type,
  564 + unsigned char **ek, int *ekl, unsigned char *iv,
  565 + EVP_PKEY **pubk, int npubk);
584 566 int EVP_SealFinal(EVP_CIPHER_CTX *ctx,unsigned char *out,int *outl);
585 567  
586 568 void EVP_EncodeInit(EVP_ENCODE_CTX *ctx);
587   -void EVP_EncodeUpdate(EVP_ENCODE_CTX *ctx,unsigned char *out,
588   - int *outl,unsigned char *in,int inl);
  569 +void EVP_EncodeUpdate(EVP_ENCODE_CTX *ctx,unsigned char *out,int *outl,
  570 + const unsigned char *in,int inl);
589 571 void EVP_EncodeFinal(EVP_ENCODE_CTX *ctx,unsigned char *out,int *outl);
590 572 int EVP_EncodeBlock(unsigned char *t, const unsigned char *f, int n);
591 573  
592 574 void EVP_DecodeInit(EVP_ENCODE_CTX *ctx);
593 575 int EVP_DecodeUpdate(EVP_ENCODE_CTX *ctx,unsigned char *out,int *outl,
594   - unsigned char *in, int inl);
  576 + const unsigned char *in, int inl);
595 577 int EVP_DecodeFinal(EVP_ENCODE_CTX *ctx, unsigned
596 578 char *out, int *outl);
597 579 int EVP_DecodeBlock(unsigned char *t, const unsigned char *f, int n);
598 580  
599 581 void EVP_CIPHER_CTX_init(EVP_CIPHER_CTX *a);
600 582 int EVP_CIPHER_CTX_cleanup(EVP_CIPHER_CTX *a);
  583 +EVP_CIPHER_CTX *EVP_CIPHER_CTX_new(void);
  584 +void EVP_CIPHER_CTX_free(EVP_CIPHER_CTX *a);
601 585 int EVP_CIPHER_CTX_set_key_length(EVP_CIPHER_CTX *x, int keylen);
602 586 int EVP_CIPHER_CTX_set_padding(EVP_CIPHER_CTX *c, int pad);
603 587 int EVP_CIPHER_CTX_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr);
  588 +int EVP_CIPHER_CTX_rand_key(EVP_CIPHER_CTX *ctx, unsigned char *key);
604 589  
605 590 #ifndef OPENSSL_NO_BIO
606 591 BIO_METHOD *BIO_f_md(void);
607 592 BIO_METHOD *BIO_f_base64(void);
608 593 BIO_METHOD *BIO_f_cipher(void);
609 594 BIO_METHOD *BIO_f_reliable(void);
610   -void BIO_set_cipher(BIO *b,const EVP_CIPHER *c,unsigned char *k,
611   - unsigned char *i, int enc);
  595 +void BIO_set_cipher(BIO *b,const EVP_CIPHER *c,const unsigned char *k,
  596 + const unsigned char *i, int enc);
612 597 #endif
613 598  
614 599 const EVP_MD *EVP_md_null(void);
... ... @@ -626,6 +611,15 @@ const EVP_MD *EVP_sha(void);
626 611 const EVP_MD *EVP_sha1(void);
627 612 const EVP_MD *EVP_dss(void);
628 613 const EVP_MD *EVP_dss1(void);
  614 +const EVP_MD *EVP_ecdsa(void);
  615 +#endif
  616 +#ifndef OPENSSL_NO_SHA256
  617 +const EVP_MD *EVP_sha224(void);
  618 +const EVP_MD *EVP_sha256(void);
  619 +#endif
  620 +#ifndef OPENSSL_NO_SHA512
  621 +const EVP_MD *EVP_sha384(void);
  622 +const EVP_MD *EVP_sha512(void);
629 623 #endif
630 624 #ifndef OPENSSL_NO_MDC2
631 625 const EVP_MD *EVP_mdc2(void);
... ... @@ -640,9 +634,20 @@ const EVP_CIPHER *EVP_des_ede(void);
640 634 const EVP_CIPHER *EVP_des_ede3(void);
641 635 const EVP_CIPHER *EVP_des_ede_ecb(void);
642 636 const EVP_CIPHER *EVP_des_ede3_ecb(void);
643   -const EVP_CIPHER *EVP_des_cfb(void);
644   -const EVP_CIPHER *EVP_des_ede_cfb(void);
645   -const EVP_CIPHER *EVP_des_ede3_cfb(void);
  637 +const EVP_CIPHER *EVP_des_cfb64(void);
  638 +# define EVP_des_cfb EVP_des_cfb64
  639 +const EVP_CIPHER *EVP_des_cfb1(void);
  640 +const EVP_CIPHER *EVP_des_cfb8(void);
  641 +const EVP_CIPHER *EVP_des_ede_cfb64(void);
  642 +# define EVP_des_ede_cfb EVP_des_ede_cfb64
  643 +#if 0
  644 +const EVP_CIPHER *EVP_des_ede_cfb1(void);
  645 +const EVP_CIPHER *EVP_des_ede_cfb8(void);
  646 +#endif
  647 +const EVP_CIPHER *EVP_des_ede3_cfb64(void);
  648 +# define EVP_des_ede3_cfb EVP_des_ede3_cfb64
  649 +const EVP_CIPHER *EVP_des_ede3_cfb1(void);
  650 +const EVP_CIPHER *EVP_des_ede3_cfb8(void);
646 651 const EVP_CIPHER *EVP_des_ofb(void);
647 652 const EVP_CIPHER *EVP_des_ede_ofb(void);
648 653 const EVP_CIPHER *EVP_des_ede3_ofb(void);
... ... @@ -666,7 +671,8 @@ const EVP_CIPHER *EVP_rc4_40(void);
666 671 #endif
667 672 #ifndef OPENSSL_NO_IDEA
668 673 const EVP_CIPHER *EVP_idea_ecb(void);
669   -const EVP_CIPHER *EVP_idea_cfb(void);
  674 +const EVP_CIPHER *EVP_idea_cfb64(void);
  675 +# define EVP_idea_cfb EVP_idea_cfb64
670 676 const EVP_CIPHER *EVP_idea_ofb(void);
671 677 const EVP_CIPHER *EVP_idea_cbc(void);
672 678 #endif
... ... @@ -675,45 +681,58 @@ const EVP_CIPHER *EVP_rc2_ecb(void);
675 681 const EVP_CIPHER *EVP_rc2_cbc(void);
676 682 const EVP_CIPHER *EVP_rc2_40_cbc(void);
677 683 const EVP_CIPHER *EVP_rc2_64_cbc(void);
678   -const EVP_CIPHER *EVP_rc2_cfb(void);
  684 +const EVP_CIPHER *EVP_rc2_cfb64(void);
  685 +# define EVP_rc2_cfb EVP_rc2_cfb64
679 686 const EVP_CIPHER *EVP_rc2_ofb(void);
680 687 #endif
681 688 #ifndef OPENSSL_NO_BF
682 689 const EVP_CIPHER *EVP_bf_ecb(void);
683 690 const EVP_CIPHER *EVP_bf_cbc(void);
684   -const EVP_CIPHER *EVP_bf_cfb(void);
  691 +const EVP_CIPHER *EVP_bf_cfb64(void);
  692 +# define EVP_bf_cfb EVP_bf_cfb64
685 693 const EVP_CIPHER *EVP_bf_ofb(void);
686 694 #endif
687 695 #ifndef OPENSSL_NO_CAST
688 696 const EVP_CIPHER *EVP_cast5_ecb(void);
689 697 const EVP_CIPHER *EVP_cast5_cbc(void);
690   -const EVP_CIPHER *EVP_cast5_cfb(void);
  698 +const EVP_CIPHER *EVP_cast5_cfb64(void);
  699 +# define EVP_cast5_cfb EVP_cast5_cfb64
691 700 const EVP_CIPHER *EVP_cast5_ofb(void);
692 701 #endif
693 702 #ifndef OPENSSL_NO_RC5
694 703 const EVP_CIPHER *EVP_rc5_32_12_16_cbc(void);
695 704 const EVP_CIPHER *EVP_rc5_32_12_16_ecb(void);
696   -const EVP_CIPHER *EVP_rc5_32_12_16_cfb(void);
  705 +const EVP_CIPHER *EVP_rc5_32_12_16_cfb64(void);
  706 +# define EVP_rc5_32_12_16_cfb EVP_rc5_32_12_16_cfb64
697 707 const EVP_CIPHER *EVP_rc5_32_12_16_ofb(void);
698 708 #endif
699 709 #ifndef OPENSSL_NO_AES
700 710 const EVP_CIPHER *EVP_aes_128_ecb(void);
701 711 const EVP_CIPHER *EVP_aes_128_cbc(void);
702   -const EVP_CIPHER *EVP_aes_128_cfb(void);
  712 +const EVP_CIPHER *EVP_aes_128_cfb1(void);
  713 +const EVP_CIPHER *EVP_aes_128_cfb8(void);
  714 +const EVP_CIPHER *EVP_aes_128_cfb128(void);
  715 +# define EVP_aes_128_cfb EVP_aes_128_cfb128
703 716 const EVP_CIPHER *EVP_aes_128_ofb(void);
704 717 #if 0
705 718 const EVP_CIPHER *EVP_aes_128_ctr(void);
706 719 #endif
707 720 const EVP_CIPHER *EVP_aes_192_ecb(void);
708 721 const EVP_CIPHER *EVP_aes_192_cbc(void);
709   -const EVP_CIPHER *EVP_aes_192_cfb(void);
  722 +const EVP_CIPHER *EVP_aes_192_cfb1(void);
  723 +const EVP_CIPHER *EVP_aes_192_cfb8(void);
  724 +const EVP_CIPHER *EVP_aes_192_cfb128(void);
  725 +# define EVP_aes_192_cfb EVP_aes_192_cfb128
710 726 const EVP_CIPHER *EVP_aes_192_ofb(void);
711 727 #if 0
712 728 const EVP_CIPHER *EVP_aes_192_ctr(void);
713 729 #endif
714 730 const EVP_CIPHER *EVP_aes_256_ecb(void);
715 731 const EVP_CIPHER *EVP_aes_256_cbc(void);
716   -const EVP_CIPHER *EVP_aes_256_cfb(void);
  732 +const EVP_CIPHER *EVP_aes_256_cfb1(void);
  733 +const EVP_CIPHER *EVP_aes_256_cfb8(void);
  734 +const EVP_CIPHER *EVP_aes_256_cfb128(void);
  735 +# define EVP_aes_256_cfb EVP_aes_256_cfb128
717 736 const EVP_CIPHER *EVP_aes_256_ofb(void);
718 737 #if 0
719 738 const EVP_CIPHER *EVP_aes_256_ctr(void);
... ... @@ -744,10 +763,12 @@ const EVP_CIPHER *EVP_get_cipherbyname(const char *name);
744 763 const EVP_MD *EVP_get_digestbyname(const char *name);
745 764 void EVP_cleanup(void);
746 765  
747   -int EVP_PKEY_decrypt(unsigned char *dec_key,unsigned char *enc_key,
748   - int enc_key_len,EVP_PKEY *private_key);
  766 +int EVP_PKEY_decrypt(unsigned char *dec_key,
  767 + const unsigned char *enc_key,int enc_key_len,
  768 + EVP_PKEY *private_key);
749 769 int EVP_PKEY_encrypt(unsigned char *enc_key,
750   - unsigned char *key,int key_len,EVP_PKEY *pub_key);
  770 + const unsigned char *key,int key_len,
  771 + EVP_PKEY *pub_key);
751 772 int EVP_PKEY_type(int type);
752 773 int EVP_PKEY_bits(EVP_PKEY *pkey);
753 774 int EVP_PKEY_size(EVP_PKEY *pkey);
... ... @@ -768,24 +789,31 @@ struct dh_st;
768 789 int EVP_PKEY_set1_DH(EVP_PKEY *pkey,struct dh_st *key);
769 790 struct dh_st *EVP_PKEY_get1_DH(EVP_PKEY *pkey);
770 791 #endif
771   -
  792 +#ifndef OPENSSL_NO_EC
  793 +struct ec_key_st;
  794 +int EVP_PKEY_set1_EC_KEY(EVP_PKEY *pkey,struct ec_key_st *key);
  795 +struct ec_key_st *EVP_PKEY_get1_EC_KEY(EVP_PKEY *pkey);
  796 +#endif
772 797  
773 798 EVP_PKEY * EVP_PKEY_new(void);
774 799 void EVP_PKEY_free(EVP_PKEY *pkey);
775   -EVP_PKEY * d2i_PublicKey(int type,EVP_PKEY **a, unsigned char **pp,
  800 +
  801 +EVP_PKEY * d2i_PublicKey(int type,EVP_PKEY **a, const unsigned char **pp,
776 802 long length);
777 803 int i2d_PublicKey(EVP_PKEY *a, unsigned char **pp);
778 804  
779   -EVP_PKEY * d2i_PrivateKey(int type,EVP_PKEY **a, unsigned char **pp,
  805 +EVP_PKEY * d2i_PrivateKey(int type,EVP_PKEY **a, const unsigned char **pp,
780 806 long length);
781   -EVP_PKEY * d2i_AutoPrivateKey(EVP_PKEY **a, unsigned char **pp,
  807 +EVP_PKEY * d2i_AutoPrivateKey(EVP_PKEY **a, const unsigned char **pp,
782 808 long length);
783 809 int i2d_PrivateKey(EVP_PKEY *a, unsigned char **pp);
784 810  
785   -int EVP_PKEY_copy_parameters(EVP_PKEY *to,EVP_PKEY *from);
786   -int EVP_PKEY_missing_parameters(EVP_PKEY *pkey);
  811 +int EVP_PKEY_copy_parameters(EVP_PKEY *to, const EVP_PKEY *from);
  812 +int EVP_PKEY_missing_parameters(const EVP_PKEY *pkey);
787 813 int EVP_PKEY_save_parameters(EVP_PKEY *pkey,int mode);
788   -int EVP_PKEY_cmp_parameters(EVP_PKEY *a,EVP_PKEY *b);
  814 +int EVP_PKEY_cmp_parameters(const EVP_PKEY *a, const EVP_PKEY *b);
  815 +
  816 +int EVP_PKEY_cmp(const EVP_PKEY *a, const EVP_PKEY *b);
789 817  
790 818 int EVP_CIPHER_type(const EVP_CIPHER *ctx);
791 819  
... ... @@ -802,7 +830,7 @@ int PKCS5_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen,
802 830 ASN1_TYPE *param, const EVP_CIPHER *cipher, const EVP_MD *md,
803 831 int en_de);
804 832 int PKCS5_PBKDF2_HMAC_SHA1(const char *pass, int passlen,
805   - unsigned char *salt, int saltlen, int iter,
  833 + const unsigned char *salt, int saltlen, int iter,
806 834 int keylen, unsigned char *out);
807 835 int PKCS5_v2_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen,
808 836 ASN1_TYPE *param, const EVP_CIPHER *cipher, const EVP_MD *md,
... ... @@ -825,25 +853,31 @@ void ERR_load_EVP_strings(void);
825 853 /* Error codes for the EVP functions. */
826 854  
827 855 /* Function codes. */
  856 +#define EVP_F_AES_INIT_KEY 133
828 857 #define EVP_F_D2I_PKEY 100
829   -#define EVP_F_EVP_CIPHERINIT 123
  858 +#define EVP_F_DSAPKEY2PKCS8 134
  859 +#define EVP_F_DSA_PKEY2PKCS8 135
  860 +#define EVP_F_ECDSA_PKEY2PKCS8 129
  861 +#define EVP_F_ECKEY_PKEY2PKCS8 132
  862 +#define EVP_F_EVP_CIPHERINIT_EX 123
830 863 #define EVP_F_EVP_CIPHER_CTX_CTRL 124
831 864 #define EVP_F_EVP_CIPHER_CTX_SET_KEY_LENGTH 122
832   -#define EVP_F_EVP_DECRYPTFINAL 101
833   -#define EVP_F_EVP_DIGESTINIT 128
834   -#define EVP_F_EVP_ENCRYPTFINAL 127
835   -#define EVP_F_EVP_MD_CTX_COPY 110
  865 +#define EVP_F_EVP_DECRYPTFINAL_EX 101
  866 +#define EVP_F_EVP_DIGESTINIT_EX 128
  867 +#define EVP_F_EVP_ENCRYPTFINAL_EX 127
  868 +#define EVP_F_EVP_MD_CTX_COPY_EX 110
836 869 #define EVP_F_EVP_OPENINIT 102
837 870 #define EVP_F_EVP_PBE_ALG_ADD 115
838 871 #define EVP_F_EVP_PBE_CIPHERINIT 116
839 872 #define EVP_F_EVP_PKCS82PKEY 111
840   -#define EVP_F_EVP_PKCS8_SET_BROKEN 112
841   -#define EVP_F_EVP_PKEY2PKCS8 113
  873 +#define EVP_F_EVP_PKEY2PKCS8_BROKEN 113
842 874 #define EVP_F_EVP_PKEY_COPY_PARAMETERS 103
843 875 #define EVP_F_EVP_PKEY_DECRYPT 104
844 876 #define EVP_F_EVP_PKEY_ENCRYPT 105
845 877 #define EVP_F_EVP_PKEY_GET1_DH 119
846 878 #define EVP_F_EVP_PKEY_GET1_DSA 120
  879 +#define EVP_F_EVP_PKEY_GET1_ECDSA 130
  880 +#define EVP_F_EVP_PKEY_GET1_EC_KEY 131
847 881 #define EVP_F_EVP_PKEY_GET1_RSA 121
848 882 #define EVP_F_EVP_PKEY_NEW 106
849 883 #define EVP_F_EVP_RIJNDAEL 126
... ... @@ -851,10 +885,13 @@ void ERR_load_EVP_strings(void);
851 885 #define EVP_F_EVP_VERIFYFINAL 108
852 886 #define EVP_F_PKCS5_PBE_KEYIVGEN 117
853 887 #define EVP_F_PKCS5_V2_PBE_KEYIVGEN 118
  888 +#define EVP_F_PKCS8_SET_BROKEN 112
854 889 #define EVP_F_RC2_MAGIC_TO_METH 109
855 890 #define EVP_F_RC5_CTRL 125
856 891  
857 892 /* Reason codes. */
  893 +#define EVP_R_AES_KEY_SETUP_FAILED 143
  894 +#define EVP_R_ASN1_LIB 140
858 895 #define EVP_R_BAD_BLOCK_LENGTH 136
859 896 #define EVP_R_BAD_DECRYPT 100
860 897 #define EVP_R_BAD_KEY_LENGTH 137
... ... @@ -871,6 +908,8 @@ void ERR_load_EVP_strings(void);
871 908 #define EVP_R_EXPECTING_AN_RSA_KEY 127
872 909 #define EVP_R_EXPECTING_A_DH_KEY 128
873 910 #define EVP_R_EXPECTING_A_DSA_KEY 129
  911 +#define EVP_R_EXPECTING_A_ECDSA_KEY 141
  912 +#define EVP_R_EXPECTING_A_EC_KEY 142
874 913 #define EVP_R_INITIALIZATION_ERROR 134
875 914 #define EVP_R_INPUT_NOT_INITIALIZED 111
876 915 #define EVP_R_INVALID_KEY_LENGTH 130
... ...
third_dev/openssl/include/openssl/hmac.h
... ... @@ -58,13 +58,15 @@
58 58 #ifndef HEADER_HMAC_H
59 59 #define HEADER_HMAC_H
60 60  
  61 +#include <openssl/opensslconf.h>
  62 +
61 63 #ifdef OPENSSL_NO_HMAC
62 64 #error HMAC is disabled.
63 65 #endif
64 66  
65 67 #include <openssl/evp.h>
66 68  
67   -#define HMAC_MAX_MD_CBLOCK 64
  69 +#define HMAC_MAX_MD_CBLOCK 128 /* largest known is SHA512 */
68 70  
69 71 #ifdef __cplusplus
70 72 extern "C" {
... ... @@ -92,10 +94,10 @@ void HMAC_Init(HMAC_CTX *ctx, const void *key, int len,
92 94 const EVP_MD *md); /* deprecated */
93 95 void HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len,
94 96 const EVP_MD *md, ENGINE *impl);
95   -void HMAC_Update(HMAC_CTX *ctx, const unsigned char *data, int len);
  97 +void HMAC_Update(HMAC_CTX *ctx, const unsigned char *data, size_t len);
96 98 void HMAC_Final(HMAC_CTX *ctx, unsigned char *md, unsigned int *len);
97 99 unsigned char *HMAC(const EVP_MD *evp_md, const void *key, int key_len,
98   - const unsigned char *d, int n, unsigned char *md,
  100 + const unsigned char *d, size_t n, unsigned char *md,
99 101 unsigned int *md_len);
100 102  
101 103  
... ...
third_dev/openssl/include/openssl/idea.h
... ... @@ -59,6 +59,8 @@
59 59 #ifndef HEADER_IDEA_H
60 60 #define HEADER_IDEA_H
61 61  
  62 +#include <openssl/opensslconf.h> /* IDEA_INT, OPENSSL_NO_IDEA */
  63 +
62 64 #ifdef OPENSSL_NO_IDEA
63 65 #error IDEA is disabled.
64 66 #endif
... ... @@ -66,7 +68,6 @@
66 68 #define IDEA_ENCRYPT 1
67 69 #define IDEA_DECRYPT 0
68 70  
69   -#include <openssl/opensslconf.h> /* IDEA_INT */
70 71 #define IDEA_BLOCK 8
71 72 #define IDEA_KEY_LENGTH 16
72 73  
... ... @@ -83,7 +84,7 @@ const char *idea_options(void);
83 84 void idea_ecb_encrypt(const unsigned char *in, unsigned char *out,
84 85 IDEA_KEY_SCHEDULE *ks);
85 86 void idea_set_encrypt_key(const unsigned char *key, IDEA_KEY_SCHEDULE *ks);
86   -void idea_set_decrypt_key(IDEA_KEY_SCHEDULE *ek, IDEA_KEY_SCHEDULE *dk);
  87 +void idea_set_decrypt_key(const IDEA_KEY_SCHEDULE *ek, IDEA_KEY_SCHEDULE *dk);
87 88 void idea_cbc_encrypt(const unsigned char *in, unsigned char *out,
88 89 long length, IDEA_KEY_SCHEDULE *ks, unsigned char *iv,int enc);
89 90 void idea_cfb64_encrypt(const unsigned char *in, unsigned char *out,
... ...
third_dev/openssl/include/openssl/krb5_asn.h
... ... @@ -225,7 +225,7 @@ DECLARE_STACK_OF(KRB5_AUTHENTBODY)
225 225 ** void name##_free(type *a);
226 226 ** DECLARE_ASN1_ENCODE_FUNCTIONS(type, name, name) =
227 227 ** DECLARE_ASN1_ENCODE_FUNCTIONS(type, itname, name) =
228   -** type *d2i_##name(type **a, unsigned char **in, long len);
  228 +** type *d2i_##name(type **a, const unsigned char **in, long len);
229 229 ** int i2d_##name(type *a, unsigned char **out);
230 230 ** DECLARE_ASN1_ITEM(itname) = OPENSSL_EXTERN const ASN1_ITEM itname##_it
231 231 */
... ...
third_dev/openssl/include/openssl/kssl.h
... ... @@ -82,6 +82,12 @@ extern &quot;C&quot; {
82 82 #ifdef KRB5_HEIMDAL
83 83 typedef unsigned char krb5_octet;
84 84 #define FAR
  85 +#else
  86 +
  87 +#ifndef FAR
  88 +#define FAR
  89 +#endif
  90 +
85 91 #endif
86 92  
87 93 /* Uncomment this to debug kssl problems or
... ...
third_dev/openssl/include/openssl/lhash.h
... ... @@ -63,6 +63,7 @@
63 63 #ifndef HEADER_LHASH_H
64 64 #define HEADER_LHASH_H
65 65  
  66 +#include <openssl/e_os2.h>
66 67 #ifndef OPENSSL_NO_FP_API
67 68 #include <stdio.h>
68 69 #endif
... ... @@ -77,7 +78,7 @@ extern &quot;C&quot; {
77 78  
78 79 typedef struct lhash_node_st
79 80 {
80   - const void *data;
  81 + void *data;
81 82 struct lhash_node_st *next;
82 83 #ifndef OPENSSL_NO_HASH_COMP
83 84 unsigned long hash;
... ... @@ -86,8 +87,8 @@ typedef struct lhash_node_st
86 87  
87 88 typedef int (*LHASH_COMP_FN_TYPE)(const void *, const void *);
88 89 typedef unsigned long (*LHASH_HASH_FN_TYPE)(const void *);
89   -typedef void (*LHASH_DOALL_FN_TYPE)(const void *);
90   -typedef void (*LHASH_DOALL_ARG_FN_TYPE)(const void *, void *);
  90 +typedef void (*LHASH_DOALL_FN_TYPE)(void *);
  91 +typedef void (*LHASH_DOALL_ARG_FN_TYPE)(void *, void *);
91 92  
92 93 /* Macros for declaring and implementing type-safe wrappers for LHASH callbacks.
93 94 * This way, callbacks can be provided to LHASH structures without function
... ... @@ -117,18 +118,18 @@ typedef void (*LHASH_DOALL_ARG_FN_TYPE)(const void *, void *);
117 118  
118 119 /* Third: "doall" functions */
119 120 #define DECLARE_LHASH_DOALL_FN(f_name,o_type) \
120   - void f_name##_LHASH_DOALL(const void *);
  121 + void f_name##_LHASH_DOALL(void *);
121 122 #define IMPLEMENT_LHASH_DOALL_FN(f_name,o_type) \
122   - void f_name##_LHASH_DOALL(const void *arg) { \
  123 + void f_name##_LHASH_DOALL(void *arg) { \
123 124 o_type a = (o_type)arg; \
124 125 f_name(a); }
125 126 #define LHASH_DOALL_FN(f_name) f_name##_LHASH_DOALL
126 127  
127 128 /* Fourth: "doall_arg" functions */
128 129 #define DECLARE_LHASH_DOALL_ARG_FN(f_name,o_type,a_type) \
129   - void f_name##_LHASH_DOALL_ARG(const void *, void *);
  130 + void f_name##_LHASH_DOALL_ARG(void *, void *);
130 131 #define IMPLEMENT_LHASH_DOALL_ARG_FN(f_name,o_type,a_type) \
131   - void f_name##_LHASH_DOALL_ARG(const void *arg1, void *arg2) { \
  132 + void f_name##_LHASH_DOALL_ARG(void *arg1, void *arg2) { \
132 133 o_type a = (o_type)arg1; \
133 134 a_type b = (a_type)arg2; \
134 135 f_name(a,b); }
... ... @@ -172,7 +173,7 @@ typedef struct lhash_st
172 173  
173 174 LHASH *lh_new(LHASH_HASH_FN_TYPE h, LHASH_COMP_FN_TYPE c);
174 175 void lh_free(LHASH *lh);
175   -void *lh_insert(LHASH *lh, const void *data);
  176 +void *lh_insert(LHASH *lh, void *data);
176 177 void *lh_delete(LHASH *lh, const void *data);
177 178 void *lh_retrieve(LHASH *lh, const void *data);
178 179 void lh_doall(LHASH *lh, LHASH_DOALL_FN_TYPE func);
... ...
third_dev/openssl/include/openssl/md2.h
... ... @@ -59,13 +59,13 @@
59 59 #ifndef HEADER_MD2_H
60 60 #define HEADER_MD2_H
61 61  
  62 +#include <openssl/opensslconf.h> /* OPENSSL_NO_MD2, MD2_INT */
62 63 #ifdef OPENSSL_NO_MD2
63 64 #error MD2 is disabled.
64 65 #endif
65 66  
66 67 #define MD2_DIGEST_LENGTH 16
67 68 #define MD2_BLOCK 16
68   -#include <openssl/opensslconf.h> /* MD2_INT */
69 69  
70 70 #ifdef __cplusplus
71 71 extern "C" {
... ... @@ -73,7 +73,7 @@ extern &quot;C&quot; {
73 73  
74 74 typedef struct MD2state_st
75 75 {
76   - int num;
  76 + unsigned int num;
77 77 unsigned char data[MD2_BLOCK];
78 78 MD2_INT cksm[MD2_BLOCK];
79 79 MD2_INT state[MD2_BLOCK];
... ... @@ -81,9 +81,9 @@ typedef struct MD2state_st
81 81  
82 82 const char *MD2_options(void);
83 83 int MD2_Init(MD2_CTX *c);
84   -int MD2_Update(MD2_CTX *c, const unsigned char *data, unsigned long len);
  84 +int MD2_Update(MD2_CTX *c, const unsigned char *data, size_t len);
85 85 int MD2_Final(unsigned char *md, MD2_CTX *c);
86   -unsigned char *MD2(const unsigned char *d, unsigned long n,unsigned char *md);
  86 +unsigned char *MD2(const unsigned char *d, size_t n,unsigned char *md);
87 87 #ifdef __cplusplus
88 88 }
89 89 #endif
... ...
third_dev/openssl/include/openssl/md4.h
... ... @@ -101,13 +101,13 @@ typedef struct MD4state_st
101 101 MD4_LONG A,B,C,D;
102 102 MD4_LONG Nl,Nh;
103 103 MD4_LONG data[MD4_LBLOCK];
104   - int num;
  104 + unsigned int num;
105 105 } MD4_CTX;
106 106  
107 107 int MD4_Init(MD4_CTX *c);
108   -int MD4_Update(MD4_CTX *c, const void *data, unsigned long len);
  108 +int MD4_Update(MD4_CTX *c, const void *data, size_t len);
109 109 int MD4_Final(unsigned char *md, MD4_CTX *c);
110   -unsigned char *MD4(const unsigned char *d, unsigned long n, unsigned char *md);
  110 +unsigned char *MD4(const unsigned char *d, size_t n, unsigned char *md);
111 111 void MD4_Transform(MD4_CTX *c, const unsigned char *b);
112 112 #ifdef __cplusplus
113 113 }
... ...
third_dev/openssl/include/openssl/md5.h
... ... @@ -101,13 +101,13 @@ typedef struct MD5state_st
101 101 MD5_LONG A,B,C,D;
102 102 MD5_LONG Nl,Nh;
103 103 MD5_LONG data[MD5_LBLOCK];
104   - int num;
  104 + unsigned int num;
105 105 } MD5_CTX;
106 106  
107 107 int MD5_Init(MD5_CTX *c);
108   -int MD5_Update(MD5_CTX *c, const void *data, unsigned long len);
  108 +int MD5_Update(MD5_CTX *c, const void *data, size_t len);
109 109 int MD5_Final(unsigned char *md, MD5_CTX *c);
110   -unsigned char *MD5(const unsigned char *d, unsigned long n, unsigned char *md);
  110 +unsigned char *MD5(const unsigned char *d, size_t n, unsigned char *md);
111 111 void MD5_Transform(MD5_CTX *c, const unsigned char *b);
112 112 #ifdef __cplusplus
113 113 }
... ...
third_dev/openssl/include/openssl/obj_mac.h
... ... @@ -67,30 +67,57 @@
67 67 #define NID_undef 0
68 68 #define OBJ_undef 0L
69 69  
70   -#define SN_ccitt "CCITT"
71   -#define LN_ccitt "ccitt"
  70 +#define SN_itu_t "ITU-T"
  71 +#define LN_itu_t "itu-t"
  72 +#define NID_itu_t 645
  73 +#define OBJ_itu_t 0L
  74 +
72 75 #define NID_ccitt 404
73   -#define OBJ_ccitt 0L
  76 +#define OBJ_ccitt OBJ_itu_t
74 77  
75 78 #define SN_iso "ISO"
76 79 #define LN_iso "iso"
77 80 #define NID_iso 181
78 81 #define OBJ_iso 1L
79 82  
80   -#define SN_joint_iso_ccitt "JOINT-ISO-CCITT"
81   -#define LN_joint_iso_ccitt "joint-iso-ccitt"
  83 +#define SN_joint_iso_itu_t "JOINT-ISO-ITU-T"
  84 +#define LN_joint_iso_itu_t "joint-iso-itu-t"
  85 +#define NID_joint_iso_itu_t 646
  86 +#define OBJ_joint_iso_itu_t 2L
  87 +
82 88 #define NID_joint_iso_ccitt 393
83   -#define OBJ_joint_iso_ccitt 2L
  89 +#define OBJ_joint_iso_ccitt OBJ_joint_iso_itu_t
84 90  
85 91 #define SN_member_body "member-body"
86 92 #define LN_member_body "ISO Member Body"
87 93 #define NID_member_body 182
88 94 #define OBJ_member_body OBJ_iso,2L
89 95  
  96 +#define SN_identified_organization "identified-organization"
  97 +#define NID_identified_organization 676
  98 +#define OBJ_identified_organization OBJ_iso,3L
  99 +
  100 +#define SN_certicom_arc "certicom-arc"
  101 +#define NID_certicom_arc 677
  102 +#define OBJ_certicom_arc OBJ_identified_organization,132L
  103 +
  104 +#define SN_international_organizations "international-organizations"
  105 +#define LN_international_organizations "International Organizations"
  106 +#define NID_international_organizations 647
  107 +#define OBJ_international_organizations OBJ_joint_iso_itu_t,23L
  108 +
  109 +#define SN_wap "wap"
  110 +#define NID_wap 678
  111 +#define OBJ_wap OBJ_international_organizations,43L
  112 +
  113 +#define SN_wap_wsg "wap-wsg"
  114 +#define NID_wap_wsg 679
  115 +#define OBJ_wap_wsg OBJ_wap,13L
  116 +
90 117 #define SN_selected_attribute_types "selected-attribute-types"
91 118 #define LN_selected_attribute_types "Selected Attribute Types"
92 119 #define NID_selected_attribute_types 394
93   -#define OBJ_selected_attribute_types OBJ_joint_iso_ccitt,5L,1L,5L
  120 +#define OBJ_selected_attribute_types OBJ_joint_iso_itu_t,5L,1L,5L
94 121  
95 122 #define SN_clearance "clearance"
96 123 #define NID_clearance 395
... ... @@ -136,6 +163,22 @@
136 163 #define NID_X9_62_characteristic_two_field 407
137 164 #define OBJ_X9_62_characteristic_two_field OBJ_X9_62_id_fieldType,2L
138 165  
  166 +#define SN_X9_62_id_characteristic_two_basis "id-characteristic-two-basis"
  167 +#define NID_X9_62_id_characteristic_two_basis 680
  168 +#define OBJ_X9_62_id_characteristic_two_basis OBJ_X9_62_characteristic_two_field,3L
  169 +
  170 +#define SN_X9_62_onBasis "onBasis"
  171 +#define NID_X9_62_onBasis 681
  172 +#define OBJ_X9_62_onBasis OBJ_X9_62_id_characteristic_two_basis,1L
  173 +
  174 +#define SN_X9_62_tpBasis "tpBasis"
  175 +#define NID_X9_62_tpBasis 682
  176 +#define OBJ_X9_62_tpBasis OBJ_X9_62_id_characteristic_two_basis,2L
  177 +
  178 +#define SN_X9_62_ppBasis "ppBasis"
  179 +#define NID_X9_62_ppBasis 683
  180 +#define OBJ_X9_62_ppBasis OBJ_X9_62_id_characteristic_two_basis,3L
  181 +
139 182 #define OBJ_X9_62_id_publicKeyType OBJ_ansi_X9_62,2L
140 183  
141 184 #define SN_X9_62_id_ecPublicKey "id-ecPublicKey"
... ... @@ -146,6 +189,86 @@
146 189  
147 190 #define OBJ_X9_62_c_TwoCurve OBJ_X9_62_ellipticCurve,0L
148 191  
  192 +#define SN_X9_62_c2pnb163v1 "c2pnb163v1"
  193 +#define NID_X9_62_c2pnb163v1 684
  194 +#define OBJ_X9_62_c2pnb163v1 OBJ_X9_62_c_TwoCurve,1L
  195 +
  196 +#define SN_X9_62_c2pnb163v2 "c2pnb163v2"
  197 +#define NID_X9_62_c2pnb163v2 685
  198 +#define OBJ_X9_62_c2pnb163v2 OBJ_X9_62_c_TwoCurve,2L
  199 +
  200 +#define SN_X9_62_c2pnb163v3 "c2pnb163v3"
  201 +#define NID_X9_62_c2pnb163v3 686
  202 +#define OBJ_X9_62_c2pnb163v3 OBJ_X9_62_c_TwoCurve,3L
  203 +
  204 +#define SN_X9_62_c2pnb176v1 "c2pnb176v1"
  205 +#define NID_X9_62_c2pnb176v1 687
  206 +#define OBJ_X9_62_c2pnb176v1 OBJ_X9_62_c_TwoCurve,4L
  207 +
  208 +#define SN_X9_62_c2tnb191v1 "c2tnb191v1"
  209 +#define NID_X9_62_c2tnb191v1 688
  210 +#define OBJ_X9_62_c2tnb191v1 OBJ_X9_62_c_TwoCurve,5L
  211 +
  212 +#define SN_X9_62_c2tnb191v2 "c2tnb191v2"
  213 +#define NID_X9_62_c2tnb191v2 689
  214 +#define OBJ_X9_62_c2tnb191v2 OBJ_X9_62_c_TwoCurve,6L
  215 +
  216 +#define SN_X9_62_c2tnb191v3 "c2tnb191v3"
  217 +#define NID_X9_62_c2tnb191v3 690
  218 +#define OBJ_X9_62_c2tnb191v3 OBJ_X9_62_c_TwoCurve,7L
  219 +
  220 +#define SN_X9_62_c2onb191v4 "c2onb191v4"
  221 +#define NID_X9_62_c2onb191v4 691
  222 +#define OBJ_X9_62_c2onb191v4 OBJ_X9_62_c_TwoCurve,8L
  223 +
  224 +#define SN_X9_62_c2onb191v5 "c2onb191v5"
  225 +#define NID_X9_62_c2onb191v5 692
  226 +#define OBJ_X9_62_c2onb191v5 OBJ_X9_62_c_TwoCurve,9L
  227 +
  228 +#define SN_X9_62_c2pnb208w1 "c2pnb208w1"
  229 +#define NID_X9_62_c2pnb208w1 693
  230 +#define OBJ_X9_62_c2pnb208w1 OBJ_X9_62_c_TwoCurve,10L
  231 +
  232 +#define SN_X9_62_c2tnb239v1 "c2tnb239v1"
  233 +#define NID_X9_62_c2tnb239v1 694
  234 +#define OBJ_X9_62_c2tnb239v1 OBJ_X9_62_c_TwoCurve,11L
  235 +
  236 +#define SN_X9_62_c2tnb239v2 "c2tnb239v2"
  237 +#define NID_X9_62_c2tnb239v2 695
  238 +#define OBJ_X9_62_c2tnb239v2 OBJ_X9_62_c_TwoCurve,12L
  239 +
  240 +#define SN_X9_62_c2tnb239v3 "c2tnb239v3"
  241 +#define NID_X9_62_c2tnb239v3 696
  242 +#define OBJ_X9_62_c2tnb239v3 OBJ_X9_62_c_TwoCurve,13L
  243 +
  244 +#define SN_X9_62_c2onb239v4 "c2onb239v4"
  245 +#define NID_X9_62_c2onb239v4 697
  246 +#define OBJ_X9_62_c2onb239v4 OBJ_X9_62_c_TwoCurve,14L
  247 +
  248 +#define SN_X9_62_c2onb239v5 "c2onb239v5"
  249 +#define NID_X9_62_c2onb239v5 698
  250 +#define OBJ_X9_62_c2onb239v5 OBJ_X9_62_c_TwoCurve,15L
  251 +
  252 +#define SN_X9_62_c2pnb272w1 "c2pnb272w1"
  253 +#define NID_X9_62_c2pnb272w1 699
  254 +#define OBJ_X9_62_c2pnb272w1 OBJ_X9_62_c_TwoCurve,16L
  255 +
  256 +#define SN_X9_62_c2pnb304w1 "c2pnb304w1"
  257 +#define NID_X9_62_c2pnb304w1 700
  258 +#define OBJ_X9_62_c2pnb304w1 OBJ_X9_62_c_TwoCurve,17L
  259 +
  260 +#define SN_X9_62_c2tnb359v1 "c2tnb359v1"
  261 +#define NID_X9_62_c2tnb359v1 701
  262 +#define OBJ_X9_62_c2tnb359v1 OBJ_X9_62_c_TwoCurve,18L
  263 +
  264 +#define SN_X9_62_c2pnb368w1 "c2pnb368w1"
  265 +#define NID_X9_62_c2pnb368w1 702
  266 +#define OBJ_X9_62_c2pnb368w1 OBJ_X9_62_c_TwoCurve,19L
  267 +
  268 +#define SN_X9_62_c2tnb431r1 "c2tnb431r1"
  269 +#define NID_X9_62_c2tnb431r1 703
  270 +#define OBJ_X9_62_c2tnb431r1 OBJ_X9_62_c_TwoCurve,20L
  271 +
149 272 #define OBJ_X9_62_primeCurve OBJ_X9_62_ellipticCurve,1L
150 273  
151 274 #define SN_X9_62_prime192v1 "prime192v1"
... ... @@ -182,6 +305,178 @@
182 305 #define NID_ecdsa_with_SHA1 416
183 306 #define OBJ_ecdsa_with_SHA1 OBJ_X9_62_id_ecSigType,1L
184 307  
  308 +#define OBJ_secg_ellipticCurve OBJ_certicom_arc,0L
  309 +
  310 +#define SN_secp112r1 "secp112r1"
  311 +#define NID_secp112r1 704
  312 +#define OBJ_secp112r1 OBJ_secg_ellipticCurve,6L
  313 +
  314 +#define SN_secp112r2 "secp112r2"
  315 +#define NID_secp112r2 705
  316 +#define OBJ_secp112r2 OBJ_secg_ellipticCurve,7L
  317 +
  318 +#define SN_secp128r1 "secp128r1"
  319 +#define NID_secp128r1 706
  320 +#define OBJ_secp128r1 OBJ_secg_ellipticCurve,28L
  321 +
  322 +#define SN_secp128r2 "secp128r2"
  323 +#define NID_secp128r2 707
  324 +#define OBJ_secp128r2 OBJ_secg_ellipticCurve,29L
  325 +
  326 +#define SN_secp160k1 "secp160k1"
  327 +#define NID_secp160k1 708
  328 +#define OBJ_secp160k1 OBJ_secg_ellipticCurve,9L
  329 +
  330 +#define SN_secp160r1 "secp160r1"
  331 +#define NID_secp160r1 709
  332 +#define OBJ_secp160r1 OBJ_secg_ellipticCurve,8L
  333 +
  334 +#define SN_secp160r2 "secp160r2"
  335 +#define NID_secp160r2 710
  336 +#define OBJ_secp160r2 OBJ_secg_ellipticCurve,30L
  337 +
  338 +#define SN_secp192k1 "secp192k1"
  339 +#define NID_secp192k1 711
  340 +#define OBJ_secp192k1 OBJ_secg_ellipticCurve,31L
  341 +
  342 +#define SN_secp224k1 "secp224k1"
  343 +#define NID_secp224k1 712
  344 +#define OBJ_secp224k1 OBJ_secg_ellipticCurve,32L
  345 +
  346 +#define SN_secp224r1 "secp224r1"
  347 +#define NID_secp224r1 713
  348 +#define OBJ_secp224r1 OBJ_secg_ellipticCurve,33L
  349 +
  350 +#define SN_secp256k1 "secp256k1"
  351 +#define NID_secp256k1 714
  352 +#define OBJ_secp256k1 OBJ_secg_ellipticCurve,10L
  353 +
  354 +#define SN_secp384r1 "secp384r1"
  355 +#define NID_secp384r1 715
  356 +#define OBJ_secp384r1 OBJ_secg_ellipticCurve,34L
  357 +
  358 +#define SN_secp521r1 "secp521r1"
  359 +#define NID_secp521r1 716
  360 +#define OBJ_secp521r1 OBJ_secg_ellipticCurve,35L
  361 +
  362 +#define SN_sect113r1 "sect113r1"
  363 +#define NID_sect113r1 717
  364 +#define OBJ_sect113r1 OBJ_secg_ellipticCurve,4L
  365 +
  366 +#define SN_sect113r2 "sect113r2"
  367 +#define NID_sect113r2 718
  368 +#define OBJ_sect113r2 OBJ_secg_ellipticCurve,5L
  369 +
  370 +#define SN_sect131r1 "sect131r1"
  371 +#define NID_sect131r1 719
  372 +#define OBJ_sect131r1 OBJ_secg_ellipticCurve,22L
  373 +
  374 +#define SN_sect131r2 "sect131r2"
  375 +#define NID_sect131r2 720
  376 +#define OBJ_sect131r2 OBJ_secg_ellipticCurve,23L
  377 +
  378 +#define SN_sect163k1 "sect163k1"
  379 +#define NID_sect163k1 721
  380 +#define OBJ_sect163k1 OBJ_secg_ellipticCurve,1L
  381 +
  382 +#define SN_sect163r1 "sect163r1"
  383 +#define NID_sect163r1 722
  384 +#define OBJ_sect163r1 OBJ_secg_ellipticCurve,2L
  385 +
  386 +#define SN_sect163r2 "sect163r2"
  387 +#define NID_sect163r2 723
  388 +#define OBJ_sect163r2 OBJ_secg_ellipticCurve,15L
  389 +
  390 +#define SN_sect193r1 "sect193r1"
  391 +#define NID_sect193r1 724
  392 +#define OBJ_sect193r1 OBJ_secg_ellipticCurve,24L
  393 +
  394 +#define SN_sect193r2 "sect193r2"
  395 +#define NID_sect193r2 725
  396 +#define OBJ_sect193r2 OBJ_secg_ellipticCurve,25L
  397 +
  398 +#define SN_sect233k1 "sect233k1"
  399 +#define NID_sect233k1 726
  400 +#define OBJ_sect233k1 OBJ_secg_ellipticCurve,26L
  401 +
  402 +#define SN_sect233r1 "sect233r1"
  403 +#define NID_sect233r1 727
  404 +#define OBJ_sect233r1 OBJ_secg_ellipticCurve,27L
  405 +
  406 +#define SN_sect239k1 "sect239k1"
  407 +#define NID_sect239k1 728
  408 +#define OBJ_sect239k1 OBJ_secg_ellipticCurve,3L
  409 +
  410 +#define SN_sect283k1 "sect283k1"
  411 +#define NID_sect283k1 729
  412 +#define OBJ_sect283k1 OBJ_secg_ellipticCurve,16L
  413 +
  414 +#define SN_sect283r1 "sect283r1"
  415 +#define NID_sect283r1 730
  416 +#define OBJ_sect283r1 OBJ_secg_ellipticCurve,17L
  417 +
  418 +#define SN_sect409k1 "sect409k1"
  419 +#define NID_sect409k1 731
  420 +#define OBJ_sect409k1 OBJ_secg_ellipticCurve,36L
  421 +
  422 +#define SN_sect409r1 "sect409r1"
  423 +#define NID_sect409r1 732
  424 +#define OBJ_sect409r1 OBJ_secg_ellipticCurve,37L
  425 +
  426 +#define SN_sect571k1 "sect571k1"
  427 +#define NID_sect571k1 733
  428 +#define OBJ_sect571k1 OBJ_secg_ellipticCurve,38L
  429 +
  430 +#define SN_sect571r1 "sect571r1"
  431 +#define NID_sect571r1 734
  432 +#define OBJ_sect571r1 OBJ_secg_ellipticCurve,39L
  433 +
  434 +#define OBJ_wap_wsg_idm_ecid OBJ_wap_wsg,4L
  435 +
  436 +#define SN_wap_wsg_idm_ecid_wtls1 "wap-wsg-idm-ecid-wtls1"
  437 +#define NID_wap_wsg_idm_ecid_wtls1 735
  438 +#define OBJ_wap_wsg_idm_ecid_wtls1 OBJ_wap_wsg_idm_ecid,1L
  439 +
  440 +#define SN_wap_wsg_idm_ecid_wtls3 "wap-wsg-idm-ecid-wtls3"
  441 +#define NID_wap_wsg_idm_ecid_wtls3 736
  442 +#define OBJ_wap_wsg_idm_ecid_wtls3 OBJ_wap_wsg_idm_ecid,3L
  443 +
  444 +#define SN_wap_wsg_idm_ecid_wtls4 "wap-wsg-idm-ecid-wtls4"
  445 +#define NID_wap_wsg_idm_ecid_wtls4 737
  446 +#define OBJ_wap_wsg_idm_ecid_wtls4 OBJ_wap_wsg_idm_ecid,4L
  447 +
  448 +#define SN_wap_wsg_idm_ecid_wtls5 "wap-wsg-idm-ecid-wtls5"
  449 +#define NID_wap_wsg_idm_ecid_wtls5 738
  450 +#define OBJ_wap_wsg_idm_ecid_wtls5 OBJ_wap_wsg_idm_ecid,5L
  451 +
  452 +#define SN_wap_wsg_idm_ecid_wtls6 "wap-wsg-idm-ecid-wtls6"
  453 +#define NID_wap_wsg_idm_ecid_wtls6 739
  454 +#define OBJ_wap_wsg_idm_ecid_wtls6 OBJ_wap_wsg_idm_ecid,6L
  455 +
  456 +#define SN_wap_wsg_idm_ecid_wtls7 "wap-wsg-idm-ecid-wtls7"
  457 +#define NID_wap_wsg_idm_ecid_wtls7 740
  458 +#define OBJ_wap_wsg_idm_ecid_wtls7 OBJ_wap_wsg_idm_ecid,7L
  459 +
  460 +#define SN_wap_wsg_idm_ecid_wtls8 "wap-wsg-idm-ecid-wtls8"
  461 +#define NID_wap_wsg_idm_ecid_wtls8 741
  462 +#define OBJ_wap_wsg_idm_ecid_wtls8 OBJ_wap_wsg_idm_ecid,8L
  463 +
  464 +#define SN_wap_wsg_idm_ecid_wtls9 "wap-wsg-idm-ecid-wtls9"
  465 +#define NID_wap_wsg_idm_ecid_wtls9 742
  466 +#define OBJ_wap_wsg_idm_ecid_wtls9 OBJ_wap_wsg_idm_ecid,9L
  467 +
  468 +#define SN_wap_wsg_idm_ecid_wtls10 "wap-wsg-idm-ecid-wtls10"
  469 +#define NID_wap_wsg_idm_ecid_wtls10 743
  470 +#define OBJ_wap_wsg_idm_ecid_wtls10 OBJ_wap_wsg_idm_ecid,10L
  471 +
  472 +#define SN_wap_wsg_idm_ecid_wtls11 "wap-wsg-idm-ecid-wtls11"
  473 +#define NID_wap_wsg_idm_ecid_wtls11 744
  474 +#define OBJ_wap_wsg_idm_ecid_wtls11 OBJ_wap_wsg_idm_ecid,11L
  475 +
  476 +#define SN_wap_wsg_idm_ecid_wtls12 "wap-wsg-idm-ecid-wtls12"
  477 +#define NID_wap_wsg_idm_ecid_wtls12 745
  478 +#define OBJ_wap_wsg_idm_ecid_wtls12 OBJ_wap_wsg_idm_ecid,12L
  479 +
185 480 #define SN_cast5_cbc "CAST5-CBC"
186 481 #define LN_cast5_cbc "cast5-cbc"
187 482 #define NID_cast5_cbc 108
... ... @@ -241,6 +536,26 @@
241 536 #define NID_sha1WithRSAEncryption 65
242 537 #define OBJ_sha1WithRSAEncryption OBJ_pkcs1,5L
243 538  
  539 +#define SN_sha256WithRSAEncryption "RSA-SHA256"
  540 +#define LN_sha256WithRSAEncryption "sha256WithRSAEncryption"
  541 +#define NID_sha256WithRSAEncryption 668
  542 +#define OBJ_sha256WithRSAEncryption OBJ_pkcs1,11L
  543 +
  544 +#define SN_sha384WithRSAEncryption "RSA-SHA384"
  545 +#define LN_sha384WithRSAEncryption "sha384WithRSAEncryption"
  546 +#define NID_sha384WithRSAEncryption 669
  547 +#define OBJ_sha384WithRSAEncryption OBJ_pkcs1,12L
  548 +
  549 +#define SN_sha512WithRSAEncryption "RSA-SHA512"
  550 +#define LN_sha512WithRSAEncryption "sha512WithRSAEncryption"
  551 +#define NID_sha512WithRSAEncryption 670
  552 +#define OBJ_sha512WithRSAEncryption OBJ_pkcs1,13L
  553 +
  554 +#define SN_sha224WithRSAEncryption "RSA-SHA224"
  555 +#define LN_sha224WithRSAEncryption "sha224WithRSAEncryption"
  556 +#define NID_sha224WithRSAEncryption 671
  557 +#define OBJ_sha224WithRSAEncryption OBJ_pkcs1,14L
  558 +
244 559 #define SN_pkcs3 "pkcs3"
245 560 #define NID_pkcs3 27
246 561 #define OBJ_pkcs3 OBJ_pkcs,3L
... ... @@ -950,6 +1265,10 @@
950 1265 #define NID_id_cct 268
951 1266 #define OBJ_id_cct OBJ_id_pkix,12L
952 1267  
  1268 +#define SN_id_ppl "id-ppl"
  1269 +#define NID_id_ppl 662
  1270 +#define OBJ_id_ppl OBJ_id_pkix,21L
  1271 +
953 1272 #define SN_id_ad "id-ad"
954 1273 #define NID_id_ad 176
955 1274 #define OBJ_id_ad OBJ_id_pkix,48L
... ... @@ -1044,17 +1363,17 @@
1044 1363 #define NID_aaControls 289
1045 1364 #define OBJ_aaControls OBJ_id_pe,6L
1046 1365  
1047   -#define SN_sbqp_ipAddrBlock "sbqp-ipAddrBlock"
1048   -#define NID_sbqp_ipAddrBlock 290
1049   -#define OBJ_sbqp_ipAddrBlock OBJ_id_pe,7L
  1366 +#define SN_sbgp_ipAddrBlock "sbgp-ipAddrBlock"
  1367 +#define NID_sbgp_ipAddrBlock 290
  1368 +#define OBJ_sbgp_ipAddrBlock OBJ_id_pe,7L
1050 1369  
1051   -#define SN_sbqp_autonomousSysNum "sbqp-autonomousSysNum"
1052   -#define NID_sbqp_autonomousSysNum 291
1053   -#define OBJ_sbqp_autonomousSysNum OBJ_id_pe,8L
  1370 +#define SN_sbgp_autonomousSysNum "sbgp-autonomousSysNum"
  1371 +#define NID_sbgp_autonomousSysNum 291
  1372 +#define OBJ_sbgp_autonomousSysNum OBJ_id_pe,8L
1054 1373  
1055   -#define SN_sbqp_routerIdentifier "sbqp-routerIdentifier"
1056   -#define NID_sbqp_routerIdentifier 292
1057   -#define OBJ_sbqp_routerIdentifier OBJ_id_pe,9L
  1374 +#define SN_sbgp_routerIdentifier "sbgp-routerIdentifier"
  1375 +#define NID_sbgp_routerIdentifier 292
  1376 +#define OBJ_sbgp_routerIdentifier OBJ_id_pe,9L
1058 1377  
1059 1378 #define SN_ac_proxying "ac-proxying"
1060 1379 #define NID_ac_proxying 397
... ... @@ -1065,6 +1384,11 @@
1065 1384 #define NID_sinfo_access 398
1066 1385 #define OBJ_sinfo_access OBJ_id_pe,11L
1067 1386  
  1387 +#define SN_proxyCertInfo "proxyCertInfo"
  1388 +#define LN_proxyCertInfo "Proxy Certificate Information"
  1389 +#define NID_proxyCertInfo 663
  1390 +#define OBJ_proxyCertInfo OBJ_id_pe,14L
  1391 +
1068 1392 #define SN_id_qt_cps "id-qt-cps"
1069 1393 #define LN_id_qt_cps "Policy Qualifier CPS"
1070 1394 #define NID_id_qt_cps 164
... ... @@ -1389,6 +1713,21 @@
1389 1713 #define NID_id_cct_PKIResponse 362
1390 1714 #define OBJ_id_cct_PKIResponse OBJ_id_cct,3L
1391 1715  
  1716 +#define SN_id_ppl_anyLanguage "id-ppl-anyLanguage"
  1717 +#define LN_id_ppl_anyLanguage "Any language"
  1718 +#define NID_id_ppl_anyLanguage 664
  1719 +#define OBJ_id_ppl_anyLanguage OBJ_id_ppl,0L
  1720 +
  1721 +#define SN_id_ppl_inheritAll "id-ppl-inheritAll"
  1722 +#define LN_id_ppl_inheritAll "Inherit all"
  1723 +#define NID_id_ppl_inheritAll 665
  1724 +#define OBJ_id_ppl_inheritAll OBJ_id_ppl,1L
  1725 +
  1726 +#define SN_Independent "id-ppl-independent"
  1727 +#define LN_Independent "Independent"
  1728 +#define NID_Independent 667
  1729 +#define OBJ_Independent OBJ_id_ppl,2L
  1730 +
1392 1731 #define SN_ad_OCSP "OCSP"
1393 1732 #define LN_ad_OCSP "OCSP"
1394 1733 #define NID_ad_OCSP 178
... ... @@ -1619,6 +1958,10 @@
1619 1958 #define NID_stateOrProvinceName 16
1620 1959 #define OBJ_stateOrProvinceName OBJ_X509,8L
1621 1960  
  1961 +#define LN_streetAddress "streetAddress"
  1962 +#define NID_streetAddress 660
  1963 +#define OBJ_streetAddress OBJ_X509,9L
  1964 +
1622 1965 #define SN_organizationName "O"
1623 1966 #define LN_organizationName "organizationName"
1624 1967 #define NID_organizationName 17
... ... @@ -1637,6 +1980,10 @@
1637 1980 #define NID_description 107
1638 1981 #define OBJ_description OBJ_X509,13L
1639 1982  
  1983 +#define LN_postalCode "postalCode"
  1984 +#define NID_postalCode 661
  1985 +#define OBJ_postalCode OBJ_X509,17L
  1986 +
1640 1987 #define SN_name "name"
1641 1988 #define LN_name "name"
1642 1989 #define NID_name 173
... ... @@ -1747,6 +2094,11 @@
1747 2094 #define NID_delta_crl 140
1748 2095 #define OBJ_delta_crl OBJ_id_ce,27L
1749 2096  
  2097 +#define SN_name_constraints "nameConstraints"
  2098 +#define LN_name_constraints "X509v3 Name Constraints"
  2099 +#define NID_name_constraints 666
  2100 +#define OBJ_name_constraints OBJ_id_ce,30L
  2101 +
1750 2102 #define SN_crl_distribution_points "crlDistributionPoints"
1751 2103 #define LN_crl_distribution_points "X509v3 CRL Distribution Points"
1752 2104 #define NID_crl_distribution_points 103
... ... @@ -1757,6 +2109,16 @@
1757 2109 #define NID_certificate_policies 89
1758 2110 #define OBJ_certificate_policies OBJ_id_ce,32L
1759 2111  
  2112 +#define SN_any_policy "anyPolicy"
  2113 +#define LN_any_policy "X509v3 Any Policy"
  2114 +#define NID_any_policy 746
  2115 +#define OBJ_any_policy OBJ_certificate_policies,0L
  2116 +
  2117 +#define SN_policy_mappings "policyMappings"
  2118 +#define LN_policy_mappings "X509v3 Policy Mappings"
  2119 +#define NID_policy_mappings 747
  2120 +#define OBJ_policy_mappings OBJ_id_ce,33L
  2121 +
1760 2122 #define SN_authority_key_identifier "authorityKeyIdentifier"
1761 2123 #define LN_authority_key_identifier "X509v3 Authority Key Identifier"
1762 2124 #define NID_authority_key_identifier 90
... ... @@ -1772,6 +2134,11 @@
1772 2134 #define NID_ext_key_usage 126
1773 2135 #define OBJ_ext_key_usage OBJ_id_ce,37L
1774 2136  
  2137 +#define SN_inhibit_any_policy "inhibitAnyPolicy"
  2138 +#define LN_inhibit_any_policy "X509v3 Inhibit Any Policy"
  2139 +#define NID_inhibit_any_policy 748
  2140 +#define OBJ_inhibit_any_policy OBJ_id_ce,54L
  2141 +
1775 2142 #define SN_target_information "targetInformation"
1776 2143 #define LN_target_information "X509v3 AC Targeting"
1777 2144 #define NID_target_information 402
... ... @@ -2009,6 +2376,68 @@
2009 2376 #define NID_aes_256_cfb128 429
2010 2377 #define OBJ_aes_256_cfb128 OBJ_aes,44L
2011 2378  
  2379 +#define SN_aes_128_cfb1 "AES-128-CFB1"
  2380 +#define LN_aes_128_cfb1 "aes-128-cfb1"
  2381 +#define NID_aes_128_cfb1 650
  2382 +
  2383 +#define SN_aes_192_cfb1 "AES-192-CFB1"
  2384 +#define LN_aes_192_cfb1 "aes-192-cfb1"
  2385 +#define NID_aes_192_cfb1 651
  2386 +
  2387 +#define SN_aes_256_cfb1 "AES-256-CFB1"
  2388 +#define LN_aes_256_cfb1 "aes-256-cfb1"
  2389 +#define NID_aes_256_cfb1 652
  2390 +
  2391 +#define SN_aes_128_cfb8 "AES-128-CFB8"
  2392 +#define LN_aes_128_cfb8 "aes-128-cfb8"
  2393 +#define NID_aes_128_cfb8 653
  2394 +
  2395 +#define SN_aes_192_cfb8 "AES-192-CFB8"
  2396 +#define LN_aes_192_cfb8 "aes-192-cfb8"
  2397 +#define NID_aes_192_cfb8 654
  2398 +
  2399 +#define SN_aes_256_cfb8 "AES-256-CFB8"
  2400 +#define LN_aes_256_cfb8 "aes-256-cfb8"
  2401 +#define NID_aes_256_cfb8 655
  2402 +
  2403 +#define SN_des_cfb1 "DES-CFB1"
  2404 +#define LN_des_cfb1 "des-cfb1"
  2405 +#define NID_des_cfb1 656
  2406 +
  2407 +#define SN_des_cfb8 "DES-CFB8"
  2408 +#define LN_des_cfb8 "des-cfb8"
  2409 +#define NID_des_cfb8 657
  2410 +
  2411 +#define SN_des_ede3_cfb1 "DES-EDE3-CFB1"
  2412 +#define LN_des_ede3_cfb1 "des-ede3-cfb1"
  2413 +#define NID_des_ede3_cfb1 658
  2414 +
  2415 +#define SN_des_ede3_cfb8 "DES-EDE3-CFB8"
  2416 +#define LN_des_ede3_cfb8 "des-ede3-cfb8"
  2417 +#define NID_des_ede3_cfb8 659
  2418 +
  2419 +#define OBJ_nist_hashalgs OBJ_nistAlgorithms,2L
  2420 +
  2421 +#define SN_sha256 "SHA256"
  2422 +#define LN_sha256 "sha256"
  2423 +#define NID_sha256 672
  2424 +#define OBJ_sha256 OBJ_nist_hashalgs,1L
  2425 +
  2426 +#define SN_sha384 "SHA384"
  2427 +#define LN_sha384 "sha384"
  2428 +#define NID_sha384 673
  2429 +#define OBJ_sha384 OBJ_nist_hashalgs,2L
  2430 +
  2431 +#define SN_sha512 "SHA512"
  2432 +#define LN_sha512 "sha512"
  2433 +#define NID_sha512 674
  2434 +#define OBJ_sha512 OBJ_nist_hashalgs,3L
  2435 +
  2436 +#define SN_sha224 "SHA224"
  2437 +#define LN_sha224 "sha224"
  2438 +#define NID_sha224 675
  2439 +#define OBJ_sha224 OBJ_nist_hashalgs,4L
  2440 +
2012 2441 #define SN_hold_instruction_code "holdInstructionCode"
2013 2442 #define LN_hold_instruction_code "Hold Instruction Code"
2014 2443 #define NID_hold_instruction_code 430
... ... @@ -2033,7 +2462,7 @@
2033 2462  
2034 2463 #define SN_data "data"
2035 2464 #define NID_data 434
2036   -#define OBJ_data OBJ_ccitt,9L
  2465 +#define OBJ_data OBJ_itu_t,9L
2037 2466  
2038 2467 #define SN_pss "pss"
2039 2468 #define NID_pss 435
... ... @@ -2322,7 +2751,7 @@
2322 2751 #define SN_id_set "id-set"
2323 2752 #define LN_id_set "Secure Electronic Transactions"
2324 2753 #define NID_id_set 512
2325   -#define OBJ_id_set 2L,23L,42L
  2754 +#define OBJ_id_set OBJ_international_organizations,42L
2326 2755  
2327 2756 #define SN_set_ctype "set-ctype"
2328 2757 #define LN_set_ctype "content types"
... ... @@ -2866,3 +3295,11 @@
2866 3295 #define NID_rsaOAEPEncryptionSET 644
2867 3296 #define OBJ_rsaOAEPEncryptionSET OBJ_rsadsi,1L,1L,6L
2868 3297  
  3298 +#define SN_ipsec3 "Oakley-EC2N-3"
  3299 +#define LN_ipsec3 "ipsec3"
  3300 +#define NID_ipsec3 749
  3301 +
  3302 +#define SN_ipsec4 "Oakley-EC2N-4"
  3303 +#define LN_ipsec4 "ipsec4"
  3304 +#define NID_ipsec4 750
  3305 +
... ...
third_dev/openssl/include/openssl/objects.h
... ... @@ -966,7 +966,10 @@
966 966 #define OBJ_NAME_TYPE_COMP_METH 0x04
967 967 #define OBJ_NAME_TYPE_NUM 0x05
968 968  
969   -#define OBJ_NAME_ALIAS 0x8000
  969 +#define OBJ_NAME_ALIAS 0x8000
  970 +
  971 +#define OBJ_BSEARCH_VALUE_ON_NOMATCH 0x01
  972 +#define OBJ_BSEARCH_FIRST_VALUE_ON_MATCH 0x02
970 973  
971 974  
972 975 #ifdef __cplusplus
... ... @@ -1010,6 +1013,8 @@ int OBJ_sn2nid(const char *s);
1010 1013 int OBJ_cmp(const ASN1_OBJECT *a,const ASN1_OBJECT *b);
1011 1014 const char * OBJ_bsearch(const char *key,const char *base,int num,int size,
1012 1015 int (*cmp)(const void *, const void *));
  1016 +const char * OBJ_bsearch_ex(const char *key,const char *base,int num,
  1017 + int size, int (*cmp)(const void *, const void *), int flags);
1013 1018  
1014 1019 int OBJ_new_nid(int num);
1015 1020 int OBJ_add_object(const ASN1_OBJECT *obj);
... ... @@ -1026,8 +1031,10 @@ void ERR_load_OBJ_strings(void);
1026 1031 /* Error codes for the OBJ functions. */
1027 1032  
1028 1033 /* Function codes. */
  1034 +#define OBJ_F_OBJ_ADD_OBJECT 105
1029 1035 #define OBJ_F_OBJ_CREATE 100
1030 1036 #define OBJ_F_OBJ_DUP 101
  1037 +#define OBJ_F_OBJ_NAME_NEW_INDEX 106
1031 1038 #define OBJ_F_OBJ_NID2LN 102
1032 1039 #define OBJ_F_OBJ_NID2OBJ 103
1033 1040 #define OBJ_F_OBJ_NID2SN 104
... ...
third_dev/openssl/include/openssl/ocsp.h
... ... @@ -349,13 +349,9 @@ typedef struct ocsp_service_locator_st
349 349 #define PEM_STRING_OCSP_REQUEST "OCSP REQUEST"
350 350 #define PEM_STRING_OCSP_RESPONSE "OCSP RESPONSE"
351 351  
352   -#define d2i_OCSP_REQUEST_bio(bp,p) (OCSP_REQUEST*)ASN1_d2i_bio((char*(*)()) \
353   - OCSP_REQUEST_new,(char *(*)())d2i_OCSP_REQUEST, (bp),\
354   - (unsigned char **)(p))
  352 +#define d2i_OCSP_REQUEST_bio(bp,p) ASN1_d2i_bio_of(OCSP_REQUEST,OCSP_REQUEST_new,d2i_OCSP_REQUEST,bp,p)
355 353  
356   -#define d2i_OCSP_RESPONSE_bio(bp,p) (OCSP_RESPONSE*)ASN1_d2i_bio((char*(*)())\
357   - OCSP_REQUEST_new,(char *(*)())d2i_OCSP_RESPONSE, (bp),\
358   - (unsigned char **)(p))
  354 +#define d2i_OCSP_RESPONSE_bio(bp,p) ASN1_d2i_bio_of(OCSP_RESPONSE,OCSP_RESPONSE_new,d2i_OCSP_RESPONSE,bp,p)
359 355  
360 356 #define PEM_read_bio_OCSP_REQUEST(bp,x,cb) (OCSP_REQUEST *)PEM_ASN1_read_bio( \
361 357 (char *(*)())d2i_OCSP_REQUEST,PEM_STRING_OCSP_REQUEST,bp,(char **)x,cb,NULL)
... ... @@ -371,11 +367,9 @@ typedef struct ocsp_service_locator_st
371 367 PEM_ASN1_write_bio((int (*)())i2d_OCSP_RESPONSE,PEM_STRING_OCSP_RESPONSE,\
372 368 bp,(char *)o, NULL,NULL,0,NULL,NULL)
373 369  
374   -#define i2d_OCSP_RESPONSE_bio(bp,o) ASN1_i2d_bio(i2d_OCSP_RESPONSE,bp,\
375   - (unsigned char *)o)
  370 +#define i2d_OCSP_RESPONSE_bio(bp,o) ASN1_i2d_bio_of(OCSP_RESPONSE,i2d_OCSP_RESPONSE,bp,o)
376 371  
377   -#define i2d_OCSP_REQUEST_bio(bp,o) ASN1_i2d_bio(i2d_OCSP_REQUEST,bp,\
378   - (unsigned char *)o)
  372 +#define i2d_OCSP_REQUEST_bio(bp,o) ASN1_i2d_bio_of(OCSP_REQUEST,i2d_OCSP_REQUEST,bp,o)
379 373  
380 374 #define OCSP_REQUEST_sign(o,pkey,md) \
381 375 ASN1_item_sign(ASN1_ITEM_rptr(OCSP_REQINFO),\
... ... @@ -396,8 +390,7 @@ typedef struct ocsp_service_locator_st
396 390 #define ASN1_BIT_STRING_digest(data,type,md,len) \
397 391 ASN1_item_digest(ASN1_ITEM_rptr(ASN1_BIT_STRING),type,data,md,len)
398 392  
399   -#define OCSP_CERTID_dup(cid) (OCSP_CERTID*)ASN1_dup((int(*)())i2d_OCSP_CERTID,\
400   - (char *(*)())d2i_OCSP_CERTID,(char *)(cid))
  393 +#define OCSP_CERTID_dup(cid) ASN1_dup_of(OCSP_CERTID,i2d_OCSP_CERTID,d2i_OCSP_CERTID,cid)
401 394  
402 395 #define OCSP_CERTSTATUS_dup(cs)\
403 396 (OCSP_CERTSTATUS*)ASN1_dup((int(*)())i2d_OCSP_CERTSTATUS,\
... ... @@ -473,8 +466,10 @@ int OCSP_basic_sign(OCSP_BASICRESP *brsp,
473 466 X509 *signer, EVP_PKEY *key, const EVP_MD *dgst,
474 467 STACK_OF(X509) *certs, unsigned long flags);
475 468  
476   -ASN1_STRING *ASN1_STRING_encode(ASN1_STRING *s, int (*i2d)(),
477   - char *data, STACK_OF(ASN1_OBJECT) *sk);
  469 +ASN1_STRING *ASN1_STRING_encode(ASN1_STRING *s, i2d_of_void *i2d,
  470 + void *data, STACK_OF(ASN1_OBJECT) *sk);
  471 +#define ASN1_STRING_encode_of(type,s,i2d,data,sk) \
  472 +((ASN1_STRING *(*)(ASN1_STRING *,I2D_OF(type),type *,STACK_OF(ASN1_OBJECT) *))openssl_fcast(ASN1_STRING_encode))(s,i2d,data,sk)
478 473  
479 474 X509_EXTENSION *OCSP_crlID_new(char *url, long *n, char *tim);
480 475  
... ... @@ -564,11 +559,11 @@ void ERR_load_OCSP_strings(void);
564 559  
565 560 /* Function codes. */
566 561 #define OCSP_F_ASN1_STRING_ENCODE 100
567   -#define OCSP_F_CERT_ID_NEW 101
568 562 #define OCSP_F_D2I_OCSP_NONCE 102
569 563 #define OCSP_F_OCSP_BASIC_ADD1_STATUS 103
570 564 #define OCSP_F_OCSP_BASIC_SIGN 104
571 565 #define OCSP_F_OCSP_BASIC_VERIFY 105
  566 +#define OCSP_F_OCSP_CERT_ID_NEW 101
572 567 #define OCSP_F_OCSP_CHECK_DELEGATED 106
573 568 #define OCSP_F_OCSP_CHECK_IDS 107
574 569 #define OCSP_F_OCSP_CHECK_ISSUER 108
... ...
third_dev/openssl/include/openssl/opensslconf.h
... ... @@ -2,18 +2,24 @@
2 2 /* WARNING: Generated automatically from opensslconf.h.in by Configure. */
3 3  
4 4 /* OpenSSL was configured with the following options: */
5   -#ifndef OPENSSL_SYSNAME_WIN32
6   -# define OPENSSL_SYSNAME_WIN32
7   -#endif
8 5 #ifndef OPENSSL_DOING_MAKEDEPEND
9 6  
  7 +#ifndef OPENSSL_NO_GMP
  8 +# define OPENSSL_NO_GMP
  9 +#endif
10 10 #ifndef OPENSSL_NO_KRB5
11 11 # define OPENSSL_NO_KRB5
12 12 #endif
  13 +#ifndef OPENSSL_NO_MDC2
  14 +# define OPENSSL_NO_MDC2
  15 +#endif
  16 +#ifndef OPENSSL_NO_RC5
  17 +# define OPENSSL_NO_RC5
  18 +#endif
13 19  
14 20 #endif /* OPENSSL_DOING_MAKEDEPEND */
15   -#ifndef OPENSSL_THREADS
16   -# define OPENSSL_THREADS
  21 +#ifndef OPENSSL_NO_DYNAMIC_ENGINE
  22 +# define OPENSSL_NO_DYNAMIC_ENGINE
17 23 #endif
18 24  
19 25 /* The OPENSSL_NO_* macros are also defined as NO_* if the application
... ... @@ -21,9 +27,18 @@
21 27 who haven't had the time to do the appropriate changes in their
22 28 applications. */
23 29 #ifdef OPENSSL_ALGORITHM_DEFINES
  30 +# if defined(OPENSSL_NO_GMP) && !defined(NO_GMP)
  31 +# define NO_GMP
  32 +# endif
24 33 # if defined(OPENSSL_NO_KRB5) && !defined(NO_KRB5)
25 34 # define NO_KRB5
26 35 # endif
  36 +# if defined(OPENSSL_NO_MDC2) && !defined(NO_MDC2)
  37 +# define NO_MDC2
  38 +# endif
  39 +# if defined(OPENSSL_NO_RC5) && !defined(NO_RC5)
  40 +# define NO_RC5
  41 +# endif
27 42 #endif
28 43  
29 44 /* crypto/opensslconf.h.in */
... ... @@ -33,6 +48,7 @@
33 48  
34 49 #if !(defined(VMS) || defined(__VMS)) /* VMS uses logical names instead */
35 50 #if defined(HEADER_CRYPTLIB_H) && !defined(OPENSSLDIR)
  51 +#define ENGINESDIR "/usr/local/ssl/lib/engines"
36 52 #define OPENSSLDIR "/usr/local/ssl"
37 53 #endif
38 54 #endif
... ... @@ -41,7 +57,6 @@
41 57 #define OPENSSL_UNISTD <unistd.h>
42 58  
43 59 #undef OPENSSL_EXPORT_VAR_AS_FUNCTION
44   -#define OPENSSL_EXPORT_VAR_AS_FUNCTION
45 60  
46 61 #if defined(HEADER_IDEA_H) && !defined(IDEA_INT)
47 62 #define IDEA_INT unsigned int
... ... @@ -86,7 +101,7 @@
86 101  
87 102 #if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H)
88 103 #define CONFIG_HEADER_BN_H
89   -#define BN_LLONG
  104 +#undef BN_LLONG
90 105  
91 106 /* Should we define BN_DIV2W here? */
92 107  
... ... @@ -105,7 +120,7 @@
105 120 #define CONFIG_HEADER_RC4_LOCL_H
106 121 /* if this is defined data[i] is used instead of *data, this is a %20
107 122 * speedup on x86 */
108   -#define RC4_INDEX
  123 +#undef RC4_INDEX
109 124 #endif
110 125  
111 126 #if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H)
... ...
third_dev/openssl/include/openssl/opensslv.h
... ... @@ -12,7 +12,7 @@
12 12 * 0.9.3-beta2 0x00903002 (same as ...beta2-dev)
13 13 * 0.9.3 0x0090300f
14 14 * 0.9.3a 0x0090301f
15   - * 0.9.4 0x0090400f
  15 + * 0.9.4 0x0090400f
16 16 * 1.2.3z 0x102031af
17 17 *
18 18 * For continuity reasons (because 0.9.5 is already out, and is coded
... ... @@ -25,8 +25,12 @@
25 25 * (Prior to 0.9.5a beta1, a different scheme was used: MMNNFFRBB for
26 26 * major minor fix final patch/beta)
27 27 */
28   -#define OPENSSL_VERSION_NUMBER 0x0090704fL
29   -#define OPENSSL_VERSION_TEXT "OpenSSL 0.9.7d 17 Mar 2004"
  28 +#define OPENSSL_VERSION_NUMBER 0x0090802fL
  29 +#ifdef OPENSSL_FIPS
  30 +#define OPENSSL_VERSION_TEXT "OpenSSL 0.9.8b-fips 04 May 2006"
  31 +#else
  32 +#define OPENSSL_VERSION_TEXT "OpenSSL 0.9.8b 04 May 2006"
  33 +#endif
30 34 #define OPENSSL_VERSION_PTEXT " part of " OPENSSL_VERSION_TEXT
31 35  
32 36  
... ... @@ -79,7 +83,7 @@
79 83 * should only keep the versions that are binary compatible with the current.
80 84 */
81 85 #define SHLIB_VERSION_HISTORY ""
82   -#define SHLIB_VERSION_NUMBER "0.9.7"
  86 +#define SHLIB_VERSION_NUMBER "0.9.8"
83 87  
84 88  
85 89 #endif /* HEADER_OPENSSLV_H */
... ...
third_dev/openssl/include/openssl/ossl_typ.h
... ... @@ -97,15 +97,42 @@ typedef int ASN1_NULL;
97 97  
98 98 #ifdef OPENSSL_SYS_WIN32
99 99 #undef X509_NAME
  100 +#undef X509_CERT_PAIR
100 101 #undef PKCS7_ISSUER_AND_SERIAL
101 102 #endif
102 103  
  104 +#ifdef BIGNUM
  105 +#undef BIGNUM
  106 +#endif
  107 +typedef struct bignum_st BIGNUM;
  108 +typedef struct bignum_ctx BN_CTX;
  109 +typedef struct bn_blinding_st BN_BLINDING;
  110 +typedef struct bn_mont_ctx_st BN_MONT_CTX;
  111 +typedef struct bn_recp_ctx_st BN_RECP_CTX;
  112 +typedef struct bn_gencb_st BN_GENCB;
  113 +
  114 +typedef struct buf_mem_st BUF_MEM;
  115 +
103 116 typedef struct evp_cipher_st EVP_CIPHER;
104 117 typedef struct evp_cipher_ctx_st EVP_CIPHER_CTX;
105 118 typedef struct env_md_st EVP_MD;
106 119 typedef struct env_md_ctx_st EVP_MD_CTX;
107 120 typedef struct evp_pkey_st EVP_PKEY;
108 121  
  122 +typedef struct dh_st DH;
  123 +typedef struct dh_method DH_METHOD;
  124 +
  125 +typedef struct dsa_st DSA;
  126 +typedef struct dsa_method DSA_METHOD;
  127 +
  128 +typedef struct rsa_st RSA;
  129 +typedef struct rsa_meth_st RSA_METHOD;
  130 +
  131 +typedef struct rand_meth_st RAND_METHOD;
  132 +
  133 +typedef struct ecdh_method ECDH_METHOD;
  134 +typedef struct ecdsa_method ECDSA_METHOD;
  135 +
109 136 typedef struct x509_st X509;
110 137 typedef struct X509_algor_st X509_ALGOR;
111 138 typedef struct X509_crl_st X509_CRL;
... ... @@ -113,10 +140,35 @@ typedef struct X509_name_st X509_NAME;
113 140 typedef struct x509_store_st X509_STORE;
114 141 typedef struct x509_store_ctx_st X509_STORE_CTX;
115 142  
  143 +typedef struct v3_ext_ctx X509V3_CTX;
  144 +typedef struct conf_st CONF;
  145 +
  146 +typedef struct store_st STORE;
  147 +typedef struct store_method_st STORE_METHOD;
  148 +
  149 +typedef struct ui_st UI;
  150 +typedef struct ui_method_st UI_METHOD;
  151 +
  152 +typedef struct st_ERR_FNS ERR_FNS;
  153 +
116 154 typedef struct engine_st ENGINE;
117 155  
  156 +typedef struct X509_POLICY_NODE_st X509_POLICY_NODE;
  157 +typedef struct X509_POLICY_LEVEL_st X509_POLICY_LEVEL;
  158 +typedef struct X509_POLICY_TREE_st X509_POLICY_TREE;
  159 +typedef struct X509_POLICY_CACHE_st X509_POLICY_CACHE;
  160 +
118 161 /* If placed in pkcs12.h, we end up with a circular depency with pkcs7.h */
119 162 #define DECLARE_PKCS12_STACK_OF(type) /* Nothing */
120 163 #define IMPLEMENT_PKCS12_STACK_OF(type) /* Nothing */
121 164  
  165 +typedef struct crypto_ex_data_st CRYPTO_EX_DATA;
  166 +/* Callback types for crypto.h */
  167 +typedef int CRYPTO_EX_new(void *parent, void *ptr, CRYPTO_EX_DATA *ad,
  168 + int idx, long argl, void *argp);
  169 +typedef void CRYPTO_EX_free(void *parent, void *ptr, CRYPTO_EX_DATA *ad,
  170 + int idx, long argl, void *argp);
  171 +typedef int CRYPTO_EX_dup(CRYPTO_EX_DATA *to, CRYPTO_EX_DATA *from, void *from_d,
  172 + int idx, long argl, void *argp);
  173 +
122 174 #endif /* def HEADER_OPENSSL_TYPES_H */
... ...
third_dev/openssl/include/openssl/pem.h
... ... @@ -59,6 +59,7 @@
59 59 #ifndef HEADER_PEM_H
60 60 #define HEADER_PEM_H
61 61  
  62 +#include <openssl/e_os2.h>
62 63 #ifndef OPENSSL_NO_BIO
63 64 #include <openssl/bio.h>
64 65 #endif
... ... @@ -68,7 +69,6 @@
68 69 #include <openssl/evp.h>
69 70 #include <openssl/x509.h>
70 71 #include <openssl/pem2.h>
71   -#include <openssl/e_os2.h>
72 72  
73 73 #ifdef __cplusplus
74 74 extern "C" {
... ... @@ -91,6 +91,9 @@ extern &quot;C&quot; {
91 91 #define PEM_OBJ_DHPARAMS 17
92 92 #define PEM_OBJ_DSAPARAMS 18
93 93 #define PEM_OBJ_PRIV_RSA_PUBLIC 19
  94 +#define PEM_OBJ_PRIV_ECDSA 20
  95 +#define PEM_OBJ_PUB_ECDSA 21
  96 +#define PEM_OBJ_ECPARAMETERS 22
94 97  
95 98 #define PEM_ERROR 30
96 99 #define PEM_DEK_DES_CBC 40
... ... @@ -110,6 +113,7 @@ extern &quot;C&quot; {
110 113  
111 114 #define PEM_STRING_X509_OLD "X509 CERTIFICATE"
112 115 #define PEM_STRING_X509 "CERTIFICATE"
  116 +#define PEM_STRING_X509_PAIR "CERTIFICATE PAIR"
113 117 #define PEM_STRING_X509_TRUSTED "TRUSTED CERTIFICATE"
114 118 #define PEM_STRING_X509_REQ_OLD "NEW CERTIFICATE REQUEST"
115 119 #define PEM_STRING_X509_REQ "CERTIFICATE REQUEST"
... ... @@ -126,6 +130,9 @@ extern &quot;C&quot; {
126 130 #define PEM_STRING_DHPARAMS "DH PARAMETERS"
127 131 #define PEM_STRING_SSL_SESSION "SSL SESSION PARAMETERS"
128 132 #define PEM_STRING_DSAPARAMS "DSA PARAMETERS"
  133 +#define PEM_STRING_ECDSA_PUBLIC "ECDSA PUBLIC KEY"
  134 +#define PEM_STRING_ECPARAMETERS "EC PARAMETERS"
  135 +#define PEM_STRING_ECPRIVATEKEY "EC PRIVATE KEY"
129 136  
130 137 /* Note that this structure is initialised by PEM_SealInit and cleaned up
131 138 by PEM_SealFinal (at least for now) */
... ... @@ -213,24 +220,35 @@ typedef struct pem_ctx_st
213 220 #define IMPLEMENT_PEM_read_fp(name, type, str, asn1) \
214 221 type *PEM_read_##name(FILE *fp, type **x, pem_password_cb *cb, void *u)\
215 222 { \
216   -return((type *)PEM_ASN1_read((char *(*)())d2i_##asn1, str,fp,(char **)x,\
217   - cb,u)); \
  223 +return(((type *(*)(D2I_OF(type),char *,FILE *,type **,pem_password_cb *,void *))openssl_fcast(PEM_ASN1_read))(d2i_##asn1, str,fp,x,cb,u)); \
218 224 } \
219 225  
220 226 #define IMPLEMENT_PEM_write_fp(name, type, str, asn1) \
221 227 int PEM_write_##name(FILE *fp, type *x) \
222 228 { \
223   -return(PEM_ASN1_write((int (*)())i2d_##asn1,str,fp, (char *)x, \
224   - NULL,NULL,0,NULL,NULL)); \
225   -}
  229 +return(((int (*)(I2D_OF(type),const char *,FILE *,type *, const EVP_CIPHER *,unsigned char *,int, pem_password_cb *,void *))openssl_fcast(PEM_ASN1_write))(i2d_##asn1,str,fp,x,NULL,NULL,0,NULL,NULL)); \
  230 +}
  231 +
  232 +#define IMPLEMENT_PEM_write_fp_const(name, type, str, asn1) \
  233 +int PEM_write_##name(FILE *fp, const type *x) \
  234 +{ \
  235 +return(((int (*)(I2D_OF_const(type),const char *,FILE *, const type *, const EVP_CIPHER *,unsigned char *,int, pem_password_cb *,void *))openssl_fcast(PEM_ASN1_write))(i2d_##asn1,str,fp,x,NULL,NULL,0,NULL,NULL)); \
  236 +}
226 237  
227 238 #define IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1) \
228 239 int PEM_write_##name(FILE *fp, type *x, const EVP_CIPHER *enc, \
229 240 unsigned char *kstr, int klen, pem_password_cb *cb, \
230 241 void *u) \
231 242 { \
232   - return(PEM_ASN1_write((int (*)())i2d_##asn1,str,fp, \
233   - (char *)x,enc,kstr,klen,cb,u)); \
  243 + return(((int (*)(I2D_OF(type),const char *,FILE *,type *, const EVP_CIPHER *,unsigned char *,int, pem_password_cb *,void *))openssl_fcast(PEM_ASN1_write))(i2d_##asn1,str,fp,x,enc,kstr,klen,cb,u)); \
  244 + }
  245 +
  246 +#define IMPLEMENT_PEM_write_cb_fp_const(name, type, str, asn1) \
  247 +int PEM_write_##name(FILE *fp, type *x, const EVP_CIPHER *enc, \
  248 + unsigned char *kstr, int klen, pem_password_cb *cb, \
  249 + void *u) \
  250 + { \
  251 + return(((int (*)(I2D_OF_const(type),const char *,FILE *,type *, const EVP_CIPHER *,unsigned char *,int, pem_password_cb *,void *))openssl_fcast(PEM_ASN1_write))(i2d_##asn1,str,fp,x,enc,kstr,klen,cb,u)); \
234 252 }
235 253  
236 254 #endif
... ... @@ -238,33 +256,51 @@ int PEM_write_##name(FILE *fp, type *x, const EVP_CIPHER *enc, \
238 256 #define IMPLEMENT_PEM_read_bio(name, type, str, asn1) \
239 257 type *PEM_read_bio_##name(BIO *bp, type **x, pem_password_cb *cb, void *u)\
240 258 { \
241   -return((type *)PEM_ASN1_read_bio((char *(*)())d2i_##asn1, str,bp,\
242   - (char **)x,cb,u)); \
  259 +return(((type *(*)(D2I_OF(type),const char *,BIO *,type **,pem_password_cb *,void *))openssl_fcast(PEM_ASN1_read_bio))(d2i_##asn1, str,bp,x,cb,u)); \
243 260 }
244 261  
245 262 #define IMPLEMENT_PEM_write_bio(name, type, str, asn1) \
246 263 int PEM_write_bio_##name(BIO *bp, type *x) \
247 264 { \
248   -return(PEM_ASN1_write_bio((int (*)())i2d_##asn1,str,bp, (char *)x, \
249   - NULL,NULL,0,NULL,NULL)); \
  265 +return(((int (*)(I2D_OF(type),const char *,BIO *,type *, const EVP_CIPHER *,unsigned char *,int, pem_password_cb *,void *))openssl_fcast(PEM_ASN1_write_bio))(i2d_##asn1,str,bp,x,NULL,NULL,0,NULL,NULL)); \
  266 +}
  267 +
  268 +#define IMPLEMENT_PEM_write_bio_const(name, type, str, asn1) \
  269 +int PEM_write_bio_##name(BIO *bp, const type *x) \
  270 +{ \
  271 +return(((int (*)(I2D_OF_const(type),const char *,BIO *,const type *, const EVP_CIPHER *,unsigned char *,int, pem_password_cb *,void *))openssl_fcast(PEM_ASN1_write_bio))(i2d_##asn1,str,bp,x,NULL,NULL,0,NULL,NULL)); \
250 272 }
251 273  
252 274 #define IMPLEMENT_PEM_write_cb_bio(name, type, str, asn1) \
253 275 int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \
254 276 unsigned char *kstr, int klen, pem_password_cb *cb, void *u) \
255 277 { \
256   - return(PEM_ASN1_write_bio((int (*)())i2d_##asn1,str,bp, \
257   - (char *)x,enc,kstr,klen,cb,u)); \
  278 + return(((int (*)(I2D_OF(type),const char *,BIO *,type *,const EVP_CIPHER *,unsigned char *,int,pem_password_cb *,void *))openssl_fcast(PEM_ASN1_write_bio))(i2d_##asn1,str,bp,x,enc,kstr,klen,cb,u)); \
  279 + }
  280 +
  281 +#define IMPLEMENT_PEM_write_cb_bio_const(name, type, str, asn1) \
  282 +int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \
  283 + unsigned char *kstr, int klen, pem_password_cb *cb, void *u) \
  284 + { \
  285 + return(((int (*)(I2D_OF_const(type),const char *,BIO *,type *,const EVP_CIPHER *,unsigned char *,int,pem_password_cb *,void *))openssl_fcast(PEM_ASN1_write_bio))(i2d_##asn1,str,bp,x,enc,kstr,klen,cb,u)); \
258 286 }
259 287  
260 288 #define IMPLEMENT_PEM_write(name, type, str, asn1) \
261 289 IMPLEMENT_PEM_write_bio(name, type, str, asn1) \
262 290 IMPLEMENT_PEM_write_fp(name, type, str, asn1)
263 291  
  292 +#define IMPLEMENT_PEM_write_const(name, type, str, asn1) \
  293 + IMPLEMENT_PEM_write_bio_const(name, type, str, asn1) \
  294 + IMPLEMENT_PEM_write_fp_const(name, type, str, asn1)
  295 +
264 296 #define IMPLEMENT_PEM_write_cb(name, type, str, asn1) \
265 297 IMPLEMENT_PEM_write_cb_bio(name, type, str, asn1) \
266 298 IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1)
267 299  
  300 +#define IMPLEMENT_PEM_write_cb_const(name, type, str, asn1) \
  301 + IMPLEMENT_PEM_write_cb_bio_const(name, type, str, asn1) \
  302 + IMPLEMENT_PEM_write_cb_fp_const(name, type, str, asn1)
  303 +
268 304 #define IMPLEMENT_PEM_read(name, type, str, asn1) \
269 305 IMPLEMENT_PEM_read_bio(name, type, str, asn1) \
270 306 IMPLEMENT_PEM_read_fp(name, type, str, asn1)
... ... @@ -273,6 +309,10 @@ int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \
273 309 IMPLEMENT_PEM_read(name, type, str, asn1) \
274 310 IMPLEMENT_PEM_write(name, type, str, asn1)
275 311  
  312 +#define IMPLEMENT_PEM_rw_const(name, type, str, asn1) \
  313 + IMPLEMENT_PEM_read(name, type, str, asn1) \
  314 + IMPLEMENT_PEM_write_const(name, type, str, asn1)
  315 +
276 316 #define IMPLEMENT_PEM_rw_cb(name, type, str, asn1) \
277 317 IMPLEMENT_PEM_read(name, type, str, asn1) \
278 318 IMPLEMENT_PEM_write_cb(name, type, str, asn1)
... ... @@ -293,6 +333,9 @@ int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \
293 333 #define DECLARE_PEM_write_fp(name, type) \
294 334 int PEM_write_##name(FILE *fp, type *x);
295 335  
  336 +#define DECLARE_PEM_write_fp_const(name, type) \
  337 + int PEM_write_##name(FILE *fp, const type *x);
  338 +
296 339 #define DECLARE_PEM_write_cb_fp(name, type) \
297 340 int PEM_write_##name(FILE *fp, type *x, const EVP_CIPHER *enc, \
298 341 unsigned char *kstr, int klen, pem_password_cb *cb, void *u);
... ... @@ -306,6 +349,9 @@ int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \
306 349 #define DECLARE_PEM_write_bio(name, type) \
307 350 int PEM_write_bio_##name(BIO *bp, type *x);
308 351  
  352 +#define DECLARE_PEM_write_bio_const(name, type) \
  353 + int PEM_write_bio_##name(BIO *bp, const type *x);
  354 +
309 355 #define DECLARE_PEM_write_cb_bio(name, type) \
310 356 int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \
311 357 unsigned char *kstr, int klen, pem_password_cb *cb, void *u);
... ... @@ -322,6 +368,10 @@ int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \
322 368 DECLARE_PEM_write_bio(name, type) \
323 369 DECLARE_PEM_write_fp(name, type)
324 370  
  371 +#define DECLARE_PEM_write_const(name, type) \
  372 + DECLARE_PEM_write_bio_const(name, type) \
  373 + DECLARE_PEM_write_fp_const(name, type)
  374 +
325 375 #define DECLARE_PEM_write_cb(name, type) \
326 376 DECLARE_PEM_write_cb_bio(name, type) \
327 377 DECLARE_PEM_write_cb_fp(name, type)
... ... @@ -334,6 +384,10 @@ int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \
334 384 DECLARE_PEM_read(name, type) \
335 385 DECLARE_PEM_write(name, type)
336 386  
  387 +#define DECLARE_PEM_rw_const(name, type) \
  388 + DECLARE_PEM_read(name, type) \
  389 + DECLARE_PEM_write_const(name, type)
  390 +
337 391 #define DECLARE_PEM_rw_cb(name, type) \
338 392 DECLARE_PEM_read(name, type) \
339 393 DECLARE_PEM_write_cb(name, type)
... ... @@ -403,9 +457,6 @@ int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \
403 457 (char *(*)())d2i_NETSCAPE_CERT_SEQUENCE,PEM_STRING_X509,fp,\
404 458 (char **)x,cb,u)
405 459  
406   -#define PEM_write_bio_SSL_SESSION(bp,x) \
407   - PEM_ASN1_write_bio((int (*)())i2d_SSL_SESSION, \
408   - PEM_STRING_SSL_SESSION,bp, (char *)x, NULL,NULL,0,NULL,NULL)
409 460 #define PEM_write_bio_X509(bp,x) \
410 461 PEM_ASN1_write_bio((int (*)())i2d_X509,PEM_STRING_X509,bp, \
411 462 (char *)x, NULL,NULL,0,NULL,NULL)
... ... @@ -444,8 +495,6 @@ int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \
444 495 PEM_STRING_X509,bp, \
445 496 (char *)x, NULL,NULL,0,NULL,NULL)
446 497  
447   -#define PEM_read_bio_SSL_SESSION(bp,x,cb,u) (SSL_SESSION *)PEM_ASN1_read_bio( \
448   - (char *(*)())d2i_SSL_SESSION,PEM_STRING_SSL_SESSION,bp,(char **)x,cb,u)
449 498 #define PEM_read_bio_X509(bp,x,cb,u) (X509 *)PEM_ASN1_read_bio( \
450 499 (char *(*)())d2i_X509,PEM_STRING_X509,bp,(char **)x,cb,u)
451 500 #define PEM_read_bio_X509_REQ(bp,x,cb,u) (X509_REQ *)PEM_ASN1_read_bio( \
... ... @@ -494,11 +543,16 @@ int PEM_write_bio(BIO *bp,const char *name,char *hdr,unsigned char *data,
494 543 long len);
495 544 int PEM_bytes_read_bio(unsigned char **pdata, long *plen, char **pnm, const char *name, BIO *bp,
496 545 pem_password_cb *cb, void *u);
497   -char * PEM_ASN1_read_bio(char *(*d2i)(),const char *name,BIO *bp,char **x,
498   - pem_password_cb *cb, void *u);
499   -int PEM_ASN1_write_bio(int (*i2d)(),const char *name,BIO *bp,char *x,
  546 +void * PEM_ASN1_read_bio(d2i_of_void *d2i, const char *name, BIO *bp,
  547 + void **x, pem_password_cb *cb, void *u);
  548 +#define PEM_ASN1_read_bio_of(type,d2i,name,bp,x,cb,u) \
  549 +((type *(*)(D2I_OF(type),const char *,BIO *,type **,pem_password_cb *,void *))openssl_fcast(PEM_ASN1_read_bio))(d2i,name,bp,x,cb,u)
  550 +int PEM_ASN1_write_bio(i2d_of_void *i2d,const char *name,BIO *bp,char *x,
500 551 const EVP_CIPHER *enc,unsigned char *kstr,int klen,
501 552 pem_password_cb *cb, void *u);
  553 +#define PEM_ASN1_write_bio_of(type,i2d,name,bp,x,enc,kstr,klen,cb,u) \
  554 + ((int (*)(I2D_OF(type),const char *,BIO *,type *, const EVP_CIPHER *,unsigned char *,int, pem_password_cb *,void *))openssl_fcast(PEM_ASN1_write_bio))(i2d,name,bp,x,enc,kstr,klen,cb,u)
  555 +
502 556 STACK_OF(X509_INFO) * PEM_X509_INFO_read_bio(BIO *bp, STACK_OF(X509_INFO) *sk, pem_password_cb *cb, void *u);
503 557 int PEM_X509_INFO_write_bio(BIO *bp,X509_INFO *xi, EVP_CIPHER *enc,
504 558 unsigned char *kstr, int klen, pem_password_cb *cd, void *u);
... ... @@ -508,11 +562,11 @@ int PEM_X509_INFO_write_bio(BIO *bp,X509_INFO *xi, EVP_CIPHER *enc,
508 562 int PEM_read(FILE *fp, char **name, char **header,
509 563 unsigned char **data,long *len);
510 564 int PEM_write(FILE *fp,char *name,char *hdr,unsigned char *data,long len);
511   -char * PEM_ASN1_read(char *(*d2i)(),const char *name,FILE *fp,char **x,
512   - pem_password_cb *cb, void *u);
513   -int PEM_ASN1_write(int (*i2d)(),const char *name,FILE *fp,char *x,
514   - const EVP_CIPHER *enc,unsigned char *kstr,int klen,
515   - pem_password_cb *callback, void *u);
  565 +void * PEM_ASN1_read(d2i_of_void *d2i, const char *name, FILE *fp, void **x,
  566 + pem_password_cb *cb, void *u);
  567 +int PEM_ASN1_write(i2d_of_void *i2d,const char *name,FILE *fp,
  568 + char *x,const EVP_CIPHER *enc,unsigned char *kstr,
  569 + int klen,pem_password_cb *callback, void *u);
516 570 STACK_OF(X509_INFO) * PEM_X509_INFO_read(FILE *fp, STACK_OF(X509_INFO) *sk,
517 571 pem_password_cb *cb, void *u);
518 572 #endif
... ... @@ -542,6 +596,8 @@ DECLARE_PEM_rw(X509, X509)
542 596  
543 597 DECLARE_PEM_rw(X509_AUX, X509)
544 598  
  599 +DECLARE_PEM_rw(X509_CERT_PAIR, X509_CERT_PAIR)
  600 +
545 601 DECLARE_PEM_rw(X509_REQ, X509_REQ)
546 602 DECLARE_PEM_write(X509_REQ_NEW, X509_REQ)
547 603  
... ... @@ -559,7 +615,7 @@ DECLARE_PEM_rw(PKCS8_PRIV_KEY_INFO, PKCS8_PRIV_KEY_INFO)
559 615  
560 616 DECLARE_PEM_rw_cb(RSAPrivateKey, RSA)
561 617  
562   -DECLARE_PEM_rw(RSAPublicKey, RSA)
  618 +DECLARE_PEM_rw_const(RSAPublicKey, RSA)
563 619 DECLARE_PEM_rw(RSA_PUBKEY, RSA)
564 620  
565 621 #endif
... ... @@ -570,13 +626,19 @@ DECLARE_PEM_rw_cb(DSAPrivateKey, DSA)
570 626  
571 627 DECLARE_PEM_rw(DSA_PUBKEY, DSA)
572 628  
573   -DECLARE_PEM_rw(DSAparams, DSA)
  629 +DECLARE_PEM_rw_const(DSAparams, DSA)
  630 +
  631 +#endif
574 632  
  633 +#ifndef OPENSSL_NO_EC
  634 +DECLARE_PEM_rw_const(ECPKParameters, EC_GROUP)
  635 +DECLARE_PEM_rw_cb(ECPrivateKey, EC_KEY)
  636 +DECLARE_PEM_rw(EC_PUBKEY, EC_KEY)
575 637 #endif
576 638  
577 639 #ifndef OPENSSL_NO_DH
578 640  
579   -DECLARE_PEM_rw(DHparams, DH)
  641 +DECLARE_PEM_rw_const(DHparams, DH)
580 642  
581 643 #endif
582 644  
... ... @@ -626,24 +688,27 @@ void ERR_load_PEM_strings(void);
626 688 /* Function codes. */
627 689 #define PEM_F_D2I_PKCS8PRIVATEKEY_BIO 120
628 690 #define PEM_F_D2I_PKCS8PRIVATEKEY_FP 121
629   -#define PEM_F_DEF_CALLBACK 100
  691 +#define PEM_F_DO_PK8PKEY 126
  692 +#define PEM_F_DO_PK8PKEY_FP 125
630 693 #define PEM_F_LOAD_IV 101
631 694 #define PEM_F_PEM_ASN1_READ 102
632 695 #define PEM_F_PEM_ASN1_READ_BIO 103
633 696 #define PEM_F_PEM_ASN1_WRITE 104
634 697 #define PEM_F_PEM_ASN1_WRITE_BIO 105
  698 +#define PEM_F_PEM_DEF_CALLBACK 100
635 699 #define PEM_F_PEM_DO_HEADER 106
636   -#define PEM_F_PEM_F_DO_PK8KEY_FP 122
637 700 #define PEM_F_PEM_F_PEM_WRITE_PKCS8PRIVATEKEY 118
638 701 #define PEM_F_PEM_GET_EVP_CIPHER_INFO 107
  702 +#define PEM_F_PEM_PK8PKEY 119
639 703 #define PEM_F_PEM_READ 108
640 704 #define PEM_F_PEM_READ_BIO 109
  705 +#define PEM_F_PEM_READ_BIO_PRIVATEKEY 123
  706 +#define PEM_F_PEM_READ_PRIVATEKEY 124
641 707 #define PEM_F_PEM_SEALFINAL 110
642 708 #define PEM_F_PEM_SEALINIT 111
643 709 #define PEM_F_PEM_SIGNFINAL 112
644 710 #define PEM_F_PEM_WRITE 113
645 711 #define PEM_F_PEM_WRITE_BIO 114
646   -#define PEM_F_PEM_WRITE_BIO_PKCS8PRIVATEKEY 119
647 712 #define PEM_F_PEM_X509_INFO_READ 115
648 713 #define PEM_F_PEM_X509_INFO_READ_BIO 116
649 714 #define PEM_F_PEM_X509_INFO_WRITE_BIO 117
... ...
third_dev/openssl/include/openssl/pkcs12.h
... ... @@ -249,6 +249,15 @@ int PKCS12_parse(PKCS12 *p12, const char *pass, EVP_PKEY **pkey, X509 **cert,
249 249 PKCS12 *PKCS12_create(char *pass, char *name, EVP_PKEY *pkey, X509 *cert,
250 250 STACK_OF(X509) *ca, int nid_key, int nid_cert, int iter,
251 251 int mac_iter, int keytype);
  252 +
  253 +PKCS12_SAFEBAG *PKCS12_add_cert(STACK_OF(PKCS12_SAFEBAG) **pbags, X509 *cert);
  254 +PKCS12_SAFEBAG *PKCS12_add_key(STACK_OF(PKCS12_SAFEBAG) **pbags, EVP_PKEY *key,
  255 + int key_usage, int iter,
  256 + int key_nid, char *pass);
  257 +int PKCS12_add_safe(STACK_OF(PKCS7) **psafes, STACK_OF(PKCS12_SAFEBAG) *bags,
  258 + int safe_nid, int iter, char *pass);
  259 +PKCS12 *PKCS12_add_safes(STACK_OF(PKCS7) *safes, int p7_nid);
  260 +
252 261 int i2d_PKCS12_bio(BIO *bp, PKCS12 *p12);
253 262 int i2d_PKCS12_fp(FILE *fp, PKCS12 *p12);
254 263 PKCS12 *d2i_PKCS12_bio(BIO *bp, PKCS12 **p12);
... ... @@ -264,16 +273,18 @@ void ERR_load_PKCS12_strings(void);
264 273 /* Error codes for the PKCS12 functions. */
265 274  
266 275 /* Function codes. */
  276 +#define PKCS12_F_PARSE_BAG 129
267 277 #define PKCS12_F_PARSE_BAGS 103
268 278 #define PKCS12_F_PKCS12_ADD_FRIENDLYNAME 100
269 279 #define PKCS12_F_PKCS12_ADD_FRIENDLYNAME_ASC 127
270 280 #define PKCS12_F_PKCS12_ADD_FRIENDLYNAME_UNI 102
271 281 #define PKCS12_F_PKCS12_ADD_LOCALKEYID 104
272 282 #define PKCS12_F_PKCS12_CREATE 105
273   -#define PKCS12_F_PKCS12_DECRYPT_D2I 106
274 283 #define PKCS12_F_PKCS12_GEN_MAC 107
275   -#define PKCS12_F_PKCS12_I2D_ENCRYPT 108
276 284 #define PKCS12_F_PKCS12_INIT 109
  285 +#define PKCS12_F_PKCS12_ITEM_DECRYPT_D2I 106
  286 +#define PKCS12_F_PKCS12_ITEM_I2D_ENCRYPT 108
  287 +#define PKCS12_F_PKCS12_ITEM_PACK_SAFEBAG 117
277 288 #define PKCS12_F_PKCS12_KEY_GEN_ASC 110
278 289 #define PKCS12_F_PKCS12_KEY_GEN_UNI 111
279 290 #define PKCS12_F_PKCS12_MAKE_KEYBAG 112
... ... @@ -281,18 +292,20 @@ void ERR_load_PKCS12_strings(void);
281 292 #define PKCS12_F_PKCS12_NEWPASS 128
282 293 #define PKCS12_F_PKCS12_PACK_P7DATA 114
283 294 #define PKCS12_F_PKCS12_PACK_P7ENCDATA 115
284   -#define PKCS12_F_PKCS12_PACK_SAFEBAG 117
285 295 #define PKCS12_F_PKCS12_PARSE 118
286 296 #define PKCS12_F_PKCS12_PBE_CRYPT 119
287 297 #define PKCS12_F_PKCS12_PBE_KEYIVGEN 120
288 298 #define PKCS12_F_PKCS12_SETUP_MAC 122
289 299 #define PKCS12_F_PKCS12_SET_MAC 123
  300 +#define PKCS12_F_PKCS12_UNPACK_AUTHSAFES 130
  301 +#define PKCS12_F_PKCS12_UNPACK_P7DATA 131
  302 +#define PKCS12_F_PKCS12_VERIFY_MAC 126
290 303 #define PKCS12_F_PKCS8_ADD_KEYUSAGE 124
291 304 #define PKCS12_F_PKCS8_ENCRYPT 125
292   -#define PKCS12_F_VERIFY_MAC 126
293 305  
294 306 /* Reason codes. */
295 307 #define PKCS12_R_CANT_PACK_STRUCTURE 100
  308 +#define PKCS12_R_CONTENT_TYPE_NOT_DATA 121
296 309 #define PKCS12_R_DECODE_ERROR 101
297 310 #define PKCS12_R_ENCODE_ERROR 102
298 311 #define PKCS12_R_ENCRYPT_ERROR 103
... ...
third_dev/openssl/include/openssl/pkcs7.h
... ... @@ -233,6 +233,8 @@ DECLARE_PKCS12_STACK_OF(PKCS7)
233 233 (OBJ_obj2nid((a)->type) == NID_pkcs7_signedAndEnveloped)
234 234 #define PKCS7_type_is_data(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_data)
235 235  
  236 +#define PKCS7_type_is_digest(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_digest)
  237 +
236 238 #define PKCS7_set_detached(p,v) \
237 239 PKCS7_ctrl(p,PKCS7_OP_SET_DETACHED_SIGNATURE,v,NULL)
238 240 #define PKCS7_get_detached(p) \
... ... @@ -262,6 +264,8 @@ DECLARE_PKCS12_STACK_OF(PKCS7)
262 264 #define PKCS7_NOSMIMECAP 0x200
263 265 #define PKCS7_NOOLDMIMETYPE 0x400
264 266 #define PKCS7_CRLFEOL 0x800
  267 +#define PKCS7_STREAM 0x1000
  268 +#define PKCS7_NOCRL 0x2000
265 269  
266 270 /* Flags: for compatibility with older code */
267 271  
... ... @@ -302,10 +306,12 @@ DECLARE_ASN1_FUNCTIONS(PKCS7)
302 306 DECLARE_ASN1_ITEM(PKCS7_ATTR_SIGN)
303 307 DECLARE_ASN1_ITEM(PKCS7_ATTR_VERIFY)
304 308  
  309 +DECLARE_ASN1_NDEF_FUNCTION(PKCS7)
305 310  
306 311 long PKCS7_ctrl(PKCS7 *p7, int cmd, long larg, char *parg);
307 312  
308 313 int PKCS7_set_type(PKCS7 *p7, int type);
  314 +int PKCS7_set0_type_other(PKCS7 *p7, int type, ASN1_TYPE *other);
309 315 int PKCS7_set_content(PKCS7 *p7, PKCS7 *p7_data);
310 316 int PKCS7_SIGNER_INFO_set(PKCS7_SIGNER_INFO *p7i, X509 *x509, EVP_PKEY *pkey,
311 317 const EVP_MD *dgst);
... ... @@ -326,6 +332,7 @@ BIO *PKCS7_dataDecode(PKCS7 *p7, EVP_PKEY *pkey, BIO *in_bio, X509 *pcert);
326 332 PKCS7_SIGNER_INFO *PKCS7_add_signature(PKCS7 *p7, X509 *x509,
327 333 EVP_PKEY *pkey, const EVP_MD *dgst);
328 334 X509 *PKCS7_cert_from_signer_info(PKCS7 *p7, PKCS7_SIGNER_INFO *si);
  335 +int PKCS7_set_digest(PKCS7 *p7, const EVP_MD *md);
329 336 STACK_OF(PKCS7_SIGNER_INFO) *PKCS7_get_signer_info(PKCS7 *p7);
330 337  
331 338 PKCS7_RECIP_INFO *PKCS7_add_recipient(PKCS7 *p7, X509 *x509);
... ... @@ -381,16 +388,20 @@ void ERR_load_PKCS7_strings(void);
381 388 #define PKCS7_F_PKCS7_ADD_CRL 101
382 389 #define PKCS7_F_PKCS7_ADD_RECIPIENT_INFO 102
383 390 #define PKCS7_F_PKCS7_ADD_SIGNER 103
  391 +#define PKCS7_F_PKCS7_BIO_ADD_DIGEST 125
384 392 #define PKCS7_F_PKCS7_CTRL 104
385 393 #define PKCS7_F_PKCS7_DATADECODE 112
  394 +#define PKCS7_F_PKCS7_DATAFINAL 128
386 395 #define PKCS7_F_PKCS7_DATAINIT 105
387 396 #define PKCS7_F_PKCS7_DATASIGN 106
388 397 #define PKCS7_F_PKCS7_DATAVERIFY 107
389 398 #define PKCS7_F_PKCS7_DECRYPT 114
390 399 #define PKCS7_F_PKCS7_ENCRYPT 115
  400 +#define PKCS7_F_PKCS7_FIND_DIGEST 127
391 401 #define PKCS7_F_PKCS7_GET0_SIGNERS 124
392 402 #define PKCS7_F_PKCS7_SET_CIPHER 108
393 403 #define PKCS7_F_PKCS7_SET_CONTENT 109
  404 +#define PKCS7_F_PKCS7_SET_DIGEST 126
394 405 #define PKCS7_F_PKCS7_SET_TYPE 110
395 406 #define PKCS7_F_PKCS7_SIGN 116
396 407 #define PKCS7_F_PKCS7_SIGNATUREVERIFY 113
... ... @@ -421,13 +432,15 @@ void ERR_load_PKCS7_strings(void);
421 432 #define PKCS7_R_NO_MULTIPART_BODY_FAILURE 136
422 433 #define PKCS7_R_NO_MULTIPART_BOUNDARY 137
423 434 #define PKCS7_R_NO_RECIPIENT_MATCHES_CERTIFICATE 115
  435 +#define PKCS7_R_NO_RECIPIENT_MATCHES_KEY 146
424 436 #define PKCS7_R_NO_SIGNATURES_ON_DATA 123
425 437 #define PKCS7_R_NO_SIGNERS 142
426 438 #define PKCS7_R_NO_SIG_CONTENT_TYPE 138
427 439 #define PKCS7_R_OPERATION_NOT_SUPPORTED_ON_THIS_TYPE 104
428 440 #define PKCS7_R_PKCS7_ADD_SIGNATURE_ERROR 124
  441 +#define PKCS7_R_PKCS7_DATAFINAL 126
429 442 #define PKCS7_R_PKCS7_DATAFINAL_ERROR 125
430   -#define PKCS7_R_PKCS7_DATASIGN 126
  443 +#define PKCS7_R_PKCS7_DATASIGN 145
431 444 #define PKCS7_R_PKCS7_PARSE_ERROR 139
432 445 #define PKCS7_R_PKCS7_SIG_PARSE_ERROR 140
433 446 #define PKCS7_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE 127
... ...
third_dev/openssl/include/openssl/pq_compat.h 0 → 100644
  1 +/* crypto/pqueue/pqueue_compat.h */
  2 +/*
  3 + * DTLS implementation written by Nagendra Modadugu
  4 + * (nagendra@cs.stanford.edu) for the OpenSSL project 2005.
  5 + */
  6 +/* ====================================================================
  7 + * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved.
  8 + *
  9 + * Redistribution and use in source and binary forms, with or without
  10 + * modification, are permitted provided that the following conditions
  11 + * are met:
  12 + *
  13 + * 1. Redistributions of source code must retain the above copyright
  14 + * notice, this list of conditions and the following disclaimer.
  15 + *
  16 + * 2. Redistributions in binary form must reproduce the above copyright
  17 + * notice, this list of conditions and the following disclaimer in
  18 + * the documentation and/or other materials provided with the
  19 + * distribution.
  20 + *
  21 + * 3. All advertising materials mentioning features or use of this
  22 + * software must display the following acknowledgment:
  23 + * "This product includes software developed by the OpenSSL Project
  24 + * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
  25 + *
  26 + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
  27 + * endorse or promote products derived from this software without
  28 + * prior written permission. For written permission, please contact
  29 + * openssl-core@OpenSSL.org.
  30 + *
  31 + * 5. Products derived from this software may not be called "OpenSSL"
  32 + * nor may "OpenSSL" appear in their names without prior written
  33 + * permission of the OpenSSL Project.
  34 + *
  35 + * 6. Redistributions of any form whatsoever must retain the following
  36 + * acknowledgment:
  37 + * "This product includes software developed by the OpenSSL Project
  38 + * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
  39 + *
  40 + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
  41 + * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  42 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  43 + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
  44 + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  45 + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  46 + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  47 + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  48 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  49 + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  50 + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
  51 + * OF THE POSSIBILITY OF SUCH DAMAGE.
  52 + * ====================================================================
  53 + *
  54 + * This product includes cryptographic software written by Eric Young
  55 + * (eay@cryptsoft.com). This product includes software written by Tim
  56 + * Hudson (tjh@cryptsoft.com).
  57 + *
  58 + */
  59 +
  60 +#include "opensslconf.h"
  61 +#include <openssl/bn.h>
  62 +
  63 +/*
  64 + * The purpose of this header file is for supporting 64-bit integer
  65 + * manipulation on 32-bit (and lower) machines. Currently the only
  66 + * such environment is VMS, Utrix and those with smaller default integer
  67 + * sizes than 32 bits. For all such environment, we fall back to using
  68 + * BIGNUM. We may need to fine tune the conditions for systems that
  69 + * are incorrectly configured.
  70 + *
  71 + * The only clients of this code are (1) pqueue for priority, and
  72 + * (2) DTLS, for sequence number manipulation.
  73 + */
  74 +
  75 +#if (defined(THIRTY_TWO_BIT) && !defined(BN_LLONG)) || defined(SIXTEEN_BIT) || defined(EIGHT_BIT)
  76 +
  77 +#define PQ_64BIT_IS_INTEGER 0
  78 +#define PQ_64BIT_IS_BIGNUM 1
  79 +
  80 +#define PQ_64BIT BIGNUM
  81 +#define PQ_64BIT_CTX BN_CTX
  82 +
  83 +#define pq_64bit_init(x) BN_init(x)
  84 +#define pq_64bit_free(x) BN_free(x)
  85 +
  86 +#define pq_64bit_ctx_new(ctx) BN_CTX_new()
  87 +#define pq_64bit_ctx_free(x) BN_CTX_free(x)
  88 +
  89 +#define pq_64bit_assign(x, y) BN_copy(x, y)
  90 +#define pq_64bit_assign_word(x, y) BN_set_word(x, y)
  91 +#define pq_64bit_gt(x, y) BN_ucmp(x, y) >= 1 ? 1 : 0
  92 +#define pq_64bit_eq(x, y) BN_ucmp(x, y) == 0 ? 1 : 0
  93 +#define pq_64bit_add_word(x, w) BN_add_word(x, w)
  94 +#define pq_64bit_sub(r, x, y) BN_sub(r, x, y)
  95 +#define pq_64bit_sub_word(x, w) BN_sub_word(x, w)
  96 +#define pq_64bit_mod(r, x, n, ctx) BN_mod(r, x, n, ctx)
  97 +
  98 +#define pq_64bit_bin2num(bn, bytes, len) BN_bin2bn(bytes, len, bn)
  99 +#define pq_64bit_num2bin(bn, bytes) BN_bn2bin(bn, bytes)
  100 +#define pq_64bit_get_word(x) BN_get_word(x)
  101 +#define pq_64bit_is_bit_set(x, offset) BN_is_bit_set(x, offset)
  102 +#define pq_64bit_lshift(r, x, shift) BN_lshift(r, x, shift)
  103 +#define pq_64bit_set_bit(x, num) BN_set_bit(x, num)
  104 +#define pq_64bit_get_length(x) BN_num_bits((x))
  105 +
  106 +#else
  107 +
  108 +#define PQ_64BIT_IS_INTEGER 1
  109 +#define PQ_64BIT_IS_BIGNUM 0
  110 +
  111 +#if defined(SIXTY_FOUR_BIT)
  112 +#define PQ_64BIT BN_ULONG
  113 +#define PQ_64BIT_PRINT "%lld"
  114 +#elif defined(SIXTY_FOUR_BIT_LONG)
  115 +#define PQ_64BIT BN_ULONG
  116 +#define PQ_64BIT_PRINT "%ld"
  117 +#elif defined(THIRTY_TWO_BIT)
  118 +#define PQ_64BIT BN_ULLONG
  119 +#define PQ_64BIT_PRINT "%lld"
  120 +#endif
  121 +
  122 +#define PQ_64BIT_CTX void
  123 +
  124 +#define pq_64bit_init(x)
  125 +#define pq_64bit_free(x)
  126 +#define pq_64bit_ctx_new(ctx) (ctx)
  127 +#define pq_64bit_ctx_free(x)
  128 +
  129 +#define pq_64bit_assign(x, y) (*(x) = *(y))
  130 +#define pq_64bit_assign_word(x, y) (*(x) = y)
  131 +#define pq_64bit_gt(x, y) (*(x) > *(y))
  132 +#define pq_64bit_eq(x, y) (*(x) == *(y))
  133 +#define pq_64bit_add_word(x, w) (*(x) = (*(x) + (w)))
  134 +#define pq_64bit_sub(r, x, y) (*(r) = (*(x) - *(y)))
  135 +#define pq_64bit_sub_word(x, w) (*(x) = (*(x) - (w)))
  136 +#define pq_64bit_mod(r, x, n, ctx)
  137 +
  138 +#define pq_64bit_bin2num(num, bytes, len) bytes_to_long_long(bytes, num)
  139 +#define pq_64bit_num2bin(num, bytes) long_long_to_bytes(num, bytes)
  140 +#define pq_64bit_get_word(x) *(x)
  141 +#define pq_64bit_lshift(r, x, shift) (*(r) = (*(x) << (shift)))
  142 +#define pq_64bit_set_bit(x, num) do { \
  143 + PQ_64BIT mask = 1; \
  144 + mask = mask << (num); \
  145 + *(x) |= mask; \
  146 + } while(0)
  147 +#endif /* OPENSSL_SYS_VMS */
... ...
third_dev/openssl/include/openssl/pqueue.h 0 → 100644
  1 +/* crypto/pqueue/pqueue.h */
  2 +/*
  3 + * DTLS implementation written by Nagendra Modadugu
  4 + * (nagendra@cs.stanford.edu) for the OpenSSL project 2005.
  5 + */
  6 +/* ====================================================================
  7 + * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved.
  8 + *
  9 + * Redistribution and use in source and binary forms, with or without
  10 + * modification, are permitted provided that the following conditions
  11 + * are met:
  12 + *
  13 + * 1. Redistributions of source code must retain the above copyright
  14 + * notice, this list of conditions and the following disclaimer.
  15 + *
  16 + * 2. Redistributions in binary form must reproduce the above copyright
  17 + * notice, this list of conditions and the following disclaimer in
  18 + * the documentation and/or other materials provided with the
  19 + * distribution.
  20 + *
  21 + * 3. All advertising materials mentioning features or use of this
  22 + * software must display the following acknowledgment:
  23 + * "This product includes software developed by the OpenSSL Project
  24 + * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
  25 + *
  26 + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
  27 + * endorse or promote products derived from this software without
  28 + * prior written permission. For written permission, please contact
  29 + * openssl-core@OpenSSL.org.
  30 + *
  31 + * 5. Products derived from this software may not be called "OpenSSL"
  32 + * nor may "OpenSSL" appear in their names without prior written
  33 + * permission of the OpenSSL Project.
  34 + *
  35 + * 6. Redistributions of any form whatsoever must retain the following
  36 + * acknowledgment:
  37 + * "This product includes software developed by the OpenSSL Project
  38 + * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
  39 + *
  40 + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
  41 + * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  42 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  43 + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
  44 + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  45 + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  46 + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  47 + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  48 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  49 + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  50 + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
  51 + * OF THE POSSIBILITY OF SUCH DAMAGE.
  52 + * ====================================================================
  53 + *
  54 + * This product includes cryptographic software written by Eric Young
  55 + * (eay@cryptsoft.com). This product includes software written by Tim
  56 + * Hudson (tjh@cryptsoft.com).
  57 + *
  58 + */
  59 +
  60 +#ifndef HEADER_PQUEUE_H
  61 +#define HEADER_PQUEUE_H
  62 +
  63 +#include <stdio.h>
  64 +#include <stdlib.h>
  65 +#include <string.h>
  66 +
  67 +#include <openssl/pq_compat.h>
  68 +
  69 +typedef struct _pqueue *pqueue;
  70 +
  71 +typedef struct _pitem
  72 + {
  73 + PQ_64BIT priority;
  74 + void *data;
  75 + struct _pitem *next;
  76 + } pitem;
  77 +
  78 +typedef struct _pitem *piterator;
  79 +
  80 +pitem *pitem_new(PQ_64BIT priority, void *data);
  81 +void pitem_free(pitem *item);
  82 +
  83 +pqueue pqueue_new(void);
  84 +void pqueue_free(pqueue pq);
  85 +
  86 +pitem *pqueue_insert(pqueue pq, pitem *item);
  87 +pitem *pqueue_peek(pqueue pq);
  88 +pitem *pqueue_pop(pqueue pq);
  89 +pitem *pqueue_find(pqueue pq, PQ_64BIT priority);
  90 +pitem *pqueue_iterator(pqueue pq);
  91 +pitem *pqueue_next(piterator *iter);
  92 +
  93 +void pqueue_print(pqueue pq);
  94 +
  95 +#endif /* ! HEADER_PQUEUE_H */
... ...
third_dev/openssl/include/openssl/rand.h
... ... @@ -71,7 +71,14 @@
71 71 extern "C" {
72 72 #endif
73 73  
74   -typedef struct rand_meth_st
  74 +#if defined(OPENSSL_FIPS)
  75 +#define FIPS_RAND_SIZE_T size_t
  76 +#endif
  77 +
  78 +/* Already defined in ossl_typ.h */
  79 +/* typedef struct rand_meth_st RAND_METHOD; */
  80 +
  81 +struct rand_meth_st
75 82 {
76 83 void (*seed)(const void *buf, int num);
77 84 int (*bytes)(unsigned char *buf, int num);
... ... @@ -79,7 +86,7 @@ typedef struct rand_meth_st
79 86 void (*add)(const void *buf, int num, double entropy);
80 87 int (*pseudorand)(unsigned char *buf, int num);
81 88 int (*status)(void);
82   - } RAND_METHOD;
  89 + };
83 90  
84 91 #ifdef BN_DEBUG
85 92 extern int rand_predictable;
... ...
third_dev/openssl/include/openssl/rc2.h
... ... @@ -59,6 +59,7 @@
59 59 #ifndef HEADER_RC2_H
60 60 #define HEADER_RC2_H
61 61  
  62 +#include <openssl/opensslconf.h> /* OPENSSL_NO_RC2, RC2_INT */
62 63 #ifdef OPENSSL_NO_RC2
63 64 #error RC2 is disabled.
64 65 #endif
... ... @@ -66,7 +67,6 @@
66 67 #define RC2_ENCRYPT 1
67 68 #define RC2_DECRYPT 0
68 69  
69   -#include <openssl/opensslconf.h> /* RC2_INT */
70 70 #define RC2_BLOCK 8
71 71 #define RC2_KEY_LENGTH 16
72 72  
... ...
third_dev/openssl/include/openssl/rc4.h
... ... @@ -59,12 +59,11 @@
59 59 #ifndef HEADER_RC4_H
60 60 #define HEADER_RC4_H
61 61  
  62 +#include <openssl/opensslconf.h> /* OPENSSL_NO_RC4, RC4_INT */
62 63 #ifdef OPENSSL_NO_RC4
63 64 #error RC4 is disabled.
64 65 #endif
65 66  
66   -#include <openssl/opensslconf.h> /* RC4_INT */
67   -
68 67 #ifdef __cplusplus
69 68 extern "C" {
70 69 #endif
... ...
third_dev/openssl/include/openssl/ripemd.h
... ... @@ -87,13 +87,13 @@ typedef struct RIPEMD160state_st
87 87 RIPEMD160_LONG A,B,C,D,E;
88 88 RIPEMD160_LONG Nl,Nh;
89 89 RIPEMD160_LONG data[RIPEMD160_LBLOCK];
90   - int num;
  90 + unsigned int num;
91 91 } RIPEMD160_CTX;
92 92  
93 93 int RIPEMD160_Init(RIPEMD160_CTX *c);
94   -int RIPEMD160_Update(RIPEMD160_CTX *c, const void *data, unsigned long len);
  94 +int RIPEMD160_Update(RIPEMD160_CTX *c, const void *data, size_t len);
95 95 int RIPEMD160_Final(unsigned char *md, RIPEMD160_CTX *c);
96   -unsigned char *RIPEMD160(const unsigned char *d, unsigned long n,
  96 +unsigned char *RIPEMD160(const unsigned char *d, size_t n,
97 97 unsigned char *md);
98 98 void RIPEMD160_Transform(RIPEMD160_CTX *c, const unsigned char *b);
99 99 #ifdef __cplusplus
... ...
third_dev/openssl/include/openssl/rsa.h
... ... @@ -64,9 +64,11 @@
64 64 #ifndef OPENSSL_NO_BIO
65 65 #include <openssl/bio.h>
66 66 #endif
67   -#include <openssl/bn.h>
68 67 #include <openssl/crypto.h>
69 68 #include <openssl/ossl_typ.h>
  69 +#ifndef OPENSSL_NO_DEPRECATED
  70 +#include <openssl/bn.h>
  71 +#endif
70 72  
71 73 #ifdef OPENSSL_NO_RSA
72 74 #error RSA is disabled.
... ... @@ -76,9 +78,11 @@
76 78 extern "C" {
77 79 #endif
78 80  
79   -typedef struct rsa_st RSA;
  81 +/* Declared already in ossl_typ.h */
  82 +/* typedef struct rsa_st RSA; */
  83 +/* typedef struct rsa_meth_st RSA_METHOD; */
80 84  
81   -typedef struct rsa_meth_st
  85 +struct rsa_meth_st
82 86 {
83 87 const char *name;
84 88 int (*rsa_pub_enc)(int flen,const unsigned char *from,
... ... @@ -93,7 +97,7 @@ typedef struct rsa_meth_st
93 97 int (*rsa_priv_dec)(int flen,const unsigned char *from,
94 98 unsigned char *to,
95 99 RSA *rsa,int padding);
96   - int (*rsa_mod_exp)(BIGNUM *r0,const BIGNUM *I,RSA *rsa); /* Can be null */
  100 + int (*rsa_mod_exp)(BIGNUM *r0,const BIGNUM *I,RSA *rsa,BN_CTX *ctx); /* Can be null */
97 101 int (*bn_mod_exp)(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
98 102 const BIGNUM *m, BN_CTX *ctx,
99 103 BN_MONT_CTX *m_ctx); /* Can be null */
... ... @@ -114,8 +118,12 @@ typedef struct rsa_meth_st
114 118 int (*rsa_verify)(int dtype,
115 119 const unsigned char *m, unsigned int m_length,
116 120 unsigned char *sigbuf, unsigned int siglen, const RSA *rsa);
117   -
118   - } RSA_METHOD;
  121 +/* If this callback is NULL, the builtin software RSA key-gen will be used. This
  122 + * is for behavioural compatibility whilst the code gets rewired, but one day
  123 + * it would be nice to assume there are no such things as "builtin software"
  124 + * implementations. */
  125 + int (*rsa_keygen)(RSA *rsa, int bits, BIGNUM *e, BN_GENCB *cb);
  126 + };
119 127  
120 128 struct rsa_st
121 129 {
... ... @@ -148,38 +156,47 @@ struct rsa_st
148 156 * NULL */
149 157 char *bignum_data;
150 158 BN_BLINDING *blinding;
  159 + BN_BLINDING *mt_blinding;
151 160 };
152 161  
153 162 #define RSA_3 0x3L
154 163 #define RSA_F4 0x10001L
155 164  
156   -#define RSA_METHOD_FLAG_NO_CHECK 0x01 /* don't check pub/private match */
  165 +#define RSA_METHOD_FLAG_NO_CHECK 0x0001 /* don't check pub/private match */
157 166  
158   -#define RSA_FLAG_CACHE_PUBLIC 0x02
159   -#define RSA_FLAG_CACHE_PRIVATE 0x04
160   -#define RSA_FLAG_BLINDING 0x08
161   -#define RSA_FLAG_THREAD_SAFE 0x10
  167 +#define RSA_FLAG_CACHE_PUBLIC 0x0002
  168 +#define RSA_FLAG_CACHE_PRIVATE 0x0004
  169 +#define RSA_FLAG_BLINDING 0x0008
  170 +#define RSA_FLAG_THREAD_SAFE 0x0010
162 171 /* This flag means the private key operations will be handled by rsa_mod_exp
163 172 * and that they do not depend on the private key components being present:
164 173 * for example a key stored in external hardware. Without this flag bn_mod_exp
165 174 * gets called when private key components are absent.
166 175 */
167   -#define RSA_FLAG_EXT_PKEY 0x20
  176 +#define RSA_FLAG_EXT_PKEY 0x0020
168 177  
169 178 /* This flag in the RSA_METHOD enables the new rsa_sign, rsa_verify functions.
170 179 */
171   -#define RSA_FLAG_SIGN_VER 0x40
172   -
173   -#define RSA_FLAG_NO_BLINDING 0x80 /* new with 0.9.6j and 0.9.7b; the built-in
174   - * RSA implementation now uses blinding by
175   - * default (ignoring RSA_FLAG_BLINDING),
176   - * but other engines might not need it
177   - */
  180 +#define RSA_FLAG_SIGN_VER 0x0040
  181 +
  182 +#define RSA_FLAG_NO_BLINDING 0x0080 /* new with 0.9.6j and 0.9.7b; the built-in
  183 + * RSA implementation now uses blinding by
  184 + * default (ignoring RSA_FLAG_BLINDING),
  185 + * but other engines might not need it
  186 + */
  187 +#define RSA_FLAG_NO_EXP_CONSTTIME 0x0100 /* new with 0.9.7h; the built-in RSA
  188 + * implementation now uses constant time
  189 + * modular exponentiation for secret exponents
  190 + * by default. This flag causes the
  191 + * faster variable sliding window method to
  192 + * be used for all exponents.
  193 + */
178 194  
179 195 #define RSA_PKCS1_PADDING 1
180 196 #define RSA_SSLV23_PADDING 2
181 197 #define RSA_NO_PADDING 3
182 198 #define RSA_PKCS1_OAEP_PADDING 4
  199 +#define RSA_X931_PADDING 5
183 200  
184 201 #define RSA_PKCS1_PADDING_SIZE 11
185 202  
... ... @@ -189,8 +206,16 @@ struct rsa_st
189 206 RSA * RSA_new(void);
190 207 RSA * RSA_new_method(ENGINE *engine);
191 208 int RSA_size(const RSA *);
  209 +
  210 +/* Deprecated version */
  211 +#ifndef OPENSSL_NO_DEPRECATED
192 212 RSA * RSA_generate_key(int bits, unsigned long e,void
193 213 (*callback)(int,int,void *),void *cb_arg);
  214 +#endif /* !defined(OPENSSL_NO_DEPRECATED) */
  215 +
  216 +/* New version */
  217 +int RSA_generate_key_ex(RSA *rsa, int bits, BIGNUM *e, BN_GENCB *cb);
  218 +
194 219 int RSA_check_key(const RSA *);
195 220 /* next 4 return -1 on error */
196 221 int RSA_public_encrypt(int flen, const unsigned char *from,
... ... @@ -231,11 +256,19 @@ int RSA_print_fp(FILE *fp, const RSA *r,int offset);
231 256 int RSA_print(BIO *bp, const RSA *r,int offset);
232 257 #endif
233 258  
234   -int i2d_RSA_NET(const RSA *a, unsigned char **pp, int (*cb)(), int sgckey);
235   -RSA *d2i_RSA_NET(RSA **a, const unsigned char **pp, long length, int (*cb)(), int sgckey);
  259 +int i2d_RSA_NET(const RSA *a, unsigned char **pp,
  260 + int (*cb)(char *buf, int len, const char *prompt, int verify),
  261 + int sgckey);
  262 +RSA *d2i_RSA_NET(RSA **a, const unsigned char **pp, long length,
  263 + int (*cb)(char *buf, int len, const char *prompt, int verify),
  264 + int sgckey);
236 265  
237   -int i2d_Netscape_RSA(const RSA *a, unsigned char **pp, int (*cb)());
238   -RSA *d2i_Netscape_RSA(RSA **a, const unsigned char **pp, long length, int (*cb)());
  266 +int i2d_Netscape_RSA(const RSA *a, unsigned char **pp,
  267 + int (*cb)(char *buf, int len, const char *prompt,
  268 + int verify));
  269 +RSA *d2i_Netscape_RSA(RSA **a, const unsigned char **pp, long length,
  270 + int (*cb)(char *buf, int len, const char *prompt,
  271 + int verify));
239 272  
240 273 /* The following 2 functions sign and verify a X509_SIG ASN1 object
241 274 * inside PKCS#1 padded RSA encryption */
... ... @@ -255,6 +288,7 @@ int RSA_verify_ASN1_OCTET_STRING(int type,
255 288  
256 289 int RSA_blinding_on(RSA *rsa, BN_CTX *ctx);
257 290 void RSA_blinding_off(RSA *rsa);
  291 +BN_BLINDING *RSA_setup_blinding(RSA *rsa, BN_CTX *ctx);
258 292  
259 293 int RSA_padding_add_PKCS1_type_1(unsigned char *to,int tlen,
260 294 const unsigned char *f,int fl);
... ... @@ -264,6 +298,8 @@ int RSA_padding_add_PKCS1_type_2(unsigned char *to,int tlen,
264 298 const unsigned char *f,int fl);
265 299 int RSA_padding_check_PKCS1_type_2(unsigned char *to,int tlen,
266 300 const unsigned char *f,int fl,int rsa_len);
  301 +int PKCS1_MGF1(unsigned char *mask, long len,
  302 + const unsigned char *seed, long seedlen, const EVP_MD *dgst);
267 303 int RSA_padding_add_PKCS1_OAEP(unsigned char *to,int tlen,
268 304 const unsigned char *f,int fl,
269 305 const unsigned char *p,int pl);
... ... @@ -278,6 +314,17 @@ int RSA_padding_add_none(unsigned char *to,int tlen,
278 314 const unsigned char *f,int fl);
279 315 int RSA_padding_check_none(unsigned char *to,int tlen,
280 316 const unsigned char *f,int fl,int rsa_len);
  317 +int RSA_padding_add_X931(unsigned char *to,int tlen,
  318 + const unsigned char *f,int fl);
  319 +int RSA_padding_check_X931(unsigned char *to,int tlen,
  320 + const unsigned char *f,int fl,int rsa_len);
  321 +int RSA_X931_hash_id(int nid);
  322 +
  323 +int RSA_verify_PKCS1_PSS(RSA *rsa, const unsigned char *mHash,
  324 + const EVP_MD *Hash, const unsigned char *EM, int sLen);
  325 +int RSA_padding_add_PKCS1_PSS(RSA *rsa, unsigned char *EM,
  326 + const unsigned char *mHash,
  327 + const EVP_MD *Hash, int sLen);
281 328  
282 329 int RSA_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
283 330 CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
... ... @@ -297,30 +344,42 @@ void ERR_load_RSA_strings(void);
297 344  
298 345 /* Function codes. */
299 346 #define RSA_F_MEMORY_LOCK 100
  347 +#define RSA_F_RSA_BUILTIN_KEYGEN 129
300 348 #define RSA_F_RSA_CHECK_KEY 123
301 349 #define RSA_F_RSA_EAY_PRIVATE_DECRYPT 101
302 350 #define RSA_F_RSA_EAY_PRIVATE_ENCRYPT 102
303 351 #define RSA_F_RSA_EAY_PUBLIC_DECRYPT 103
304 352 #define RSA_F_RSA_EAY_PUBLIC_ENCRYPT 104
305 353 #define RSA_F_RSA_GENERATE_KEY 105
  354 +#define RSA_F_RSA_MEMORY_LOCK 130
306 355 #define RSA_F_RSA_NEW_METHOD 106
307 356 #define RSA_F_RSA_NULL 124
  357 +#define RSA_F_RSA_NULL_MOD_EXP 131
  358 +#define RSA_F_RSA_NULL_PRIVATE_DECRYPT 132
  359 +#define RSA_F_RSA_NULL_PRIVATE_ENCRYPT 133
  360 +#define RSA_F_RSA_NULL_PUBLIC_DECRYPT 134
  361 +#define RSA_F_RSA_NULL_PUBLIC_ENCRYPT 135
308 362 #define RSA_F_RSA_PADDING_ADD_NONE 107
309 363 #define RSA_F_RSA_PADDING_ADD_PKCS1_OAEP 121
  364 +#define RSA_F_RSA_PADDING_ADD_PKCS1_PSS 125
310 365 #define RSA_F_RSA_PADDING_ADD_PKCS1_TYPE_1 108
311 366 #define RSA_F_RSA_PADDING_ADD_PKCS1_TYPE_2 109
312 367 #define RSA_F_RSA_PADDING_ADD_SSLV23 110
  368 +#define RSA_F_RSA_PADDING_ADD_X931 127
313 369 #define RSA_F_RSA_PADDING_CHECK_NONE 111
314 370 #define RSA_F_RSA_PADDING_CHECK_PKCS1_OAEP 122
315 371 #define RSA_F_RSA_PADDING_CHECK_PKCS1_TYPE_1 112
316 372 #define RSA_F_RSA_PADDING_CHECK_PKCS1_TYPE_2 113
317 373 #define RSA_F_RSA_PADDING_CHECK_SSLV23 114
  374 +#define RSA_F_RSA_PADDING_CHECK_X931 128
318 375 #define RSA_F_RSA_PRINT 115
319 376 #define RSA_F_RSA_PRINT_FP 116
  377 +#define RSA_F_RSA_SETUP_BLINDING 136
320 378 #define RSA_F_RSA_SIGN 117
321 379 #define RSA_F_RSA_SIGN_ASN1_OCTET_STRING 118
322 380 #define RSA_F_RSA_VERIFY 119
323 381 #define RSA_F_RSA_VERIFY_ASN1_OCTET_STRING 120
  382 +#define RSA_F_RSA_VERIFY_PKCS1_PSS 126
324 383  
325 384 /* Reason codes. */
326 385 #define RSA_R_ALGORITHM_MISMATCH 100
... ... @@ -340,9 +399,15 @@ void ERR_load_RSA_strings(void);
340 399 #define RSA_R_DMP1_NOT_CONGRUENT_TO_D 124
341 400 #define RSA_R_DMQ1_NOT_CONGRUENT_TO_D 125
342 401 #define RSA_R_D_E_NOT_CONGRUENT_TO_1 123
  402 +#define RSA_R_FIRST_OCTET_INVALID 133
  403 +#define RSA_R_INVALID_HEADER 137
343 404 #define RSA_R_INVALID_MESSAGE_LENGTH 131
  405 +#define RSA_R_INVALID_PADDING 138
  406 +#define RSA_R_INVALID_TRAILER 139
344 407 #define RSA_R_IQMP_NOT_INVERSE_OF_Q 126
345 408 #define RSA_R_KEY_SIZE_TOO_SMALL 120
  409 +#define RSA_R_LAST_OCTET_INVALID 134
  410 +#define RSA_R_NO_PUBLIC_EXPONENT 140
346 411 #define RSA_R_NULL_BEFORE_BLOCK_MISSING 113
347 412 #define RSA_R_N_DOES_NOT_EQUAL_P_Q 127
348 413 #define RSA_R_OAEP_DECODING_ERROR 121
... ... @@ -350,6 +415,8 @@ void ERR_load_RSA_strings(void);
350 415 #define RSA_R_P_NOT_PRIME 128
351 416 #define RSA_R_Q_NOT_PRIME 129
352 417 #define RSA_R_RSA_OPERATIONS_NOT_SUPPORTED 130
  418 +#define RSA_R_SLEN_CHECK_FAILED 136
  419 +#define RSA_R_SLEN_RECOVERY_FAILED 135
353 420 #define RSA_R_SSLV3_ROLLBACK_ATTACK 115
354 421 #define RSA_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD 116
355 422 #define RSA_R_UNKNOWN_ALGORITHM_TYPE 117
... ...
third_dev/openssl/include/openssl/safestack.h
... ... @@ -57,6 +57,9 @@
57 57  
58 58 #include <openssl/stack.h>
59 59  
  60 +typedef void (*openssl_fptr)(void);
  61 +#define openssl_fcast(f) ((openssl_fptr)f)
  62 +
60 63 #ifdef DEBUG_SAFESTACK
61 64  
62 65 #define STACK_OF(type) struct stack_st_##type
... ... @@ -73,70 +76,73 @@ STACK_OF(type) \
73 76 /* SKM_sk_... stack macros are internal to safestack.h:
74 77 * never use them directly, use sk_<type>_... instead */
75 78 #define SKM_sk_new(type, cmp) \
76   - ((STACK_OF(type) * (*)(int (*)(const type * const *, const type * const *)))sk_new)(cmp)
  79 + ((STACK_OF(type) * (*)(int (*)(const type * const *, const type * const *)))openssl_fcast(sk_new))(cmp)
77 80 #define SKM_sk_new_null(type) \
78   - ((STACK_OF(type) * (*)(void))sk_new_null)()
  81 + ((STACK_OF(type) * (*)(void))openssl_fcast(sk_new_null))()
79 82 #define SKM_sk_free(type, st) \
80   - ((void (*)(STACK_OF(type) *))sk_free)(st)
  83 + ((void (*)(STACK_OF(type) *))openssl_fcast(sk_free))(st)
81 84 #define SKM_sk_num(type, st) \
82   - ((int (*)(const STACK_OF(type) *))sk_num)(st)
  85 + ((int (*)(const STACK_OF(type) *))openssl_fcast(sk_num))(st)
83 86 #define SKM_sk_value(type, st,i) \
84   - ((type * (*)(const STACK_OF(type) *, int))sk_value)(st, i)
  87 + ((type * (*)(const STACK_OF(type) *, int))openssl_fcast(sk_value))(st, i)
85 88 #define SKM_sk_set(type, st,i,val) \
86   - ((type * (*)(STACK_OF(type) *, int, type *))sk_set)(st, i, val)
  89 + ((type * (*)(STACK_OF(type) *, int, type *))openssl_fcast(sk_set))(st, i, val)
87 90 #define SKM_sk_zero(type, st) \
88   - ((void (*)(STACK_OF(type) *))sk_zero)(st)
  91 + ((void (*)(STACK_OF(type) *))openssl_fcast(sk_zero))(st)
89 92 #define SKM_sk_push(type, st,val) \
90   - ((int (*)(STACK_OF(type) *, type *))sk_push)(st, val)
  93 + ((int (*)(STACK_OF(type) *, type *))openssl_fcast(sk_push))(st, val)
91 94 #define SKM_sk_unshift(type, st,val) \
92   - ((int (*)(STACK_OF(type) *, type *))sk_unshift)(st, val)
  95 + ((int (*)(STACK_OF(type) *, type *))openssl_fcast(sk_unshift))(st, val)
93 96 #define SKM_sk_find(type, st,val) \
94   - ((int (*)(STACK_OF(type) *, type *))sk_find)(st, val)
  97 + ((int (*)(STACK_OF(type) *, type *))openssl_fcast(sk_find))(st, val)
95 98 #define SKM_sk_delete(type, st,i) \
96   - ((type * (*)(STACK_OF(type) *, int))sk_delete)(st, i)
  99 + ((type * (*)(STACK_OF(type) *, int))openssl_fcast(sk_delete))(st, i)
97 100 #define SKM_sk_delete_ptr(type, st,ptr) \
98   - ((type * (*)(STACK_OF(type) *, type *))sk_delete_ptr)(st, ptr)
  101 + ((type * (*)(STACK_OF(type) *, type *))openssl_fcast(sk_delete_ptr))(st, ptr)
99 102 #define SKM_sk_insert(type, st,val,i) \
100   - ((int (*)(STACK_OF(type) *, type *, int))sk_insert)(st, val, i)
  103 + ((int (*)(STACK_OF(type) *, type *, int))openssl_fcast(sk_insert))(st, val, i)
101 104 #define SKM_sk_set_cmp_func(type, st,cmp) \
102 105 ((int (*(*)(STACK_OF(type) *, int (*)(const type * const *, const type * const *))) \
103   - (const type * const *, const type * const *))sk_set_cmp_func)\
  106 + (const type * const *, const type * const *))openssl_fcast(sk_set_cmp_func))\
104 107 (st, cmp)
105 108 #define SKM_sk_dup(type, st) \
106   - ((STACK_OF(type) *(*)(STACK_OF(type) *))sk_dup)(st)
  109 + ((STACK_OF(type) *(*)(STACK_OF(type) *))openssl_fcast(sk_dup))(st)
107 110 #define SKM_sk_pop_free(type, st,free_func) \
108   - ((void (*)(STACK_OF(type) *, void (*)(type *)))sk_pop_free)\
  111 + ((void (*)(STACK_OF(type) *, void (*)(type *)))openssl_fcast(sk_pop_free))\
109 112 (st, free_func)
110 113 #define SKM_sk_shift(type, st) \
111   - ((type * (*)(STACK_OF(type) *))sk_shift)(st)
  114 + ((type * (*)(STACK_OF(type) *))openssl_fcast(sk_shift))(st)
112 115 #define SKM_sk_pop(type, st) \
113   - ((type * (*)(STACK_OF(type) *))sk_pop)(st)
  116 + ((type * (*)(STACK_OF(type) *))openssl_fcast(sk_pop))(st)
114 117 #define SKM_sk_sort(type, st) \
115   - ((void (*)(STACK_OF(type) *))sk_sort)(st)
  118 + ((void (*)(STACK_OF(type) *))openssl_fcast(sk_sort))(st)
  119 +#define SKM_sk_is_sorted(type, st) \
  120 + ((int (*)(const STACK_OF(type) *))openssl_fcast(sk_is_sorted))(st)
116 121  
117 122 #define SKM_ASN1_SET_OF_d2i(type, st, pp, length, d2i_func, free_func, ex_tag, ex_class) \
118   - ((STACK_OF(type) * (*) (STACK_OF(type) **,unsigned char **, long , \
119   - type *(*)(type **, unsigned char **,long), \
120   - void (*)(type *), int ,int )) d2i_ASN1_SET) \
121   - (st,pp,length, d2i_func, free_func, ex_tag,ex_class)
  123 +((STACK_OF(type) * (*) (STACK_OF(type) **,const unsigned char **, long , \
  124 + type *(*)(type **, const unsigned char **,long), \
  125 + void (*)(type *), int ,int )) openssl_fcast(d2i_ASN1_SET)) \
  126 + (st,pp,length, d2i_func, free_func, ex_tag,ex_class)
122 127 #define SKM_ASN1_SET_OF_i2d(type, st, pp, i2d_func, ex_tag, ex_class, is_set) \
123 128 ((int (*)(STACK_OF(type) *,unsigned char **, \
124   - int (*)(type *,unsigned char **), int , int , int)) i2d_ASN1_SET) \
  129 + int (*)(type *,unsigned char **), int , int , int)) openssl_fcast(i2d_ASN1_SET)) \
125 130 (st,pp,i2d_func,ex_tag,ex_class,is_set)
126 131  
127 132 #define SKM_ASN1_seq_pack(type, st, i2d_func, buf, len) \
128 133 ((unsigned char *(*)(STACK_OF(type) *, \
129   - int (*)(type *,unsigned char **), unsigned char **,int *)) ASN1_seq_pack) \
  134 + int (*)(type *,unsigned char **), unsigned char **,int *)) openssl_fcast(ASN1_seq_pack)) \
130 135 (st, i2d_func, buf, len)
131 136 #define SKM_ASN1_seq_unpack(type, buf, len, d2i_func, free_func) \
132   - ((STACK_OF(type) * (*)(unsigned char *,int, \
133   - type *(*)(type **,unsigned char **, long), \
134   - void (*)(type *)))ASN1_seq_unpack) \
  137 + ((STACK_OF(type) * (*)(const unsigned char *,int, \
  138 + type *(*)(type **,const unsigned char **, long), \
  139 + void (*)(type *)))openssl_fcast(ASN1_seq_unpack)) \
135 140 (buf,len,d2i_func, free_func)
136 141  
137 142 #define SKM_PKCS12_decrypt_d2i(type, algor, d2i_func, free_func, pass, passlen, oct, seq) \
138 143 ((STACK_OF(type) * (*)(X509_ALGOR *, \
139   - type *(*)(type **, unsigned char **, long), void (*)(type *), \
  144 + type *(*)(type **, const unsigned char **, long), \
  145 + void (*)(type *), \
140 146 const char *, int, \
141 147 ASN1_STRING *, int))PKCS12_decrypt_d2i) \
142 148 (algor,d2i_func,free_func,pass,passlen,oct,seq)
... ... @@ -187,16 +193,18 @@ STACK_OF(type) \
187 193 ((type *)sk_pop(st))
188 194 #define SKM_sk_sort(type, st) \
189 195 sk_sort(st)
  196 +#define SKM_sk_is_sorted(type, st) \
  197 + sk_is_sorted(st)
190 198  
191 199 #define SKM_ASN1_SET_OF_d2i(type, st, pp, length, d2i_func, free_func, ex_tag, ex_class) \
192   - d2i_ASN1_SET(st,pp,length, (char *(*)())d2i_func, (void (*)(void *))free_func, ex_tag,ex_class)
  200 + d2i_ASN1_SET(st,pp,length, (void *(*)(void ** ,const unsigned char ** ,long))d2i_func, (void (*)(void *))free_func, ex_tag,ex_class)
193 201 #define SKM_ASN1_SET_OF_i2d(type, st, pp, i2d_func, ex_tag, ex_class, is_set) \
194   - i2d_ASN1_SET(st,pp,i2d_func,ex_tag,ex_class,is_set)
  202 + i2d_ASN1_SET(st,pp,(int (*)(void *, unsigned char **))i2d_func,ex_tag,ex_class,is_set)
195 203  
196 204 #define SKM_ASN1_seq_pack(type, st, i2d_func, buf, len) \
197   - ASN1_seq_pack(st, i2d_func, buf, len)
  205 + ASN1_seq_pack(st, (int (*)(void *, unsigned char **))i2d_func, buf, len)
198 206 #define SKM_ASN1_seq_unpack(type, buf, len, d2i_func, free_func) \
199   - ASN1_seq_unpack(buf,len,(char *(*)())d2i_func, (void(*)(void *))free_func)
  207 + ASN1_seq_unpack(buf,len,(void *(*)(void **,const unsigned char **,long))d2i_func, (void(*)(void *))free_func)
200 208  
201 209 #define SKM_PKCS12_decrypt_d2i(type, algor, d2i_func, free_func, pass, passlen, oct, seq) \
202 210 ((STACK *)PKCS12_decrypt_d2i(algor,(char *(*)())d2i_func, (void(*)(void *))free_func,pass,passlen,oct,seq))
... ... @@ -214,6 +222,7 @@ STACK_OF(type) \
214 222 #define sk_ACCESS_DESCRIPTION_push(st, val) SKM_sk_push(ACCESS_DESCRIPTION, (st), (val))
215 223 #define sk_ACCESS_DESCRIPTION_unshift(st, val) SKM_sk_unshift(ACCESS_DESCRIPTION, (st), (val))
216 224 #define sk_ACCESS_DESCRIPTION_find(st, val) SKM_sk_find(ACCESS_DESCRIPTION, (st), (val))
  225 +#define sk_ACCESS_DESCRIPTION_find_ex(st, val) SKM_sk_find_ex(ACCESS_DESCRIPTION, (st), (val))
217 226 #define sk_ACCESS_DESCRIPTION_delete(st, i) SKM_sk_delete(ACCESS_DESCRIPTION, (st), (i))
218 227 #define sk_ACCESS_DESCRIPTION_delete_ptr(st, ptr) SKM_sk_delete_ptr(ACCESS_DESCRIPTION, (st), (ptr))
219 228 #define sk_ACCESS_DESCRIPTION_insert(st, val, i) SKM_sk_insert(ACCESS_DESCRIPTION, (st), (val), (i))
... ... @@ -223,6 +232,7 @@ STACK_OF(type) \
223 232 #define sk_ACCESS_DESCRIPTION_shift(st) SKM_sk_shift(ACCESS_DESCRIPTION, (st))
224 233 #define sk_ACCESS_DESCRIPTION_pop(st) SKM_sk_pop(ACCESS_DESCRIPTION, (st))
225 234 #define sk_ACCESS_DESCRIPTION_sort(st) SKM_sk_sort(ACCESS_DESCRIPTION, (st))
  235 +#define sk_ACCESS_DESCRIPTION_is_sorted(st) SKM_sk_is_sorted(ACCESS_DESCRIPTION, (st))
226 236  
227 237 #define sk_ASN1_GENERALSTRING_new(st) SKM_sk_new(ASN1_GENERALSTRING, (st))
228 238 #define sk_ASN1_GENERALSTRING_new_null() SKM_sk_new_null(ASN1_GENERALSTRING)
... ... @@ -234,6 +244,7 @@ STACK_OF(type) \
234 244 #define sk_ASN1_GENERALSTRING_push(st, val) SKM_sk_push(ASN1_GENERALSTRING, (st), (val))
235 245 #define sk_ASN1_GENERALSTRING_unshift(st, val) SKM_sk_unshift(ASN1_GENERALSTRING, (st), (val))
236 246 #define sk_ASN1_GENERALSTRING_find(st, val) SKM_sk_find(ASN1_GENERALSTRING, (st), (val))
  247 +#define sk_ASN1_GENERALSTRING_find_ex(st, val) SKM_sk_find_ex(ASN1_GENERALSTRING, (st), (val))
237 248 #define sk_ASN1_GENERALSTRING_delete(st, i) SKM_sk_delete(ASN1_GENERALSTRING, (st), (i))
238 249 #define sk_ASN1_GENERALSTRING_delete_ptr(st, ptr) SKM_sk_delete_ptr(ASN1_GENERALSTRING, (st), (ptr))
239 250 #define sk_ASN1_GENERALSTRING_insert(st, val, i) SKM_sk_insert(ASN1_GENERALSTRING, (st), (val), (i))
... ... @@ -243,6 +254,7 @@ STACK_OF(type) \
243 254 #define sk_ASN1_GENERALSTRING_shift(st) SKM_sk_shift(ASN1_GENERALSTRING, (st))
244 255 #define sk_ASN1_GENERALSTRING_pop(st) SKM_sk_pop(ASN1_GENERALSTRING, (st))
245 256 #define sk_ASN1_GENERALSTRING_sort(st) SKM_sk_sort(ASN1_GENERALSTRING, (st))
  257 +#define sk_ASN1_GENERALSTRING_is_sorted(st) SKM_sk_is_sorted(ASN1_GENERALSTRING, (st))
246 258  
247 259 #define sk_ASN1_INTEGER_new(st) SKM_sk_new(ASN1_INTEGER, (st))
248 260 #define sk_ASN1_INTEGER_new_null() SKM_sk_new_null(ASN1_INTEGER)
... ... @@ -254,6 +266,7 @@ STACK_OF(type) \
254 266 #define sk_ASN1_INTEGER_push(st, val) SKM_sk_push(ASN1_INTEGER, (st), (val))
255 267 #define sk_ASN1_INTEGER_unshift(st, val) SKM_sk_unshift(ASN1_INTEGER, (st), (val))
256 268 #define sk_ASN1_INTEGER_find(st, val) SKM_sk_find(ASN1_INTEGER, (st), (val))
  269 +#define sk_ASN1_INTEGER_find_ex(st, val) SKM_sk_find_ex(ASN1_INTEGER, (st), (val))
257 270 #define sk_ASN1_INTEGER_delete(st, i) SKM_sk_delete(ASN1_INTEGER, (st), (i))
258 271 #define sk_ASN1_INTEGER_delete_ptr(st, ptr) SKM_sk_delete_ptr(ASN1_INTEGER, (st), (ptr))
259 272 #define sk_ASN1_INTEGER_insert(st, val, i) SKM_sk_insert(ASN1_INTEGER, (st), (val), (i))
... ... @@ -263,6 +276,7 @@ STACK_OF(type) \
263 276 #define sk_ASN1_INTEGER_shift(st) SKM_sk_shift(ASN1_INTEGER, (st))
264 277 #define sk_ASN1_INTEGER_pop(st) SKM_sk_pop(ASN1_INTEGER, (st))
265 278 #define sk_ASN1_INTEGER_sort(st) SKM_sk_sort(ASN1_INTEGER, (st))
  279 +#define sk_ASN1_INTEGER_is_sorted(st) SKM_sk_is_sorted(ASN1_INTEGER, (st))
266 280  
267 281 #define sk_ASN1_OBJECT_new(st) SKM_sk_new(ASN1_OBJECT, (st))
268 282 #define sk_ASN1_OBJECT_new_null() SKM_sk_new_null(ASN1_OBJECT)
... ... @@ -274,6 +288,7 @@ STACK_OF(type) \
274 288 #define sk_ASN1_OBJECT_push(st, val) SKM_sk_push(ASN1_OBJECT, (st), (val))
275 289 #define sk_ASN1_OBJECT_unshift(st, val) SKM_sk_unshift(ASN1_OBJECT, (st), (val))
276 290 #define sk_ASN1_OBJECT_find(st, val) SKM_sk_find(ASN1_OBJECT, (st), (val))
  291 +#define sk_ASN1_OBJECT_find_ex(st, val) SKM_sk_find_ex(ASN1_OBJECT, (st), (val))
277 292 #define sk_ASN1_OBJECT_delete(st, i) SKM_sk_delete(ASN1_OBJECT, (st), (i))
278 293 #define sk_ASN1_OBJECT_delete_ptr(st, ptr) SKM_sk_delete_ptr(ASN1_OBJECT, (st), (ptr))
279 294 #define sk_ASN1_OBJECT_insert(st, val, i) SKM_sk_insert(ASN1_OBJECT, (st), (val), (i))
... ... @@ -283,6 +298,7 @@ STACK_OF(type) \
283 298 #define sk_ASN1_OBJECT_shift(st) SKM_sk_shift(ASN1_OBJECT, (st))
284 299 #define sk_ASN1_OBJECT_pop(st) SKM_sk_pop(ASN1_OBJECT, (st))
285 300 #define sk_ASN1_OBJECT_sort(st) SKM_sk_sort(ASN1_OBJECT, (st))
  301 +#define sk_ASN1_OBJECT_is_sorted(st) SKM_sk_is_sorted(ASN1_OBJECT, (st))
286 302  
287 303 #define sk_ASN1_STRING_TABLE_new(st) SKM_sk_new(ASN1_STRING_TABLE, (st))
288 304 #define sk_ASN1_STRING_TABLE_new_null() SKM_sk_new_null(ASN1_STRING_TABLE)
... ... @@ -294,6 +310,7 @@ STACK_OF(type) \
294 310 #define sk_ASN1_STRING_TABLE_push(st, val) SKM_sk_push(ASN1_STRING_TABLE, (st), (val))
295 311 #define sk_ASN1_STRING_TABLE_unshift(st, val) SKM_sk_unshift(ASN1_STRING_TABLE, (st), (val))
296 312 #define sk_ASN1_STRING_TABLE_find(st, val) SKM_sk_find(ASN1_STRING_TABLE, (st), (val))
  313 +#define sk_ASN1_STRING_TABLE_find_ex(st, val) SKM_sk_find_ex(ASN1_STRING_TABLE, (st), (val))
297 314 #define sk_ASN1_STRING_TABLE_delete(st, i) SKM_sk_delete(ASN1_STRING_TABLE, (st), (i))
298 315 #define sk_ASN1_STRING_TABLE_delete_ptr(st, ptr) SKM_sk_delete_ptr(ASN1_STRING_TABLE, (st), (ptr))
299 316 #define sk_ASN1_STRING_TABLE_insert(st, val, i) SKM_sk_insert(ASN1_STRING_TABLE, (st), (val), (i))
... ... @@ -303,6 +320,7 @@ STACK_OF(type) \
303 320 #define sk_ASN1_STRING_TABLE_shift(st) SKM_sk_shift(ASN1_STRING_TABLE, (st))
304 321 #define sk_ASN1_STRING_TABLE_pop(st) SKM_sk_pop(ASN1_STRING_TABLE, (st))
305 322 #define sk_ASN1_STRING_TABLE_sort(st) SKM_sk_sort(ASN1_STRING_TABLE, (st))
  323 +#define sk_ASN1_STRING_TABLE_is_sorted(st) SKM_sk_is_sorted(ASN1_STRING_TABLE, (st))
306 324  
307 325 #define sk_ASN1_TYPE_new(st) SKM_sk_new(ASN1_TYPE, (st))
308 326 #define sk_ASN1_TYPE_new_null() SKM_sk_new_null(ASN1_TYPE)
... ... @@ -314,6 +332,7 @@ STACK_OF(type) \
314 332 #define sk_ASN1_TYPE_push(st, val) SKM_sk_push(ASN1_TYPE, (st), (val))
315 333 #define sk_ASN1_TYPE_unshift(st, val) SKM_sk_unshift(ASN1_TYPE, (st), (val))
316 334 #define sk_ASN1_TYPE_find(st, val) SKM_sk_find(ASN1_TYPE, (st), (val))
  335 +#define sk_ASN1_TYPE_find_ex(st, val) SKM_sk_find_ex(ASN1_TYPE, (st), (val))
317 336 #define sk_ASN1_TYPE_delete(st, i) SKM_sk_delete(ASN1_TYPE, (st), (i))
318 337 #define sk_ASN1_TYPE_delete_ptr(st, ptr) SKM_sk_delete_ptr(ASN1_TYPE, (st), (ptr))
319 338 #define sk_ASN1_TYPE_insert(st, val, i) SKM_sk_insert(ASN1_TYPE, (st), (val), (i))
... ... @@ -323,6 +342,7 @@ STACK_OF(type) \
323 342 #define sk_ASN1_TYPE_shift(st) SKM_sk_shift(ASN1_TYPE, (st))
324 343 #define sk_ASN1_TYPE_pop(st) SKM_sk_pop(ASN1_TYPE, (st))
325 344 #define sk_ASN1_TYPE_sort(st) SKM_sk_sort(ASN1_TYPE, (st))
  345 +#define sk_ASN1_TYPE_is_sorted(st) SKM_sk_is_sorted(ASN1_TYPE, (st))
326 346  
327 347 #define sk_ASN1_VALUE_new(st) SKM_sk_new(ASN1_VALUE, (st))
328 348 #define sk_ASN1_VALUE_new_null() SKM_sk_new_null(ASN1_VALUE)
... ... @@ -334,6 +354,7 @@ STACK_OF(type) \
334 354 #define sk_ASN1_VALUE_push(st, val) SKM_sk_push(ASN1_VALUE, (st), (val))
335 355 #define sk_ASN1_VALUE_unshift(st, val) SKM_sk_unshift(ASN1_VALUE, (st), (val))
336 356 #define sk_ASN1_VALUE_find(st, val) SKM_sk_find(ASN1_VALUE, (st), (val))
  357 +#define sk_ASN1_VALUE_find_ex(st, val) SKM_sk_find_ex(ASN1_VALUE, (st), (val))
337 358 #define sk_ASN1_VALUE_delete(st, i) SKM_sk_delete(ASN1_VALUE, (st), (i))
338 359 #define sk_ASN1_VALUE_delete_ptr(st, ptr) SKM_sk_delete_ptr(ASN1_VALUE, (st), (ptr))
339 360 #define sk_ASN1_VALUE_insert(st, val, i) SKM_sk_insert(ASN1_VALUE, (st), (val), (i))
... ... @@ -343,6 +364,7 @@ STACK_OF(type) \
343 364 #define sk_ASN1_VALUE_shift(st) SKM_sk_shift(ASN1_VALUE, (st))
344 365 #define sk_ASN1_VALUE_pop(st) SKM_sk_pop(ASN1_VALUE, (st))
345 366 #define sk_ASN1_VALUE_sort(st) SKM_sk_sort(ASN1_VALUE, (st))
  367 +#define sk_ASN1_VALUE_is_sorted(st) SKM_sk_is_sorted(ASN1_VALUE, (st))
346 368  
347 369 #define sk_BIO_new(st) SKM_sk_new(BIO, (st))
348 370 #define sk_BIO_new_null() SKM_sk_new_null(BIO)
... ... @@ -354,6 +376,7 @@ STACK_OF(type) \
354 376 #define sk_BIO_push(st, val) SKM_sk_push(BIO, (st), (val))
355 377 #define sk_BIO_unshift(st, val) SKM_sk_unshift(BIO, (st), (val))
356 378 #define sk_BIO_find(st, val) SKM_sk_find(BIO, (st), (val))
  379 +#define sk_BIO_find_ex(st, val) SKM_sk_find_ex(BIO, (st), (val))
357 380 #define sk_BIO_delete(st, i) SKM_sk_delete(BIO, (st), (i))
358 381 #define sk_BIO_delete_ptr(st, ptr) SKM_sk_delete_ptr(BIO, (st), (ptr))
359 382 #define sk_BIO_insert(st, val, i) SKM_sk_insert(BIO, (st), (val), (i))
... ... @@ -363,6 +386,7 @@ STACK_OF(type) \
363 386 #define sk_BIO_shift(st) SKM_sk_shift(BIO, (st))
364 387 #define sk_BIO_pop(st) SKM_sk_pop(BIO, (st))
365 388 #define sk_BIO_sort(st) SKM_sk_sort(BIO, (st))
  389 +#define sk_BIO_is_sorted(st) SKM_sk_is_sorted(BIO, (st))
366 390  
367 391 #define sk_CONF_IMODULE_new(st) SKM_sk_new(CONF_IMODULE, (st))
368 392 #define sk_CONF_IMODULE_new_null() SKM_sk_new_null(CONF_IMODULE)
... ... @@ -374,6 +398,7 @@ STACK_OF(type) \
374 398 #define sk_CONF_IMODULE_push(st, val) SKM_sk_push(CONF_IMODULE, (st), (val))
375 399 #define sk_CONF_IMODULE_unshift(st, val) SKM_sk_unshift(CONF_IMODULE, (st), (val))
376 400 #define sk_CONF_IMODULE_find(st, val) SKM_sk_find(CONF_IMODULE, (st), (val))
  401 +#define sk_CONF_IMODULE_find_ex(st, val) SKM_sk_find_ex(CONF_IMODULE, (st), (val))
377 402 #define sk_CONF_IMODULE_delete(st, i) SKM_sk_delete(CONF_IMODULE, (st), (i))
378 403 #define sk_CONF_IMODULE_delete_ptr(st, ptr) SKM_sk_delete_ptr(CONF_IMODULE, (st), (ptr))
379 404 #define sk_CONF_IMODULE_insert(st, val, i) SKM_sk_insert(CONF_IMODULE, (st), (val), (i))
... ... @@ -383,6 +408,7 @@ STACK_OF(type) \
383 408 #define sk_CONF_IMODULE_shift(st) SKM_sk_shift(CONF_IMODULE, (st))
384 409 #define sk_CONF_IMODULE_pop(st) SKM_sk_pop(CONF_IMODULE, (st))
385 410 #define sk_CONF_IMODULE_sort(st) SKM_sk_sort(CONF_IMODULE, (st))
  411 +#define sk_CONF_IMODULE_is_sorted(st) SKM_sk_is_sorted(CONF_IMODULE, (st))
386 412  
387 413 #define sk_CONF_MODULE_new(st) SKM_sk_new(CONF_MODULE, (st))
388 414 #define sk_CONF_MODULE_new_null() SKM_sk_new_null(CONF_MODULE)
... ... @@ -394,6 +420,7 @@ STACK_OF(type) \
394 420 #define sk_CONF_MODULE_push(st, val) SKM_sk_push(CONF_MODULE, (st), (val))
395 421 #define sk_CONF_MODULE_unshift(st, val) SKM_sk_unshift(CONF_MODULE, (st), (val))
396 422 #define sk_CONF_MODULE_find(st, val) SKM_sk_find(CONF_MODULE, (st), (val))
  423 +#define sk_CONF_MODULE_find_ex(st, val) SKM_sk_find_ex(CONF_MODULE, (st), (val))
397 424 #define sk_CONF_MODULE_delete(st, i) SKM_sk_delete(CONF_MODULE, (st), (i))
398 425 #define sk_CONF_MODULE_delete_ptr(st, ptr) SKM_sk_delete_ptr(CONF_MODULE, (st), (ptr))
399 426 #define sk_CONF_MODULE_insert(st, val, i) SKM_sk_insert(CONF_MODULE, (st), (val), (i))
... ... @@ -403,6 +430,7 @@ STACK_OF(type) \
403 430 #define sk_CONF_MODULE_shift(st) SKM_sk_shift(CONF_MODULE, (st))
404 431 #define sk_CONF_MODULE_pop(st) SKM_sk_pop(CONF_MODULE, (st))
405 432 #define sk_CONF_MODULE_sort(st) SKM_sk_sort(CONF_MODULE, (st))
  433 +#define sk_CONF_MODULE_is_sorted(st) SKM_sk_is_sorted(CONF_MODULE, (st))
406 434  
407 435 #define sk_CONF_VALUE_new(st) SKM_sk_new(CONF_VALUE, (st))
408 436 #define sk_CONF_VALUE_new_null() SKM_sk_new_null(CONF_VALUE)
... ... @@ -414,6 +442,7 @@ STACK_OF(type) \
414 442 #define sk_CONF_VALUE_push(st, val) SKM_sk_push(CONF_VALUE, (st), (val))
415 443 #define sk_CONF_VALUE_unshift(st, val) SKM_sk_unshift(CONF_VALUE, (st), (val))
416 444 #define sk_CONF_VALUE_find(st, val) SKM_sk_find(CONF_VALUE, (st), (val))
  445 +#define sk_CONF_VALUE_find_ex(st, val) SKM_sk_find_ex(CONF_VALUE, (st), (val))
417 446 #define sk_CONF_VALUE_delete(st, i) SKM_sk_delete(CONF_VALUE, (st), (i))
418 447 #define sk_CONF_VALUE_delete_ptr(st, ptr) SKM_sk_delete_ptr(CONF_VALUE, (st), (ptr))
419 448 #define sk_CONF_VALUE_insert(st, val, i) SKM_sk_insert(CONF_VALUE, (st), (val), (i))
... ... @@ -423,6 +452,7 @@ STACK_OF(type) \
423 452 #define sk_CONF_VALUE_shift(st) SKM_sk_shift(CONF_VALUE, (st))
424 453 #define sk_CONF_VALUE_pop(st) SKM_sk_pop(CONF_VALUE, (st))
425 454 #define sk_CONF_VALUE_sort(st) SKM_sk_sort(CONF_VALUE, (st))
  455 +#define sk_CONF_VALUE_is_sorted(st) SKM_sk_is_sorted(CONF_VALUE, (st))
426 456  
427 457 #define sk_CRYPTO_EX_DATA_FUNCS_new(st) SKM_sk_new(CRYPTO_EX_DATA_FUNCS, (st))
428 458 #define sk_CRYPTO_EX_DATA_FUNCS_new_null() SKM_sk_new_null(CRYPTO_EX_DATA_FUNCS)
... ... @@ -434,6 +464,7 @@ STACK_OF(type) \
434 464 #define sk_CRYPTO_EX_DATA_FUNCS_push(st, val) SKM_sk_push(CRYPTO_EX_DATA_FUNCS, (st), (val))
435 465 #define sk_CRYPTO_EX_DATA_FUNCS_unshift(st, val) SKM_sk_unshift(CRYPTO_EX_DATA_FUNCS, (st), (val))
436 466 #define sk_CRYPTO_EX_DATA_FUNCS_find(st, val) SKM_sk_find(CRYPTO_EX_DATA_FUNCS, (st), (val))
  467 +#define sk_CRYPTO_EX_DATA_FUNCS_find_ex(st, val) SKM_sk_find_ex(CRYPTO_EX_DATA_FUNCS, (st), (val))
437 468 #define sk_CRYPTO_EX_DATA_FUNCS_delete(st, i) SKM_sk_delete(CRYPTO_EX_DATA_FUNCS, (st), (i))
438 469 #define sk_CRYPTO_EX_DATA_FUNCS_delete_ptr(st, ptr) SKM_sk_delete_ptr(CRYPTO_EX_DATA_FUNCS, (st), (ptr))
439 470 #define sk_CRYPTO_EX_DATA_FUNCS_insert(st, val, i) SKM_sk_insert(CRYPTO_EX_DATA_FUNCS, (st), (val), (i))
... ... @@ -443,6 +474,7 @@ STACK_OF(type) \
443 474 #define sk_CRYPTO_EX_DATA_FUNCS_shift(st) SKM_sk_shift(CRYPTO_EX_DATA_FUNCS, (st))
444 475 #define sk_CRYPTO_EX_DATA_FUNCS_pop(st) SKM_sk_pop(CRYPTO_EX_DATA_FUNCS, (st))
445 476 #define sk_CRYPTO_EX_DATA_FUNCS_sort(st) SKM_sk_sort(CRYPTO_EX_DATA_FUNCS, (st))
  477 +#define sk_CRYPTO_EX_DATA_FUNCS_is_sorted(st) SKM_sk_is_sorted(CRYPTO_EX_DATA_FUNCS, (st))
446 478  
447 479 #define sk_CRYPTO_dynlock_new(st) SKM_sk_new(CRYPTO_dynlock, (st))
448 480 #define sk_CRYPTO_dynlock_new_null() SKM_sk_new_null(CRYPTO_dynlock)
... ... @@ -454,6 +486,7 @@ STACK_OF(type) \
454 486 #define sk_CRYPTO_dynlock_push(st, val) SKM_sk_push(CRYPTO_dynlock, (st), (val))
455 487 #define sk_CRYPTO_dynlock_unshift(st, val) SKM_sk_unshift(CRYPTO_dynlock, (st), (val))
456 488 #define sk_CRYPTO_dynlock_find(st, val) SKM_sk_find(CRYPTO_dynlock, (st), (val))
  489 +#define sk_CRYPTO_dynlock_find_ex(st, val) SKM_sk_find_ex(CRYPTO_dynlock, (st), (val))
457 490 #define sk_CRYPTO_dynlock_delete(st, i) SKM_sk_delete(CRYPTO_dynlock, (st), (i))
458 491 #define sk_CRYPTO_dynlock_delete_ptr(st, ptr) SKM_sk_delete_ptr(CRYPTO_dynlock, (st), (ptr))
459 492 #define sk_CRYPTO_dynlock_insert(st, val, i) SKM_sk_insert(CRYPTO_dynlock, (st), (val), (i))
... ... @@ -463,6 +496,7 @@ STACK_OF(type) \
463 496 #define sk_CRYPTO_dynlock_shift(st) SKM_sk_shift(CRYPTO_dynlock, (st))
464 497 #define sk_CRYPTO_dynlock_pop(st) SKM_sk_pop(CRYPTO_dynlock, (st))
465 498 #define sk_CRYPTO_dynlock_sort(st) SKM_sk_sort(CRYPTO_dynlock, (st))
  499 +#define sk_CRYPTO_dynlock_is_sorted(st) SKM_sk_is_sorted(CRYPTO_dynlock, (st))
466 500  
467 501 #define sk_DIST_POINT_new(st) SKM_sk_new(DIST_POINT, (st))
468 502 #define sk_DIST_POINT_new_null() SKM_sk_new_null(DIST_POINT)
... ... @@ -474,6 +508,7 @@ STACK_OF(type) \
474 508 #define sk_DIST_POINT_push(st, val) SKM_sk_push(DIST_POINT, (st), (val))
475 509 #define sk_DIST_POINT_unshift(st, val) SKM_sk_unshift(DIST_POINT, (st), (val))
476 510 #define sk_DIST_POINT_find(st, val) SKM_sk_find(DIST_POINT, (st), (val))
  511 +#define sk_DIST_POINT_find_ex(st, val) SKM_sk_find_ex(DIST_POINT, (st), (val))
477 512 #define sk_DIST_POINT_delete(st, i) SKM_sk_delete(DIST_POINT, (st), (i))
478 513 #define sk_DIST_POINT_delete_ptr(st, ptr) SKM_sk_delete_ptr(DIST_POINT, (st), (ptr))
479 514 #define sk_DIST_POINT_insert(st, val, i) SKM_sk_insert(DIST_POINT, (st), (val), (i))
... ... @@ -483,6 +518,7 @@ STACK_OF(type) \
483 518 #define sk_DIST_POINT_shift(st) SKM_sk_shift(DIST_POINT, (st))
484 519 #define sk_DIST_POINT_pop(st) SKM_sk_pop(DIST_POINT, (st))
485 520 #define sk_DIST_POINT_sort(st) SKM_sk_sort(DIST_POINT, (st))
  521 +#define sk_DIST_POINT_is_sorted(st) SKM_sk_is_sorted(DIST_POINT, (st))
486 522  
487 523 #define sk_ENGINE_new(st) SKM_sk_new(ENGINE, (st))
488 524 #define sk_ENGINE_new_null() SKM_sk_new_null(ENGINE)
... ... @@ -494,6 +530,7 @@ STACK_OF(type) \
494 530 #define sk_ENGINE_push(st, val) SKM_sk_push(ENGINE, (st), (val))
495 531 #define sk_ENGINE_unshift(st, val) SKM_sk_unshift(ENGINE, (st), (val))
496 532 #define sk_ENGINE_find(st, val) SKM_sk_find(ENGINE, (st), (val))
  533 +#define sk_ENGINE_find_ex(st, val) SKM_sk_find_ex(ENGINE, (st), (val))
497 534 #define sk_ENGINE_delete(st, i) SKM_sk_delete(ENGINE, (st), (i))
498 535 #define sk_ENGINE_delete_ptr(st, ptr) SKM_sk_delete_ptr(ENGINE, (st), (ptr))
499 536 #define sk_ENGINE_insert(st, val, i) SKM_sk_insert(ENGINE, (st), (val), (i))
... ... @@ -503,6 +540,7 @@ STACK_OF(type) \
503 540 #define sk_ENGINE_shift(st) SKM_sk_shift(ENGINE, (st))
504 541 #define sk_ENGINE_pop(st) SKM_sk_pop(ENGINE, (st))
505 542 #define sk_ENGINE_sort(st) SKM_sk_sort(ENGINE, (st))
  543 +#define sk_ENGINE_is_sorted(st) SKM_sk_is_sorted(ENGINE, (st))
506 544  
507 545 #define sk_ENGINE_CLEANUP_ITEM_new(st) SKM_sk_new(ENGINE_CLEANUP_ITEM, (st))
508 546 #define sk_ENGINE_CLEANUP_ITEM_new_null() SKM_sk_new_null(ENGINE_CLEANUP_ITEM)
... ... @@ -514,6 +552,7 @@ STACK_OF(type) \
514 552 #define sk_ENGINE_CLEANUP_ITEM_push(st, val) SKM_sk_push(ENGINE_CLEANUP_ITEM, (st), (val))
515 553 #define sk_ENGINE_CLEANUP_ITEM_unshift(st, val) SKM_sk_unshift(ENGINE_CLEANUP_ITEM, (st), (val))
516 554 #define sk_ENGINE_CLEANUP_ITEM_find(st, val) SKM_sk_find(ENGINE_CLEANUP_ITEM, (st), (val))
  555 +#define sk_ENGINE_CLEANUP_ITEM_find_ex(st, val) SKM_sk_find_ex(ENGINE_CLEANUP_ITEM, (st), (val))
517 556 #define sk_ENGINE_CLEANUP_ITEM_delete(st, i) SKM_sk_delete(ENGINE_CLEANUP_ITEM, (st), (i))
518 557 #define sk_ENGINE_CLEANUP_ITEM_delete_ptr(st, ptr) SKM_sk_delete_ptr(ENGINE_CLEANUP_ITEM, (st), (ptr))
519 558 #define sk_ENGINE_CLEANUP_ITEM_insert(st, val, i) SKM_sk_insert(ENGINE_CLEANUP_ITEM, (st), (val), (i))
... ... @@ -523,6 +562,7 @@ STACK_OF(type) \
523 562 #define sk_ENGINE_CLEANUP_ITEM_shift(st) SKM_sk_shift(ENGINE_CLEANUP_ITEM, (st))
524 563 #define sk_ENGINE_CLEANUP_ITEM_pop(st) SKM_sk_pop(ENGINE_CLEANUP_ITEM, (st))
525 564 #define sk_ENGINE_CLEANUP_ITEM_sort(st) SKM_sk_sort(ENGINE_CLEANUP_ITEM, (st))
  565 +#define sk_ENGINE_CLEANUP_ITEM_is_sorted(st) SKM_sk_is_sorted(ENGINE_CLEANUP_ITEM, (st))
526 566  
527 567 #define sk_GENERAL_NAME_new(st) SKM_sk_new(GENERAL_NAME, (st))
528 568 #define sk_GENERAL_NAME_new_null() SKM_sk_new_null(GENERAL_NAME)
... ... @@ -534,6 +574,7 @@ STACK_OF(type) \
534 574 #define sk_GENERAL_NAME_push(st, val) SKM_sk_push(GENERAL_NAME, (st), (val))
535 575 #define sk_GENERAL_NAME_unshift(st, val) SKM_sk_unshift(GENERAL_NAME, (st), (val))
536 576 #define sk_GENERAL_NAME_find(st, val) SKM_sk_find(GENERAL_NAME, (st), (val))
  577 +#define sk_GENERAL_NAME_find_ex(st, val) SKM_sk_find_ex(GENERAL_NAME, (st), (val))
537 578 #define sk_GENERAL_NAME_delete(st, i) SKM_sk_delete(GENERAL_NAME, (st), (i))
538 579 #define sk_GENERAL_NAME_delete_ptr(st, ptr) SKM_sk_delete_ptr(GENERAL_NAME, (st), (ptr))
539 580 #define sk_GENERAL_NAME_insert(st, val, i) SKM_sk_insert(GENERAL_NAME, (st), (val), (i))
... ... @@ -543,6 +584,29 @@ STACK_OF(type) \
543 584 #define sk_GENERAL_NAME_shift(st) SKM_sk_shift(GENERAL_NAME, (st))
544 585 #define sk_GENERAL_NAME_pop(st) SKM_sk_pop(GENERAL_NAME, (st))
545 586 #define sk_GENERAL_NAME_sort(st) SKM_sk_sort(GENERAL_NAME, (st))
  587 +#define sk_GENERAL_NAME_is_sorted(st) SKM_sk_is_sorted(GENERAL_NAME, (st))
  588 +
  589 +#define sk_GENERAL_SUBTREE_new(st) SKM_sk_new(GENERAL_SUBTREE, (st))
  590 +#define sk_GENERAL_SUBTREE_new_null() SKM_sk_new_null(GENERAL_SUBTREE)
  591 +#define sk_GENERAL_SUBTREE_free(st) SKM_sk_free(GENERAL_SUBTREE, (st))
  592 +#define sk_GENERAL_SUBTREE_num(st) SKM_sk_num(GENERAL_SUBTREE, (st))
  593 +#define sk_GENERAL_SUBTREE_value(st, i) SKM_sk_value(GENERAL_SUBTREE, (st), (i))
  594 +#define sk_GENERAL_SUBTREE_set(st, i, val) SKM_sk_set(GENERAL_SUBTREE, (st), (i), (val))
  595 +#define sk_GENERAL_SUBTREE_zero(st) SKM_sk_zero(GENERAL_SUBTREE, (st))
  596 +#define sk_GENERAL_SUBTREE_push(st, val) SKM_sk_push(GENERAL_SUBTREE, (st), (val))
  597 +#define sk_GENERAL_SUBTREE_unshift(st, val) SKM_sk_unshift(GENERAL_SUBTREE, (st), (val))
  598 +#define sk_GENERAL_SUBTREE_find(st, val) SKM_sk_find(GENERAL_SUBTREE, (st), (val))
  599 +#define sk_GENERAL_SUBTREE_find_ex(st, val) SKM_sk_find_ex(GENERAL_SUBTREE, (st), (val))
  600 +#define sk_GENERAL_SUBTREE_delete(st, i) SKM_sk_delete(GENERAL_SUBTREE, (st), (i))
  601 +#define sk_GENERAL_SUBTREE_delete_ptr(st, ptr) SKM_sk_delete_ptr(GENERAL_SUBTREE, (st), (ptr))
  602 +#define sk_GENERAL_SUBTREE_insert(st, val, i) SKM_sk_insert(GENERAL_SUBTREE, (st), (val), (i))
  603 +#define sk_GENERAL_SUBTREE_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(GENERAL_SUBTREE, (st), (cmp))
  604 +#define sk_GENERAL_SUBTREE_dup(st) SKM_sk_dup(GENERAL_SUBTREE, st)
  605 +#define sk_GENERAL_SUBTREE_pop_free(st, free_func) SKM_sk_pop_free(GENERAL_SUBTREE, (st), (free_func))
  606 +#define sk_GENERAL_SUBTREE_shift(st) SKM_sk_shift(GENERAL_SUBTREE, (st))
  607 +#define sk_GENERAL_SUBTREE_pop(st) SKM_sk_pop(GENERAL_SUBTREE, (st))
  608 +#define sk_GENERAL_SUBTREE_sort(st) SKM_sk_sort(GENERAL_SUBTREE, (st))
  609 +#define sk_GENERAL_SUBTREE_is_sorted(st) SKM_sk_is_sorted(GENERAL_SUBTREE, (st))
546 610  
547 611 #define sk_KRB5_APREQBODY_new(st) SKM_sk_new(KRB5_APREQBODY, (st))
548 612 #define sk_KRB5_APREQBODY_new_null() SKM_sk_new_null(KRB5_APREQBODY)
... ... @@ -554,6 +618,7 @@ STACK_OF(type) \
554 618 #define sk_KRB5_APREQBODY_push(st, val) SKM_sk_push(KRB5_APREQBODY, (st), (val))
555 619 #define sk_KRB5_APREQBODY_unshift(st, val) SKM_sk_unshift(KRB5_APREQBODY, (st), (val))
556 620 #define sk_KRB5_APREQBODY_find(st, val) SKM_sk_find(KRB5_APREQBODY, (st), (val))
  621 +#define sk_KRB5_APREQBODY_find_ex(st, val) SKM_sk_find_ex(KRB5_APREQBODY, (st), (val))
557 622 #define sk_KRB5_APREQBODY_delete(st, i) SKM_sk_delete(KRB5_APREQBODY, (st), (i))
558 623 #define sk_KRB5_APREQBODY_delete_ptr(st, ptr) SKM_sk_delete_ptr(KRB5_APREQBODY, (st), (ptr))
559 624 #define sk_KRB5_APREQBODY_insert(st, val, i) SKM_sk_insert(KRB5_APREQBODY, (st), (val), (i))
... ... @@ -563,6 +628,7 @@ STACK_OF(type) \
563 628 #define sk_KRB5_APREQBODY_shift(st) SKM_sk_shift(KRB5_APREQBODY, (st))
564 629 #define sk_KRB5_APREQBODY_pop(st) SKM_sk_pop(KRB5_APREQBODY, (st))
565 630 #define sk_KRB5_APREQBODY_sort(st) SKM_sk_sort(KRB5_APREQBODY, (st))
  631 +#define sk_KRB5_APREQBODY_is_sorted(st) SKM_sk_is_sorted(KRB5_APREQBODY, (st))
566 632  
567 633 #define sk_KRB5_AUTHDATA_new(st) SKM_sk_new(KRB5_AUTHDATA, (st))
568 634 #define sk_KRB5_AUTHDATA_new_null() SKM_sk_new_null(KRB5_AUTHDATA)
... ... @@ -574,6 +640,7 @@ STACK_OF(type) \
574 640 #define sk_KRB5_AUTHDATA_push(st, val) SKM_sk_push(KRB5_AUTHDATA, (st), (val))
575 641 #define sk_KRB5_AUTHDATA_unshift(st, val) SKM_sk_unshift(KRB5_AUTHDATA, (st), (val))
576 642 #define sk_KRB5_AUTHDATA_find(st, val) SKM_sk_find(KRB5_AUTHDATA, (st), (val))
  643 +#define sk_KRB5_AUTHDATA_find_ex(st, val) SKM_sk_find_ex(KRB5_AUTHDATA, (st), (val))
577 644 #define sk_KRB5_AUTHDATA_delete(st, i) SKM_sk_delete(KRB5_AUTHDATA, (st), (i))
578 645 #define sk_KRB5_AUTHDATA_delete_ptr(st, ptr) SKM_sk_delete_ptr(KRB5_AUTHDATA, (st), (ptr))
579 646 #define sk_KRB5_AUTHDATA_insert(st, val, i) SKM_sk_insert(KRB5_AUTHDATA, (st), (val), (i))
... ... @@ -583,6 +650,7 @@ STACK_OF(type) \
583 650 #define sk_KRB5_AUTHDATA_shift(st) SKM_sk_shift(KRB5_AUTHDATA, (st))
584 651 #define sk_KRB5_AUTHDATA_pop(st) SKM_sk_pop(KRB5_AUTHDATA, (st))
585 652 #define sk_KRB5_AUTHDATA_sort(st) SKM_sk_sort(KRB5_AUTHDATA, (st))
  653 +#define sk_KRB5_AUTHDATA_is_sorted(st) SKM_sk_is_sorted(KRB5_AUTHDATA, (st))
586 654  
587 655 #define sk_KRB5_AUTHENTBODY_new(st) SKM_sk_new(KRB5_AUTHENTBODY, (st))
588 656 #define sk_KRB5_AUTHENTBODY_new_null() SKM_sk_new_null(KRB5_AUTHENTBODY)
... ... @@ -594,6 +662,7 @@ STACK_OF(type) \
594 662 #define sk_KRB5_AUTHENTBODY_push(st, val) SKM_sk_push(KRB5_AUTHENTBODY, (st), (val))
595 663 #define sk_KRB5_AUTHENTBODY_unshift(st, val) SKM_sk_unshift(KRB5_AUTHENTBODY, (st), (val))
596 664 #define sk_KRB5_AUTHENTBODY_find(st, val) SKM_sk_find(KRB5_AUTHENTBODY, (st), (val))
  665 +#define sk_KRB5_AUTHENTBODY_find_ex(st, val) SKM_sk_find_ex(KRB5_AUTHENTBODY, (st), (val))
597 666 #define sk_KRB5_AUTHENTBODY_delete(st, i) SKM_sk_delete(KRB5_AUTHENTBODY, (st), (i))
598 667 #define sk_KRB5_AUTHENTBODY_delete_ptr(st, ptr) SKM_sk_delete_ptr(KRB5_AUTHENTBODY, (st), (ptr))
599 668 #define sk_KRB5_AUTHENTBODY_insert(st, val, i) SKM_sk_insert(KRB5_AUTHENTBODY, (st), (val), (i))
... ... @@ -603,6 +672,7 @@ STACK_OF(type) \
603 672 #define sk_KRB5_AUTHENTBODY_shift(st) SKM_sk_shift(KRB5_AUTHENTBODY, (st))
604 673 #define sk_KRB5_AUTHENTBODY_pop(st) SKM_sk_pop(KRB5_AUTHENTBODY, (st))
605 674 #define sk_KRB5_AUTHENTBODY_sort(st) SKM_sk_sort(KRB5_AUTHENTBODY, (st))
  675 +#define sk_KRB5_AUTHENTBODY_is_sorted(st) SKM_sk_is_sorted(KRB5_AUTHENTBODY, (st))
606 676  
607 677 #define sk_KRB5_CHECKSUM_new(st) SKM_sk_new(KRB5_CHECKSUM, (st))
608 678 #define sk_KRB5_CHECKSUM_new_null() SKM_sk_new_null(KRB5_CHECKSUM)
... ... @@ -614,6 +684,7 @@ STACK_OF(type) \
614 684 #define sk_KRB5_CHECKSUM_push(st, val) SKM_sk_push(KRB5_CHECKSUM, (st), (val))
615 685 #define sk_KRB5_CHECKSUM_unshift(st, val) SKM_sk_unshift(KRB5_CHECKSUM, (st), (val))
616 686 #define sk_KRB5_CHECKSUM_find(st, val) SKM_sk_find(KRB5_CHECKSUM, (st), (val))
  687 +#define sk_KRB5_CHECKSUM_find_ex(st, val) SKM_sk_find_ex(KRB5_CHECKSUM, (st), (val))
617 688 #define sk_KRB5_CHECKSUM_delete(st, i) SKM_sk_delete(KRB5_CHECKSUM, (st), (i))
618 689 #define sk_KRB5_CHECKSUM_delete_ptr(st, ptr) SKM_sk_delete_ptr(KRB5_CHECKSUM, (st), (ptr))
619 690 #define sk_KRB5_CHECKSUM_insert(st, val, i) SKM_sk_insert(KRB5_CHECKSUM, (st), (val), (i))
... ... @@ -623,6 +694,7 @@ STACK_OF(type) \
623 694 #define sk_KRB5_CHECKSUM_shift(st) SKM_sk_shift(KRB5_CHECKSUM, (st))
624 695 #define sk_KRB5_CHECKSUM_pop(st) SKM_sk_pop(KRB5_CHECKSUM, (st))
625 696 #define sk_KRB5_CHECKSUM_sort(st) SKM_sk_sort(KRB5_CHECKSUM, (st))
  697 +#define sk_KRB5_CHECKSUM_is_sorted(st) SKM_sk_is_sorted(KRB5_CHECKSUM, (st))
626 698  
627 699 #define sk_KRB5_ENCDATA_new(st) SKM_sk_new(KRB5_ENCDATA, (st))
628 700 #define sk_KRB5_ENCDATA_new_null() SKM_sk_new_null(KRB5_ENCDATA)
... ... @@ -634,6 +706,7 @@ STACK_OF(type) \
634 706 #define sk_KRB5_ENCDATA_push(st, val) SKM_sk_push(KRB5_ENCDATA, (st), (val))
635 707 #define sk_KRB5_ENCDATA_unshift(st, val) SKM_sk_unshift(KRB5_ENCDATA, (st), (val))
636 708 #define sk_KRB5_ENCDATA_find(st, val) SKM_sk_find(KRB5_ENCDATA, (st), (val))
  709 +#define sk_KRB5_ENCDATA_find_ex(st, val) SKM_sk_find_ex(KRB5_ENCDATA, (st), (val))
637 710 #define sk_KRB5_ENCDATA_delete(st, i) SKM_sk_delete(KRB5_ENCDATA, (st), (i))
638 711 #define sk_KRB5_ENCDATA_delete_ptr(st, ptr) SKM_sk_delete_ptr(KRB5_ENCDATA, (st), (ptr))
639 712 #define sk_KRB5_ENCDATA_insert(st, val, i) SKM_sk_insert(KRB5_ENCDATA, (st), (val), (i))
... ... @@ -643,6 +716,7 @@ STACK_OF(type) \
643 716 #define sk_KRB5_ENCDATA_shift(st) SKM_sk_shift(KRB5_ENCDATA, (st))
644 717 #define sk_KRB5_ENCDATA_pop(st) SKM_sk_pop(KRB5_ENCDATA, (st))
645 718 #define sk_KRB5_ENCDATA_sort(st) SKM_sk_sort(KRB5_ENCDATA, (st))
  719 +#define sk_KRB5_ENCDATA_is_sorted(st) SKM_sk_is_sorted(KRB5_ENCDATA, (st))
646 720  
647 721 #define sk_KRB5_ENCKEY_new(st) SKM_sk_new(KRB5_ENCKEY, (st))
648 722 #define sk_KRB5_ENCKEY_new_null() SKM_sk_new_null(KRB5_ENCKEY)
... ... @@ -654,6 +728,7 @@ STACK_OF(type) \
654 728 #define sk_KRB5_ENCKEY_push(st, val) SKM_sk_push(KRB5_ENCKEY, (st), (val))
655 729 #define sk_KRB5_ENCKEY_unshift(st, val) SKM_sk_unshift(KRB5_ENCKEY, (st), (val))
656 730 #define sk_KRB5_ENCKEY_find(st, val) SKM_sk_find(KRB5_ENCKEY, (st), (val))
  731 +#define sk_KRB5_ENCKEY_find_ex(st, val) SKM_sk_find_ex(KRB5_ENCKEY, (st), (val))
657 732 #define sk_KRB5_ENCKEY_delete(st, i) SKM_sk_delete(KRB5_ENCKEY, (st), (i))
658 733 #define sk_KRB5_ENCKEY_delete_ptr(st, ptr) SKM_sk_delete_ptr(KRB5_ENCKEY, (st), (ptr))
659 734 #define sk_KRB5_ENCKEY_insert(st, val, i) SKM_sk_insert(KRB5_ENCKEY, (st), (val), (i))
... ... @@ -663,6 +738,7 @@ STACK_OF(type) \
663 738 #define sk_KRB5_ENCKEY_shift(st) SKM_sk_shift(KRB5_ENCKEY, (st))
664 739 #define sk_KRB5_ENCKEY_pop(st) SKM_sk_pop(KRB5_ENCKEY, (st))
665 740 #define sk_KRB5_ENCKEY_sort(st) SKM_sk_sort(KRB5_ENCKEY, (st))
  741 +#define sk_KRB5_ENCKEY_is_sorted(st) SKM_sk_is_sorted(KRB5_ENCKEY, (st))
666 742  
667 743 #define sk_KRB5_PRINCNAME_new(st) SKM_sk_new(KRB5_PRINCNAME, (st))
668 744 #define sk_KRB5_PRINCNAME_new_null() SKM_sk_new_null(KRB5_PRINCNAME)
... ... @@ -674,6 +750,7 @@ STACK_OF(type) \
674 750 #define sk_KRB5_PRINCNAME_push(st, val) SKM_sk_push(KRB5_PRINCNAME, (st), (val))
675 751 #define sk_KRB5_PRINCNAME_unshift(st, val) SKM_sk_unshift(KRB5_PRINCNAME, (st), (val))
676 752 #define sk_KRB5_PRINCNAME_find(st, val) SKM_sk_find(KRB5_PRINCNAME, (st), (val))
  753 +#define sk_KRB5_PRINCNAME_find_ex(st, val) SKM_sk_find_ex(KRB5_PRINCNAME, (st), (val))
677 754 #define sk_KRB5_PRINCNAME_delete(st, i) SKM_sk_delete(KRB5_PRINCNAME, (st), (i))
678 755 #define sk_KRB5_PRINCNAME_delete_ptr(st, ptr) SKM_sk_delete_ptr(KRB5_PRINCNAME, (st), (ptr))
679 756 #define sk_KRB5_PRINCNAME_insert(st, val, i) SKM_sk_insert(KRB5_PRINCNAME, (st), (val), (i))
... ... @@ -683,6 +760,7 @@ STACK_OF(type) \
683 760 #define sk_KRB5_PRINCNAME_shift(st) SKM_sk_shift(KRB5_PRINCNAME, (st))
684 761 #define sk_KRB5_PRINCNAME_pop(st) SKM_sk_pop(KRB5_PRINCNAME, (st))
685 762 #define sk_KRB5_PRINCNAME_sort(st) SKM_sk_sort(KRB5_PRINCNAME, (st))
  763 +#define sk_KRB5_PRINCNAME_is_sorted(st) SKM_sk_is_sorted(KRB5_PRINCNAME, (st))
686 764  
687 765 #define sk_KRB5_TKTBODY_new(st) SKM_sk_new(KRB5_TKTBODY, (st))
688 766 #define sk_KRB5_TKTBODY_new_null() SKM_sk_new_null(KRB5_TKTBODY)
... ... @@ -694,6 +772,7 @@ STACK_OF(type) \
694 772 #define sk_KRB5_TKTBODY_push(st, val) SKM_sk_push(KRB5_TKTBODY, (st), (val))
695 773 #define sk_KRB5_TKTBODY_unshift(st, val) SKM_sk_unshift(KRB5_TKTBODY, (st), (val))
696 774 #define sk_KRB5_TKTBODY_find(st, val) SKM_sk_find(KRB5_TKTBODY, (st), (val))
  775 +#define sk_KRB5_TKTBODY_find_ex(st, val) SKM_sk_find_ex(KRB5_TKTBODY, (st), (val))
697 776 #define sk_KRB5_TKTBODY_delete(st, i) SKM_sk_delete(KRB5_TKTBODY, (st), (i))
698 777 #define sk_KRB5_TKTBODY_delete_ptr(st, ptr) SKM_sk_delete_ptr(KRB5_TKTBODY, (st), (ptr))
699 778 #define sk_KRB5_TKTBODY_insert(st, val, i) SKM_sk_insert(KRB5_TKTBODY, (st), (val), (i))
... ... @@ -703,6 +782,7 @@ STACK_OF(type) \
703 782 #define sk_KRB5_TKTBODY_shift(st) SKM_sk_shift(KRB5_TKTBODY, (st))
704 783 #define sk_KRB5_TKTBODY_pop(st) SKM_sk_pop(KRB5_TKTBODY, (st))
705 784 #define sk_KRB5_TKTBODY_sort(st) SKM_sk_sort(KRB5_TKTBODY, (st))
  785 +#define sk_KRB5_TKTBODY_is_sorted(st) SKM_sk_is_sorted(KRB5_TKTBODY, (st))
706 786  
707 787 #define sk_MIME_HEADER_new(st) SKM_sk_new(MIME_HEADER, (st))
708 788 #define sk_MIME_HEADER_new_null() SKM_sk_new_null(MIME_HEADER)
... ... @@ -714,6 +794,7 @@ STACK_OF(type) \
714 794 #define sk_MIME_HEADER_push(st, val) SKM_sk_push(MIME_HEADER, (st), (val))
715 795 #define sk_MIME_HEADER_unshift(st, val) SKM_sk_unshift(MIME_HEADER, (st), (val))
716 796 #define sk_MIME_HEADER_find(st, val) SKM_sk_find(MIME_HEADER, (st), (val))
  797 +#define sk_MIME_HEADER_find_ex(st, val) SKM_sk_find_ex(MIME_HEADER, (st), (val))
717 798 #define sk_MIME_HEADER_delete(st, i) SKM_sk_delete(MIME_HEADER, (st), (i))
718 799 #define sk_MIME_HEADER_delete_ptr(st, ptr) SKM_sk_delete_ptr(MIME_HEADER, (st), (ptr))
719 800 #define sk_MIME_HEADER_insert(st, val, i) SKM_sk_insert(MIME_HEADER, (st), (val), (i))
... ... @@ -723,6 +804,7 @@ STACK_OF(type) \
723 804 #define sk_MIME_HEADER_shift(st) SKM_sk_shift(MIME_HEADER, (st))
724 805 #define sk_MIME_HEADER_pop(st) SKM_sk_pop(MIME_HEADER, (st))
725 806 #define sk_MIME_HEADER_sort(st) SKM_sk_sort(MIME_HEADER, (st))
  807 +#define sk_MIME_HEADER_is_sorted(st) SKM_sk_is_sorted(MIME_HEADER, (st))
726 808  
727 809 #define sk_MIME_PARAM_new(st) SKM_sk_new(MIME_PARAM, (st))
728 810 #define sk_MIME_PARAM_new_null() SKM_sk_new_null(MIME_PARAM)
... ... @@ -734,6 +816,7 @@ STACK_OF(type) \
734 816 #define sk_MIME_PARAM_push(st, val) SKM_sk_push(MIME_PARAM, (st), (val))
735 817 #define sk_MIME_PARAM_unshift(st, val) SKM_sk_unshift(MIME_PARAM, (st), (val))
736 818 #define sk_MIME_PARAM_find(st, val) SKM_sk_find(MIME_PARAM, (st), (val))
  819 +#define sk_MIME_PARAM_find_ex(st, val) SKM_sk_find_ex(MIME_PARAM, (st), (val))
737 820 #define sk_MIME_PARAM_delete(st, i) SKM_sk_delete(MIME_PARAM, (st), (i))
738 821 #define sk_MIME_PARAM_delete_ptr(st, ptr) SKM_sk_delete_ptr(MIME_PARAM, (st), (ptr))
739 822 #define sk_MIME_PARAM_insert(st, val, i) SKM_sk_insert(MIME_PARAM, (st), (val), (i))
... ... @@ -743,6 +826,7 @@ STACK_OF(type) \
743 826 #define sk_MIME_PARAM_shift(st) SKM_sk_shift(MIME_PARAM, (st))
744 827 #define sk_MIME_PARAM_pop(st) SKM_sk_pop(MIME_PARAM, (st))
745 828 #define sk_MIME_PARAM_sort(st) SKM_sk_sort(MIME_PARAM, (st))
  829 +#define sk_MIME_PARAM_is_sorted(st) SKM_sk_is_sorted(MIME_PARAM, (st))
746 830  
747 831 #define sk_NAME_FUNCS_new(st) SKM_sk_new(NAME_FUNCS, (st))
748 832 #define sk_NAME_FUNCS_new_null() SKM_sk_new_null(NAME_FUNCS)
... ... @@ -754,6 +838,7 @@ STACK_OF(type) \
754 838 #define sk_NAME_FUNCS_push(st, val) SKM_sk_push(NAME_FUNCS, (st), (val))
755 839 #define sk_NAME_FUNCS_unshift(st, val) SKM_sk_unshift(NAME_FUNCS, (st), (val))
756 840 #define sk_NAME_FUNCS_find(st, val) SKM_sk_find(NAME_FUNCS, (st), (val))
  841 +#define sk_NAME_FUNCS_find_ex(st, val) SKM_sk_find_ex(NAME_FUNCS, (st), (val))
757 842 #define sk_NAME_FUNCS_delete(st, i) SKM_sk_delete(NAME_FUNCS, (st), (i))
758 843 #define sk_NAME_FUNCS_delete_ptr(st, ptr) SKM_sk_delete_ptr(NAME_FUNCS, (st), (ptr))
759 844 #define sk_NAME_FUNCS_insert(st, val, i) SKM_sk_insert(NAME_FUNCS, (st), (val), (i))
... ... @@ -763,6 +848,7 @@ STACK_OF(type) \
763 848 #define sk_NAME_FUNCS_shift(st) SKM_sk_shift(NAME_FUNCS, (st))
764 849 #define sk_NAME_FUNCS_pop(st) SKM_sk_pop(NAME_FUNCS, (st))
765 850 #define sk_NAME_FUNCS_sort(st) SKM_sk_sort(NAME_FUNCS, (st))
  851 +#define sk_NAME_FUNCS_is_sorted(st) SKM_sk_is_sorted(NAME_FUNCS, (st))
766 852  
767 853 #define sk_OCSP_CERTID_new(st) SKM_sk_new(OCSP_CERTID, (st))
768 854 #define sk_OCSP_CERTID_new_null() SKM_sk_new_null(OCSP_CERTID)
... ... @@ -774,6 +860,7 @@ STACK_OF(type) \
774 860 #define sk_OCSP_CERTID_push(st, val) SKM_sk_push(OCSP_CERTID, (st), (val))
775 861 #define sk_OCSP_CERTID_unshift(st, val) SKM_sk_unshift(OCSP_CERTID, (st), (val))
776 862 #define sk_OCSP_CERTID_find(st, val) SKM_sk_find(OCSP_CERTID, (st), (val))
  863 +#define sk_OCSP_CERTID_find_ex(st, val) SKM_sk_find_ex(OCSP_CERTID, (st), (val))
777 864 #define sk_OCSP_CERTID_delete(st, i) SKM_sk_delete(OCSP_CERTID, (st), (i))
778 865 #define sk_OCSP_CERTID_delete_ptr(st, ptr) SKM_sk_delete_ptr(OCSP_CERTID, (st), (ptr))
779 866 #define sk_OCSP_CERTID_insert(st, val, i) SKM_sk_insert(OCSP_CERTID, (st), (val), (i))
... ... @@ -783,6 +870,7 @@ STACK_OF(type) \
783 870 #define sk_OCSP_CERTID_shift(st) SKM_sk_shift(OCSP_CERTID, (st))
784 871 #define sk_OCSP_CERTID_pop(st) SKM_sk_pop(OCSP_CERTID, (st))
785 872 #define sk_OCSP_CERTID_sort(st) SKM_sk_sort(OCSP_CERTID, (st))
  873 +#define sk_OCSP_CERTID_is_sorted(st) SKM_sk_is_sorted(OCSP_CERTID, (st))
786 874  
787 875 #define sk_OCSP_ONEREQ_new(st) SKM_sk_new(OCSP_ONEREQ, (st))
788 876 #define sk_OCSP_ONEREQ_new_null() SKM_sk_new_null(OCSP_ONEREQ)
... ... @@ -794,6 +882,7 @@ STACK_OF(type) \
794 882 #define sk_OCSP_ONEREQ_push(st, val) SKM_sk_push(OCSP_ONEREQ, (st), (val))
795 883 #define sk_OCSP_ONEREQ_unshift(st, val) SKM_sk_unshift(OCSP_ONEREQ, (st), (val))
796 884 #define sk_OCSP_ONEREQ_find(st, val) SKM_sk_find(OCSP_ONEREQ, (st), (val))
  885 +#define sk_OCSP_ONEREQ_find_ex(st, val) SKM_sk_find_ex(OCSP_ONEREQ, (st), (val))
797 886 #define sk_OCSP_ONEREQ_delete(st, i) SKM_sk_delete(OCSP_ONEREQ, (st), (i))
798 887 #define sk_OCSP_ONEREQ_delete_ptr(st, ptr) SKM_sk_delete_ptr(OCSP_ONEREQ, (st), (ptr))
799 888 #define sk_OCSP_ONEREQ_insert(st, val, i) SKM_sk_insert(OCSP_ONEREQ, (st), (val), (i))
... ... @@ -803,6 +892,7 @@ STACK_OF(type) \
803 892 #define sk_OCSP_ONEREQ_shift(st) SKM_sk_shift(OCSP_ONEREQ, (st))
804 893 #define sk_OCSP_ONEREQ_pop(st) SKM_sk_pop(OCSP_ONEREQ, (st))
805 894 #define sk_OCSP_ONEREQ_sort(st) SKM_sk_sort(OCSP_ONEREQ, (st))
  895 +#define sk_OCSP_ONEREQ_is_sorted(st) SKM_sk_is_sorted(OCSP_ONEREQ, (st))
806 896  
807 897 #define sk_OCSP_SINGLERESP_new(st) SKM_sk_new(OCSP_SINGLERESP, (st))
808 898 #define sk_OCSP_SINGLERESP_new_null() SKM_sk_new_null(OCSP_SINGLERESP)
... ... @@ -814,6 +904,7 @@ STACK_OF(type) \
814 904 #define sk_OCSP_SINGLERESP_push(st, val) SKM_sk_push(OCSP_SINGLERESP, (st), (val))
815 905 #define sk_OCSP_SINGLERESP_unshift(st, val) SKM_sk_unshift(OCSP_SINGLERESP, (st), (val))
816 906 #define sk_OCSP_SINGLERESP_find(st, val) SKM_sk_find(OCSP_SINGLERESP, (st), (val))
  907 +#define sk_OCSP_SINGLERESP_find_ex(st, val) SKM_sk_find_ex(OCSP_SINGLERESP, (st), (val))
817 908 #define sk_OCSP_SINGLERESP_delete(st, i) SKM_sk_delete(OCSP_SINGLERESP, (st), (i))
818 909 #define sk_OCSP_SINGLERESP_delete_ptr(st, ptr) SKM_sk_delete_ptr(OCSP_SINGLERESP, (st), (ptr))
819 910 #define sk_OCSP_SINGLERESP_insert(st, val, i) SKM_sk_insert(OCSP_SINGLERESP, (st), (val), (i))
... ... @@ -823,6 +914,7 @@ STACK_OF(type) \
823 914 #define sk_OCSP_SINGLERESP_shift(st) SKM_sk_shift(OCSP_SINGLERESP, (st))
824 915 #define sk_OCSP_SINGLERESP_pop(st) SKM_sk_pop(OCSP_SINGLERESP, (st))
825 916 #define sk_OCSP_SINGLERESP_sort(st) SKM_sk_sort(OCSP_SINGLERESP, (st))
  917 +#define sk_OCSP_SINGLERESP_is_sorted(st) SKM_sk_is_sorted(OCSP_SINGLERESP, (st))
826 918  
827 919 #define sk_PKCS12_SAFEBAG_new(st) SKM_sk_new(PKCS12_SAFEBAG, (st))
828 920 #define sk_PKCS12_SAFEBAG_new_null() SKM_sk_new_null(PKCS12_SAFEBAG)
... ... @@ -834,6 +926,7 @@ STACK_OF(type) \
834 926 #define sk_PKCS12_SAFEBAG_push(st, val) SKM_sk_push(PKCS12_SAFEBAG, (st), (val))
835 927 #define sk_PKCS12_SAFEBAG_unshift(st, val) SKM_sk_unshift(PKCS12_SAFEBAG, (st), (val))
836 928 #define sk_PKCS12_SAFEBAG_find(st, val) SKM_sk_find(PKCS12_SAFEBAG, (st), (val))
  929 +#define sk_PKCS12_SAFEBAG_find_ex(st, val) SKM_sk_find_ex(PKCS12_SAFEBAG, (st), (val))
837 930 #define sk_PKCS12_SAFEBAG_delete(st, i) SKM_sk_delete(PKCS12_SAFEBAG, (st), (i))
838 931 #define sk_PKCS12_SAFEBAG_delete_ptr(st, ptr) SKM_sk_delete_ptr(PKCS12_SAFEBAG, (st), (ptr))
839 932 #define sk_PKCS12_SAFEBAG_insert(st, val, i) SKM_sk_insert(PKCS12_SAFEBAG, (st), (val), (i))
... ... @@ -843,6 +936,7 @@ STACK_OF(type) \
843 936 #define sk_PKCS12_SAFEBAG_shift(st) SKM_sk_shift(PKCS12_SAFEBAG, (st))
844 937 #define sk_PKCS12_SAFEBAG_pop(st) SKM_sk_pop(PKCS12_SAFEBAG, (st))
845 938 #define sk_PKCS12_SAFEBAG_sort(st) SKM_sk_sort(PKCS12_SAFEBAG, (st))
  939 +#define sk_PKCS12_SAFEBAG_is_sorted(st) SKM_sk_is_sorted(PKCS12_SAFEBAG, (st))
846 940  
847 941 #define sk_PKCS7_new(st) SKM_sk_new(PKCS7, (st))
848 942 #define sk_PKCS7_new_null() SKM_sk_new_null(PKCS7)
... ... @@ -854,6 +948,7 @@ STACK_OF(type) \
854 948 #define sk_PKCS7_push(st, val) SKM_sk_push(PKCS7, (st), (val))
855 949 #define sk_PKCS7_unshift(st, val) SKM_sk_unshift(PKCS7, (st), (val))
856 950 #define sk_PKCS7_find(st, val) SKM_sk_find(PKCS7, (st), (val))
  951 +#define sk_PKCS7_find_ex(st, val) SKM_sk_find_ex(PKCS7, (st), (val))
857 952 #define sk_PKCS7_delete(st, i) SKM_sk_delete(PKCS7, (st), (i))
858 953 #define sk_PKCS7_delete_ptr(st, ptr) SKM_sk_delete_ptr(PKCS7, (st), (ptr))
859 954 #define sk_PKCS7_insert(st, val, i) SKM_sk_insert(PKCS7, (st), (val), (i))
... ... @@ -863,6 +958,7 @@ STACK_OF(type) \
863 958 #define sk_PKCS7_shift(st) SKM_sk_shift(PKCS7, (st))
864 959 #define sk_PKCS7_pop(st) SKM_sk_pop(PKCS7, (st))
865 960 #define sk_PKCS7_sort(st) SKM_sk_sort(PKCS7, (st))
  961 +#define sk_PKCS7_is_sorted(st) SKM_sk_is_sorted(PKCS7, (st))
866 962  
867 963 #define sk_PKCS7_RECIP_INFO_new(st) SKM_sk_new(PKCS7_RECIP_INFO, (st))
868 964 #define sk_PKCS7_RECIP_INFO_new_null() SKM_sk_new_null(PKCS7_RECIP_INFO)
... ... @@ -874,6 +970,7 @@ STACK_OF(type) \
874 970 #define sk_PKCS7_RECIP_INFO_push(st, val) SKM_sk_push(PKCS7_RECIP_INFO, (st), (val))
875 971 #define sk_PKCS7_RECIP_INFO_unshift(st, val) SKM_sk_unshift(PKCS7_RECIP_INFO, (st), (val))
876 972 #define sk_PKCS7_RECIP_INFO_find(st, val) SKM_sk_find(PKCS7_RECIP_INFO, (st), (val))
  973 +#define sk_PKCS7_RECIP_INFO_find_ex(st, val) SKM_sk_find_ex(PKCS7_RECIP_INFO, (st), (val))
877 974 #define sk_PKCS7_RECIP_INFO_delete(st, i) SKM_sk_delete(PKCS7_RECIP_INFO, (st), (i))
878 975 #define sk_PKCS7_RECIP_INFO_delete_ptr(st, ptr) SKM_sk_delete_ptr(PKCS7_RECIP_INFO, (st), (ptr))
879 976 #define sk_PKCS7_RECIP_INFO_insert(st, val, i) SKM_sk_insert(PKCS7_RECIP_INFO, (st), (val), (i))
... ... @@ -883,6 +980,7 @@ STACK_OF(type) \
883 980 #define sk_PKCS7_RECIP_INFO_shift(st) SKM_sk_shift(PKCS7_RECIP_INFO, (st))
884 981 #define sk_PKCS7_RECIP_INFO_pop(st) SKM_sk_pop(PKCS7_RECIP_INFO, (st))
885 982 #define sk_PKCS7_RECIP_INFO_sort(st) SKM_sk_sort(PKCS7_RECIP_INFO, (st))
  983 +#define sk_PKCS7_RECIP_INFO_is_sorted(st) SKM_sk_is_sorted(PKCS7_RECIP_INFO, (st))
886 984  
887 985 #define sk_PKCS7_SIGNER_INFO_new(st) SKM_sk_new(PKCS7_SIGNER_INFO, (st))
888 986 #define sk_PKCS7_SIGNER_INFO_new_null() SKM_sk_new_null(PKCS7_SIGNER_INFO)
... ... @@ -894,6 +992,7 @@ STACK_OF(type) \
894 992 #define sk_PKCS7_SIGNER_INFO_push(st, val) SKM_sk_push(PKCS7_SIGNER_INFO, (st), (val))
895 993 #define sk_PKCS7_SIGNER_INFO_unshift(st, val) SKM_sk_unshift(PKCS7_SIGNER_INFO, (st), (val))
896 994 #define sk_PKCS7_SIGNER_INFO_find(st, val) SKM_sk_find(PKCS7_SIGNER_INFO, (st), (val))
  995 +#define sk_PKCS7_SIGNER_INFO_find_ex(st, val) SKM_sk_find_ex(PKCS7_SIGNER_INFO, (st), (val))
897 996 #define sk_PKCS7_SIGNER_INFO_delete(st, i) SKM_sk_delete(PKCS7_SIGNER_INFO, (st), (i))
898 997 #define sk_PKCS7_SIGNER_INFO_delete_ptr(st, ptr) SKM_sk_delete_ptr(PKCS7_SIGNER_INFO, (st), (ptr))
899 998 #define sk_PKCS7_SIGNER_INFO_insert(st, val, i) SKM_sk_insert(PKCS7_SIGNER_INFO, (st), (val), (i))
... ... @@ -903,6 +1002,7 @@ STACK_OF(type) \
903 1002 #define sk_PKCS7_SIGNER_INFO_shift(st) SKM_sk_shift(PKCS7_SIGNER_INFO, (st))
904 1003 #define sk_PKCS7_SIGNER_INFO_pop(st) SKM_sk_pop(PKCS7_SIGNER_INFO, (st))
905 1004 #define sk_PKCS7_SIGNER_INFO_sort(st) SKM_sk_sort(PKCS7_SIGNER_INFO, (st))
  1005 +#define sk_PKCS7_SIGNER_INFO_is_sorted(st) SKM_sk_is_sorted(PKCS7_SIGNER_INFO, (st))
906 1006  
907 1007 #define sk_POLICYINFO_new(st) SKM_sk_new(POLICYINFO, (st))
908 1008 #define sk_POLICYINFO_new_null() SKM_sk_new_null(POLICYINFO)
... ... @@ -914,6 +1014,7 @@ STACK_OF(type) \
914 1014 #define sk_POLICYINFO_push(st, val) SKM_sk_push(POLICYINFO, (st), (val))
915 1015 #define sk_POLICYINFO_unshift(st, val) SKM_sk_unshift(POLICYINFO, (st), (val))
916 1016 #define sk_POLICYINFO_find(st, val) SKM_sk_find(POLICYINFO, (st), (val))
  1017 +#define sk_POLICYINFO_find_ex(st, val) SKM_sk_find_ex(POLICYINFO, (st), (val))
917 1018 #define sk_POLICYINFO_delete(st, i) SKM_sk_delete(POLICYINFO, (st), (i))
918 1019 #define sk_POLICYINFO_delete_ptr(st, ptr) SKM_sk_delete_ptr(POLICYINFO, (st), (ptr))
919 1020 #define sk_POLICYINFO_insert(st, val, i) SKM_sk_insert(POLICYINFO, (st), (val), (i))
... ... @@ -923,6 +1024,7 @@ STACK_OF(type) \
923 1024 #define sk_POLICYINFO_shift(st) SKM_sk_shift(POLICYINFO, (st))
924 1025 #define sk_POLICYINFO_pop(st) SKM_sk_pop(POLICYINFO, (st))
925 1026 #define sk_POLICYINFO_sort(st) SKM_sk_sort(POLICYINFO, (st))
  1027 +#define sk_POLICYINFO_is_sorted(st) SKM_sk_is_sorted(POLICYINFO, (st))
926 1028  
927 1029 #define sk_POLICYQUALINFO_new(st) SKM_sk_new(POLICYQUALINFO, (st))
928 1030 #define sk_POLICYQUALINFO_new_null() SKM_sk_new_null(POLICYQUALINFO)
... ... @@ -934,6 +1036,7 @@ STACK_OF(type) \
934 1036 #define sk_POLICYQUALINFO_push(st, val) SKM_sk_push(POLICYQUALINFO, (st), (val))
935 1037 #define sk_POLICYQUALINFO_unshift(st, val) SKM_sk_unshift(POLICYQUALINFO, (st), (val))
936 1038 #define sk_POLICYQUALINFO_find(st, val) SKM_sk_find(POLICYQUALINFO, (st), (val))
  1039 +#define sk_POLICYQUALINFO_find_ex(st, val) SKM_sk_find_ex(POLICYQUALINFO, (st), (val))
937 1040 #define sk_POLICYQUALINFO_delete(st, i) SKM_sk_delete(POLICYQUALINFO, (st), (i))
938 1041 #define sk_POLICYQUALINFO_delete_ptr(st, ptr) SKM_sk_delete_ptr(POLICYQUALINFO, (st), (ptr))
939 1042 #define sk_POLICYQUALINFO_insert(st, val, i) SKM_sk_insert(POLICYQUALINFO, (st), (val), (i))
... ... @@ -943,6 +1046,29 @@ STACK_OF(type) \
943 1046 #define sk_POLICYQUALINFO_shift(st) SKM_sk_shift(POLICYQUALINFO, (st))
944 1047 #define sk_POLICYQUALINFO_pop(st) SKM_sk_pop(POLICYQUALINFO, (st))
945 1048 #define sk_POLICYQUALINFO_sort(st) SKM_sk_sort(POLICYQUALINFO, (st))
  1049 +#define sk_POLICYQUALINFO_is_sorted(st) SKM_sk_is_sorted(POLICYQUALINFO, (st))
  1050 +
  1051 +#define sk_POLICY_MAPPING_new(st) SKM_sk_new(POLICY_MAPPING, (st))
  1052 +#define sk_POLICY_MAPPING_new_null() SKM_sk_new_null(POLICY_MAPPING)
  1053 +#define sk_POLICY_MAPPING_free(st) SKM_sk_free(POLICY_MAPPING, (st))
  1054 +#define sk_POLICY_MAPPING_num(st) SKM_sk_num(POLICY_MAPPING, (st))
  1055 +#define sk_POLICY_MAPPING_value(st, i) SKM_sk_value(POLICY_MAPPING, (st), (i))
  1056 +#define sk_POLICY_MAPPING_set(st, i, val) SKM_sk_set(POLICY_MAPPING, (st), (i), (val))
  1057 +#define sk_POLICY_MAPPING_zero(st) SKM_sk_zero(POLICY_MAPPING, (st))
  1058 +#define sk_POLICY_MAPPING_push(st, val) SKM_sk_push(POLICY_MAPPING, (st), (val))
  1059 +#define sk_POLICY_MAPPING_unshift(st, val) SKM_sk_unshift(POLICY_MAPPING, (st), (val))
  1060 +#define sk_POLICY_MAPPING_find(st, val) SKM_sk_find(POLICY_MAPPING, (st), (val))
  1061 +#define sk_POLICY_MAPPING_find_ex(st, val) SKM_sk_find_ex(POLICY_MAPPING, (st), (val))
  1062 +#define sk_POLICY_MAPPING_delete(st, i) SKM_sk_delete(POLICY_MAPPING, (st), (i))
  1063 +#define sk_POLICY_MAPPING_delete_ptr(st, ptr) SKM_sk_delete_ptr(POLICY_MAPPING, (st), (ptr))
  1064 +#define sk_POLICY_MAPPING_insert(st, val, i) SKM_sk_insert(POLICY_MAPPING, (st), (val), (i))
  1065 +#define sk_POLICY_MAPPING_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(POLICY_MAPPING, (st), (cmp))
  1066 +#define sk_POLICY_MAPPING_dup(st) SKM_sk_dup(POLICY_MAPPING, st)
  1067 +#define sk_POLICY_MAPPING_pop_free(st, free_func) SKM_sk_pop_free(POLICY_MAPPING, (st), (free_func))
  1068 +#define sk_POLICY_MAPPING_shift(st) SKM_sk_shift(POLICY_MAPPING, (st))
  1069 +#define sk_POLICY_MAPPING_pop(st) SKM_sk_pop(POLICY_MAPPING, (st))
  1070 +#define sk_POLICY_MAPPING_sort(st) SKM_sk_sort(POLICY_MAPPING, (st))
  1071 +#define sk_POLICY_MAPPING_is_sorted(st) SKM_sk_is_sorted(POLICY_MAPPING, (st))
946 1072  
947 1073 #define sk_SSL_CIPHER_new(st) SKM_sk_new(SSL_CIPHER, (st))
948 1074 #define sk_SSL_CIPHER_new_null() SKM_sk_new_null(SSL_CIPHER)
... ... @@ -954,6 +1080,7 @@ STACK_OF(type) \
954 1080 #define sk_SSL_CIPHER_push(st, val) SKM_sk_push(SSL_CIPHER, (st), (val))
955 1081 #define sk_SSL_CIPHER_unshift(st, val) SKM_sk_unshift(SSL_CIPHER, (st), (val))
956 1082 #define sk_SSL_CIPHER_find(st, val) SKM_sk_find(SSL_CIPHER, (st), (val))
  1083 +#define sk_SSL_CIPHER_find_ex(st, val) SKM_sk_find_ex(SSL_CIPHER, (st), (val))
957 1084 #define sk_SSL_CIPHER_delete(st, i) SKM_sk_delete(SSL_CIPHER, (st), (i))
958 1085 #define sk_SSL_CIPHER_delete_ptr(st, ptr) SKM_sk_delete_ptr(SSL_CIPHER, (st), (ptr))
959 1086 #define sk_SSL_CIPHER_insert(st, val, i) SKM_sk_insert(SSL_CIPHER, (st), (val), (i))
... ... @@ -963,6 +1090,7 @@ STACK_OF(type) \
963 1090 #define sk_SSL_CIPHER_shift(st) SKM_sk_shift(SSL_CIPHER, (st))
964 1091 #define sk_SSL_CIPHER_pop(st) SKM_sk_pop(SSL_CIPHER, (st))
965 1092 #define sk_SSL_CIPHER_sort(st) SKM_sk_sort(SSL_CIPHER, (st))
  1093 +#define sk_SSL_CIPHER_is_sorted(st) SKM_sk_is_sorted(SSL_CIPHER, (st))
966 1094  
967 1095 #define sk_SSL_COMP_new(st) SKM_sk_new(SSL_COMP, (st))
968 1096 #define sk_SSL_COMP_new_null() SKM_sk_new_null(SSL_COMP)
... ... @@ -974,6 +1102,7 @@ STACK_OF(type) \
974 1102 #define sk_SSL_COMP_push(st, val) SKM_sk_push(SSL_COMP, (st), (val))
975 1103 #define sk_SSL_COMP_unshift(st, val) SKM_sk_unshift(SSL_COMP, (st), (val))
976 1104 #define sk_SSL_COMP_find(st, val) SKM_sk_find(SSL_COMP, (st), (val))
  1105 +#define sk_SSL_COMP_find_ex(st, val) SKM_sk_find_ex(SSL_COMP, (st), (val))
977 1106 #define sk_SSL_COMP_delete(st, i) SKM_sk_delete(SSL_COMP, (st), (i))
978 1107 #define sk_SSL_COMP_delete_ptr(st, ptr) SKM_sk_delete_ptr(SSL_COMP, (st), (ptr))
979 1108 #define sk_SSL_COMP_insert(st, val, i) SKM_sk_insert(SSL_COMP, (st), (val), (i))
... ... @@ -983,6 +1112,29 @@ STACK_OF(type) \
983 1112 #define sk_SSL_COMP_shift(st) SKM_sk_shift(SSL_COMP, (st))
984 1113 #define sk_SSL_COMP_pop(st) SKM_sk_pop(SSL_COMP, (st))
985 1114 #define sk_SSL_COMP_sort(st) SKM_sk_sort(SSL_COMP, (st))
  1115 +#define sk_SSL_COMP_is_sorted(st) SKM_sk_is_sorted(SSL_COMP, (st))
  1116 +
  1117 +#define sk_STORE_OBJECT_new(st) SKM_sk_new(STORE_OBJECT, (st))
  1118 +#define sk_STORE_OBJECT_new_null() SKM_sk_new_null(STORE_OBJECT)
  1119 +#define sk_STORE_OBJECT_free(st) SKM_sk_free(STORE_OBJECT, (st))
  1120 +#define sk_STORE_OBJECT_num(st) SKM_sk_num(STORE_OBJECT, (st))
  1121 +#define sk_STORE_OBJECT_value(st, i) SKM_sk_value(STORE_OBJECT, (st), (i))
  1122 +#define sk_STORE_OBJECT_set(st, i, val) SKM_sk_set(STORE_OBJECT, (st), (i), (val))
  1123 +#define sk_STORE_OBJECT_zero(st) SKM_sk_zero(STORE_OBJECT, (st))
  1124 +#define sk_STORE_OBJECT_push(st, val) SKM_sk_push(STORE_OBJECT, (st), (val))
  1125 +#define sk_STORE_OBJECT_unshift(st, val) SKM_sk_unshift(STORE_OBJECT, (st), (val))
  1126 +#define sk_STORE_OBJECT_find(st, val) SKM_sk_find(STORE_OBJECT, (st), (val))
  1127 +#define sk_STORE_OBJECT_find_ex(st, val) SKM_sk_find_ex(STORE_OBJECT, (st), (val))
  1128 +#define sk_STORE_OBJECT_delete(st, i) SKM_sk_delete(STORE_OBJECT, (st), (i))
  1129 +#define sk_STORE_OBJECT_delete_ptr(st, ptr) SKM_sk_delete_ptr(STORE_OBJECT, (st), (ptr))
  1130 +#define sk_STORE_OBJECT_insert(st, val, i) SKM_sk_insert(STORE_OBJECT, (st), (val), (i))
  1131 +#define sk_STORE_OBJECT_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(STORE_OBJECT, (st), (cmp))
  1132 +#define sk_STORE_OBJECT_dup(st) SKM_sk_dup(STORE_OBJECT, st)
  1133 +#define sk_STORE_OBJECT_pop_free(st, free_func) SKM_sk_pop_free(STORE_OBJECT, (st), (free_func))
  1134 +#define sk_STORE_OBJECT_shift(st) SKM_sk_shift(STORE_OBJECT, (st))
  1135 +#define sk_STORE_OBJECT_pop(st) SKM_sk_pop(STORE_OBJECT, (st))
  1136 +#define sk_STORE_OBJECT_sort(st) SKM_sk_sort(STORE_OBJECT, (st))
  1137 +#define sk_STORE_OBJECT_is_sorted(st) SKM_sk_is_sorted(STORE_OBJECT, (st))
986 1138  
987 1139 #define sk_SXNETID_new(st) SKM_sk_new(SXNETID, (st))
988 1140 #define sk_SXNETID_new_null() SKM_sk_new_null(SXNETID)
... ... @@ -994,6 +1146,7 @@ STACK_OF(type) \
994 1146 #define sk_SXNETID_push(st, val) SKM_sk_push(SXNETID, (st), (val))
995 1147 #define sk_SXNETID_unshift(st, val) SKM_sk_unshift(SXNETID, (st), (val))
996 1148 #define sk_SXNETID_find(st, val) SKM_sk_find(SXNETID, (st), (val))
  1149 +#define sk_SXNETID_find_ex(st, val) SKM_sk_find_ex(SXNETID, (st), (val))
997 1150 #define sk_SXNETID_delete(st, i) SKM_sk_delete(SXNETID, (st), (i))
998 1151 #define sk_SXNETID_delete_ptr(st, ptr) SKM_sk_delete_ptr(SXNETID, (st), (ptr))
999 1152 #define sk_SXNETID_insert(st, val, i) SKM_sk_insert(SXNETID, (st), (val), (i))
... ... @@ -1003,6 +1156,7 @@ STACK_OF(type) \
1003 1156 #define sk_SXNETID_shift(st) SKM_sk_shift(SXNETID, (st))
1004 1157 #define sk_SXNETID_pop(st) SKM_sk_pop(SXNETID, (st))
1005 1158 #define sk_SXNETID_sort(st) SKM_sk_sort(SXNETID, (st))
  1159 +#define sk_SXNETID_is_sorted(st) SKM_sk_is_sorted(SXNETID, (st))
1006 1160  
1007 1161 #define sk_UI_STRING_new(st) SKM_sk_new(UI_STRING, (st))
1008 1162 #define sk_UI_STRING_new_null() SKM_sk_new_null(UI_STRING)
... ... @@ -1014,6 +1168,7 @@ STACK_OF(type) \
1014 1168 #define sk_UI_STRING_push(st, val) SKM_sk_push(UI_STRING, (st), (val))
1015 1169 #define sk_UI_STRING_unshift(st, val) SKM_sk_unshift(UI_STRING, (st), (val))
1016 1170 #define sk_UI_STRING_find(st, val) SKM_sk_find(UI_STRING, (st), (val))
  1171 +#define sk_UI_STRING_find_ex(st, val) SKM_sk_find_ex(UI_STRING, (st), (val))
1017 1172 #define sk_UI_STRING_delete(st, i) SKM_sk_delete(UI_STRING, (st), (i))
1018 1173 #define sk_UI_STRING_delete_ptr(st, ptr) SKM_sk_delete_ptr(UI_STRING, (st), (ptr))
1019 1174 #define sk_UI_STRING_insert(st, val, i) SKM_sk_insert(UI_STRING, (st), (val), (i))
... ... @@ -1023,6 +1178,7 @@ STACK_OF(type) \
1023 1178 #define sk_UI_STRING_shift(st) SKM_sk_shift(UI_STRING, (st))
1024 1179 #define sk_UI_STRING_pop(st) SKM_sk_pop(UI_STRING, (st))
1025 1180 #define sk_UI_STRING_sort(st) SKM_sk_sort(UI_STRING, (st))
  1181 +#define sk_UI_STRING_is_sorted(st) SKM_sk_is_sorted(UI_STRING, (st))
1026 1182  
1027 1183 #define sk_X509_new(st) SKM_sk_new(X509, (st))
1028 1184 #define sk_X509_new_null() SKM_sk_new_null(X509)
... ... @@ -1034,6 +1190,7 @@ STACK_OF(type) \
1034 1190 #define sk_X509_push(st, val) SKM_sk_push(X509, (st), (val))
1035 1191 #define sk_X509_unshift(st, val) SKM_sk_unshift(X509, (st), (val))
1036 1192 #define sk_X509_find(st, val) SKM_sk_find(X509, (st), (val))
  1193 +#define sk_X509_find_ex(st, val) SKM_sk_find_ex(X509, (st), (val))
1037 1194 #define sk_X509_delete(st, i) SKM_sk_delete(X509, (st), (i))
1038 1195 #define sk_X509_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509, (st), (ptr))
1039 1196 #define sk_X509_insert(st, val, i) SKM_sk_insert(X509, (st), (val), (i))
... ... @@ -1043,6 +1200,7 @@ STACK_OF(type) \
1043 1200 #define sk_X509_shift(st) SKM_sk_shift(X509, (st))
1044 1201 #define sk_X509_pop(st) SKM_sk_pop(X509, (st))
1045 1202 #define sk_X509_sort(st) SKM_sk_sort(X509, (st))
  1203 +#define sk_X509_is_sorted(st) SKM_sk_is_sorted(X509, (st))
1046 1204  
1047 1205 #define sk_X509V3_EXT_METHOD_new(st) SKM_sk_new(X509V3_EXT_METHOD, (st))
1048 1206 #define sk_X509V3_EXT_METHOD_new_null() SKM_sk_new_null(X509V3_EXT_METHOD)
... ... @@ -1054,6 +1212,7 @@ STACK_OF(type) \
1054 1212 #define sk_X509V3_EXT_METHOD_push(st, val) SKM_sk_push(X509V3_EXT_METHOD, (st), (val))
1055 1213 #define sk_X509V3_EXT_METHOD_unshift(st, val) SKM_sk_unshift(X509V3_EXT_METHOD, (st), (val))
1056 1214 #define sk_X509V3_EXT_METHOD_find(st, val) SKM_sk_find(X509V3_EXT_METHOD, (st), (val))
  1215 +#define sk_X509V3_EXT_METHOD_find_ex(st, val) SKM_sk_find_ex(X509V3_EXT_METHOD, (st), (val))
1057 1216 #define sk_X509V3_EXT_METHOD_delete(st, i) SKM_sk_delete(X509V3_EXT_METHOD, (st), (i))
1058 1217 #define sk_X509V3_EXT_METHOD_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509V3_EXT_METHOD, (st), (ptr))
1059 1218 #define sk_X509V3_EXT_METHOD_insert(st, val, i) SKM_sk_insert(X509V3_EXT_METHOD, (st), (val), (i))
... ... @@ -1063,6 +1222,7 @@ STACK_OF(type) \
1063 1222 #define sk_X509V3_EXT_METHOD_shift(st) SKM_sk_shift(X509V3_EXT_METHOD, (st))
1064 1223 #define sk_X509V3_EXT_METHOD_pop(st) SKM_sk_pop(X509V3_EXT_METHOD, (st))
1065 1224 #define sk_X509V3_EXT_METHOD_sort(st) SKM_sk_sort(X509V3_EXT_METHOD, (st))
  1225 +#define sk_X509V3_EXT_METHOD_is_sorted(st) SKM_sk_is_sorted(X509V3_EXT_METHOD, (st))
1066 1226  
1067 1227 #define sk_X509_ALGOR_new(st) SKM_sk_new(X509_ALGOR, (st))
1068 1228 #define sk_X509_ALGOR_new_null() SKM_sk_new_null(X509_ALGOR)
... ... @@ -1074,6 +1234,7 @@ STACK_OF(type) \
1074 1234 #define sk_X509_ALGOR_push(st, val) SKM_sk_push(X509_ALGOR, (st), (val))
1075 1235 #define sk_X509_ALGOR_unshift(st, val) SKM_sk_unshift(X509_ALGOR, (st), (val))
1076 1236 #define sk_X509_ALGOR_find(st, val) SKM_sk_find(X509_ALGOR, (st), (val))
  1237 +#define sk_X509_ALGOR_find_ex(st, val) SKM_sk_find_ex(X509_ALGOR, (st), (val))
1077 1238 #define sk_X509_ALGOR_delete(st, i) SKM_sk_delete(X509_ALGOR, (st), (i))
1078 1239 #define sk_X509_ALGOR_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_ALGOR, (st), (ptr))
1079 1240 #define sk_X509_ALGOR_insert(st, val, i) SKM_sk_insert(X509_ALGOR, (st), (val), (i))
... ... @@ -1083,6 +1244,7 @@ STACK_OF(type) \
1083 1244 #define sk_X509_ALGOR_shift(st) SKM_sk_shift(X509_ALGOR, (st))
1084 1245 #define sk_X509_ALGOR_pop(st) SKM_sk_pop(X509_ALGOR, (st))
1085 1246 #define sk_X509_ALGOR_sort(st) SKM_sk_sort(X509_ALGOR, (st))
  1247 +#define sk_X509_ALGOR_is_sorted(st) SKM_sk_is_sorted(X509_ALGOR, (st))
1086 1248  
1087 1249 #define sk_X509_ATTRIBUTE_new(st) SKM_sk_new(X509_ATTRIBUTE, (st))
1088 1250 #define sk_X509_ATTRIBUTE_new_null() SKM_sk_new_null(X509_ATTRIBUTE)
... ... @@ -1094,6 +1256,7 @@ STACK_OF(type) \
1094 1256 #define sk_X509_ATTRIBUTE_push(st, val) SKM_sk_push(X509_ATTRIBUTE, (st), (val))
1095 1257 #define sk_X509_ATTRIBUTE_unshift(st, val) SKM_sk_unshift(X509_ATTRIBUTE, (st), (val))
1096 1258 #define sk_X509_ATTRIBUTE_find(st, val) SKM_sk_find(X509_ATTRIBUTE, (st), (val))
  1259 +#define sk_X509_ATTRIBUTE_find_ex(st, val) SKM_sk_find_ex(X509_ATTRIBUTE, (st), (val))
1097 1260 #define sk_X509_ATTRIBUTE_delete(st, i) SKM_sk_delete(X509_ATTRIBUTE, (st), (i))
1098 1261 #define sk_X509_ATTRIBUTE_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_ATTRIBUTE, (st), (ptr))
1099 1262 #define sk_X509_ATTRIBUTE_insert(st, val, i) SKM_sk_insert(X509_ATTRIBUTE, (st), (val), (i))
... ... @@ -1103,6 +1266,7 @@ STACK_OF(type) \
1103 1266 #define sk_X509_ATTRIBUTE_shift(st) SKM_sk_shift(X509_ATTRIBUTE, (st))
1104 1267 #define sk_X509_ATTRIBUTE_pop(st) SKM_sk_pop(X509_ATTRIBUTE, (st))
1105 1268 #define sk_X509_ATTRIBUTE_sort(st) SKM_sk_sort(X509_ATTRIBUTE, (st))
  1269 +#define sk_X509_ATTRIBUTE_is_sorted(st) SKM_sk_is_sorted(X509_ATTRIBUTE, (st))
1106 1270  
1107 1271 #define sk_X509_CRL_new(st) SKM_sk_new(X509_CRL, (st))
1108 1272 #define sk_X509_CRL_new_null() SKM_sk_new_null(X509_CRL)
... ... @@ -1114,6 +1278,7 @@ STACK_OF(type) \
1114 1278 #define sk_X509_CRL_push(st, val) SKM_sk_push(X509_CRL, (st), (val))
1115 1279 #define sk_X509_CRL_unshift(st, val) SKM_sk_unshift(X509_CRL, (st), (val))
1116 1280 #define sk_X509_CRL_find(st, val) SKM_sk_find(X509_CRL, (st), (val))
  1281 +#define sk_X509_CRL_find_ex(st, val) SKM_sk_find_ex(X509_CRL, (st), (val))
1117 1282 #define sk_X509_CRL_delete(st, i) SKM_sk_delete(X509_CRL, (st), (i))
1118 1283 #define sk_X509_CRL_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_CRL, (st), (ptr))
1119 1284 #define sk_X509_CRL_insert(st, val, i) SKM_sk_insert(X509_CRL, (st), (val), (i))
... ... @@ -1123,6 +1288,7 @@ STACK_OF(type) \
1123 1288 #define sk_X509_CRL_shift(st) SKM_sk_shift(X509_CRL, (st))
1124 1289 #define sk_X509_CRL_pop(st) SKM_sk_pop(X509_CRL, (st))
1125 1290 #define sk_X509_CRL_sort(st) SKM_sk_sort(X509_CRL, (st))
  1291 +#define sk_X509_CRL_is_sorted(st) SKM_sk_is_sorted(X509_CRL, (st))
1126 1292  
1127 1293 #define sk_X509_EXTENSION_new(st) SKM_sk_new(X509_EXTENSION, (st))
1128 1294 #define sk_X509_EXTENSION_new_null() SKM_sk_new_null(X509_EXTENSION)
... ... @@ -1134,6 +1300,7 @@ STACK_OF(type) \
1134 1300 #define sk_X509_EXTENSION_push(st, val) SKM_sk_push(X509_EXTENSION, (st), (val))
1135 1301 #define sk_X509_EXTENSION_unshift(st, val) SKM_sk_unshift(X509_EXTENSION, (st), (val))
1136 1302 #define sk_X509_EXTENSION_find(st, val) SKM_sk_find(X509_EXTENSION, (st), (val))
  1303 +#define sk_X509_EXTENSION_find_ex(st, val) SKM_sk_find_ex(X509_EXTENSION, (st), (val))
1137 1304 #define sk_X509_EXTENSION_delete(st, i) SKM_sk_delete(X509_EXTENSION, (st), (i))
1138 1305 #define sk_X509_EXTENSION_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_EXTENSION, (st), (ptr))
1139 1306 #define sk_X509_EXTENSION_insert(st, val, i) SKM_sk_insert(X509_EXTENSION, (st), (val), (i))
... ... @@ -1143,6 +1310,7 @@ STACK_OF(type) \
1143 1310 #define sk_X509_EXTENSION_shift(st) SKM_sk_shift(X509_EXTENSION, (st))
1144 1311 #define sk_X509_EXTENSION_pop(st) SKM_sk_pop(X509_EXTENSION, (st))
1145 1312 #define sk_X509_EXTENSION_sort(st) SKM_sk_sort(X509_EXTENSION, (st))
  1313 +#define sk_X509_EXTENSION_is_sorted(st) SKM_sk_is_sorted(X509_EXTENSION, (st))
1146 1314  
1147 1315 #define sk_X509_INFO_new(st) SKM_sk_new(X509_INFO, (st))
1148 1316 #define sk_X509_INFO_new_null() SKM_sk_new_null(X509_INFO)
... ... @@ -1154,6 +1322,7 @@ STACK_OF(type) \
1154 1322 #define sk_X509_INFO_push(st, val) SKM_sk_push(X509_INFO, (st), (val))
1155 1323 #define sk_X509_INFO_unshift(st, val) SKM_sk_unshift(X509_INFO, (st), (val))
1156 1324 #define sk_X509_INFO_find(st, val) SKM_sk_find(X509_INFO, (st), (val))
  1325 +#define sk_X509_INFO_find_ex(st, val) SKM_sk_find_ex(X509_INFO, (st), (val))
1157 1326 #define sk_X509_INFO_delete(st, i) SKM_sk_delete(X509_INFO, (st), (i))
1158 1327 #define sk_X509_INFO_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_INFO, (st), (ptr))
1159 1328 #define sk_X509_INFO_insert(st, val, i) SKM_sk_insert(X509_INFO, (st), (val), (i))
... ... @@ -1163,6 +1332,7 @@ STACK_OF(type) \
1163 1332 #define sk_X509_INFO_shift(st) SKM_sk_shift(X509_INFO, (st))
1164 1333 #define sk_X509_INFO_pop(st) SKM_sk_pop(X509_INFO, (st))
1165 1334 #define sk_X509_INFO_sort(st) SKM_sk_sort(X509_INFO, (st))
  1335 +#define sk_X509_INFO_is_sorted(st) SKM_sk_is_sorted(X509_INFO, (st))
1166 1336  
1167 1337 #define sk_X509_LOOKUP_new(st) SKM_sk_new(X509_LOOKUP, (st))
1168 1338 #define sk_X509_LOOKUP_new_null() SKM_sk_new_null(X509_LOOKUP)
... ... @@ -1174,6 +1344,7 @@ STACK_OF(type) \
1174 1344 #define sk_X509_LOOKUP_push(st, val) SKM_sk_push(X509_LOOKUP, (st), (val))
1175 1345 #define sk_X509_LOOKUP_unshift(st, val) SKM_sk_unshift(X509_LOOKUP, (st), (val))
1176 1346 #define sk_X509_LOOKUP_find(st, val) SKM_sk_find(X509_LOOKUP, (st), (val))
  1347 +#define sk_X509_LOOKUP_find_ex(st, val) SKM_sk_find_ex(X509_LOOKUP, (st), (val))
1177 1348 #define sk_X509_LOOKUP_delete(st, i) SKM_sk_delete(X509_LOOKUP, (st), (i))
1178 1349 #define sk_X509_LOOKUP_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_LOOKUP, (st), (ptr))
1179 1350 #define sk_X509_LOOKUP_insert(st, val, i) SKM_sk_insert(X509_LOOKUP, (st), (val), (i))
... ... @@ -1183,6 +1354,7 @@ STACK_OF(type) \
1183 1354 #define sk_X509_LOOKUP_shift(st) SKM_sk_shift(X509_LOOKUP, (st))
1184 1355 #define sk_X509_LOOKUP_pop(st) SKM_sk_pop(X509_LOOKUP, (st))
1185 1356 #define sk_X509_LOOKUP_sort(st) SKM_sk_sort(X509_LOOKUP, (st))
  1357 +#define sk_X509_LOOKUP_is_sorted(st) SKM_sk_is_sorted(X509_LOOKUP, (st))
1186 1358  
1187 1359 #define sk_X509_NAME_new(st) SKM_sk_new(X509_NAME, (st))
1188 1360 #define sk_X509_NAME_new_null() SKM_sk_new_null(X509_NAME)
... ... @@ -1194,6 +1366,7 @@ STACK_OF(type) \
1194 1366 #define sk_X509_NAME_push(st, val) SKM_sk_push(X509_NAME, (st), (val))
1195 1367 #define sk_X509_NAME_unshift(st, val) SKM_sk_unshift(X509_NAME, (st), (val))
1196 1368 #define sk_X509_NAME_find(st, val) SKM_sk_find(X509_NAME, (st), (val))
  1369 +#define sk_X509_NAME_find_ex(st, val) SKM_sk_find_ex(X509_NAME, (st), (val))
1197 1370 #define sk_X509_NAME_delete(st, i) SKM_sk_delete(X509_NAME, (st), (i))
1198 1371 #define sk_X509_NAME_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_NAME, (st), (ptr))
1199 1372 #define sk_X509_NAME_insert(st, val, i) SKM_sk_insert(X509_NAME, (st), (val), (i))
... ... @@ -1203,6 +1376,7 @@ STACK_OF(type) \
1203 1376 #define sk_X509_NAME_shift(st) SKM_sk_shift(X509_NAME, (st))
1204 1377 #define sk_X509_NAME_pop(st) SKM_sk_pop(X509_NAME, (st))
1205 1378 #define sk_X509_NAME_sort(st) SKM_sk_sort(X509_NAME, (st))
  1379 +#define sk_X509_NAME_is_sorted(st) SKM_sk_is_sorted(X509_NAME, (st))
1206 1380  
1207 1381 #define sk_X509_NAME_ENTRY_new(st) SKM_sk_new(X509_NAME_ENTRY, (st))
1208 1382 #define sk_X509_NAME_ENTRY_new_null() SKM_sk_new_null(X509_NAME_ENTRY)
... ... @@ -1214,6 +1388,7 @@ STACK_OF(type) \
1214 1388 #define sk_X509_NAME_ENTRY_push(st, val) SKM_sk_push(X509_NAME_ENTRY, (st), (val))
1215 1389 #define sk_X509_NAME_ENTRY_unshift(st, val) SKM_sk_unshift(X509_NAME_ENTRY, (st), (val))
1216 1390 #define sk_X509_NAME_ENTRY_find(st, val) SKM_sk_find(X509_NAME_ENTRY, (st), (val))
  1391 +#define sk_X509_NAME_ENTRY_find_ex(st, val) SKM_sk_find_ex(X509_NAME_ENTRY, (st), (val))
1217 1392 #define sk_X509_NAME_ENTRY_delete(st, i) SKM_sk_delete(X509_NAME_ENTRY, (st), (i))
1218 1393 #define sk_X509_NAME_ENTRY_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_NAME_ENTRY, (st), (ptr))
1219 1394 #define sk_X509_NAME_ENTRY_insert(st, val, i) SKM_sk_insert(X509_NAME_ENTRY, (st), (val), (i))
... ... @@ -1223,6 +1398,7 @@ STACK_OF(type) \
1223 1398 #define sk_X509_NAME_ENTRY_shift(st) SKM_sk_shift(X509_NAME_ENTRY, (st))
1224 1399 #define sk_X509_NAME_ENTRY_pop(st) SKM_sk_pop(X509_NAME_ENTRY, (st))
1225 1400 #define sk_X509_NAME_ENTRY_sort(st) SKM_sk_sort(X509_NAME_ENTRY, (st))
  1401 +#define sk_X509_NAME_ENTRY_is_sorted(st) SKM_sk_is_sorted(X509_NAME_ENTRY, (st))
1226 1402  
1227 1403 #define sk_X509_OBJECT_new(st) SKM_sk_new(X509_OBJECT, (st))
1228 1404 #define sk_X509_OBJECT_new_null() SKM_sk_new_null(X509_OBJECT)
... ... @@ -1234,6 +1410,7 @@ STACK_OF(type) \
1234 1410 #define sk_X509_OBJECT_push(st, val) SKM_sk_push(X509_OBJECT, (st), (val))
1235 1411 #define sk_X509_OBJECT_unshift(st, val) SKM_sk_unshift(X509_OBJECT, (st), (val))
1236 1412 #define sk_X509_OBJECT_find(st, val) SKM_sk_find(X509_OBJECT, (st), (val))
  1413 +#define sk_X509_OBJECT_find_ex(st, val) SKM_sk_find_ex(X509_OBJECT, (st), (val))
1237 1414 #define sk_X509_OBJECT_delete(st, i) SKM_sk_delete(X509_OBJECT, (st), (i))
1238 1415 #define sk_X509_OBJECT_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_OBJECT, (st), (ptr))
1239 1416 #define sk_X509_OBJECT_insert(st, val, i) SKM_sk_insert(X509_OBJECT, (st), (val), (i))
... ... @@ -1243,6 +1420,73 @@ STACK_OF(type) \
1243 1420 #define sk_X509_OBJECT_shift(st) SKM_sk_shift(X509_OBJECT, (st))
1244 1421 #define sk_X509_OBJECT_pop(st) SKM_sk_pop(X509_OBJECT, (st))
1245 1422 #define sk_X509_OBJECT_sort(st) SKM_sk_sort(X509_OBJECT, (st))
  1423 +#define sk_X509_OBJECT_is_sorted(st) SKM_sk_is_sorted(X509_OBJECT, (st))
  1424 +
  1425 +#define sk_X509_POLICY_DATA_new(st) SKM_sk_new(X509_POLICY_DATA, (st))
  1426 +#define sk_X509_POLICY_DATA_new_null() SKM_sk_new_null(X509_POLICY_DATA)
  1427 +#define sk_X509_POLICY_DATA_free(st) SKM_sk_free(X509_POLICY_DATA, (st))
  1428 +#define sk_X509_POLICY_DATA_num(st) SKM_sk_num(X509_POLICY_DATA, (st))
  1429 +#define sk_X509_POLICY_DATA_value(st, i) SKM_sk_value(X509_POLICY_DATA, (st), (i))
  1430 +#define sk_X509_POLICY_DATA_set(st, i, val) SKM_sk_set(X509_POLICY_DATA, (st), (i), (val))
  1431 +#define sk_X509_POLICY_DATA_zero(st) SKM_sk_zero(X509_POLICY_DATA, (st))
  1432 +#define sk_X509_POLICY_DATA_push(st, val) SKM_sk_push(X509_POLICY_DATA, (st), (val))
  1433 +#define sk_X509_POLICY_DATA_unshift(st, val) SKM_sk_unshift(X509_POLICY_DATA, (st), (val))
  1434 +#define sk_X509_POLICY_DATA_find(st, val) SKM_sk_find(X509_POLICY_DATA, (st), (val))
  1435 +#define sk_X509_POLICY_DATA_find_ex(st, val) SKM_sk_find_ex(X509_POLICY_DATA, (st), (val))
  1436 +#define sk_X509_POLICY_DATA_delete(st, i) SKM_sk_delete(X509_POLICY_DATA, (st), (i))
  1437 +#define sk_X509_POLICY_DATA_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_POLICY_DATA, (st), (ptr))
  1438 +#define sk_X509_POLICY_DATA_insert(st, val, i) SKM_sk_insert(X509_POLICY_DATA, (st), (val), (i))
  1439 +#define sk_X509_POLICY_DATA_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_POLICY_DATA, (st), (cmp))
  1440 +#define sk_X509_POLICY_DATA_dup(st) SKM_sk_dup(X509_POLICY_DATA, st)
  1441 +#define sk_X509_POLICY_DATA_pop_free(st, free_func) SKM_sk_pop_free(X509_POLICY_DATA, (st), (free_func))
  1442 +#define sk_X509_POLICY_DATA_shift(st) SKM_sk_shift(X509_POLICY_DATA, (st))
  1443 +#define sk_X509_POLICY_DATA_pop(st) SKM_sk_pop(X509_POLICY_DATA, (st))
  1444 +#define sk_X509_POLICY_DATA_sort(st) SKM_sk_sort(X509_POLICY_DATA, (st))
  1445 +#define sk_X509_POLICY_DATA_is_sorted(st) SKM_sk_is_sorted(X509_POLICY_DATA, (st))
  1446 +
  1447 +#define sk_X509_POLICY_NODE_new(st) SKM_sk_new(X509_POLICY_NODE, (st))
  1448 +#define sk_X509_POLICY_NODE_new_null() SKM_sk_new_null(X509_POLICY_NODE)
  1449 +#define sk_X509_POLICY_NODE_free(st) SKM_sk_free(X509_POLICY_NODE, (st))
  1450 +#define sk_X509_POLICY_NODE_num(st) SKM_sk_num(X509_POLICY_NODE, (st))
  1451 +#define sk_X509_POLICY_NODE_value(st, i) SKM_sk_value(X509_POLICY_NODE, (st), (i))
  1452 +#define sk_X509_POLICY_NODE_set(st, i, val) SKM_sk_set(X509_POLICY_NODE, (st), (i), (val))
  1453 +#define sk_X509_POLICY_NODE_zero(st) SKM_sk_zero(X509_POLICY_NODE, (st))
  1454 +#define sk_X509_POLICY_NODE_push(st, val) SKM_sk_push(X509_POLICY_NODE, (st), (val))
  1455 +#define sk_X509_POLICY_NODE_unshift(st, val) SKM_sk_unshift(X509_POLICY_NODE, (st), (val))
  1456 +#define sk_X509_POLICY_NODE_find(st, val) SKM_sk_find(X509_POLICY_NODE, (st), (val))
  1457 +#define sk_X509_POLICY_NODE_find_ex(st, val) SKM_sk_find_ex(X509_POLICY_NODE, (st), (val))
  1458 +#define sk_X509_POLICY_NODE_delete(st, i) SKM_sk_delete(X509_POLICY_NODE, (st), (i))
  1459 +#define sk_X509_POLICY_NODE_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_POLICY_NODE, (st), (ptr))
  1460 +#define sk_X509_POLICY_NODE_insert(st, val, i) SKM_sk_insert(X509_POLICY_NODE, (st), (val), (i))
  1461 +#define sk_X509_POLICY_NODE_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_POLICY_NODE, (st), (cmp))
  1462 +#define sk_X509_POLICY_NODE_dup(st) SKM_sk_dup(X509_POLICY_NODE, st)
  1463 +#define sk_X509_POLICY_NODE_pop_free(st, free_func) SKM_sk_pop_free(X509_POLICY_NODE, (st), (free_func))
  1464 +#define sk_X509_POLICY_NODE_shift(st) SKM_sk_shift(X509_POLICY_NODE, (st))
  1465 +#define sk_X509_POLICY_NODE_pop(st) SKM_sk_pop(X509_POLICY_NODE, (st))
  1466 +#define sk_X509_POLICY_NODE_sort(st) SKM_sk_sort(X509_POLICY_NODE, (st))
  1467 +#define sk_X509_POLICY_NODE_is_sorted(st) SKM_sk_is_sorted(X509_POLICY_NODE, (st))
  1468 +
  1469 +#define sk_X509_POLICY_REF_new(st) SKM_sk_new(X509_POLICY_REF, (st))
  1470 +#define sk_X509_POLICY_REF_new_null() SKM_sk_new_null(X509_POLICY_REF)
  1471 +#define sk_X509_POLICY_REF_free(st) SKM_sk_free(X509_POLICY_REF, (st))
  1472 +#define sk_X509_POLICY_REF_num(st) SKM_sk_num(X509_POLICY_REF, (st))
  1473 +#define sk_X509_POLICY_REF_value(st, i) SKM_sk_value(X509_POLICY_REF, (st), (i))
  1474 +#define sk_X509_POLICY_REF_set(st, i, val) SKM_sk_set(X509_POLICY_REF, (st), (i), (val))
  1475 +#define sk_X509_POLICY_REF_zero(st) SKM_sk_zero(X509_POLICY_REF, (st))
  1476 +#define sk_X509_POLICY_REF_push(st, val) SKM_sk_push(X509_POLICY_REF, (st), (val))
  1477 +#define sk_X509_POLICY_REF_unshift(st, val) SKM_sk_unshift(X509_POLICY_REF, (st), (val))
  1478 +#define sk_X509_POLICY_REF_find(st, val) SKM_sk_find(X509_POLICY_REF, (st), (val))
  1479 +#define sk_X509_POLICY_REF_find_ex(st, val) SKM_sk_find_ex(X509_POLICY_REF, (st), (val))
  1480 +#define sk_X509_POLICY_REF_delete(st, i) SKM_sk_delete(X509_POLICY_REF, (st), (i))
  1481 +#define sk_X509_POLICY_REF_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_POLICY_REF, (st), (ptr))
  1482 +#define sk_X509_POLICY_REF_insert(st, val, i) SKM_sk_insert(X509_POLICY_REF, (st), (val), (i))
  1483 +#define sk_X509_POLICY_REF_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_POLICY_REF, (st), (cmp))
  1484 +#define sk_X509_POLICY_REF_dup(st) SKM_sk_dup(X509_POLICY_REF, st)
  1485 +#define sk_X509_POLICY_REF_pop_free(st, free_func) SKM_sk_pop_free(X509_POLICY_REF, (st), (free_func))
  1486 +#define sk_X509_POLICY_REF_shift(st) SKM_sk_shift(X509_POLICY_REF, (st))
  1487 +#define sk_X509_POLICY_REF_pop(st) SKM_sk_pop(X509_POLICY_REF, (st))
  1488 +#define sk_X509_POLICY_REF_sort(st) SKM_sk_sort(X509_POLICY_REF, (st))
  1489 +#define sk_X509_POLICY_REF_is_sorted(st) SKM_sk_is_sorted(X509_POLICY_REF, (st))
1246 1490  
1247 1491 #define sk_X509_PURPOSE_new(st) SKM_sk_new(X509_PURPOSE, (st))
1248 1492 #define sk_X509_PURPOSE_new_null() SKM_sk_new_null(X509_PURPOSE)
... ... @@ -1254,6 +1498,7 @@ STACK_OF(type) \
1254 1498 #define sk_X509_PURPOSE_push(st, val) SKM_sk_push(X509_PURPOSE, (st), (val))
1255 1499 #define sk_X509_PURPOSE_unshift(st, val) SKM_sk_unshift(X509_PURPOSE, (st), (val))
1256 1500 #define sk_X509_PURPOSE_find(st, val) SKM_sk_find(X509_PURPOSE, (st), (val))
  1501 +#define sk_X509_PURPOSE_find_ex(st, val) SKM_sk_find_ex(X509_PURPOSE, (st), (val))
1257 1502 #define sk_X509_PURPOSE_delete(st, i) SKM_sk_delete(X509_PURPOSE, (st), (i))
1258 1503 #define sk_X509_PURPOSE_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_PURPOSE, (st), (ptr))
1259 1504 #define sk_X509_PURPOSE_insert(st, val, i) SKM_sk_insert(X509_PURPOSE, (st), (val), (i))
... ... @@ -1263,6 +1508,7 @@ STACK_OF(type) \
1263 1508 #define sk_X509_PURPOSE_shift(st) SKM_sk_shift(X509_PURPOSE, (st))
1264 1509 #define sk_X509_PURPOSE_pop(st) SKM_sk_pop(X509_PURPOSE, (st))
1265 1510 #define sk_X509_PURPOSE_sort(st) SKM_sk_sort(X509_PURPOSE, (st))
  1511 +#define sk_X509_PURPOSE_is_sorted(st) SKM_sk_is_sorted(X509_PURPOSE, (st))
1266 1512  
1267 1513 #define sk_X509_REVOKED_new(st) SKM_sk_new(X509_REVOKED, (st))
1268 1514 #define sk_X509_REVOKED_new_null() SKM_sk_new_null(X509_REVOKED)
... ... @@ -1274,6 +1520,7 @@ STACK_OF(type) \
1274 1520 #define sk_X509_REVOKED_push(st, val) SKM_sk_push(X509_REVOKED, (st), (val))
1275 1521 #define sk_X509_REVOKED_unshift(st, val) SKM_sk_unshift(X509_REVOKED, (st), (val))
1276 1522 #define sk_X509_REVOKED_find(st, val) SKM_sk_find(X509_REVOKED, (st), (val))
  1523 +#define sk_X509_REVOKED_find_ex(st, val) SKM_sk_find_ex(X509_REVOKED, (st), (val))
1277 1524 #define sk_X509_REVOKED_delete(st, i) SKM_sk_delete(X509_REVOKED, (st), (i))
1278 1525 #define sk_X509_REVOKED_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_REVOKED, (st), (ptr))
1279 1526 #define sk_X509_REVOKED_insert(st, val, i) SKM_sk_insert(X509_REVOKED, (st), (val), (i))
... ... @@ -1283,6 +1530,7 @@ STACK_OF(type) \
1283 1530 #define sk_X509_REVOKED_shift(st) SKM_sk_shift(X509_REVOKED, (st))
1284 1531 #define sk_X509_REVOKED_pop(st) SKM_sk_pop(X509_REVOKED, (st))
1285 1532 #define sk_X509_REVOKED_sort(st) SKM_sk_sort(X509_REVOKED, (st))
  1533 +#define sk_X509_REVOKED_is_sorted(st) SKM_sk_is_sorted(X509_REVOKED, (st))
1286 1534  
1287 1535 #define sk_X509_TRUST_new(st) SKM_sk_new(X509_TRUST, (st))
1288 1536 #define sk_X509_TRUST_new_null() SKM_sk_new_null(X509_TRUST)
... ... @@ -1294,6 +1542,7 @@ STACK_OF(type) \
1294 1542 #define sk_X509_TRUST_push(st, val) SKM_sk_push(X509_TRUST, (st), (val))
1295 1543 #define sk_X509_TRUST_unshift(st, val) SKM_sk_unshift(X509_TRUST, (st), (val))
1296 1544 #define sk_X509_TRUST_find(st, val) SKM_sk_find(X509_TRUST, (st), (val))
  1545 +#define sk_X509_TRUST_find_ex(st, val) SKM_sk_find_ex(X509_TRUST, (st), (val))
1297 1546 #define sk_X509_TRUST_delete(st, i) SKM_sk_delete(X509_TRUST, (st), (i))
1298 1547 #define sk_X509_TRUST_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_TRUST, (st), (ptr))
1299 1548 #define sk_X509_TRUST_insert(st, val, i) SKM_sk_insert(X509_TRUST, (st), (val), (i))
... ... @@ -1303,6 +1552,29 @@ STACK_OF(type) \
1303 1552 #define sk_X509_TRUST_shift(st) SKM_sk_shift(X509_TRUST, (st))
1304 1553 #define sk_X509_TRUST_pop(st) SKM_sk_pop(X509_TRUST, (st))
1305 1554 #define sk_X509_TRUST_sort(st) SKM_sk_sort(X509_TRUST, (st))
  1555 +#define sk_X509_TRUST_is_sorted(st) SKM_sk_is_sorted(X509_TRUST, (st))
  1556 +
  1557 +#define sk_X509_VERIFY_PARAM_new(st) SKM_sk_new(X509_VERIFY_PARAM, (st))
  1558 +#define sk_X509_VERIFY_PARAM_new_null() SKM_sk_new_null(X509_VERIFY_PARAM)
  1559 +#define sk_X509_VERIFY_PARAM_free(st) SKM_sk_free(X509_VERIFY_PARAM, (st))
  1560 +#define sk_X509_VERIFY_PARAM_num(st) SKM_sk_num(X509_VERIFY_PARAM, (st))
  1561 +#define sk_X509_VERIFY_PARAM_value(st, i) SKM_sk_value(X509_VERIFY_PARAM, (st), (i))
  1562 +#define sk_X509_VERIFY_PARAM_set(st, i, val) SKM_sk_set(X509_VERIFY_PARAM, (st), (i), (val))
  1563 +#define sk_X509_VERIFY_PARAM_zero(st) SKM_sk_zero(X509_VERIFY_PARAM, (st))
  1564 +#define sk_X509_VERIFY_PARAM_push(st, val) SKM_sk_push(X509_VERIFY_PARAM, (st), (val))
  1565 +#define sk_X509_VERIFY_PARAM_unshift(st, val) SKM_sk_unshift(X509_VERIFY_PARAM, (st), (val))
  1566 +#define sk_X509_VERIFY_PARAM_find(st, val) SKM_sk_find(X509_VERIFY_PARAM, (st), (val))
  1567 +#define sk_X509_VERIFY_PARAM_find_ex(st, val) SKM_sk_find_ex(X509_VERIFY_PARAM, (st), (val))
  1568 +#define sk_X509_VERIFY_PARAM_delete(st, i) SKM_sk_delete(X509_VERIFY_PARAM, (st), (i))
  1569 +#define sk_X509_VERIFY_PARAM_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_VERIFY_PARAM, (st), (ptr))
  1570 +#define sk_X509_VERIFY_PARAM_insert(st, val, i) SKM_sk_insert(X509_VERIFY_PARAM, (st), (val), (i))
  1571 +#define sk_X509_VERIFY_PARAM_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_VERIFY_PARAM, (st), (cmp))
  1572 +#define sk_X509_VERIFY_PARAM_dup(st) SKM_sk_dup(X509_VERIFY_PARAM, st)
  1573 +#define sk_X509_VERIFY_PARAM_pop_free(st, free_func) SKM_sk_pop_free(X509_VERIFY_PARAM, (st), (free_func))
  1574 +#define sk_X509_VERIFY_PARAM_shift(st) SKM_sk_shift(X509_VERIFY_PARAM, (st))
  1575 +#define sk_X509_VERIFY_PARAM_pop(st) SKM_sk_pop(X509_VERIFY_PARAM, (st))
  1576 +#define sk_X509_VERIFY_PARAM_sort(st) SKM_sk_sort(X509_VERIFY_PARAM, (st))
  1577 +#define sk_X509_VERIFY_PARAM_is_sorted(st) SKM_sk_is_sorted(X509_VERIFY_PARAM, (st))
1306 1578  
1307 1579 #define d2i_ASN1_SET_OF_ACCESS_DESCRIPTION(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \
1308 1580 SKM_ASN1_SET_OF_d2i(ACCESS_DESCRIPTION, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class))
... ...
third_dev/openssl/include/openssl/sha.h
... ... @@ -69,6 +69,10 @@ extern &quot;C&quot; {
69 69 #error SHA is disabled.
70 70 #endif
71 71  
  72 +#if defined(OPENSSL_FIPS)
  73 +#define FIPS_SHA_SIZE_T size_t
  74 +#endif
  75 +
72 76 /*
73 77 * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
74 78 * ! SHA_LONG has to be at least 32 bits wide. If it's wider, then !
... ... @@ -97,23 +101,97 @@ typedef struct SHAstate_st
97 101 SHA_LONG h0,h1,h2,h3,h4;
98 102 SHA_LONG Nl,Nh;
99 103 SHA_LONG data[SHA_LBLOCK];
100   - int num;
  104 + unsigned int num;
101 105 } SHA_CTX;
102 106  
103 107 #ifndef OPENSSL_NO_SHA0
104 108 int SHA_Init(SHA_CTX *c);
105   -int SHA_Update(SHA_CTX *c, const void *data, unsigned long len);
  109 +int SHA_Update(SHA_CTX *c, const void *data, size_t len);
106 110 int SHA_Final(unsigned char *md, SHA_CTX *c);
107   -unsigned char *SHA(const unsigned char *d, unsigned long n,unsigned char *md);
  111 +unsigned char *SHA(const unsigned char *d, size_t n, unsigned char *md);
108 112 void SHA_Transform(SHA_CTX *c, const unsigned char *data);
109 113 #endif
110 114 #ifndef OPENSSL_NO_SHA1
111 115 int SHA1_Init(SHA_CTX *c);
112   -int SHA1_Update(SHA_CTX *c, const void *data, unsigned long len);
  116 +int SHA1_Update(SHA_CTX *c, const void *data, size_t len);
113 117 int SHA1_Final(unsigned char *md, SHA_CTX *c);
114   -unsigned char *SHA1(const unsigned char *d, unsigned long n,unsigned char *md);
  118 +unsigned char *SHA1(const unsigned char *d, size_t n, unsigned char *md);
115 119 void SHA1_Transform(SHA_CTX *c, const unsigned char *data);
116 120 #endif
  121 +
  122 +#define SHA256_CBLOCK (SHA_LBLOCK*4) /* SHA-256 treats input data as a
  123 + * contiguous array of 32 bit
  124 + * wide big-endian values. */
  125 +#define SHA224_DIGEST_LENGTH 28
  126 +#define SHA256_DIGEST_LENGTH 32
  127 +
  128 +typedef struct SHA256state_st
  129 + {
  130 + SHA_LONG h[8];
  131 + SHA_LONG Nl,Nh;
  132 + SHA_LONG data[SHA_LBLOCK];
  133 + unsigned int num,md_len;
  134 + } SHA256_CTX;
  135 +
  136 +#ifndef OPENSSL_NO_SHA256
  137 +int SHA224_Init(SHA256_CTX *c);
  138 +int SHA224_Update(SHA256_CTX *c, const void *data, size_t len);
  139 +int SHA224_Final(unsigned char *md, SHA256_CTX *c);
  140 +unsigned char *SHA224(const unsigned char *d, size_t n,unsigned char *md);
  141 +int SHA256_Init(SHA256_CTX *c);
  142 +int SHA256_Update(SHA256_CTX *c, const void *data, size_t len);
  143 +int SHA256_Final(unsigned char *md, SHA256_CTX *c);
  144 +unsigned char *SHA256(const unsigned char *d, size_t n,unsigned char *md);
  145 +void SHA256_Transform(SHA256_CTX *c, const unsigned char *data);
  146 +#endif
  147 +
  148 +#define SHA384_DIGEST_LENGTH 48
  149 +#define SHA512_DIGEST_LENGTH 64
  150 +
  151 +#ifndef OPENSSL_NO_SHA512
  152 +/*
  153 + * Unlike 32-bit digest algorithms, SHA-512 *relies* on SHA_LONG64
  154 + * being exactly 64-bit wide. See Implementation Notes in sha512.c
  155 + * for further details.
  156 + */
  157 +#define SHA512_CBLOCK (SHA_LBLOCK*8) /* SHA-512 treats input data as a
  158 + * contiguous array of 64 bit
  159 + * wide big-endian values. */
  160 +#if (defined(_WIN32) || defined(_WIN64)) && !defined(__MINGW32__)
  161 +#define SHA_LONG64 unsigned __int64
  162 +#define U64(C) C##UI64
  163 +#elif defined(__arch64__)
  164 +#define SHA_LONG64 unsigned long
  165 +#define U64(C) C##UL
  166 +#else
  167 +#define SHA_LONG64 unsigned long long
  168 +#define U64(C) C##ULL
  169 +#endif
  170 +
  171 +typedef struct SHA512state_st
  172 + {
  173 + SHA_LONG64 h[8];
  174 + SHA_LONG64 Nl,Nh;
  175 + union {
  176 + SHA_LONG64 d[SHA_LBLOCK];
  177 + unsigned char p[SHA512_CBLOCK];
  178 + } u;
  179 + unsigned int num,md_len;
  180 + } SHA512_CTX;
  181 +#endif
  182 +
  183 +#ifndef OPENSSL_NO_SHA512
  184 +int SHA384_Init(SHA512_CTX *c);
  185 +int SHA384_Update(SHA512_CTX *c, const void *data, size_t len);
  186 +int SHA384_Final(unsigned char *md, SHA512_CTX *c);
  187 +unsigned char *SHA384(const unsigned char *d, size_t n,unsigned char *md);
  188 +int SHA512_Init(SHA512_CTX *c);
  189 +int SHA512_Update(SHA512_CTX *c, const void *data, size_t len);
  190 +int SHA512_Final(unsigned char *md, SHA512_CTX *c);
  191 +unsigned char *SHA512(const unsigned char *d, size_t n,unsigned char *md);
  192 +void SHA512_Transform(SHA512_CTX *c, const unsigned char *data);
  193 +#endif
  194 +
117 195 #ifdef __cplusplus
118 196 }
119 197 #endif
... ...
third_dev/openssl/include/openssl/ssl.h
... ... @@ -161,6 +161,11 @@
161 161 * Hudson (tjh@cryptsoft.com).
162 162 *
163 163 */
  164 +/* ====================================================================
  165 + * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
  166 + * ECC cipher suite support in OpenSSL originally developed by
  167 + * SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project.
  168 + */
164 169  
165 170 #ifndef HEADER_SSL_H
166 171 #define HEADER_SSL_H
... ... @@ -173,9 +178,16 @@
173 178 #ifndef OPENSSL_NO_BIO
174 179 #include <openssl/bio.h>
175 180 #endif
  181 +#ifndef OPENSSL_NO_DEPRECATED
176 182 #ifndef OPENSSL_NO_X509
177 183 #include <openssl/x509.h>
178 184 #endif
  185 +#include <openssl/crypto.h>
  186 +#include <openssl/lhash.h>
  187 +#include <openssl/buffer.h>
  188 +#endif
  189 +#include <openssl/pem.h>
  190 +
179 191 #include <openssl/kssl.h>
180 192 #include <openssl/safestack.h>
181 193 #include <openssl/symhacks.h>
... ... @@ -281,6 +293,7 @@ extern &quot;C&quot; {
281 293 #define SSL_TXT_SSLV3 "SSLv3"
282 294 #define SSL_TXT_TLSV1 "TLSv1"
283 295 #define SSL_TXT_ALL "ALL"
  296 +#define SSL_TXT_ECC "ECCdraft" /* ECC ciphersuites are not yet official */
284 297  
285 298 /*
286 299 * COMPLEMENTOF* definitions. These identifiers are used to (de-select)
... ... @@ -312,11 +325,6 @@ extern &quot;C&quot; {
312 325 }
313 326 #endif
314 327  
315   -#include <openssl/crypto.h>
316   -#include <openssl/lhash.h>
317   -#include <openssl/buffer.h>
318   -#include <openssl/pem.h>
319   -
320 328 #ifdef __cplusplus
321 329 extern "C" {
322 330 #endif
... ... @@ -368,19 +376,25 @@ typedef struct ssl_method_st
368 376 int (*ssl_shutdown)(SSL *s);
369 377 int (*ssl_renegotiate)(SSL *s);
370 378 int (*ssl_renegotiate_check)(SSL *s);
  379 + long (*ssl_get_message)(SSL *s, int st1, int stn, int mt, long
  380 + max, int *ok);
  381 + int (*ssl_read_bytes)(SSL *s, int type, unsigned char *buf, int len,
  382 + int peek);
  383 + int (*ssl_write_bytes)(SSL *s, int type, const void *buf_, int len);
  384 + int (*ssl_dispatch_alert)(SSL *s);
371 385 long (*ssl_ctrl)(SSL *s,int cmd,long larg,void *parg);
372 386 long (*ssl_ctx_ctrl)(SSL_CTX *ctx,int cmd,long larg,void *parg);
373 387 SSL_CIPHER *(*get_cipher_by_char)(const unsigned char *ptr);
374 388 int (*put_cipher_by_char)(const SSL_CIPHER *cipher,unsigned char *ptr);
375   - int (*ssl_pending)(SSL *s);
  389 + int (*ssl_pending)(const SSL *s);
376 390 int (*num_ciphers)(void);
377 391 SSL_CIPHER *(*get_cipher)(unsigned ncipher);
378 392 struct ssl_method_st *(*get_ssl_method)(int version);
379 393 long (*get_timeout)(void);
380 394 struct ssl3_enc_method *ssl3_enc; /* Extra SSLv3/TLS stuff */
381   - int (*ssl_version)();
382   - long (*ssl_callback_ctrl)(SSL *s, int cb_id, void (*fp)());
383   - long (*ssl_ctx_callback_ctrl)(SSL_CTX *s, int cb_id, void (*fp)());
  395 + int (*ssl_version)(void);
  396 + long (*ssl_callback_ctrl)(SSL *s, int cb_id, void (*fp)(void));
  397 + long (*ssl_ctx_callback_ctrl)(SSL_CTX *s, int cb_id, void (*fp)(void));
384 398 } SSL_METHOD;
385 399  
386 400 /* Lets make this into an ASN.1 type structure as follows
... ... @@ -466,7 +480,7 @@ typedef struct ssl_session_st
466 480 #define SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG 0x00000008L
467 481 #define SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG 0x00000010L
468 482 #define SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER 0x00000020L
469   -#define SSL_OP_MSIE_SSLV2_RSA_PADDING 0x00000040L
  483 +#define SSL_OP_MSIE_SSLV2_RSA_PADDING 0x00000040L /* no effect since 0.9.7h and 0.9.8b */
470 484 #define SSL_OP_SSLEAY_080_CLIENT_DH_BUG 0x00000080L
471 485 #define SSL_OP_TLS_D5_BUG 0x00000100L
472 486 #define SSL_OP_TLS_BLOCK_PADDING_BUG 0x00000200L
... ... @@ -482,8 +496,15 @@ typedef struct ssl_session_st
482 496 * This used to be 0x000FFFFFL before 0.9.7. */
483 497 #define SSL_OP_ALL 0x00000FFFL
484 498  
  499 +/* DTLS options */
  500 +#define SSL_OP_NO_QUERY_MTU 0x00001000L
  501 +/* Turn on Cookie Exchange (on relevant for servers) */
  502 +#define SSL_OP_COOKIE_EXCHANGE 0x00002000L
  503 +
485 504 /* As server, disallow session resumption on renegotiation */
486 505 #define SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION 0x00010000L
  506 +/* If set, always create a new key when using tmp_ecdh parameters */
  507 +#define SSL_OP_SINGLE_ECDH_USE 0x00080000L
487 508 /* If set, always create a new key when using tmp_dh parameters */
488 509 #define SSL_OP_SINGLE_DH_USE 0x00100000L
489 510 /* Set to always use the tmp_rsa key when doing RSA operations,
... ... @@ -545,6 +566,8 @@ typedef struct ssl_session_st
545 566 SSL_ctrl((ssl),SSL_CTRL_MODE,(op),NULL)
546 567 #define SSL_get_mode(ssl) \
547 568 SSL_ctrl((ssl),SSL_CTRL_MODE,0,NULL)
  569 +#define SSL_set_mtu(ssl, mtu) \
  570 + SSL_ctrl((ssl),SSL_CTRL_SET_MTU,(mtu),NULL)
548 571  
549 572  
550 573 void SSL_CTX_set_msg_callback(SSL_CTX *ctx, void (*cb)(int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg));
... ... @@ -581,7 +604,7 @@ typedef int (*GEN_SESSION_CB)(const SSL *ssl, unsigned char *id,
581 604 typedef struct ssl_comp_st
582 605 {
583 606 int id;
584   - char *name;
  607 + const char *name;
585 608 #ifndef OPENSSL_NO_COMP
586 609 COMP_METHOD *method;
587 610 #else
... ... @@ -669,6 +692,14 @@ struct ssl_ctx_st
669 692 /* get client cert callback */
670 693 int (*client_cert_cb)(SSL *ssl, X509 **x509, EVP_PKEY **pkey);
671 694  
  695 + /* cookie generate callback */
  696 + int (*app_gen_cookie_cb)(SSL *ssl, unsigned char *cookie,
  697 + unsigned int *cookie_len);
  698 +
  699 + /* verify cookie callback */
  700 + int (*app_verify_cookie_cb)(SSL *ssl, unsigned char *cookie,
  701 + unsigned int cookie_len);
  702 +
672 703 CRYPTO_EX_DATA ex_data;
673 704  
674 705 const EVP_MD *rsa_md5;/* For SSLv2 - name is 'ssl2-md5' */
... ... @@ -701,7 +732,6 @@ struct ssl_ctx_st
701 732 void *msg_callback_arg;
702 733  
703 734 int verify_mode;
704   - int verify_depth;
705 735 unsigned int sid_ctx_length;
706 736 unsigned char sid_ctx[SSL_MAX_SID_CTX_LENGTH];
707 737 int (*default_verify_callback)(int ok,X509_STORE_CTX *ctx); /* called 'verify_callback' in the SSL */
... ... @@ -709,8 +739,12 @@ struct ssl_ctx_st
709 739 /* Default generate session ID callback. */
710 740 GEN_SESSION_CB generate_session_id;
711 741  
  742 + X509_VERIFY_PARAM *param;
  743 +
  744 +#if 0
712 745 int purpose; /* Purpose setting */
713 746 int trust; /* Trust setting */
  747 +#endif
714 748  
715 749 int quiet_shutdown;
716 750 };
... ... @@ -762,6 +796,8 @@ struct ssl_ctx_st
762 796 #define SSL_CTX_get_info_callback(ctx) ((ctx)->info_callback)
763 797 #define SSL_CTX_set_client_cert_cb(ctx,cb) ((ctx)->client_cert_cb=(cb))
764 798 #define SSL_CTX_get_client_cert_cb(ctx) ((ctx)->client_cert_cb)
  799 +#define SSL_CTX_set_cookie_generate_cb(ctx,cb) ((ctx)->app_gen_cookie_cb=(cb))
  800 +#define SSL_CTX_set_cookie_verify_cb(ctx,cb) ((ctx)->app_verify_cookie_cb=(cb))
765 801  
766 802 #define SSL_NOTHING 1
767 803 #define SSL_WRITING 2
... ... @@ -777,7 +813,7 @@ struct ssl_ctx_st
777 813 struct ssl_st
778 814 {
779 815 /* protocol version
780   - * (one of SSL2_VERSION, SSL3_VERSION, TLS1_VERSION)
  816 + * (one of SSL2_VERSION, SSL3_VERSION, TLS1_VERSION, DTLS1_VERSION)
781 817 */
782 818 int version;
783 819 int type; /* SSL_ST_CONNECT or SSL_ST_ACCEPT */
... ... @@ -806,7 +842,7 @@ struct ssl_st
806 842  
807 843 /* true when we are actually in SSL_accept() or SSL_connect() */
808 844 int in_handshake;
809   - int (*handshake_func)();
  845 + int (*handshake_func)(SSL *);
810 846  
811 847 /* Imagine that here's a boolean member "init" that is
812 848 * switched as soon as SSL_set_{accept/connect}_state
... ... @@ -841,6 +877,7 @@ struct ssl_st
841 877  
842 878 struct ssl2_state_st *s2; /* SSLv2 variables */
843 879 struct ssl3_state_st *s3; /* SSLv3 variables */
  880 + struct dtls1_state_st *d1; /* DTLSv1 variables */
844 881  
845 882 int read_ahead; /* Read as many input bytes as possible
846 883 * (for non-blocking reads) */
... ... @@ -851,8 +888,12 @@ struct ssl_st
851 888  
852 889 int hit; /* reusing a previous session */
853 890  
  891 + X509_VERIFY_PARAM *param;
  892 +
  893 +#if 0
854 894 int purpose; /* Purpose setting */
855 895 int trust; /* Trust setting */
  896 +#endif
856 897  
857 898 /* crypto */
858 899 STACK_OF(SSL_CIPHER) *cipher_list;
... ... @@ -897,7 +938,6 @@ struct ssl_st
897 938 /* Used in SSL2 and SSL3 */
898 939 int verify_mode; /* 0 don't care about verify failure.
899 940 * 1 fail if verify fails */
900   - int verify_depth;
901 941 int (*verify_callback)(int ok,X509_STORE_CTX *ctx); /* fail if callback returns 0 */
902 942  
903 943 void (*info_callback)(const SSL *ssl,int type,int val); /* optional informational callback */
... ... @@ -937,6 +977,7 @@ struct ssl_st
937 977 #include <openssl/ssl2.h>
938 978 #include <openssl/ssl3.h>
939 979 #include <openssl/tls1.h> /* This is mostly sslv3 with a few tweaks */
  980 +#include <openssl/dtls1.h> /* Datagram TLS */
940 981 #include <openssl/ssl23.h>
941 982  
942 983 #ifdef __cplusplus
... ... @@ -998,8 +1039,8 @@ extern &quot;C&quot; {
998 1039 * -- that we sent (SSL_get_finished)
999 1040 * -- that we expected from peer (SSL_get_peer_finished).
1000 1041 * Returns length (0 == no Finished so far), copies up to 'count' bytes. */
1001   -size_t SSL_get_finished(SSL *s, void *buf, size_t count);
1002   -size_t SSL_get_peer_finished(SSL *s, void *buf, size_t count);
  1042 +size_t SSL_get_finished(const SSL *s, void *buf, size_t count);
  1043 +size_t SSL_get_peer_finished(const SSL *s, void *buf, size_t count);
1003 1044  
1004 1045 /* use either SSL_VERIFY_NONE or SSL_VERIFY_PEER, the last 2 options
1005 1046 * are 'ored' with SSL_VERIFY_PEER if they are desired */
... ... @@ -1034,21 +1075,16 @@ size_t SSL_get_peer_finished(SSL *s, void *buf, size_t count);
1034 1075 #define SSL_set_timeout(a,b) SSL_SESSION_set_timeout((a),(b))
1035 1076  
1036 1077 #if 1 /*SSLEAY_MACROS*/
1037   -#define d2i_SSL_SESSION_bio(bp,s_id) (SSL_SESSION *)ASN1_d2i_bio( \
1038   - (char *(*)())SSL_SESSION_new,(char *(*)())d2i_SSL_SESSION, \
1039   - (bp),(unsigned char **)(s_id))
1040   -#define i2d_SSL_SESSION_bio(bp,s_id) ASN1_i2d_bio(i2d_SSL_SESSION, \
1041   - bp,(unsigned char *)s_id)
  1078 +#define d2i_SSL_SESSION_bio(bp,s_id) ASN1_d2i_bio_of(SSL_SESSION,SSL_SESSION_new,d2i_SSL_SESSION,bp,s_id)
  1079 +#define i2d_SSL_SESSION_bio(bp,s_id) ASN1_i2d_bio_of(SSL_SESSION,i2d_SSL_SESSION,bp,s_id)
1042 1080 #define PEM_read_SSL_SESSION(fp,x,cb,u) (SSL_SESSION *)PEM_ASN1_read( \
1043 1081 (char *(*)())d2i_SSL_SESSION,PEM_STRING_SSL_SESSION,fp,(char **)x,cb,u)
1044   -#define PEM_read_bio_SSL_SESSION(bp,x,cb,u) (SSL_SESSION *)PEM_ASN1_read_bio( \
1045   - (char *(*)())d2i_SSL_SESSION,PEM_STRING_SSL_SESSION,bp,(char **)x,cb,u)
  1082 +#define PEM_read_bio_SSL_SESSION(bp,x,cb,u) PEM_ASN1_read_bio_of(SSL_SESSION,d2i_SSL_SESSION,PEM_STRING_SSL_SESSION,bp,x,cb,u)
1046 1083 #define PEM_write_SSL_SESSION(fp,x) \
1047 1084 PEM_ASN1_write((int (*)())i2d_SSL_SESSION, \
1048 1085 PEM_STRING_SSL_SESSION,fp, (char *)x, NULL,NULL,0,NULL,NULL)
1049 1086 #define PEM_write_bio_SSL_SESSION(bp,x) \
1050   - PEM_ASN1_write_bio((int (*)())i2d_SSL_SESSION, \
1051   - PEM_STRING_SSL_SESSION,bp, (char *)x, NULL,NULL,0,NULL,NULL)
  1087 + PEM_ASN1_write_bio_of(SSL_SESSION,i2d_SSL_SESSION,PEM_STRING_SSL_SESSION,bp,x,NULL,NULL,0,NULL,NULL)
1052 1088 #endif
1053 1089  
1054 1090 #define SSL_AD_REASON_OFFSET 1000
... ... @@ -1091,20 +1127,24 @@ size_t SSL_get_peer_finished(SSL *s, void *buf, size_t count);
1091 1127 #define SSL_CTRL_NEED_TMP_RSA 1
1092 1128 #define SSL_CTRL_SET_TMP_RSA 2
1093 1129 #define SSL_CTRL_SET_TMP_DH 3
1094   -#define SSL_CTRL_SET_TMP_RSA_CB 4
1095   -#define SSL_CTRL_SET_TMP_DH_CB 5
1096   -
1097   -#define SSL_CTRL_GET_SESSION_REUSED 6
1098   -#define SSL_CTRL_GET_CLIENT_CERT_REQUEST 7
1099   -#define SSL_CTRL_GET_NUM_RENEGOTIATIONS 8
1100   -#define SSL_CTRL_CLEAR_NUM_RENEGOTIATIONS 9
1101   -#define SSL_CTRL_GET_TOTAL_RENEGOTIATIONS 10
1102   -#define SSL_CTRL_GET_FLAGS 11
1103   -#define SSL_CTRL_EXTRA_CHAIN_CERT 12
1104   -
1105   -#define SSL_CTRL_SET_MSG_CALLBACK 13
1106   -#define SSL_CTRL_SET_MSG_CALLBACK_ARG 14
1107   -
  1130 +#define SSL_CTRL_SET_TMP_ECDH 4
  1131 +#define SSL_CTRL_SET_TMP_RSA_CB 5
  1132 +#define SSL_CTRL_SET_TMP_DH_CB 6
  1133 +#define SSL_CTRL_SET_TMP_ECDH_CB 7
  1134 +
  1135 +#define SSL_CTRL_GET_SESSION_REUSED 8
  1136 +#define SSL_CTRL_GET_CLIENT_CERT_REQUEST 9
  1137 +#define SSL_CTRL_GET_NUM_RENEGOTIATIONS 10
  1138 +#define SSL_CTRL_CLEAR_NUM_RENEGOTIATIONS 11
  1139 +#define SSL_CTRL_GET_TOTAL_RENEGOTIATIONS 12
  1140 +#define SSL_CTRL_GET_FLAGS 13
  1141 +#define SSL_CTRL_EXTRA_CHAIN_CERT 14
  1142 +
  1143 +#define SSL_CTRL_SET_MSG_CALLBACK 15
  1144 +#define SSL_CTRL_SET_MSG_CALLBACK_ARG 16
  1145 +
  1146 +/* only applies to datagram connections */
  1147 +#define SSL_CTRL_SET_MTU 17
1108 1148 /* Stats */
1109 1149 #define SSL_CTRL_SESS_NUMBER 20
1110 1150 #define SSL_CTRL_SESS_CONNECT 21
... ... @@ -1146,6 +1186,8 @@ size_t SSL_get_peer_finished(SSL *s, void *buf, size_t count);
1146 1186 SSL_CTX_ctrl(ctx,SSL_CTRL_SET_TMP_RSA,0,(char *)rsa)
1147 1187 #define SSL_CTX_set_tmp_dh(ctx,dh) \
1148 1188 SSL_CTX_ctrl(ctx,SSL_CTRL_SET_TMP_DH,0,(char *)dh)
  1189 +#define SSL_CTX_set_tmp_ecdh(ctx,ecdh) \
  1190 + SSL_CTX_ctrl(ctx,SSL_CTRL_SET_TMP_ECDH,0,(char *)ecdh)
1149 1191  
1150 1192 #define SSL_need_tmp_RSA(ssl) \
1151 1193 SSL_ctrl(ssl,SSL_CTRL_NEED_TMP_RSA,0,NULL)
... ... @@ -1153,6 +1195,8 @@ size_t SSL_get_peer_finished(SSL *s, void *buf, size_t count);
1153 1195 SSL_ctrl(ssl,SSL_CTRL_SET_TMP_RSA,0,(char *)rsa)
1154 1196 #define SSL_set_tmp_dh(ssl,dh) \
1155 1197 SSL_ctrl(ssl,SSL_CTRL_SET_TMP_DH,0,(char *)dh)
  1198 +#define SSL_set_tmp_ecdh(ssl,ecdh) \
  1199 + SSL_ctrl(ssl,SSL_CTRL_SET_TMP_ECDH,0,(char *)ecdh)
1156 1200  
1157 1201 #define SSL_CTX_add_extra_chain_cert(ctx,x509) \
1158 1202 SSL_CTX_ctrl(ctx,SSL_CTRL_EXTRA_CHAIN_CERT,0,(char *)x509)
... ... @@ -1171,26 +1215,26 @@ int SSL_CTX_set_cipher_list(SSL_CTX *,const char *str);
1171 1215 SSL_CTX *SSL_CTX_new(SSL_METHOD *meth);
1172 1216 void SSL_CTX_free(SSL_CTX *);
1173 1217 long SSL_CTX_set_timeout(SSL_CTX *ctx,long t);
1174   -long SSL_CTX_get_timeout(SSL_CTX *ctx);
1175   -X509_STORE *SSL_CTX_get_cert_store(SSL_CTX *);
  1218 +long SSL_CTX_get_timeout(const SSL_CTX *ctx);
  1219 +X509_STORE *SSL_CTX_get_cert_store(const SSL_CTX *);
1176 1220 void SSL_CTX_set_cert_store(SSL_CTX *,X509_STORE *);
1177   -int SSL_want(SSL *s);
  1221 +int SSL_want(const SSL *s);
1178 1222 int SSL_clear(SSL *s);
1179 1223  
1180 1224 void SSL_CTX_flush_sessions(SSL_CTX *ctx,long tm);
1181 1225  
1182   -SSL_CIPHER *SSL_get_current_cipher(SSL *s);
1183   -int SSL_CIPHER_get_bits(SSL_CIPHER *c,int *alg_bits);
1184   -char * SSL_CIPHER_get_version(SSL_CIPHER *c);
1185   -const char * SSL_CIPHER_get_name(SSL_CIPHER *c);
1186   -
1187   -int SSL_get_fd(SSL *s);
1188   -int SSL_get_rfd(SSL *s);
1189   -int SSL_get_wfd(SSL *s);
1190   -const char * SSL_get_cipher_list(SSL *s,int n);
1191   -char * SSL_get_shared_ciphers(SSL *s, char *buf, int len);
1192   -int SSL_get_read_ahead(SSL * s);
1193   -int SSL_pending(SSL *s);
  1226 +SSL_CIPHER *SSL_get_current_cipher(const SSL *s);
  1227 +int SSL_CIPHER_get_bits(const SSL_CIPHER *c,int *alg_bits);
  1228 +char * SSL_CIPHER_get_version(const SSL_CIPHER *c);
  1229 +const char * SSL_CIPHER_get_name(const SSL_CIPHER *c);
  1230 +
  1231 +int SSL_get_fd(const SSL *s);
  1232 +int SSL_get_rfd(const SSL *s);
  1233 +int SSL_get_wfd(const SSL *s);
  1234 +const char * SSL_get_cipher_list(const SSL *s,int n);
  1235 +char * SSL_get_shared_ciphers(const SSL *s, char *buf, int len);
  1236 +int SSL_get_read_ahead(const SSL * s);
  1237 +int SSL_pending(const SSL *s);
1194 1238 #ifndef OPENSSL_NO_SOCK
1195 1239 int SSL_set_fd(SSL *s, int fd);
1196 1240 int SSL_set_rfd(SSL *s, int fd);
... ... @@ -1198,14 +1242,14 @@ int SSL_set_wfd(SSL *s, int fd);
1198 1242 #endif
1199 1243 #ifndef OPENSSL_NO_BIO
1200 1244 void SSL_set_bio(SSL *s, BIO *rbio,BIO *wbio);
1201   -BIO * SSL_get_rbio(SSL *s);
1202   -BIO * SSL_get_wbio(SSL *s);
  1245 +BIO * SSL_get_rbio(const SSL *s);
  1246 +BIO * SSL_get_wbio(const SSL *s);
1203 1247 #endif
1204 1248 int SSL_set_cipher_list(SSL *s, const char *str);
1205 1249 void SSL_set_read_ahead(SSL *s, int yes);
1206   -int SSL_get_verify_mode(SSL *s);
1207   -int SSL_get_verify_depth(SSL *s);
1208   -int (*SSL_get_verify_callback(SSL *s))(int,X509_STORE_CTX *);
  1250 +int SSL_get_verify_mode(const SSL *s);
  1251 +int SSL_get_verify_depth(const SSL *s);
  1252 +int (*SSL_get_verify_callback(const SSL *s))(int,X509_STORE_CTX *);
1209 1253 void SSL_set_verify(SSL *s, int mode,
1210 1254 int (*callback)(int ok,X509_STORE_CTX *ctx));
1211 1255 void SSL_set_verify_depth(SSL *s, int depth);
... ... @@ -1214,9 +1258,9 @@ int SSL_use_RSAPrivateKey(SSL *ssl, RSA *rsa);
1214 1258 #endif
1215 1259 int SSL_use_RSAPrivateKey_ASN1(SSL *ssl, unsigned char *d, long len);
1216 1260 int SSL_use_PrivateKey(SSL *ssl, EVP_PKEY *pkey);
1217   -int SSL_use_PrivateKey_ASN1(int pk,SSL *ssl, unsigned char *d, long len);
  1261 +int SSL_use_PrivateKey_ASN1(int pk,SSL *ssl, const unsigned char *d, long len);
1218 1262 int SSL_use_certificate(SSL *ssl, X509 *x);
1219   -int SSL_use_certificate_ASN1(SSL *ssl, unsigned char *d, int len);
  1263 +int SSL_use_certificate_ASN1(SSL *ssl, const unsigned char *d, int len);
1220 1264  
1221 1265 #ifndef OPENSSL_NO_STDIO
1222 1266 int SSL_use_RSAPrivateKey_file(SSL *ssl, const char *file, int type);
... ... @@ -1243,20 +1287,21 @@ const char *SSL_state_string(const SSL *s);
1243 1287 const char *SSL_rstate_string(const SSL *s);
1244 1288 const char *SSL_state_string_long(const SSL *s);
1245 1289 const char *SSL_rstate_string_long(const SSL *s);
1246   -long SSL_SESSION_get_time(SSL_SESSION *s);
  1290 +long SSL_SESSION_get_time(const SSL_SESSION *s);
1247 1291 long SSL_SESSION_set_time(SSL_SESSION *s, long t);
1248   -long SSL_SESSION_get_timeout(SSL_SESSION *s);
  1292 +long SSL_SESSION_get_timeout(const SSL_SESSION *s);
1249 1293 long SSL_SESSION_set_timeout(SSL_SESSION *s, long t);
1250   -void SSL_copy_session_id(SSL *to,SSL *from);
  1294 +void SSL_copy_session_id(SSL *to,const SSL *from);
1251 1295  
1252 1296 SSL_SESSION *SSL_SESSION_new(void);
1253   -unsigned long SSL_SESSION_hash(SSL_SESSION *a);
1254   -int SSL_SESSION_cmp(SSL_SESSION *a,SSL_SESSION *b);
  1297 +unsigned long SSL_SESSION_hash(const SSL_SESSION *a);
  1298 +int SSL_SESSION_cmp(const SSL_SESSION *a,const SSL_SESSION *b);
  1299 +const unsigned char *SSL_SESSION_get_id(const SSL_SESSION *s, unsigned int *len);
1255 1300 #ifndef OPENSSL_NO_FP_API
1256   -int SSL_SESSION_print_fp(FILE *fp,SSL_SESSION *ses);
  1301 +int SSL_SESSION_print_fp(FILE *fp,const SSL_SESSION *ses);
1257 1302 #endif
1258 1303 #ifndef OPENSSL_NO_BIO
1259   -int SSL_SESSION_print(BIO *fp,SSL_SESSION *ses);
  1304 +int SSL_SESSION_print(BIO *fp,const SSL_SESSION *ses);
1260 1305 #endif
1261 1306 void SSL_SESSION_free(SSL_SESSION *ses);
1262 1307 int i2d_SSL_SESSION(SSL_SESSION *in,unsigned char **pp);
... ... @@ -1267,17 +1312,18 @@ int SSL_CTX_set_generate_session_id(SSL_CTX *, GEN_SESSION_CB);
1267 1312 int SSL_set_generate_session_id(SSL *, GEN_SESSION_CB);
1268 1313 int SSL_has_matching_session_id(const SSL *ssl, const unsigned char *id,
1269 1314 unsigned int id_len);
1270   -SSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a,unsigned char **pp,long length);
  1315 +SSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a,const unsigned char **pp,
  1316 + long length);
1271 1317  
1272 1318 #ifdef HEADER_X509_H
1273   -X509 * SSL_get_peer_certificate(SSL *s);
  1319 +X509 * SSL_get_peer_certificate(const SSL *s);
1274 1320 #endif
1275 1321  
1276   -STACK_OF(X509) *SSL_get_peer_cert_chain(SSL *s);
  1322 +STACK_OF(X509) *SSL_get_peer_cert_chain(const SSL *s);
1277 1323  
1278   -int SSL_CTX_get_verify_mode(SSL_CTX *ctx);
1279   -int SSL_CTX_get_verify_depth(SSL_CTX *ctx);
1280   -int (*SSL_CTX_get_verify_callback(SSL_CTX *ctx))(int,X509_STORE_CTX *);
  1324 +int SSL_CTX_get_verify_mode(const SSL_CTX *ctx);
  1325 +int SSL_CTX_get_verify_depth(const SSL_CTX *ctx);
  1326 +int (*SSL_CTX_get_verify_callback(const SSL_CTX *ctx))(int,X509_STORE_CTX *);
1281 1327 void SSL_CTX_set_verify(SSL_CTX *ctx,int mode,
1282 1328 int (*callback)(int, X509_STORE_CTX *));
1283 1329 void SSL_CTX_set_verify_depth(SSL_CTX *ctx,int depth);
... ... @@ -1285,18 +1331,18 @@ void SSL_CTX_set_cert_verify_callback(SSL_CTX *ctx, int (*cb)(X509_STORE_CTX *,v
1285 1331 #ifndef OPENSSL_NO_RSA
1286 1332 int SSL_CTX_use_RSAPrivateKey(SSL_CTX *ctx, RSA *rsa);
1287 1333 #endif
1288   -int SSL_CTX_use_RSAPrivateKey_ASN1(SSL_CTX *ctx, unsigned char *d, long len);
  1334 +int SSL_CTX_use_RSAPrivateKey_ASN1(SSL_CTX *ctx, const unsigned char *d, long len);
1289 1335 int SSL_CTX_use_PrivateKey(SSL_CTX *ctx, EVP_PKEY *pkey);
1290 1336 int SSL_CTX_use_PrivateKey_ASN1(int pk,SSL_CTX *ctx,
1291   - unsigned char *d, long len);
  1337 + const unsigned char *d, long len);
1292 1338 int SSL_CTX_use_certificate(SSL_CTX *ctx, X509 *x);
1293   -int SSL_CTX_use_certificate_ASN1(SSL_CTX *ctx, int len, unsigned char *d);
  1339 +int SSL_CTX_use_certificate_ASN1(SSL_CTX *ctx, int len, const unsigned char *d);
1294 1340  
1295 1341 void SSL_CTX_set_default_passwd_cb(SSL_CTX *ctx, pem_password_cb *cb);
1296 1342 void SSL_CTX_set_default_passwd_cb_userdata(SSL_CTX *ctx, void *u);
1297 1343  
1298   -int SSL_CTX_check_private_key(SSL_CTX *ctx);
1299   -int SSL_check_private_key(SSL *ctx);
  1344 +int SSL_CTX_check_private_key(const SSL_CTX *ctx);
  1345 +int SSL_check_private_key(const SSL *ctx);
1300 1346  
1301 1347 int SSL_CTX_set_session_id_context(SSL_CTX *ctx,const unsigned char *sid_ctx,
1302 1348 unsigned int sid_ctx_len);
... ... @@ -1317,12 +1363,12 @@ int SSL_read(SSL *ssl,void *buf,int num);
1317 1363 int SSL_peek(SSL *ssl,void *buf,int num);
1318 1364 int SSL_write(SSL *ssl,const void *buf,int num);
1319 1365 long SSL_ctrl(SSL *ssl,int cmd, long larg, void *parg);
1320   -long SSL_callback_ctrl(SSL *, int, void (*)());
  1366 +long SSL_callback_ctrl(SSL *, int, void (*)(void));
1321 1367 long SSL_CTX_ctrl(SSL_CTX *ctx,int cmd, long larg, void *parg);
1322   -long SSL_CTX_callback_ctrl(SSL_CTX *, int, void (*)());
  1368 +long SSL_CTX_callback_ctrl(SSL_CTX *, int, void (*)(void));
1323 1369  
1324   -int SSL_get_error(SSL *s,int ret_code);
1325   -const char *SSL_get_version(SSL *s);
  1370 +int SSL_get_error(const SSL *s,int ret_code);
  1371 +const char *SSL_get_version(const SSL *s);
1326 1372  
1327 1373 /* This sets the 'default' SSL version that SSL_new() will create */
1328 1374 int SSL_CTX_set_ssl_version(SSL_CTX *ctx,SSL_METHOD *meth);
... ... @@ -1343,7 +1389,11 @@ SSL_METHOD *TLSv1_method(void); /* TLSv1.0 */
1343 1389 SSL_METHOD *TLSv1_server_method(void); /* TLSv1.0 */
1344 1390 SSL_METHOD *TLSv1_client_method(void); /* TLSv1.0 */
1345 1391  
1346   -STACK_OF(SSL_CIPHER) *SSL_get_ciphers(SSL *s);
  1392 +SSL_METHOD *DTLSv1_method(void); /* DTLSv1.0 */
  1393 +SSL_METHOD *DTLSv1_server_method(void); /* DTLSv1.0 */
  1394 +SSL_METHOD *DTLSv1_client_method(void); /* DTLSv1.0 */
  1395 +
  1396 +STACK_OF(SSL_CIPHER) *SSL_get_ciphers(const SSL *s);
1347 1397  
1348 1398 int SSL_do_handshake(SSL *s);
1349 1399 int SSL_renegotiate(SSL *s);
... ... @@ -1359,15 +1409,15 @@ const char *SSL_alert_desc_string(int value);
1359 1409  
1360 1410 void SSL_set_client_CA_list(SSL *s, STACK_OF(X509_NAME) *name_list);
1361 1411 void SSL_CTX_set_client_CA_list(SSL_CTX *ctx, STACK_OF(X509_NAME) *name_list);
1362   -STACK_OF(X509_NAME) *SSL_get_client_CA_list(SSL *s);
1363   -STACK_OF(X509_NAME) *SSL_CTX_get_client_CA_list(SSL_CTX *s);
  1412 +STACK_OF(X509_NAME) *SSL_get_client_CA_list(const SSL *s);
  1413 +STACK_OF(X509_NAME) *SSL_CTX_get_client_CA_list(const SSL_CTX *s);
1364 1414 int SSL_add_client_CA(SSL *ssl,X509 *x);
1365 1415 int SSL_CTX_add_client_CA(SSL_CTX *ctx,X509 *x);
1366 1416  
1367 1417 void SSL_set_connect_state(SSL *s);
1368 1418 void SSL_set_accept_state(SSL *s);
1369 1419  
1370   -long SSL_get_default_timeout(SSL *s);
  1420 +long SSL_get_default_timeout(const SSL *s);
1371 1421  
1372 1422 int SSL_library_init(void );
1373 1423  
... ... @@ -1376,43 +1426,43 @@ STACK_OF(X509_NAME) *SSL_dup_CA_list(STACK_OF(X509_NAME) *sk);
1376 1426  
1377 1427 SSL *SSL_dup(SSL *ssl);
1378 1428  
1379   -X509 *SSL_get_certificate(SSL *ssl);
  1429 +X509 *SSL_get_certificate(const SSL *ssl);
1380 1430 /* EVP_PKEY */ struct evp_pkey_st *SSL_get_privatekey(SSL *ssl);
1381 1431  
1382 1432 void SSL_CTX_set_quiet_shutdown(SSL_CTX *ctx,int mode);
1383   -int SSL_CTX_get_quiet_shutdown(SSL_CTX *ctx);
  1433 +int SSL_CTX_get_quiet_shutdown(const SSL_CTX *ctx);
1384 1434 void SSL_set_quiet_shutdown(SSL *ssl,int mode);
1385   -int SSL_get_quiet_shutdown(SSL *ssl);
  1435 +int SSL_get_quiet_shutdown(const SSL *ssl);
1386 1436 void SSL_set_shutdown(SSL *ssl,int mode);
1387   -int SSL_get_shutdown(SSL *ssl);
1388   -int SSL_version(SSL *ssl);
  1437 +int SSL_get_shutdown(const SSL *ssl);
  1438 +int SSL_version(const SSL *ssl);
1389 1439 int SSL_CTX_set_default_verify_paths(SSL_CTX *ctx);
1390 1440 int SSL_CTX_load_verify_locations(SSL_CTX *ctx, const char *CAfile,
1391 1441 const char *CApath);
1392 1442 #define SSL_get0_session SSL_get_session /* just peek at pointer */
1393   -SSL_SESSION *SSL_get_session(SSL *ssl);
  1443 +SSL_SESSION *SSL_get_session(const SSL *ssl);
1394 1444 SSL_SESSION *SSL_get1_session(SSL *ssl); /* obtain a reference count */
1395   -SSL_CTX *SSL_get_SSL_CTX(SSL *ssl);
  1445 +SSL_CTX *SSL_get_SSL_CTX(const SSL *ssl);
1396 1446 void SSL_set_info_callback(SSL *ssl,
1397 1447 void (*cb)(const SSL *ssl,int type,int val));
1398   -void (*SSL_get_info_callback(SSL *ssl))(const SSL *ssl,int type,int val);
1399   -int SSL_state(SSL *ssl);
  1448 +void (*SSL_get_info_callback(const SSL *ssl))(const SSL *ssl,int type,int val);
  1449 +int SSL_state(const SSL *ssl);
1400 1450  
1401 1451 void SSL_set_verify_result(SSL *ssl,long v);
1402   -long SSL_get_verify_result(SSL *ssl);
  1452 +long SSL_get_verify_result(const SSL *ssl);
1403 1453  
1404 1454 int SSL_set_ex_data(SSL *ssl,int idx,void *data);
1405   -void *SSL_get_ex_data(SSL *ssl,int idx);
  1455 +void *SSL_get_ex_data(const SSL *ssl,int idx);
1406 1456 int SSL_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
1407 1457 CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
1408 1458  
1409 1459 int SSL_SESSION_set_ex_data(SSL_SESSION *ss,int idx,void *data);
1410   -void *SSL_SESSION_get_ex_data(SSL_SESSION *ss,int idx);
  1460 +void *SSL_SESSION_get_ex_data(const SSL_SESSION *ss,int idx);
1411 1461 int SSL_SESSION_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
1412 1462 CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
1413 1463  
1414 1464 int SSL_CTX_set_ex_data(SSL_CTX *ssl,int idx,void *data);
1415   -void *SSL_CTX_get_ex_data(SSL_CTX *ssl,int idx);
  1465 +void *SSL_CTX_get_ex_data(const SSL_CTX *ssl,int idx);
1416 1466 int SSL_CTX_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
1417 1467 CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
1418 1468  
... ... @@ -1460,11 +1510,27 @@ void SSL_set_tmp_dh_callback(SSL *ssl,
1460 1510 DH *(*dh)(SSL *ssl,int is_export,
1461 1511 int keylength));
1462 1512 #endif
  1513 +#ifndef OPENSSL_NO_ECDH
  1514 +void SSL_CTX_set_tmp_ecdh_callback(SSL_CTX *ctx,
  1515 + EC_KEY *(*ecdh)(SSL *ssl,int is_export,
  1516 + int keylength));
  1517 +void SSL_set_tmp_ecdh_callback(SSL *ssl,
  1518 + EC_KEY *(*ecdh)(SSL *ssl,int is_export,
  1519 + int keylength));
  1520 +#endif
1463 1521  
1464 1522 #ifndef OPENSSL_NO_COMP
  1523 +const COMP_METHOD *SSL_get_current_compression(SSL *s);
  1524 +const COMP_METHOD *SSL_get_current_expansion(SSL *s);
  1525 +const char *SSL_COMP_get_name(const COMP_METHOD *comp);
  1526 +STACK_OF(SSL_COMP) *SSL_COMP_get_compression_methods(void);
1465 1527 int SSL_COMP_add_compression_method(int id,COMP_METHOD *cm);
1466 1528 #else
1467   -int SSL_COMP_add_compression_method(int id,char *cm);
  1529 +const void *SSL_get_current_compression(SSL *s);
  1530 +const void *SSL_get_current_expansion(SSL *s);
  1531 +const char *SSL_COMP_get_name(const void *comp);
  1532 +void *SSL_COMP_get_compression_methods(void);
  1533 +int SSL_COMP_add_compression_method(int id,void *cm);
1468 1534 #endif
1469 1535  
1470 1536 /* BEGIN ERROR CODES */
... ... @@ -1477,11 +1543,35 @@ void ERR_load_SSL_strings(void);
1477 1543  
1478 1544 /* Function codes. */
1479 1545 #define SSL_F_CLIENT_CERTIFICATE 100
1480   -#define SSL_F_CLIENT_FINISHED 238
  1546 +#define SSL_F_CLIENT_FINISHED 167
1481 1547 #define SSL_F_CLIENT_HELLO 101
1482 1548 #define SSL_F_CLIENT_MASTER_KEY 102
1483 1549 #define SSL_F_D2I_SSL_SESSION 103
  1550 +#define SSL_F_DO_DTLS1_WRITE 245
1484 1551 #define SSL_F_DO_SSL3_WRITE 104
  1552 +#define SSL_F_DTLS1_ACCEPT 246
  1553 +#define SSL_F_DTLS1_BUFFER_RECORD 247
  1554 +#define SSL_F_DTLS1_CLIENT_HELLO 248
  1555 +#define SSL_F_DTLS1_CONNECT 249
  1556 +#define SSL_F_DTLS1_ENC 250
  1557 +#define SSL_F_DTLS1_GET_HELLO_VERIFY 251
  1558 +#define SSL_F_DTLS1_GET_MESSAGE 252
  1559 +#define SSL_F_DTLS1_GET_MESSAGE_FRAGMENT 253
  1560 +#define SSL_F_DTLS1_GET_RECORD 254
  1561 +#define SSL_F_DTLS1_OUTPUT_CERT_CHAIN 255
  1562 +#define SSL_F_DTLS1_PROCESS_OUT_OF_SEQ_MESSAGE 256
  1563 +#define SSL_F_DTLS1_PROCESS_RECORD 257
  1564 +#define SSL_F_DTLS1_READ_BYTES 258
  1565 +#define SSL_F_DTLS1_READ_FAILED 259
  1566 +#define SSL_F_DTLS1_SEND_CERTIFICATE_REQUEST 260
  1567 +#define SSL_F_DTLS1_SEND_CLIENT_CERTIFICATE 261
  1568 +#define SSL_F_DTLS1_SEND_CLIENT_KEY_EXCHANGE 262
  1569 +#define SSL_F_DTLS1_SEND_CLIENT_VERIFY 263
  1570 +#define SSL_F_DTLS1_SEND_HELLO_VERIFY_REQUEST 264
  1571 +#define SSL_F_DTLS1_SEND_SERVER_CERTIFICATE 265
  1572 +#define SSL_F_DTLS1_SEND_SERVER_HELLO 266
  1573 +#define SSL_F_DTLS1_SEND_SERVER_KEY_EXCHANGE 267
  1574 +#define SSL_F_DTLS1_WRITE_APP_DATA_BYTES 268
1485 1575 #define SSL_F_GET_CLIENT_FINISHED 105
1486 1576 #define SSL_F_GET_CLIENT_HELLO 106
1487 1577 #define SSL_F_GET_CLIENT_MASTER_KEY 107
... ... @@ -1565,6 +1655,7 @@ void ERR_load_SSL_strings(void);
1565 1655 #define SSL_F_SSL_CTRL 232
1566 1656 #define SSL_F_SSL_CTX_CHECK_PRIVATE_KEY 168
1567 1657 #define SSL_F_SSL_CTX_NEW 169
  1658 +#define SSL_F_SSL_CTX_SET_CIPHER_LIST 269
1568 1659 #define SSL_F_SSL_CTX_SET_PURPOSE 226
1569 1660 #define SSL_F_SSL_CTX_SET_SESSION_ID_CONTEXT 219
1570 1661 #define SSL_F_SSL_CTX_SET_SSL_VERSION 170
... ... @@ -1587,6 +1678,7 @@ void ERR_load_SSL_strings(void);
1587 1678 #define SSL_F_SSL_INIT_WBIO_BUFFER 184
1588 1679 #define SSL_F_SSL_LOAD_CLIENT_CA_FILE 185
1589 1680 #define SSL_F_SSL_NEW 186
  1681 +#define SSL_F_SSL_PEEK 270
1590 1682 #define SSL_F_SSL_READ 223
1591 1683 #define SSL_F_SSL_RSA_PRIVATE_DECRYPT 187
1592 1684 #define SSL_F_SSL_RSA_PUBLIC_ENCRYPT 188
... ... @@ -1594,6 +1686,7 @@ void ERR_load_SSL_strings(void);
1594 1686 #define SSL_F_SSL_SESSION_PRINT_FP 190
1595 1687 #define SSL_F_SSL_SESS_CERT_NEW 225
1596 1688 #define SSL_F_SSL_SET_CERT 191
  1689 +#define SSL_F_SSL_SET_CIPHER_LIST 271
1597 1690 #define SSL_F_SSL_SET_FD 192
1598 1691 #define SSL_F_SSL_SET_PKEY 193
1599 1692 #define SSL_F_SSL_SET_PURPOSE 227
... ... @@ -1603,7 +1696,9 @@ void ERR_load_SSL_strings(void);
1603 1696 #define SSL_F_SSL_SET_TRUST 228
1604 1697 #define SSL_F_SSL_SET_WFD 196
1605 1698 #define SSL_F_SSL_SHUTDOWN 224
  1699 +#define SSL_F_SSL_UNDEFINED_CONST_FUNCTION 243
1606 1700 #define SSL_F_SSL_UNDEFINED_FUNCTION 197
  1701 +#define SSL_F_SSL_UNDEFINED_VOID_FUNCTION 244
1607 1702 #define SSL_F_SSL_USE_CERTIFICATE 198
1608 1703 #define SSL_F_SSL_USE_CERTIFICATE_ASN1 199
1609 1704 #define SSL_F_SSL_USE_CERTIFICATE_FILE 200
... ... @@ -1634,6 +1729,9 @@ void ERR_load_SSL_strings(void);
1634 1729 #define SSL_R_BAD_DH_P_LENGTH 110
1635 1730 #define SSL_R_BAD_DIGEST_LENGTH 111
1636 1731 #define SSL_R_BAD_DSA_SIGNATURE 112
  1732 +#define SSL_R_BAD_ECC_CERT 304
  1733 +#define SSL_R_BAD_ECDSA_SIGNATURE 305
  1734 +#define SSL_R_BAD_ECPOINT 306
1637 1735 #define SSL_R_BAD_HELLO_REQUEST 105
1638 1736 #define SSL_R_BAD_LENGTH 271
1639 1737 #define SSL_R_BAD_MAC_DECODE 113
... ... @@ -1665,46 +1763,49 @@ void ERR_load_SSL_strings(void);
1665 1763 #define SSL_R_CIPHER_TABLE_SRC_ERROR 139
1666 1764 #define SSL_R_COMPRESSED_LENGTH_TOO_LONG 140
1667 1765 #define SSL_R_COMPRESSION_FAILURE 141
  1766 +#define SSL_R_COMPRESSION_ID_NOT_WITHIN_PRIVATE_RANGE 307
1668 1767 #define SSL_R_COMPRESSION_LIBRARY_ERROR 142
1669 1768 #define SSL_R_CONNECTION_ID_IS_DIFFERENT 143
1670 1769 #define SSL_R_CONNECTION_TYPE_NOT_SET 144
  1770 +#define SSL_R_COOKIE_MISMATCH 308
1671 1771 #define SSL_R_DATA_BETWEEN_CCS_AND_FINISHED 145
1672 1772 #define SSL_R_DATA_LENGTH_TOO_LONG 146
1673 1773 #define SSL_R_DECRYPTION_FAILED 147
1674   -#define SSL_R_DECRYPTION_FAILED_OR_BAD_RECORD_MAC 1109
  1774 +#define SSL_R_DECRYPTION_FAILED_OR_BAD_RECORD_MAC 281
1675 1775 #define SSL_R_DH_PUBLIC_VALUE_LENGTH_IS_WRONG 148
1676 1776 #define SSL_R_DIGEST_CHECK_FAILED 149
  1777 +#define SSL_R_DUPLICATE_COMPRESSION_ID 309
  1778 +#define SSL_R_ECGROUP_TOO_LARGE_FOR_CIPHER 310
1677 1779 #define SSL_R_ENCRYPTED_LENGTH_TOO_LONG 150
1678   -#define SSL_R_ERROR_GENERATING_TMP_RSA_KEY 1092
  1780 +#define SSL_R_ERROR_GENERATING_TMP_RSA_KEY 282
1679 1781 #define SSL_R_ERROR_IN_RECEIVED_CIPHER_LIST 151
1680 1782 #define SSL_R_EXCESSIVE_MESSAGE_SIZE 152
1681 1783 #define SSL_R_EXTRA_DATA_IN_MESSAGE 153
1682 1784 #define SSL_R_GOT_A_FIN_BEFORE_A_CCS 154
1683 1785 #define SSL_R_HTTPS_PROXY_REQUEST 155
1684 1786 #define SSL_R_HTTP_REQUEST 156
1685   -#define SSL_R_ILLEGAL_PADDING 1110
  1787 +#define SSL_R_ILLEGAL_PADDING 283
1686 1788 #define SSL_R_INVALID_CHALLENGE_LENGTH 158
1687 1789 #define SSL_R_INVALID_COMMAND 280
1688 1790 #define SSL_R_INVALID_PURPOSE 278
1689 1791 #define SSL_R_INVALID_TRUST 279
1690   -#define SSL_R_KEY_ARG_TOO_LONG 1112
1691   -#define SSL_R_KRB5 1104
1692   -#define SSL_R_KRB5_C_CC_PRINC 1094
1693   -#define SSL_R_KRB5_C_GET_CRED 1095
1694   -#define SSL_R_KRB5_C_INIT 1096
1695   -#define SSL_R_KRB5_C_MK_REQ 1097
1696   -#define SSL_R_KRB5_S_BAD_TICKET 1098
1697   -#define SSL_R_KRB5_S_INIT 1099
1698   -#define SSL_R_KRB5_S_RD_REQ 1108
1699   -#define SSL_R_KRB5_S_TKT_EXPIRED 1105
1700   -#define SSL_R_KRB5_S_TKT_NYV 1106
1701   -#define SSL_R_KRB5_S_TKT_SKEW 1107
  1792 +#define SSL_R_KEY_ARG_TOO_LONG 284
  1793 +#define SSL_R_KRB5 285
  1794 +#define SSL_R_KRB5_C_CC_PRINC 286
  1795 +#define SSL_R_KRB5_C_GET_CRED 287
  1796 +#define SSL_R_KRB5_C_INIT 288
  1797 +#define SSL_R_KRB5_C_MK_REQ 289
  1798 +#define SSL_R_KRB5_S_BAD_TICKET 290
  1799 +#define SSL_R_KRB5_S_INIT 291
  1800 +#define SSL_R_KRB5_S_RD_REQ 292
  1801 +#define SSL_R_KRB5_S_TKT_EXPIRED 293
  1802 +#define SSL_R_KRB5_S_TKT_NYV 294
  1803 +#define SSL_R_KRB5_S_TKT_SKEW 295
1702 1804 #define SSL_R_LENGTH_MISMATCH 159
1703 1805 #define SSL_R_LENGTH_TOO_SHORT 160
1704 1806 #define SSL_R_LIBRARY_BUG 274
1705 1807 #define SSL_R_LIBRARY_HAS_NO_CIPHERS 161
1706   -#define SSL_R_MASTER_KEY_TOO_LONG 1112
1707   -#define SSL_R_MESSAGE_TOO_LONG 1111
  1808 +#define SSL_R_MESSAGE_TOO_LONG 296
1708 1809 #define SSL_R_MISSING_DH_DSA_CERT 162
1709 1810 #define SSL_R_MISSING_DH_KEY 163
1710 1811 #define SSL_R_MISSING_DH_RSA_CERT 164
... ... @@ -1715,6 +1816,7 @@ void ERR_load_SSL_strings(void);
1715 1816 #define SSL_R_MISSING_RSA_ENCRYPTING_CERT 169
1716 1817 #define SSL_R_MISSING_RSA_SIGNING_CERT 170
1717 1818 #define SSL_R_MISSING_TMP_DH_KEY 171
  1819 +#define SSL_R_MISSING_TMP_ECDH_KEY 311
1718 1820 #define SSL_R_MISSING_TMP_RSA_KEY 172
1719 1821 #define SSL_R_MISSING_TMP_RSA_PKEY 173
1720 1822 #define SSL_R_MISSING_VERIFY_MESSAGE 174
... ... @@ -1741,6 +1843,7 @@ void ERR_load_SSL_strings(void);
1741 1843 #define SSL_R_NULL_SSL_CTX 195
1742 1844 #define SSL_R_NULL_SSL_METHOD_PASSED 196
1743 1845 #define SSL_R_OLD_SESSION_CIPHER_NOT_RETURNED 197
  1846 +#define SSL_R_ONLY_TLS_ALLOWED_IN_FIPS_MODE 297
1744 1847 #define SSL_R_PACKET_LENGTH_TOO_LONG 198
1745 1848 #define SSL_R_PATH_TOO_LONG 270
1746 1849 #define SSL_R_PEER_DID_NOT_RETURN_A_CERTIFICATE 199
... ... @@ -1756,10 +1859,11 @@ void ERR_load_SSL_strings(void);
1756 1859 #define SSL_R_PUBLIC_KEY_IS_NOT_RSA 209
1757 1860 #define SSL_R_PUBLIC_KEY_NOT_RSA 210
1758 1861 #define SSL_R_READ_BIO_NOT_SET 211
  1862 +#define SSL_R_READ_TIMEOUT_EXPIRED 312
1759 1863 #define SSL_R_READ_WRONG_PACKET_TYPE 212
1760 1864 #define SSL_R_RECORD_LENGTH_MISMATCH 213
1761 1865 #define SSL_R_RECORD_TOO_LARGE 214
1762   -#define SSL_R_RECORD_TOO_SMALL 1093
  1866 +#define SSL_R_RECORD_TOO_SMALL 298
1763 1867 #define SSL_R_REQUIRED_CIPHER_MISSING 215
1764 1868 #define SSL_R_REUSE_CERT_LENGTH_NOT_ZERO 216
1765 1869 #define SSL_R_REUSE_CERT_TYPE_NOT_ZERO 217
... ... @@ -1768,8 +1872,8 @@ void ERR_load_SSL_strings(void);
1768 1872 #define SSL_R_SHORT_READ 219
1769 1873 #define SSL_R_SIGNATURE_FOR_NON_SIGNING_CERTIFICATE 220
1770 1874 #define SSL_R_SSL23_DOING_SESSION_ID_REUSE 221
1771   -#define SSL_R_SSL2_CONNECTION_ID_TOO_LONG 1114
1772   -#define SSL_R_SSL3_SESSION_ID_TOO_LONG 1113
  1875 +#define SSL_R_SSL2_CONNECTION_ID_TOO_LONG 299
  1876 +#define SSL_R_SSL3_SESSION_ID_TOO_LONG 300
1773 1877 #define SSL_R_SSL3_SESSION_ID_TOO_SHORT 222
1774 1878 #define SSL_R_SSLV3_ALERT_BAD_CERTIFICATE 1042
1775 1879 #define SSL_R_SSLV3_ALERT_BAD_RECORD_MAC 1020
... ... @@ -1780,20 +1884,15 @@ void ERR_load_SSL_strings(void);
1780 1884 #define SSL_R_SSLV3_ALERT_HANDSHAKE_FAILURE 1040
1781 1885 #define SSL_R_SSLV3_ALERT_ILLEGAL_PARAMETER 1047
1782 1886 #define SSL_R_SSLV3_ALERT_NO_CERTIFICATE 1041
1783   -#define SSL_R_SSLV3_ALERT_PEER_ERROR_CERTIFICATE 223
1784   -#define SSL_R_SSLV3_ALERT_PEER_ERROR_NO_CERTIFICATE 224
1785   -#define SSL_R_SSLV3_ALERT_PEER_ERROR_NO_CIPHER 225
1786   -#define SSL_R_SSLV3_ALERT_PEER_ERROR_UNSUPPORTED_CERTIFICATE_TYPE 226
1787 1887 #define SSL_R_SSLV3_ALERT_UNEXPECTED_MESSAGE 1010
1788   -#define SSL_R_SSLV3_ALERT_UNKNOWN_REMOTE_ERROR_TYPE 227
1789 1888 #define SSL_R_SSLV3_ALERT_UNSUPPORTED_CERTIFICATE 1043
1790 1889 #define SSL_R_SSL_CTX_HAS_NO_DEFAULT_SSL_VERSION 228
1791 1890 #define SSL_R_SSL_HANDSHAKE_FAILURE 229
1792 1891 #define SSL_R_SSL_LIBRARY_HAS_NO_CIPHERS 230
1793   -#define SSL_R_SSL_SESSION_ID_CALLBACK_FAILED 1102
1794   -#define SSL_R_SSL_SESSION_ID_CONFLICT 1103
  1892 +#define SSL_R_SSL_SESSION_ID_CALLBACK_FAILED 301
  1893 +#define SSL_R_SSL_SESSION_ID_CONFLICT 302
1795 1894 #define SSL_R_SSL_SESSION_ID_CONTEXT_TOO_LONG 273
1796   -#define SSL_R_SSL_SESSION_ID_HAS_BAD_LENGTH 1101
  1895 +#define SSL_R_SSL_SESSION_ID_HAS_BAD_LENGTH 303
1797 1896 #define SSL_R_SSL_SESSION_ID_IS_DIFFERENT 231
1798 1897 #define SSL_R_TLSV1_ALERT_ACCESS_DENIED 1049
1799 1898 #define SSL_R_TLSV1_ALERT_DECODE_ERROR 1050
... ... @@ -1812,8 +1911,10 @@ void ERR_load_SSL_strings(void);
1812 1911 #define SSL_R_TLS_RSA_ENCRYPTED_VALUE_LENGTH_IS_WRONG 234
1813 1912 #define SSL_R_TRIED_TO_USE_UNSUPPORTED_CIPHER 235
1814 1913 #define SSL_R_UNABLE_TO_DECODE_DH_CERTS 236
  1914 +#define SSL_R_UNABLE_TO_DECODE_ECDH_CERTS 313
1815 1915 #define SSL_R_UNABLE_TO_EXTRACT_PUBLIC_KEY 237
1816 1916 #define SSL_R_UNABLE_TO_FIND_DH_PARAMETERS 238
  1917 +#define SSL_R_UNABLE_TO_FIND_ECDH_PARAMETERS 314
1817 1918 #define SSL_R_UNABLE_TO_FIND_PUBLIC_KEY_PARAMETERS 239
1818 1919 #define SSL_R_UNABLE_TO_FIND_SSL_METHOD 240
1819 1920 #define SSL_R_UNABLE_TO_LOAD_SSL2_MD5_ROUTINES 241
... ... @@ -1834,7 +1935,7 @@ void ERR_load_SSL_strings(void);
1834 1935 #define SSL_R_UNKNOWN_STATE 255
1835 1936 #define SSL_R_UNSUPPORTED_CIPHER 256
1836 1937 #define SSL_R_UNSUPPORTED_COMPRESSION_ALGORITHM 257
1837   -#define SSL_R_UNSUPPORTED_OPTION 1091
  1938 +#define SSL_R_UNSUPPORTED_ELLIPTIC_CURVE 315
1838 1939 #define SSL_R_UNSUPPORTED_PROTOCOL 258
1839 1940 #define SSL_R_UNSUPPORTED_SSL_VERSION 259
1840 1941 #define SSL_R_WRITE_BIO_NOT_SET 260
... ...
third_dev/openssl/include/openssl/ssl3.h
... ... @@ -108,6 +108,11 @@
108 108 * Hudson (tjh@cryptsoft.com).
109 109 *
110 110 */
  111 +/* ====================================================================
  112 + * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
  113 + * ECC cipher suite support in OpenSSL originally developed by
  114 + * SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project.
  115 + */
111 116  
112 117 #ifndef HEADER_SSL3_H
113 118 #define HEADER_SSL3_H
... ... @@ -118,6 +123,7 @@
118 123 #include <openssl/buffer.h>
119 124 #include <openssl/evp.h>
120 125 #include <openssl/ssl.h>
  126 +#include <openssl/pq_compat.h>
121 127  
122 128 #ifdef __cplusplus
123 129 extern "C" {
... ... @@ -248,7 +254,11 @@ extern &quot;C&quot; {
248 254 #endif
249 255  
250 256 #define SSL3_RT_MAX_PLAIN_LENGTH 16384
  257 +#ifdef OPENSSL_NO_COMP
  258 +#define SSL3_RT_MAX_COMPRESSED_LENGTH SSL3_RT_MAX_PLAIN_LENGTH
  259 +#else
251 260 #define SSL3_RT_MAX_COMPRESSED_LENGTH (1024+SSL3_RT_MAX_PLAIN_LENGTH)
  261 +#endif
252 262 #define SSL3_RT_MAX_ENCRYPTED_LENGTH (1024+SSL3_RT_MAX_COMPRESSED_LENGTH)
253 263 #define SSL3_RT_MAX_PACKET_SIZE (SSL3_RT_MAX_ENCRYPTED_LENGTH+SSL3_RT_HEADER_LENGTH)
254 264 #define SSL3_RT_MAX_DATA_SIZE (1024*1024)
... ... @@ -289,6 +299,8 @@ typedef struct ssl3_record_st
289 299 /*rw*/ unsigned char *data; /* pointer to the record data */
290 300 /*rw*/ unsigned char *input; /* where the decode bytes are */
291 301 /*r */ unsigned char *comp; /* only used with decompression - malloc()ed */
  302 +/*r */ unsigned long epoch; /* epoch number, needed by DTLS1 */
  303 +/*r */ PQ_64BIT seq_num; /* sequence number, needed by DTLS1 */
292 304 } SSL3_RECORD;
293 305  
294 306 typedef struct ssl3_buffer_st
... ... @@ -307,7 +319,12 @@ typedef struct ssl3_buffer_st
307 319 #define SSL3_CT_RSA_EPHEMERAL_DH 5
308 320 #define SSL3_CT_DSS_EPHEMERAL_DH 6
309 321 #define SSL3_CT_FORTEZZA_DMS 20
310   -#define SSL3_CT_NUMBER 7
  322 +/* SSL3_CT_NUMBER is used to size arrays and it must be large
  323 + * enough to contain all of the cert types defined either for
  324 + * SSLv3 and TLSv1.
  325 + */
  326 +#define SSL3_CT_NUMBER 7
  327 +
311 328  
312 329 #define SSL3_FLAGS_NO_RENEGOTIATE_CIPHERS 0x0001
313 330 #define SSL3_FLAGS_DELAY_CLIENT_FINISHED 0x0002
... ... @@ -392,6 +409,11 @@ typedef struct ssl3_state_st
392 409 #ifndef OPENSSL_NO_DH
393 410 DH *dh;
394 411 #endif
  412 +
  413 +#ifndef OPENSSL_NO_ECDH
  414 + EC_KEY *ecdh; /* holds short lived ECDH key */
  415 +#endif
  416 +
395 417 /* used when SSL_ST_FLUSH_DATA is entered */
396 418 int next_state;
397 419  
... ... @@ -420,6 +442,7 @@ typedef struct ssl3_state_st
420 442  
421 443 } SSL3_STATE;
422 444  
  445 +
423 446 /* SSLv3 */
424 447 /*client */
425 448 /* extra state */
... ... @@ -430,6 +453,8 @@ typedef struct ssl3_state_st
430 453 /* read from server */
431 454 #define SSL3_ST_CR_SRVR_HELLO_A (0x120|SSL_ST_CONNECT)
432 455 #define SSL3_ST_CR_SRVR_HELLO_B (0x121|SSL_ST_CONNECT)
  456 +#define DTLS1_ST_CR_HELLO_VERIFY_REQUEST_A (0x126|SSL_ST_CONNECT)
  457 +#define DTLS1_ST_CR_HELLO_VERIFY_REQUEST_B (0x127|SSL_ST_CONNECT)
433 458 #define SSL3_ST_CR_CERT_A (0x130|SSL_ST_CONNECT)
434 459 #define SSL3_ST_CR_CERT_B (0x131|SSL_ST_CONNECT)
435 460 #define SSL3_ST_CR_KEY_EXCH_A (0x140|SSL_ST_CONNECT)
... ... @@ -466,6 +491,8 @@ typedef struct ssl3_state_st
466 491 #define SSL3_ST_SR_CLNT_HELLO_B (0x111|SSL_ST_ACCEPT)
467 492 #define SSL3_ST_SR_CLNT_HELLO_C (0x112|SSL_ST_ACCEPT)
468 493 /* write to client */
  494 +#define DTLS1_ST_SW_HELLO_VERIFY_REQUEST_A (0x113|SSL_ST_ACCEPT)
  495 +#define DTLS1_ST_SW_HELLO_VERIFY_REQUEST_B (0x114|SSL_ST_ACCEPT)
469 496 #define SSL3_ST_SW_HELLO_REQ_A (0x120|SSL_ST_ACCEPT)
470 497 #define SSL3_ST_SW_HELLO_REQ_B (0x121|SSL_ST_ACCEPT)
471 498 #define SSL3_ST_SW_HELLO_REQ_C (0x122|SSL_ST_ACCEPT)
... ... @@ -506,6 +533,8 @@ typedef struct ssl3_state_st
506 533 #define SSL3_MT_CERTIFICATE_VERIFY 15
507 534 #define SSL3_MT_CLIENT_KEY_EXCHANGE 16
508 535 #define SSL3_MT_FINISHED 20
  536 +#define DTLS1_MT_HELLO_VERIFY_REQUEST 3
  537 +
509 538  
510 539 #define SSL3_MT_CCS 1
511 540  
... ...
third_dev/openssl/include/openssl/stack.h
... ... @@ -89,6 +89,7 @@ int sk_insert(STACK *sk,char *data,int where);
89 89 char *sk_delete(STACK *st,int loc);
90 90 char *sk_delete_ptr(STACK *st, char *p);
91 91 int sk_find(STACK *st,char *data);
  92 +int sk_find_ex(STACK *st,char *data);
92 93 int sk_push(STACK *st,char *data);
93 94 int sk_unshift(STACK *st,char *data);
94 95 char *sk_shift(STACK *st);
... ... @@ -99,6 +100,7 @@ int (*sk_set_cmp_func(STACK *sk, int (*c)(const char * const *,
99 100 (const char * const *, const char * const *);
100 101 STACK *sk_dup(STACK *st);
101 102 void sk_sort(STACK *st);
  103 +int sk_is_sorted(const STACK *st);
102 104  
103 105 #ifdef __cplusplus
104 106 }
... ...
third_dev/openssl/include/openssl/store.h 0 → 100644
  1 +/* crypto/store/store.h -*- mode:C; c-file-style: "eay" -*- */
  2 +/* Written by Richard Levitte (richard@levitte.org) for the OpenSSL
  3 + * project 2003.
  4 + */
  5 +/* ====================================================================
  6 + * Copyright (c) 2003 The OpenSSL Project. All rights reserved.
  7 + *
  8 + * Redistribution and use in source and binary forms, with or without
  9 + * modification, are permitted provided that the following conditions
  10 + * are met:
  11 + *
  12 + * 1. Redistributions of source code must retain the above copyright
  13 + * notice, this list of conditions and the following disclaimer.
  14 + *
  15 + * 2. Redistributions in binary form must reproduce the above copyright
  16 + * notice, this list of conditions and the following disclaimer in
  17 + * the documentation and/or other materials provided with the
  18 + * distribution.
  19 + *
  20 + * 3. All advertising materials mentioning features or use of this
  21 + * software must display the following acknowledgment:
  22 + * "This product includes software developed by the OpenSSL Project
  23 + * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
  24 + *
  25 + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
  26 + * endorse or promote products derived from this software without
  27 + * prior written permission. For written permission, please contact
  28 + * openssl-core@openssl.org.
  29 + *
  30 + * 5. Products derived from this software may not be called "OpenSSL"
  31 + * nor may "OpenSSL" appear in their names without prior written
  32 + * permission of the OpenSSL Project.
  33 + *
  34 + * 6. Redistributions of any form whatsoever must retain the following
  35 + * acknowledgment:
  36 + * "This product includes software developed by the OpenSSL Project
  37 + * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
  38 + *
  39 + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
  40 + * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  41 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  42 + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
  43 + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  44 + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  45 + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  46 + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  47 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  48 + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  49 + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
  50 + * OF THE POSSIBILITY OF SUCH DAMAGE.
  51 + * ====================================================================
  52 + *
  53 + * This product includes cryptographic software written by Eric Young
  54 + * (eay@cryptsoft.com). This product includes software written by Tim
  55 + * Hudson (tjh@cryptsoft.com).
  56 + *
  57 + */
  58 +
  59 +#ifndef HEADER_STORE_H
  60 +#define HEADER_STORE_H
  61 +
  62 +#include <openssl/ossl_typ.h>
  63 +#ifndef OPENSSL_NO_DEPRECATED
  64 +#include <openssl/evp.h>
  65 +#include <openssl/bn.h>
  66 +#include <openssl/x509.h>
  67 +#endif
  68 +
  69 +#ifdef __cplusplus
  70 +extern "C" {
  71 +#endif
  72 +
  73 +/* Already defined in ossl_typ.h */
  74 +/* typedef struct store_st STORE; */
  75 +/* typedef struct store_method_st STORE_METHOD; */
  76 +
  77 +
  78 +/* All the following functions return 0, a negative number or NULL on error.
  79 + When everything is fine, they return a positive value or a non-NULL
  80 + pointer, all depending on their purpose. */
  81 +
  82 +/* Creators and destructor. */
  83 +STORE *STORE_new_method(const STORE_METHOD *method);
  84 +STORE *STORE_new_engine(ENGINE *engine);
  85 +void STORE_free(STORE *ui);
  86 +
  87 +
  88 +/* Give a user interface parametrised control commands. This can be used to
  89 + send down an integer, a data pointer or a function pointer, as well as
  90 + be used to get information from a STORE. */
  91 +int STORE_ctrl(STORE *store, int cmd, long i, void *p, void (*f)(void));
  92 +
  93 +/* A control to set the directory with keys and certificates. Used by the
  94 + built-in directory level method. */
  95 +#define STORE_CTRL_SET_DIRECTORY 0x0001
  96 +/* A control to set a file to load. Used by the built-in file level method. */
  97 +#define STORE_CTRL_SET_FILE 0x0002
  98 +/* A control to set a configuration file to load. Can be used by any method
  99 + that wishes to load a configuration file. */
  100 +#define STORE_CTRL_SET_CONF_FILE 0x0003
  101 +/* A control to set a the section of the loaded configuration file. Can be
  102 + used by any method that wishes to load a configuration file. */
  103 +#define STORE_CTRL_SET_CONF_SECTION 0x0004
  104 +
  105 +
  106 +/* Some methods may use extra data */
  107 +#define STORE_set_app_data(s,arg) STORE_set_ex_data(s,0,arg)
  108 +#define STORE_get_app_data(s) STORE_get_ex_data(s,0)
  109 +int STORE_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
  110 + CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
  111 +int STORE_set_ex_data(STORE *r,int idx,void *arg);
  112 +void *STORE_get_ex_data(STORE *r, int idx);
  113 +
  114 +/* Use specific methods instead of the built-in one */
  115 +const STORE_METHOD *STORE_get_method(STORE *store);
  116 +const STORE_METHOD *STORE_set_method(STORE *store, const STORE_METHOD *meth);
  117 +
  118 +/* The standard OpenSSL methods. */
  119 +/* This is the in-memory method. It does everything except revoking and updating,
  120 + and is of course volatile. It's used by other methods that have an in-memory
  121 + cache. */
  122 +const STORE_METHOD *STORE_Memory(void);
  123 +#if 0 /* Not yet implemented */
  124 +/* This is the directory store. It does everything except revoking and updating,
  125 + and uses STORE_Memory() to cache things in memory. */
  126 +const STORE_METHOD *STORE_Directory(void);
  127 +/* This is the file store. It does everything except revoking and updating,
  128 + and uses STORE_Memory() to cache things in memory. Certificates are added
  129 + to it with the store operation, and it will only get cached certificates. */
  130 +const STORE_METHOD *STORE_File(void);
  131 +#endif
  132 +
  133 +/* Store functions take a type code for the type of data they should store
  134 + or fetch */
  135 +typedef enum STORE_object_types
  136 + {
  137 + STORE_OBJECT_TYPE_X509_CERTIFICATE= 0x01, /* X509 * */
  138 + STORE_OBJECT_TYPE_X509_CRL= 0x02, /* X509_CRL * */
  139 + STORE_OBJECT_TYPE_PRIVATE_KEY= 0x03, /* EVP_PKEY * */
  140 + STORE_OBJECT_TYPE_PUBLIC_KEY= 0x04, /* EVP_PKEY * */
  141 + STORE_OBJECT_TYPE_NUMBER= 0x05, /* BIGNUM * */
  142 + STORE_OBJECT_TYPE_ARBITRARY= 0x06, /* BUF_MEM * */
  143 + STORE_OBJECT_TYPE_NUM= 0x06 /* The amount of known
  144 + object types */
  145 + } STORE_OBJECT_TYPES;
  146 +/* List of text strings corresponding to the object types. */
  147 +extern const char * const STORE_object_type_string[STORE_OBJECT_TYPE_NUM+1];
  148 +
  149 +/* Some store functions take a parameter list. Those parameters come with
  150 + one of the following codes. The comments following the codes below indicate
  151 + what type the value should be a pointer to. */
  152 +typedef enum STORE_params
  153 + {
  154 + STORE_PARAM_EVP_TYPE= 0x01, /* int */
  155 + STORE_PARAM_BITS= 0x02, /* size_t */
  156 + STORE_PARAM_KEY_PARAMETERS= 0x03, /* ??? */
  157 + STORE_PARAM_KEY_NO_PARAMETERS= 0x04, /* N/A */
  158 + STORE_PARAM_AUTH_PASSPHRASE= 0x05, /* char * */
  159 + STORE_PARAM_AUTH_KRB5_TICKET= 0x06, /* void * */
  160 + STORE_PARAM_TYPE_NUM= 0x06 /* The amount of known
  161 + parameter types */
  162 + } STORE_PARAM_TYPES;
  163 +/* Parameter value sizes. -1 means unknown, anything else is the required size. */
  164 +extern const int STORE_param_sizes[STORE_PARAM_TYPE_NUM+1];
  165 +
  166 +/* Store functions take attribute lists. Those attributes come with codes.
  167 + The comments following the codes below indicate what type the value should
  168 + be a pointer to. */
  169 +typedef enum STORE_attribs
  170 + {
  171 + STORE_ATTR_END= 0x00,
  172 + STORE_ATTR_FRIENDLYNAME= 0x01, /* C string */
  173 + STORE_ATTR_KEYID= 0x02, /* 160 bit string (SHA1) */
  174 + STORE_ATTR_ISSUERKEYID= 0x03, /* 160 bit string (SHA1) */
  175 + STORE_ATTR_SUBJECTKEYID= 0x04, /* 160 bit string (SHA1) */
  176 + STORE_ATTR_ISSUERSERIALHASH= 0x05, /* 160 bit string (SHA1) */
  177 + STORE_ATTR_ISSUER= 0x06, /* X509_NAME * */
  178 + STORE_ATTR_SERIAL= 0x07, /* BIGNUM * */
  179 + STORE_ATTR_SUBJECT= 0x08, /* X509_NAME * */
  180 + STORE_ATTR_CERTHASH= 0x09, /* 160 bit string (SHA1) */
  181 + STORE_ATTR_EMAIL= 0x0a, /* C string */
  182 + STORE_ATTR_FILENAME= 0x0b, /* C string */
  183 + STORE_ATTR_TYPE_NUM= 0x0b, /* The amount of known
  184 + attribute types */
  185 + STORE_ATTR_OR= 0xff /* This is a special
  186 + separator, which
  187 + expresses the OR
  188 + operation. */
  189 + } STORE_ATTR_TYPES;
  190 +/* Attribute value sizes. -1 means unknown, anything else is the required size. */
  191 +extern const int STORE_attr_sizes[STORE_ATTR_TYPE_NUM+1];
  192 +
  193 +typedef enum STORE_certificate_status
  194 + {
  195 + STORE_X509_VALID= 0x00,
  196 + STORE_X509_EXPIRED= 0x01,
  197 + STORE_X509_SUSPENDED= 0x02,
  198 + STORE_X509_REVOKED= 0x03
  199 + } STORE_CERTIFICATE_STATUS;
  200 +
  201 +/* Engine store functions will return a structure that contains all the necessary
  202 + * information, including revokation status for certificates. This is really not
  203 + * needed for application authors, as the ENGINE framework functions will extract
  204 + * the OpenSSL-specific information when at all possible. However, for engine
  205 + * authors, it's crucial to know this structure. */
  206 +typedef struct STORE_OBJECT_st
  207 + {
  208 + STORE_OBJECT_TYPES type;
  209 + union
  210 + {
  211 + struct
  212 + {
  213 + STORE_CERTIFICATE_STATUS status;
  214 + X509 *certificate;
  215 + } x509;
  216 + X509_CRL *crl;
  217 + EVP_PKEY *key;
  218 + BIGNUM *number;
  219 + BUF_MEM *arbitrary;
  220 + } data;
  221 + } STORE_OBJECT;
  222 +DECLARE_STACK_OF(STORE_OBJECT)
  223 +STORE_OBJECT *STORE_OBJECT_new(void);
  224 +void STORE_OBJECT_free(STORE_OBJECT *data);
  225 +
  226 +
  227 +
  228 +/* The following functions handle the storage. They return 0, a negative number
  229 + or NULL on error, anything else on success. */
  230 +X509 *STORE_get_certificate(STORE *e, OPENSSL_ITEM attributes[],
  231 + OPENSSL_ITEM parameters[]);
  232 +int STORE_store_certificate(STORE *e, X509 *data, OPENSSL_ITEM attributes[],
  233 + OPENSSL_ITEM parameters[]);
  234 +int STORE_modify_certificate(STORE *e, OPENSSL_ITEM search_attributes[],
  235 + OPENSSL_ITEM add_attributes[], OPENSSL_ITEM modify_attributes[],
  236 + OPENSSL_ITEM delete_attributes[], OPENSSL_ITEM parameters[]);
  237 +int STORE_revoke_certificate(STORE *e, OPENSSL_ITEM attributes[],
  238 + OPENSSL_ITEM parameters[]);
  239 +int STORE_delete_certificate(STORE *e, OPENSSL_ITEM attributes[],
  240 + OPENSSL_ITEM parameters[]);
  241 +void *STORE_list_certificate_start(STORE *e, OPENSSL_ITEM attributes[],
  242 + OPENSSL_ITEM parameters[]);
  243 +X509 *STORE_list_certificate_next(STORE *e, void *handle);
  244 +int STORE_list_certificate_end(STORE *e, void *handle);
  245 +int STORE_list_certificate_endp(STORE *e, void *handle);
  246 +EVP_PKEY *STORE_generate_key(STORE *e, OPENSSL_ITEM attributes[],
  247 + OPENSSL_ITEM parameters[]);
  248 +EVP_PKEY *STORE_get_private_key(STORE *e, OPENSSL_ITEM attributes[],
  249 + OPENSSL_ITEM parameters[]);
  250 +int STORE_store_private_key(STORE *e, EVP_PKEY *data,
  251 + OPENSSL_ITEM attributes[], OPENSSL_ITEM parameters[]);
  252 +int STORE_modify_private_key(STORE *e, OPENSSL_ITEM search_attributes[],
  253 + OPENSSL_ITEM add_sttributes[], OPENSSL_ITEM modify_attributes[],
  254 + OPENSSL_ITEM delete_attributes[], OPENSSL_ITEM parameters[]);
  255 +int STORE_revoke_private_key(STORE *e, OPENSSL_ITEM attributes[],
  256 + OPENSSL_ITEM parameters[]);
  257 +int STORE_delete_private_key(STORE *e, OPENSSL_ITEM attributes[],
  258 + OPENSSL_ITEM parameters[]);
  259 +void *STORE_list_private_key_start(STORE *e, OPENSSL_ITEM attributes[],
  260 + OPENSSL_ITEM parameters[]);
  261 +EVP_PKEY *STORE_list_private_key_next(STORE *e, void *handle);
  262 +int STORE_list_private_key_end(STORE *e, void *handle);
  263 +int STORE_list_private_key_endp(STORE *e, void *handle);
  264 +EVP_PKEY *STORE_get_public_key(STORE *e, OPENSSL_ITEM attributes[],
  265 + OPENSSL_ITEM parameters[]);
  266 +int STORE_store_public_key(STORE *e, EVP_PKEY *data, OPENSSL_ITEM attributes[],
  267 + OPENSSL_ITEM parameters[]);
  268 +int STORE_modify_public_key(STORE *e, OPENSSL_ITEM search_attributes[],
  269 + OPENSSL_ITEM add_sttributes[], OPENSSL_ITEM modify_attributes[],
  270 + OPENSSL_ITEM delete_attributes[], OPENSSL_ITEM parameters[]);
  271 +int STORE_revoke_public_key(STORE *e, OPENSSL_ITEM attributes[],
  272 + OPENSSL_ITEM parameters[]);
  273 +int STORE_delete_public_key(STORE *e, OPENSSL_ITEM attributes[],
  274 + OPENSSL_ITEM parameters[]);
  275 +void *STORE_list_public_key_start(STORE *e, OPENSSL_ITEM attributes[],
  276 + OPENSSL_ITEM parameters[]);
  277 +EVP_PKEY *STORE_list_public_key_next(STORE *e, void *handle);
  278 +int STORE_list_public_key_end(STORE *e, void *handle);
  279 +int STORE_list_public_key_endp(STORE *e, void *handle);
  280 +X509_CRL *STORE_generate_crl(STORE *e, OPENSSL_ITEM attributes[],
  281 + OPENSSL_ITEM parameters[]);
  282 +X509_CRL *STORE_get_crl(STORE *e, OPENSSL_ITEM attributes[],
  283 + OPENSSL_ITEM parameters[]);
  284 +int STORE_store_crl(STORE *e, X509_CRL *data, OPENSSL_ITEM attributes[],
  285 + OPENSSL_ITEM parameters[]);
  286 +int STORE_modify_crl(STORE *e, OPENSSL_ITEM search_attributes[],
  287 + OPENSSL_ITEM add_sttributes[], OPENSSL_ITEM modify_attributes[],
  288 + OPENSSL_ITEM delete_attributes[], OPENSSL_ITEM parameters[]);
  289 +int STORE_delete_crl(STORE *e, OPENSSL_ITEM attributes[],
  290 + OPENSSL_ITEM parameters[]);
  291 +void *STORE_list_crl_start(STORE *e, OPENSSL_ITEM attributes[],
  292 + OPENSSL_ITEM parameters[]);
  293 +X509_CRL *STORE_list_crl_next(STORE *e, void *handle);
  294 +int STORE_list_crl_end(STORE *e, void *handle);
  295 +int STORE_list_crl_endp(STORE *e, void *handle);
  296 +int STORE_store_number(STORE *e, BIGNUM *data, OPENSSL_ITEM attributes[],
  297 + OPENSSL_ITEM parameters[]);
  298 +int STORE_modify_number(STORE *e, OPENSSL_ITEM search_attributes[],
  299 + OPENSSL_ITEM add_sttributes[], OPENSSL_ITEM modify_attributes[],
  300 + OPENSSL_ITEM delete_attributes[], OPENSSL_ITEM parameters[]);
  301 +BIGNUM *STORE_get_number(STORE *e, OPENSSL_ITEM attributes[],
  302 + OPENSSL_ITEM parameters[]);
  303 +int STORE_delete_number(STORE *e, OPENSSL_ITEM attributes[],
  304 + OPENSSL_ITEM parameters[]);
  305 +int STORE_store_arbitrary(STORE *e, BUF_MEM *data, OPENSSL_ITEM attributes[],
  306 + OPENSSL_ITEM parameters[]);
  307 +int STORE_modify_arbitrary(STORE *e, OPENSSL_ITEM search_attributes[],
  308 + OPENSSL_ITEM add_sttributes[], OPENSSL_ITEM modify_attributes[],
  309 + OPENSSL_ITEM delete_attributes[], OPENSSL_ITEM parameters[]);
  310 +BUF_MEM *STORE_get_arbitrary(STORE *e, OPENSSL_ITEM attributes[],
  311 + OPENSSL_ITEM parameters[]);
  312 +int STORE_delete_arbitrary(STORE *e, OPENSSL_ITEM attributes[],
  313 + OPENSSL_ITEM parameters[]);
  314 +
  315 +
  316 +/* Create and manipulate methods */
  317 +STORE_METHOD *STORE_create_method(char *name);
  318 +void STORE_destroy_method(STORE_METHOD *store_method);
  319 +
  320 +/* These callback types are use for store handlers */
  321 +typedef int (*STORE_INITIALISE_FUNC_PTR)(STORE *);
  322 +typedef void (*STORE_CLEANUP_FUNC_PTR)(STORE *);
  323 +typedef STORE_OBJECT *(*STORE_GENERATE_OBJECT_FUNC_PTR)(STORE *, STORE_OBJECT_TYPES type, OPENSSL_ITEM attributes[], OPENSSL_ITEM parameters[]);
  324 +typedef STORE_OBJECT *(*STORE_GET_OBJECT_FUNC_PTR)(STORE *, STORE_OBJECT_TYPES type, OPENSSL_ITEM attributes[], OPENSSL_ITEM parameters[]);
  325 +typedef void *(*STORE_START_OBJECT_FUNC_PTR)(STORE *, STORE_OBJECT_TYPES type, OPENSSL_ITEM attributes[], OPENSSL_ITEM parameters[]);
  326 +typedef STORE_OBJECT *(*STORE_NEXT_OBJECT_FUNC_PTR)(STORE *, void *handle);
  327 +typedef int (*STORE_END_OBJECT_FUNC_PTR)(STORE *, void *handle);
  328 +typedef int (*STORE_HANDLE_OBJECT_FUNC_PTR)(STORE *, STORE_OBJECT_TYPES type, OPENSSL_ITEM attributes[], OPENSSL_ITEM parameters[]);
  329 +typedef int (*STORE_STORE_OBJECT_FUNC_PTR)(STORE *, STORE_OBJECT_TYPES type, STORE_OBJECT *data, OPENSSL_ITEM attributes[], OPENSSL_ITEM parameters[]);
  330 +typedef int (*STORE_MODIFY_OBJECT_FUNC_PTR)(STORE *, STORE_OBJECT_TYPES type, OPENSSL_ITEM search_attributes[], OPENSSL_ITEM add_attributes[], OPENSSL_ITEM modify_attributes[], OPENSSL_ITEM delete_attributes[], OPENSSL_ITEM parameters[]);
  331 +typedef int (*STORE_GENERIC_FUNC_PTR)(STORE *, OPENSSL_ITEM attributes[], OPENSSL_ITEM parameters[]);
  332 +typedef int (*STORE_CTRL_FUNC_PTR)(STORE *, int cmd, long l, void *p, void (*f)(void));
  333 +
  334 +int STORE_method_set_initialise_function(STORE_METHOD *sm, STORE_INITIALISE_FUNC_PTR init_f);
  335 +int STORE_method_set_cleanup_function(STORE_METHOD *sm, STORE_CLEANUP_FUNC_PTR clean_f);
  336 +int STORE_method_set_generate_function(STORE_METHOD *sm, STORE_GENERATE_OBJECT_FUNC_PTR generate_f);
  337 +int STORE_method_set_get_function(STORE_METHOD *sm, STORE_GET_OBJECT_FUNC_PTR get_f);
  338 +int STORE_method_set_store_function(STORE_METHOD *sm, STORE_STORE_OBJECT_FUNC_PTR store_f);
  339 +int STORE_method_set_modify_function(STORE_METHOD *sm, STORE_MODIFY_OBJECT_FUNC_PTR store_f);
  340 +int STORE_method_set_revoke_function(STORE_METHOD *sm, STORE_HANDLE_OBJECT_FUNC_PTR revoke_f);
  341 +int STORE_method_set_delete_function(STORE_METHOD *sm, STORE_HANDLE_OBJECT_FUNC_PTR delete_f);
  342 +int STORE_method_set_list_start_function(STORE_METHOD *sm, STORE_START_OBJECT_FUNC_PTR list_start_f);
  343 +int STORE_method_set_list_next_function(STORE_METHOD *sm, STORE_NEXT_OBJECT_FUNC_PTR list_next_f);
  344 +int STORE_method_set_list_end_function(STORE_METHOD *sm, STORE_END_OBJECT_FUNC_PTR list_end_f);
  345 +int STORE_method_set_update_store_function(STORE_METHOD *sm, STORE_GENERIC_FUNC_PTR);
  346 +int STORE_method_set_lock_store_function(STORE_METHOD *sm, STORE_GENERIC_FUNC_PTR);
  347 +int STORE_method_set_unlock_store_function(STORE_METHOD *sm, STORE_GENERIC_FUNC_PTR);
  348 +int STORE_method_set_ctrl_function(STORE_METHOD *sm, STORE_CTRL_FUNC_PTR ctrl_f);
  349 +
  350 +STORE_INITIALISE_FUNC_PTR STORE_method_get_initialise_function(STORE_METHOD *sm);
  351 +STORE_CLEANUP_FUNC_PTR STORE_method_get_cleanup_function(STORE_METHOD *sm);
  352 +STORE_GENERATE_OBJECT_FUNC_PTR STORE_method_get_generate_function(STORE_METHOD *sm);
  353 +STORE_GET_OBJECT_FUNC_PTR STORE_method_get_get_function(STORE_METHOD *sm);
  354 +STORE_STORE_OBJECT_FUNC_PTR STORE_method_get_store_function(STORE_METHOD *sm);
  355 +STORE_MODIFY_OBJECT_FUNC_PTR STORE_method_get_modify_function(STORE_METHOD *sm);
  356 +STORE_HANDLE_OBJECT_FUNC_PTR STORE_method_get_revoke_function(STORE_METHOD *sm);
  357 +STORE_HANDLE_OBJECT_FUNC_PTR STORE_method_get_delete_function(STORE_METHOD *sm);
  358 +STORE_START_OBJECT_FUNC_PTR STORE_method_get_list_start_function(STORE_METHOD *sm);
  359 +STORE_NEXT_OBJECT_FUNC_PTR STORE_method_get_list_next_function(STORE_METHOD *sm);
  360 +STORE_END_OBJECT_FUNC_PTR STORE_method_get_list_end_function(STORE_METHOD *sm);
  361 +STORE_GENERIC_FUNC_PTR STORE_method_get_update_store_function(STORE_METHOD *sm);
  362 +STORE_GENERIC_FUNC_PTR STORE_method_get_lock_store_function(STORE_METHOD *sm);
  363 +STORE_GENERIC_FUNC_PTR STORE_method_get_unlock_store_function(STORE_METHOD *sm);
  364 +STORE_CTRL_FUNC_PTR STORE_method_get_ctrl_function(STORE_METHOD *sm);
  365 +
  366 +/* Method helper structures and functions. */
  367 +
  368 +/* This structure is the result of parsing through the information in a list
  369 + of OPENSSL_ITEMs. It stores all the necessary information in a structured
  370 + way.*/
  371 +typedef struct STORE_attr_info_st STORE_ATTR_INFO;
  372 +
  373 +/* Parse a list of OPENSSL_ITEMs and return a pointer to a STORE_ATTR_INFO.
  374 + Note that we do this in the list form, since the list of OPENSSL_ITEMs can
  375 + come in blocks separated with STORE_ATTR_OR. Note that the value returned
  376 + by STORE_parse_attrs_next() must be freed with STORE_ATTR_INFO_free(). */
  377 +void *STORE_parse_attrs_start(OPENSSL_ITEM *attributes);
  378 +STORE_ATTR_INFO *STORE_parse_attrs_next(void *handle);
  379 +int STORE_parse_attrs_end(void *handle);
  380 +int STORE_parse_attrs_endp(void *handle);
  381 +
  382 +/* Creator and destructor */
  383 +STORE_ATTR_INFO *STORE_ATTR_INFO_new(void);
  384 +int STORE_ATTR_INFO_free(STORE_ATTR_INFO *attrs);
  385 +
  386 +/* Manipulators */
  387 +char *STORE_ATTR_INFO_get0_cstr(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code);
  388 +unsigned char *STORE_ATTR_INFO_get0_sha1str(STORE_ATTR_INFO *attrs,
  389 + STORE_ATTR_TYPES code);
  390 +X509_NAME *STORE_ATTR_INFO_get0_dn(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code);
  391 +BIGNUM *STORE_ATTR_INFO_get0_number(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code);
  392 +int STORE_ATTR_INFO_set_cstr(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code,
  393 + char *cstr, size_t cstr_size);
  394 +int STORE_ATTR_INFO_set_sha1str(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code,
  395 + unsigned char *sha1str, size_t sha1str_size);
  396 +int STORE_ATTR_INFO_set_dn(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code,
  397 + X509_NAME *dn);
  398 +int STORE_ATTR_INFO_set_number(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code,
  399 + BIGNUM *number);
  400 +int STORE_ATTR_INFO_modify_cstr(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code,
  401 + char *cstr, size_t cstr_size);
  402 +int STORE_ATTR_INFO_modify_sha1str(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code,
  403 + unsigned char *sha1str, size_t sha1str_size);
  404 +int STORE_ATTR_INFO_modify_dn(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code,
  405 + X509_NAME *dn);
  406 +int STORE_ATTR_INFO_modify_number(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code,
  407 + BIGNUM *number);
  408 +
  409 +/* Compare on basis of a bit pattern formed by the STORE_ATTR_TYPES values
  410 + in each contained attribute. */
  411 +int STORE_ATTR_INFO_compare(STORE_ATTR_INFO *a, STORE_ATTR_INFO *b);
  412 +/* Check if the set of attributes in a is within the range of attributes
  413 + set in b. */
  414 +int STORE_ATTR_INFO_in_range(STORE_ATTR_INFO *a, STORE_ATTR_INFO *b);
  415 +/* Check if the set of attributes in a are also set in b. */
  416 +int STORE_ATTR_INFO_in(STORE_ATTR_INFO *a, STORE_ATTR_INFO *b);
  417 +/* Same as STORE_ATTR_INFO_in(), but also checks the attribute values. */
  418 +int STORE_ATTR_INFO_in_ex(STORE_ATTR_INFO *a, STORE_ATTR_INFO *b);
  419 +
  420 +
  421 +/* BEGIN ERROR CODES */
  422 +/* The following lines are auto generated by the script mkerr.pl. Any changes
  423 + * made after this point may be overwritten when the script is next run.
  424 + */
  425 +void ERR_load_STORE_strings(void);
  426 +
  427 +/* Error codes for the STORE functions. */
  428 +
  429 +/* Function codes. */
  430 +#define STORE_F_MEM_DELETE 134
  431 +#define STORE_F_MEM_GENERATE 135
  432 +#define STORE_F_MEM_LIST_END 168
  433 +#define STORE_F_MEM_LIST_NEXT 136
  434 +#define STORE_F_MEM_LIST_START 137
  435 +#define STORE_F_MEM_MODIFY 169
  436 +#define STORE_F_MEM_STORE 138
  437 +#define STORE_F_STORE_ATTR_INFO_GET0_CSTR 139
  438 +#define STORE_F_STORE_ATTR_INFO_GET0_DN 140
  439 +#define STORE_F_STORE_ATTR_INFO_GET0_NUMBER 141
  440 +#define STORE_F_STORE_ATTR_INFO_GET0_SHA1STR 142
  441 +#define STORE_F_STORE_ATTR_INFO_MODIFY_CSTR 143
  442 +#define STORE_F_STORE_ATTR_INFO_MODIFY_DN 144
  443 +#define STORE_F_STORE_ATTR_INFO_MODIFY_NUMBER 145
  444 +#define STORE_F_STORE_ATTR_INFO_MODIFY_SHA1STR 146
  445 +#define STORE_F_STORE_ATTR_INFO_SET_CSTR 147
  446 +#define STORE_F_STORE_ATTR_INFO_SET_DN 148
  447 +#define STORE_F_STORE_ATTR_INFO_SET_NUMBER 149
  448 +#define STORE_F_STORE_ATTR_INFO_SET_SHA1STR 150
  449 +#define STORE_F_STORE_CERTIFICATE 170
  450 +#define STORE_F_STORE_CTRL 161
  451 +#define STORE_F_STORE_DELETE_ARBITRARY 158
  452 +#define STORE_F_STORE_DELETE_CERTIFICATE 102
  453 +#define STORE_F_STORE_DELETE_CRL 103
  454 +#define STORE_F_STORE_DELETE_NUMBER 104
  455 +#define STORE_F_STORE_DELETE_PRIVATE_KEY 105
  456 +#define STORE_F_STORE_DELETE_PUBLIC_KEY 106
  457 +#define STORE_F_STORE_GENERATE_CRL 107
  458 +#define STORE_F_STORE_GENERATE_KEY 108
  459 +#define STORE_F_STORE_GET_ARBITRARY 159
  460 +#define STORE_F_STORE_GET_CERTIFICATE 109
  461 +#define STORE_F_STORE_GET_CRL 110
  462 +#define STORE_F_STORE_GET_NUMBER 111
  463 +#define STORE_F_STORE_GET_PRIVATE_KEY 112
  464 +#define STORE_F_STORE_GET_PUBLIC_KEY 113
  465 +#define STORE_F_STORE_LIST_CERTIFICATE_END 114
  466 +#define STORE_F_STORE_LIST_CERTIFICATE_ENDP 153
  467 +#define STORE_F_STORE_LIST_CERTIFICATE_NEXT 115
  468 +#define STORE_F_STORE_LIST_CERTIFICATE_START 116
  469 +#define STORE_F_STORE_LIST_CRL_END 117
  470 +#define STORE_F_STORE_LIST_CRL_ENDP 154
  471 +#define STORE_F_STORE_LIST_CRL_NEXT 118
  472 +#define STORE_F_STORE_LIST_CRL_START 119
  473 +#define STORE_F_STORE_LIST_PRIVATE_KEY_END 120
  474 +#define STORE_F_STORE_LIST_PRIVATE_KEY_ENDP 155
  475 +#define STORE_F_STORE_LIST_PRIVATE_KEY_NEXT 121
  476 +#define STORE_F_STORE_LIST_PRIVATE_KEY_START 122
  477 +#define STORE_F_STORE_LIST_PUBLIC_KEY_END 123
  478 +#define STORE_F_STORE_LIST_PUBLIC_KEY_ENDP 156
  479 +#define STORE_F_STORE_LIST_PUBLIC_KEY_NEXT 124
  480 +#define STORE_F_STORE_LIST_PUBLIC_KEY_START 125
  481 +#define STORE_F_STORE_MODIFY_ARBITRARY 162
  482 +#define STORE_F_STORE_MODIFY_CERTIFICATE 163
  483 +#define STORE_F_STORE_MODIFY_CRL 164
  484 +#define STORE_F_STORE_MODIFY_NUMBER 165
  485 +#define STORE_F_STORE_MODIFY_PRIVATE_KEY 166
  486 +#define STORE_F_STORE_MODIFY_PUBLIC_KEY 167
  487 +#define STORE_F_STORE_NEW_ENGINE 133
  488 +#define STORE_F_STORE_NEW_METHOD 132
  489 +#define STORE_F_STORE_PARSE_ATTRS_END 151
  490 +#define STORE_F_STORE_PARSE_ATTRS_ENDP 172
  491 +#define STORE_F_STORE_PARSE_ATTRS_NEXT 152
  492 +#define STORE_F_STORE_PARSE_ATTRS_START 171
  493 +#define STORE_F_STORE_REVOKE_CERTIFICATE 129
  494 +#define STORE_F_STORE_REVOKE_PRIVATE_KEY 130
  495 +#define STORE_F_STORE_REVOKE_PUBLIC_KEY 131
  496 +#define STORE_F_STORE_STORE_ARBITRARY 157
  497 +#define STORE_F_STORE_STORE_CERTIFICATE 100
  498 +#define STORE_F_STORE_STORE_CRL 101
  499 +#define STORE_F_STORE_STORE_NUMBER 126
  500 +#define STORE_F_STORE_STORE_PRIVATE_KEY 127
  501 +#define STORE_F_STORE_STORE_PUBLIC_KEY 128
  502 +
  503 +/* Reason codes. */
  504 +#define STORE_R_ALREADY_HAS_A_VALUE 127
  505 +#define STORE_R_FAILED_DELETING_ARBITRARY 132
  506 +#define STORE_R_FAILED_DELETING_CERTIFICATE 100
  507 +#define STORE_R_FAILED_DELETING_KEY 101
  508 +#define STORE_R_FAILED_DELETING_NUMBER 102
  509 +#define STORE_R_FAILED_GENERATING_CRL 103
  510 +#define STORE_R_FAILED_GENERATING_KEY 104
  511 +#define STORE_R_FAILED_GETTING_ARBITRARY 133
  512 +#define STORE_R_FAILED_GETTING_CERTIFICATE 105
  513 +#define STORE_R_FAILED_GETTING_KEY 106
  514 +#define STORE_R_FAILED_GETTING_NUMBER 107
  515 +#define STORE_R_FAILED_LISTING_CERTIFICATES 108
  516 +#define STORE_R_FAILED_LISTING_KEYS 109
  517 +#define STORE_R_FAILED_MODIFYING_ARBITRARY 138
  518 +#define STORE_R_FAILED_MODIFYING_CERTIFICATE 139
  519 +#define STORE_R_FAILED_MODIFYING_CRL 140
  520 +#define STORE_R_FAILED_MODIFYING_NUMBER 141
  521 +#define STORE_R_FAILED_MODIFYING_PRIVATE_KEY 142
  522 +#define STORE_R_FAILED_MODIFYING_PUBLIC_KEY 143
  523 +#define STORE_R_FAILED_REVOKING_CERTIFICATE 110
  524 +#define STORE_R_FAILED_REVOKING_KEY 111
  525 +#define STORE_R_FAILED_STORING_ARBITRARY 134
  526 +#define STORE_R_FAILED_STORING_CERTIFICATE 112
  527 +#define STORE_R_FAILED_STORING_KEY 113
  528 +#define STORE_R_FAILED_STORING_NUMBER 114
  529 +#define STORE_R_NOT_IMPLEMENTED 128
  530 +#define STORE_R_NO_CONTROL_FUNCTION 144
  531 +#define STORE_R_NO_DELETE_ARBITRARY_FUNCTION 135
  532 +#define STORE_R_NO_DELETE_NUMBER_FUNCTION 115
  533 +#define STORE_R_NO_DELETE_OBJECT_FUNCTION 116
  534 +#define STORE_R_NO_GENERATE_CRL_FUNCTION 117
  535 +#define STORE_R_NO_GENERATE_OBJECT_FUNCTION 118
  536 +#define STORE_R_NO_GET_OBJECT_ARBITRARY_FUNCTION 136
  537 +#define STORE_R_NO_GET_OBJECT_FUNCTION 119
  538 +#define STORE_R_NO_GET_OBJECT_NUMBER_FUNCTION 120
  539 +#define STORE_R_NO_LIST_OBJECT_ENDP_FUNCTION 131
  540 +#define STORE_R_NO_LIST_OBJECT_END_FUNCTION 121
  541 +#define STORE_R_NO_LIST_OBJECT_NEXT_FUNCTION 122
  542 +#define STORE_R_NO_LIST_OBJECT_START_FUNCTION 123
  543 +#define STORE_R_NO_MODIFY_OBJECT_FUNCTION 145
  544 +#define STORE_R_NO_REVOKE_OBJECT_FUNCTION 124
  545 +#define STORE_R_NO_STORE 129
  546 +#define STORE_R_NO_STORE_OBJECT_ARBITRARY_FUNCTION 137
  547 +#define STORE_R_NO_STORE_OBJECT_FUNCTION 125
  548 +#define STORE_R_NO_STORE_OBJECT_NUMBER_FUNCTION 126
  549 +#define STORE_R_NO_VALUE 130
  550 +
  551 +#ifdef __cplusplus
  552 +}
  553 +#endif
  554 +#endif
... ...
third_dev/openssl/include/openssl/symhacks.h
... ... @@ -127,6 +127,12 @@
127 127 /* Hack some long X509 names */
128 128 #undef X509_REVOKED_get_ext_by_critical
129 129 #define X509_REVOKED_get_ext_by_critical X509_REVOKED_get_ext_by_critic
  130 +#undef X509_policy_tree_get0_user_policies
  131 +#define X509_policy_tree_get0_user_policies X509_pcy_tree_get0_usr_policies
  132 +#undef X509_policy_node_get0_qualifiers
  133 +#define X509_policy_node_get0_qualifiers X509_pcy_node_get0_qualifiers
  134 +#undef X509_STORE_CTX_get_explicit_policy
  135 +#define X509_STORE_CTX_get_explicit_policy X509_STORE_CTX_get_expl_policy
130 136  
131 137 /* Hack some long CRYPTO names */
132 138 #undef CRYPTO_set_dynlock_destroy_callback
... ... @@ -153,16 +159,16 @@
153 159 #define SSL_get_ex_data_X509_STORE_CTX_idx SSL_get_ex_d_X509_STORE_CTX_idx
154 160 #undef SSL_add_file_cert_subjects_to_stack
155 161 #define SSL_add_file_cert_subjects_to_stack SSL_add_file_cert_subjs_to_stk
156   -#if 0 /* This function is not defined i VMS. */
157 162 #undef SSL_add_dir_cert_subjects_to_stack
158 163 #define SSL_add_dir_cert_subjects_to_stack SSL_add_dir_cert_subjs_to_stk
159   -#endif
160 164 #undef SSL_CTX_use_certificate_chain_file
161 165 #define SSL_CTX_use_certificate_chain_file SSL_CTX_use_cert_chain_file
162 166 #undef SSL_CTX_set_cert_verify_callback
163 167 #define SSL_CTX_set_cert_verify_callback SSL_CTX_set_cert_verify_cb
164 168 #undef SSL_CTX_set_default_passwd_cb_userdata
165 169 #define SSL_CTX_set_default_passwd_cb_userdata SSL_CTX_set_def_passwd_cb_ud
  170 +#undef SSL_COMP_get_compression_methods
  171 +#define SSL_COMP_get_compression_methods SSL_COMP_get_compress_methods
166 172  
167 173 /* Hack some long ENGINE names */
168 174 #undef ENGINE_get_default_BN_mod_exp_crt
... ... @@ -195,6 +201,12 @@
195 201 #define OPENSSL_add_all_algorithms_conf OPENSSL_add_all_algo_conf
196 202  
197 203 /* Hack some long EC names */
  204 +#undef EC_GROUP_set_point_conversion_form
  205 +#define EC_GROUP_set_point_conversion_form EC_GROUP_set_point_conv_form
  206 +#undef EC_GROUP_get_point_conversion_form
  207 +#define EC_GROUP_get_point_conversion_form EC_GROUP_get_point_conv_form
  208 +#undef EC_GROUP_clear_free_all_extra_data
  209 +#define EC_GROUP_clear_free_all_extra_data EC_GROUP_clr_free_all_xtra_data
198 210 #undef EC_POINT_set_Jprojective_coordinates_GFp
199 211 #define EC_POINT_set_Jprojective_coordinates_GFp \
200 212 EC_POINT_set_Jproj_coords_GFp
... ... @@ -207,6 +219,32 @@
207 219 #define EC_POINT_get_affine_coordinates_GFp EC_POINT_get_affine_coords_GFp
208 220 #undef EC_POINT_set_compressed_coordinates_GFp
209 221 #define EC_POINT_set_compressed_coordinates_GFp EC_POINT_set_compr_coords_GFp
  222 +#undef EC_POINT_set_affine_coordinates_GF2m
  223 +#define EC_POINT_set_affine_coordinates_GF2m EC_POINT_set_affine_coords_GF2m
  224 +#undef EC_POINT_get_affine_coordinates_GF2m
  225 +#define EC_POINT_get_affine_coordinates_GF2m EC_POINT_get_affine_coords_GF2m
  226 +#undef EC_POINT_set_compressed_coordinates_GF2m
  227 +#define EC_POINT_set_compressed_coordinates_GF2m \
  228 + EC_POINT_set_compr_coords_GF2m
  229 +#undef ec_GF2m_simple_group_clear_finish
  230 +#define ec_GF2m_simple_group_clear_finish ec_GF2m_simple_grp_clr_finish
  231 +#undef ec_GF2m_simple_group_check_discriminant
  232 +#define ec_GF2m_simple_group_check_discriminant ec_GF2m_simple_grp_chk_discrim
  233 +#undef ec_GF2m_simple_point_clear_finish
  234 +#define ec_GF2m_simple_point_clear_finish ec_GF2m_simple_pt_clr_finish
  235 +#undef ec_GF2m_simple_point_set_to_infinity
  236 +#define ec_GF2m_simple_point_set_to_infinity ec_GF2m_simple_pt_set_to_inf
  237 +#undef ec_GF2m_simple_points_make_affine
  238 +#define ec_GF2m_simple_points_make_affine ec_GF2m_simple_pts_make_affine
  239 +#undef ec_GF2m_simple_point_set_affine_coordinates
  240 +#define ec_GF2m_simple_point_set_affine_coordinates \
  241 + ec_GF2m_smp_pt_set_af_coords
  242 +#undef ec_GF2m_simple_point_get_affine_coordinates
  243 +#define ec_GF2m_simple_point_get_affine_coordinates \
  244 + ec_GF2m_smp_pt_get_af_coords
  245 +#undef ec_GF2m_simple_set_compressed_coordinates
  246 +#define ec_GF2m_simple_set_compressed_coordinates \
  247 + ec_GF2m_smp_set_compr_coords
210 248 #undef ec_GFp_simple_group_set_curve_GFp
211 249 #define ec_GFp_simple_group_set_curve_GFp ec_GFp_simple_grp_set_curve_GFp
212 250 #undef ec_GFp_simple_group_get_curve_GFp
... ... @@ -242,6 +280,67 @@
242 280 #undef ec_GFp_simple_set_compressed_coordinates_GFp
243 281 #define ec_GFp_simple_set_compressed_coordinates_GFp \
244 282 ec_GFp_smp_set_compr_coords_GFp
  283 +#undef ec_GFp_simple_point_set_affine_coordinates
  284 +#define ec_GFp_simple_point_set_affine_coordinates \
  285 + ec_GFp_smp_pt_set_af_coords
  286 +#undef ec_GFp_simple_point_get_affine_coordinates
  287 +#define ec_GFp_simple_point_get_affine_coordinates \
  288 + ec_GFp_smp_pt_get_af_coords
  289 +#undef ec_GFp_simple_set_compressed_coordinates
  290 +#define ec_GFp_simple_set_compressed_coordinates \
  291 + ec_GFp_smp_set_compr_coords
  292 +#undef ec_GFp_simple_group_check_discriminant
  293 +#define ec_GFp_simple_group_check_discriminant ec_GFp_simple_grp_chk_discrim
  294 +
  295 +/* Hack som long STORE names */
  296 +#undef STORE_method_set_initialise_function
  297 +#define STORE_method_set_initialise_function STORE_meth_set_initialise_fn
  298 +#undef STORE_method_set_cleanup_function
  299 +#define STORE_method_set_cleanup_function STORE_meth_set_cleanup_fn
  300 +#undef STORE_method_set_generate_function
  301 +#define STORE_method_set_generate_function STORE_meth_set_generate_fn
  302 +#undef STORE_method_set_modify_function
  303 +#define STORE_method_set_modify_function STORE_meth_set_modify_fn
  304 +#undef STORE_method_set_revoke_function
  305 +#define STORE_method_set_revoke_function STORE_meth_set_revoke_fn
  306 +#undef STORE_method_set_delete_function
  307 +#define STORE_method_set_delete_function STORE_meth_set_delete_fn
  308 +#undef STORE_method_set_list_start_function
  309 +#define STORE_method_set_list_start_function STORE_meth_set_list_start_fn
  310 +#undef STORE_method_set_list_next_function
  311 +#define STORE_method_set_list_next_function STORE_meth_set_list_next_fn
  312 +#undef STORE_method_set_list_end_function
  313 +#define STORE_method_set_list_end_function STORE_meth_set_list_end_fn
  314 +#undef STORE_method_set_update_store_function
  315 +#define STORE_method_set_update_store_function STORE_meth_set_update_store_fn
  316 +#undef STORE_method_set_lock_store_function
  317 +#define STORE_method_set_lock_store_function STORE_meth_set_lock_store_fn
  318 +#undef STORE_method_set_unlock_store_function
  319 +#define STORE_method_set_unlock_store_function STORE_meth_set_unlock_store_fn
  320 +#undef STORE_method_get_initialise_function
  321 +#define STORE_method_get_initialise_function STORE_meth_get_initialise_fn
  322 +#undef STORE_method_get_cleanup_function
  323 +#define STORE_method_get_cleanup_function STORE_meth_get_cleanup_fn
  324 +#undef STORE_method_get_generate_function
  325 +#define STORE_method_get_generate_function STORE_meth_get_generate_fn
  326 +#undef STORE_method_get_modify_function
  327 +#define STORE_method_get_modify_function STORE_meth_get_modify_fn
  328 +#undef STORE_method_get_revoke_function
  329 +#define STORE_method_get_revoke_function STORE_meth_get_revoke_fn
  330 +#undef STORE_method_get_delete_function
  331 +#define STORE_method_get_delete_function STORE_meth_get_delete_fn
  332 +#undef STORE_method_get_list_start_function
  333 +#define STORE_method_get_list_start_function STORE_meth_get_list_start_fn
  334 +#undef STORE_method_get_list_next_function
  335 +#define STORE_method_get_list_next_function STORE_meth_get_list_next_fn
  336 +#undef STORE_method_get_list_end_function
  337 +#define STORE_method_get_list_end_function STORE_meth_get_list_end_fn
  338 +#undef STORE_method_get_update_store_function
  339 +#define STORE_method_get_update_store_function STORE_meth_get_update_store_fn
  340 +#undef STORE_method_get_lock_store_function
  341 +#define STORE_method_get_lock_store_function STORE_meth_get_lock_store_fn
  342 +#undef STORE_method_get_unlock_store_function
  343 +#define STORE_method_get_unlock_store_function STORE_meth_get_unlock_store_fn
245 344  
246 345 #endif /* defined OPENSSL_SYS_VMS */
247 346  
... ... @@ -253,6 +352,15 @@
253 352 #undef OCSP_crlID_new
254 353 #define OCSP_crlID_new OCSP_crlID2_new
255 354  
  355 +#undef d2i_ECPARAMETERS
  356 +#define d2i_ECPARAMETERS d2i_UC_ECPARAMETERS
  357 +#undef i2d_ECPARAMETERS
  358 +#define i2d_ECPARAMETERS i2d_UC_ECPARAMETERS
  359 +#undef d2i_ECPKPARAMETERS
  360 +#define d2i_ECPKPARAMETERS d2i_UC_ECPKPARAMETERS
  361 +#undef i2d_ECPKPARAMETERS
  362 +#define i2d_ECPKPARAMETERS i2d_UC_ECPKPARAMETERS
  363 +
256 364 /* These functions do not seem to exist! However, I'm paranoid...
257 365 Original command in x509v3.h:
258 366 These functions are being redefined in another directory,
... ...
third_dev/openssl/include/openssl/tls1.h
... ... @@ -55,6 +55,19 @@
55 55 * copied and put under another distribution licence
56 56 * [including the GNU Public Licence.]
57 57 */
  58 +/* ====================================================================
  59 + * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
  60 + *
  61 + * Portions of the attached software ("Contribution") are developed by
  62 + * SUN MICROSYSTEMS, INC., and are contributed to the OpenSSL project.
  63 + *
  64 + * The Contribution is licensed pursuant to the OpenSSL open source
  65 + * license provided above.
  66 + *
  67 + * ECC cipher suite support in OpenSSL originally written by
  68 + * Vipul Gupta and Sumit Gupta of Sun Microsystems Laboratories.
  69 + *
  70 + */
58 71  
59 72 #ifndef HEADER_TLS1_H
60 73 #define HEADER_TLS1_H
... ... @@ -112,6 +125,37 @@ extern &quot;C&quot; {
112 125 #define TLS1_CK_DHE_RSA_WITH_AES_256_SHA 0x03000039
113 126 #define TLS1_CK_ADH_WITH_AES_256_SHA 0x0300003A
114 127  
  128 +/* ECC ciphersuites from draft-ietf-tls-ecc-12.txt with changes soon to be in draft 13 */
  129 +#define TLS1_CK_ECDH_ECDSA_WITH_NULL_SHA 0x0300C001
  130 +#define TLS1_CK_ECDH_ECDSA_WITH_RC4_128_SHA 0x0300C002
  131 +#define TLS1_CK_ECDH_ECDSA_WITH_DES_192_CBC3_SHA 0x0300C003
  132 +#define TLS1_CK_ECDH_ECDSA_WITH_AES_128_CBC_SHA 0x0300C004
  133 +#define TLS1_CK_ECDH_ECDSA_WITH_AES_256_CBC_SHA 0x0300C005
  134 +
  135 +#define TLS1_CK_ECDHE_ECDSA_WITH_NULL_SHA 0x0300C006
  136 +#define TLS1_CK_ECDHE_ECDSA_WITH_RC4_128_SHA 0x0300C007
  137 +#define TLS1_CK_ECDHE_ECDSA_WITH_DES_192_CBC3_SHA 0x0300C008
  138 +#define TLS1_CK_ECDHE_ECDSA_WITH_AES_128_CBC_SHA 0x0300C009
  139 +#define TLS1_CK_ECDHE_ECDSA_WITH_AES_256_CBC_SHA 0x0300C00A
  140 +
  141 +#define TLS1_CK_ECDH_RSA_WITH_NULL_SHA 0x0300C00B
  142 +#define TLS1_CK_ECDH_RSA_WITH_RC4_128_SHA 0x0300C00C
  143 +#define TLS1_CK_ECDH_RSA_WITH_DES_192_CBC3_SHA 0x0300C00D
  144 +#define TLS1_CK_ECDH_RSA_WITH_AES_128_CBC_SHA 0x0300C00E
  145 +#define TLS1_CK_ECDH_RSA_WITH_AES_256_CBC_SHA 0x0300C00F
  146 +
  147 +#define TLS1_CK_ECDHE_RSA_WITH_NULL_SHA 0x0300C010
  148 +#define TLS1_CK_ECDHE_RSA_WITH_RC4_128_SHA 0x0300C011
  149 +#define TLS1_CK_ECDHE_RSA_WITH_DES_192_CBC3_SHA 0x0300C012
  150 +#define TLS1_CK_ECDHE_RSA_WITH_AES_128_CBC_SHA 0x0300C013
  151 +#define TLS1_CK_ECDHE_RSA_WITH_AES_256_CBC_SHA 0x0300C014
  152 +
  153 +#define TLS1_CK_ECDH_anon_WITH_NULL_SHA 0x0300C015
  154 +#define TLS1_CK_ECDH_anon_WITH_RC4_128_SHA 0x0300C016
  155 +#define TLS1_CK_ECDH_anon_WITH_DES_192_CBC3_SHA 0x0300C017
  156 +#define TLS1_CK_ECDH_anon_WITH_AES_128_CBC_SHA 0x0300C018
  157 +#define TLS1_CK_ECDH_anon_WITH_AES_256_CBC_SHA 0x0300C019
  158 +
115 159 /* XXX
116 160 * Inconsistency alert:
117 161 * The OpenSSL names of ciphers with ephemeral DH here include the string
... ... @@ -142,12 +186,45 @@ extern &quot;C&quot; {
142 186 #define TLS1_TXT_DHE_RSA_WITH_AES_256_SHA "DHE-RSA-AES256-SHA"
143 187 #define TLS1_TXT_ADH_WITH_AES_256_SHA "ADH-AES256-SHA"
144 188  
  189 +/* ECC ciphersuites from draft-ietf-tls-ecc-01.txt (Mar 15, 2001) */
  190 +#define TLS1_TXT_ECDH_ECDSA_WITH_NULL_SHA "ECDH-ECDSA-NULL-SHA"
  191 +#define TLS1_TXT_ECDH_ECDSA_WITH_RC4_128_SHA "ECDH-ECDSA-RC4-SHA"
  192 +#define TLS1_TXT_ECDH_ECDSA_WITH_DES_192_CBC3_SHA "ECDH-ECDSA-DES-CBC3-SHA"
  193 +#define TLS1_TXT_ECDH_ECDSA_WITH_AES_128_CBC_SHA "ECDH-ECDSA-AES128-SHA"
  194 +#define TLS1_TXT_ECDH_ECDSA_WITH_AES_256_CBC_SHA "ECDH-ECDSA-AES256-SHA"
  195 +
  196 +#define TLS1_TXT_ECDHE_ECDSA_WITH_NULL_SHA "ECDHE-ECDSA-NULL-SHA"
  197 +#define TLS1_TXT_ECDHE_ECDSA_WITH_RC4_128_SHA "ECDHE-ECDSA-RC4-SHA"
  198 +#define TLS1_TXT_ECDHE_ECDSA_WITH_DES_192_CBC3_SHA "ECDHE-ECDSA-DES-CBC3-SHA"
  199 +#define TLS1_TXT_ECDHE_ECDSA_WITH_AES_128_CBC_SHA "ECDHE-ECDSA-AES128-SHA"
  200 +#define TLS1_TXT_ECDHE_ECDSA_WITH_AES_256_CBC_SHA "ECDHE-ECDSA-AES256-SHA"
  201 +
  202 +#define TLS1_TXT_ECDH_RSA_WITH_NULL_SHA "ECDH-RSA-NULL-SHA"
  203 +#define TLS1_TXT_ECDH_RSA_WITH_RC4_128_SHA "ECDH-RSA-RC4-SHA"
  204 +#define TLS1_TXT_ECDH_RSA_WITH_DES_192_CBC3_SHA "ECDH-RSA-DES-CBC3-SHA"
  205 +#define TLS1_TXT_ECDH_RSA_WITH_AES_128_CBC_SHA "ECDH-RSA-AES128-SHA"
  206 +#define TLS1_TXT_ECDH_RSA_WITH_AES_256_CBC_SHA "ECDH-RSA-AES256-SHA"
  207 +
  208 +#define TLS1_TXT_ECDHE_RSA_WITH_NULL_SHA "ECDHE-RSA-NULL-SHA"
  209 +#define TLS1_TXT_ECDHE_RSA_WITH_RC4_128_SHA "ECDHE-RSA-RC4-SHA"
  210 +#define TLS1_TXT_ECDHE_RSA_WITH_DES_192_CBC3_SHA "ECDHE-RSA-DES-CBC3-SHA"
  211 +#define TLS1_TXT_ECDHE_RSA_WITH_AES_128_CBC_SHA "ECDHE-RSA-AES128-SHA"
  212 +#define TLS1_TXT_ECDHE_RSA_WITH_AES_256_CBC_SHA "ECDHE-RSA-AES256-SHA"
  213 +
  214 +#define TLS1_TXT_ECDH_anon_WITH_NULL_SHA "AECDH-NULL-SHA"
  215 +#define TLS1_TXT_ECDH_anon_WITH_RC4_128_SHA "AECDH-RC4-SHA"
  216 +#define TLS1_TXT_ECDH_anon_WITH_DES_192_CBC3_SHA "AECDH-DES-CBC3-SHA"
  217 +#define TLS1_TXT_ECDH_anon_WITH_AES_128_CBC_SHA "AECDH-AES128-SHA"
  218 +#define TLS1_TXT_ECDH_anon_WITH_AES_256_CBC_SHA "AECDH-AES256-SHA"
145 219  
146 220 #define TLS_CT_RSA_SIGN 1
147 221 #define TLS_CT_DSS_SIGN 2
148 222 #define TLS_CT_RSA_FIXED_DH 3
149 223 #define TLS_CT_DSS_FIXED_DH 4
150   -#define TLS_CT_NUMBER 4
  224 +#define TLS_CT_ECDSA_SIGN 64
  225 +#define TLS_CT_RSA_FIXED_ECDH 65
  226 +#define TLS_CT_ECDSA_FIXED_ECDH 66
  227 +#define TLS_CT_NUMBER 7
151 228  
152 229 #define TLS1_FINISH_MAC_LENGTH 12
153 230  
... ... @@ -193,3 +270,5 @@ extern &quot;C&quot; {
193 270 #endif
194 271 #endif
195 272  
  273 +
  274 +
... ...
third_dev/openssl/include/openssl/tmdiff.h
... ... @@ -59,6 +59,16 @@
59 59 /* Header for dynamic hash table routines
60 60 * Author - Eric Young
61 61 */
  62 +/* ... erm yeah, "dynamic hash tables" you say?
  63 + *
  64 + * And what would dynamic hash tables have to do with any of this code *now*?
  65 + * AFAICS, this code is only referenced by crypto/bn/exp.c which is an unused
  66 + * file that I doubt compiles any more. speed.c is the only thing that could
  67 + * use this (and it has nothing to do with hash tables), yet it instead has its
  68 + * own duplication of all this stuff and looks, if anything, more complete. See
  69 + * the corresponding note in apps/speed.c.
  70 + * The Bemused - Geoff
  71 + */
62 72  
63 73 #ifndef HEADER_TMDIFF_H
64 74 #define HEADER_TMDIFF_H
... ... @@ -67,11 +77,13 @@
67 77 extern "C" {
68 78 #endif
69 79  
70   -char *ms_time_new(void );
71   -void ms_time_free(char *a);
72   -void ms_time_get(char *a);
73   -double ms_time_diff(char *start,char *end);
74   -int ms_time_cmp(char *ap,char *bp);
  80 +typedef struct ms_tm MS_TM;
  81 +
  82 +MS_TM *ms_time_new(void );
  83 +void ms_time_free(MS_TM *a);
  84 +void ms_time_get(MS_TM *a);
  85 +double ms_time_diff(MS_TM *start, MS_TM *end);
  86 +int ms_time_cmp(const MS_TM *ap, const MS_TM *bp);
75 87  
76 88 #ifdef __cplusplus
77 89 }
... ...
third_dev/openssl/include/openssl/txt_db.h
... ... @@ -59,6 +59,7 @@
59 59 #ifndef HEADER_TXT_DB_H
60 60 #define HEADER_TXT_DB_H
61 61  
  62 +#include <openssl/opensslconf.h>
62 63 #ifndef OPENSSL_NO_BIO
63 64 #include <openssl/bio.h>
64 65 #endif
... ... @@ -81,7 +82,7 @@ typedef struct txt_db_st
81 82 int num_fields;
82 83 STACK /* char ** */ *data;
83 84 LHASH **index;
84   - int (**qual)();
  85 + int (**qual)(char **);
85 86 long error;
86 87 long arg1;
87 88 long arg2;
... ... @@ -95,7 +96,7 @@ long TXT_DB_write(BIO *out, TXT_DB *db);
95 96 TXT_DB *TXT_DB_read(char *in, int num);
96 97 long TXT_DB_write(char *out, TXT_DB *db);
97 98 #endif
98   -int TXT_DB_create_index(TXT_DB *db,int field,int (*qual)(),
  99 +int TXT_DB_create_index(TXT_DB *db,int field,int (*qual)(char **),
99 100 LHASH_HASH_FN_TYPE hash, LHASH_COMP_FN_TYPE cmp);
100 101 void TXT_DB_free(TXT_DB *db);
101 102 char **TXT_DB_get_by_index(TXT_DB *db, int idx, char **value);
... ...
third_dev/openssl/include/openssl/ui.h
... ... @@ -59,25 +59,19 @@
59 59 #ifndef HEADER_UI_H
60 60 #define HEADER_UI_H
61 61  
  62 +#ifndef OPENSSL_NO_DEPRECATED
62 63 #include <openssl/crypto.h>
  64 +#endif
63 65 #include <openssl/safestack.h>
  66 +#include <openssl/ossl_typ.h>
64 67  
65 68 #ifdef __cplusplus
66 69 extern "C" {
67 70 #endif
68 71  
69   -/* The UI type is a holder for a specific user interface session. It can
70   - contain an illimited number of informational or error strings as well
71   - as things to prompt for, both passwords (noecho mode) and others (echo
72   - mode), and verification of the same. All of these are called strings,
73   - and are further described below. */
74   -typedef struct ui_st UI;
75   -
76   -/* All instances of UI have a reference to a method structure, which is a
77   - ordered vector of functions that implement the lower level things to do.
78   - There is an instruction on the implementation further down, in the section
79   - for method implementors. */
80   -typedef struct ui_method_st UI_METHOD;
  72 +/* Declared already in ossl_typ.h */
  73 +/* typedef struct ui_st UI; */
  74 +/* typedef struct ui_method_st UI_METHOD; */
81 75  
82 76  
83 77 /* All the following functions return -1 or NULL on error and in some cases
... ... @@ -217,7 +211,7 @@ int UI_process(UI *ui);
217 211 /* Give a user interface parametrised control commands. This can be used to
218 212 send down an integer, a data pointer or a function pointer, as well as
219 213 be used to get information from a UI. */
220   -int UI_ctrl(UI *ui, int cmd, long i, void *p, void (*f)());
  214 +int UI_ctrl(UI *ui, int cmd, long i, void *p, void (*f)(void));
221 215  
222 216 /* The commands */
223 217 /* Use UI_CONTROL_PRINT_ERRORS with the value 1 to have UI_process print the
... ...
third_dev/openssl/include/openssl/x509.h
... ... @@ -55,10 +55,16 @@
55 55 * copied and put under another distribution licence
56 56 * [including the GNU Public Licence.]
57 57 */
  58 +/* ====================================================================
  59 + * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
  60 + * ECDH support in OpenSSL originally developed by
  61 + * SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project.
  62 + */
58 63  
59 64 #ifndef HEADER_X509_H
60 65 #define HEADER_X509_H
61 66  
  67 +#include <openssl/e_os2.h>
62 68 #include <openssl/symhacks.h>
63 69 #ifndef OPENSSL_NO_BUFFER
64 70 #include <openssl/buffer.h>
... ... @@ -73,21 +79,33 @@
73 79 #include <openssl/asn1.h>
74 80 #include <openssl/safestack.h>
75 81  
  82 +#ifndef OPENSSL_NO_EC
  83 +#include <openssl/ec.h>
  84 +#endif
  85 +
  86 +#ifndef OPENSSL_NO_ECDSA
  87 +#include <openssl/ecdsa.h>
  88 +#endif
  89 +
  90 +#ifndef OPENSSL_NO_ECDH
  91 +#include <openssl/ecdh.h>
  92 +#endif
  93 +
  94 +#ifndef OPENSSL_NO_DEPRECATED
76 95 #ifndef OPENSSL_NO_RSA
77 96 #include <openssl/rsa.h>
78 97 #endif
79   -
80 98 #ifndef OPENSSL_NO_DSA
81 99 #include <openssl/dsa.h>
82 100 #endif
83   -
84 101 #ifndef OPENSSL_NO_DH
85 102 #include <openssl/dh.h>
86 103 #endif
  104 +#endif
  105 +
87 106 #ifndef OPENSSL_NO_SHA
88 107 #include <openssl/sha.h>
89 108 #endif
90   -#include <openssl/e_os2.h>
91 109 #include <openssl/ossl_typ.h>
92 110  
93 111 #ifdef __cplusplus
... ... @@ -95,8 +113,9 @@ extern &quot;C&quot; {
95 113 #endif
96 114  
97 115 #ifdef OPENSSL_SYS_WIN32
98   -/* Under Win32 this is defined in wincrypt.h */
  116 +/* Under Win32 these are defined in wincrypt.h */
99 117 #undef X509_NAME
  118 +#undef X509_CERT_PAIR
100 119 #endif
101 120  
102 121 #define X509_FILETYPE_PEM 1
... ... @@ -117,8 +136,8 @@ extern &quot;C&quot; {
117 136 typedef struct X509_objects_st
118 137 {
119 138 int nid;
120   - int (*a2i)();
121   - int (*i2a)();
  139 + int (*a2i)(void);
  140 + int (*i2a)(void);
122 141 } X509_OBJECTS;
123 142  
124 143 struct X509_algor_st
... ... @@ -261,12 +280,14 @@ struct x509_st
261 280 CRYPTO_EX_DATA ex_data;
262 281 /* These contain copies of various extension values */
263 282 long ex_pathlen;
  283 + long ex_pcpathlen;
264 284 unsigned long ex_flags;
265 285 unsigned long ex_kusage;
266 286 unsigned long ex_xkusage;
267 287 unsigned long ex_nscert;
268 288 ASN1_OCTET_STRING *skid;
269 289 struct AUTHORITY_KEYID_st *akid;
  290 + X509_POLICY_CACHE *policy_cache;
270 291 #ifndef OPENSSL_NO_SHA
271 292 unsigned char sha1_hash[SHA_DIGEST_LENGTH];
272 293 #endif
... ... @@ -289,6 +310,11 @@ typedef struct x509_trust_st {
289 310  
290 311 DECLARE_STACK_OF(X509_TRUST)
291 312  
  313 +typedef struct x509_cert_pair_st {
  314 + X509 *forward;
  315 + X509 *reverse;
  316 +} X509_CERT_PAIR;
  317 +
292 318 /* standard trust ids */
293 319  
294 320 #define X509_TRUST_DEFAULT -1 /* Only valid in purpose settings */
... ... @@ -410,6 +436,7 @@ typedef struct X509_crl_info_st
410 436 ASN1_TIME *nextUpdate;
411 437 STACK_OF(X509_REVOKED) *revoked;
412 438 STACK_OF(X509_EXTENSION) /* [0] */ *extensions;
  439 + ASN1_ENCODING enc;
413 440 } X509_CRL_INFO;
414 441  
415 442 struct X509_crl_st
... ... @@ -654,6 +681,17 @@ extern &quot;C&quot; {
654 681 #define i2d_DSAPrivateKey_bio(bp,dsa) ASN1_i2d_bio(i2d_DSAPrivateKey,bp, \
655 682 (unsigned char *)dsa)
656 683  
  684 +#define d2i_ECPrivateKey_fp(fp,ecdsa) (EC_KEY *)ASN1_d2i_fp((char *(*)())\
  685 + EC_KEY_new,(char *(*)())d2i_ECPrivateKey, (fp), \
  686 + (unsigned char **)(ecdsa))
  687 +#define i2d_ECPrivateKey_fp(fp,ecdsa) ASN1_i2d_fp(i2d_ECPrivateKey,fp, \
  688 + (unsigned char *)ecdsa)
  689 +#define d2i_ECPrivateKey_bio(bp,ecdsa) (EC_KEY *)ASN1_d2i_bio((char *(*)())\
  690 + EC_KEY_new,(char *(*)())d2i_ECPrivateKey, (bp), \
  691 + (unsigned char **)(ecdsa))
  692 +#define i2d_ECPrivateKey_bio(bp,ecdsa) ASN1_i2d_bio(i2d_ECPrivateKey,bp, \
  693 + (unsigned char *)ecdsa)
  694 +
657 695 #define X509_ALGOR_dup(xn) (X509_ALGOR *)ASN1_dup((int (*)())i2d_X509_ALGOR,\
658 696 (char *(*)())d2i_X509_ALGOR,(char *)xn)
659 697  
... ... @@ -757,6 +795,12 @@ int i2d_DSA_PUBKEY_fp(FILE *fp, DSA *dsa);
757 795 DSA *d2i_DSAPrivateKey_fp(FILE *fp, DSA **dsa);
758 796 int i2d_DSAPrivateKey_fp(FILE *fp, DSA *dsa);
759 797 #endif
  798 +#ifndef OPENSSL_NO_EC
  799 +EC_KEY *d2i_EC_PUBKEY_fp(FILE *fp, EC_KEY **eckey);
  800 +int i2d_EC_PUBKEY_fp(FILE *fp, EC_KEY *eckey);
  801 +EC_KEY *d2i_ECPrivateKey_fp(FILE *fp, EC_KEY **eckey);
  802 +int i2d_ECPrivateKey_fp(FILE *fp, EC_KEY *eckey);
  803 +#endif
760 804 X509_SIG *d2i_PKCS8_fp(FILE *fp,X509_SIG **p8);
761 805 int i2d_PKCS8_fp(FILE *fp,X509_SIG *p8);
762 806 PKCS8_PRIV_KEY_INFO *d2i_PKCS8_PRIV_KEY_INFO_fp(FILE *fp,
... ... @@ -790,6 +834,12 @@ int i2d_DSA_PUBKEY_bio(BIO *bp, DSA *dsa);
790 834 DSA *d2i_DSAPrivateKey_bio(BIO *bp, DSA **dsa);
791 835 int i2d_DSAPrivateKey_bio(BIO *bp, DSA *dsa);
792 836 #endif
  837 +#ifndef OPENSSL_NO_EC
  838 +EC_KEY *d2i_EC_PUBKEY_bio(BIO *bp, EC_KEY **eckey);
  839 +int i2d_EC_PUBKEY_bio(BIO *bp, EC_KEY *eckey);
  840 +EC_KEY *d2i_ECPrivateKey_bio(BIO *bp, EC_KEY **eckey);
  841 +int i2d_ECPrivateKey_bio(BIO *bp, EC_KEY *eckey);
  842 +#endif
793 843 X509_SIG *d2i_PKCS8_bio(BIO *bp,X509_SIG **p8);
794 844 int i2d_PKCS8_bio(BIO *bp,X509_SIG *p8);
795 845 PKCS8_PRIV_KEY_INFO *d2i_PKCS8_PRIV_KEY_INFO_bio(BIO *bp,
... ... @@ -838,16 +888,21 @@ EVP_PKEY * X509_PUBKEY_get(X509_PUBKEY *key);
838 888 int X509_get_pubkey_parameters(EVP_PKEY *pkey,
839 889 STACK_OF(X509) *chain);
840 890 int i2d_PUBKEY(EVP_PKEY *a,unsigned char **pp);
841   -EVP_PKEY * d2i_PUBKEY(EVP_PKEY **a,unsigned char **pp,
  891 +EVP_PKEY * d2i_PUBKEY(EVP_PKEY **a,const unsigned char **pp,
842 892 long length);
843 893 #ifndef OPENSSL_NO_RSA
844 894 int i2d_RSA_PUBKEY(RSA *a,unsigned char **pp);
845   -RSA * d2i_RSA_PUBKEY(RSA **a,unsigned char **pp,
  895 +RSA * d2i_RSA_PUBKEY(RSA **a,const unsigned char **pp,
846 896 long length);
847 897 #endif
848 898 #ifndef OPENSSL_NO_DSA
849 899 int i2d_DSA_PUBKEY(DSA *a,unsigned char **pp);
850   -DSA * d2i_DSA_PUBKEY(DSA **a,unsigned char **pp,
  900 +DSA * d2i_DSA_PUBKEY(DSA **a,const unsigned char **pp,
  901 + long length);
  902 +#endif
  903 +#ifndef OPENSSL_NO_EC
  904 +int i2d_EC_PUBKEY(EC_KEY *a, unsigned char **pp);
  905 +EC_KEY *d2i_EC_PUBKEY(EC_KEY **a, const unsigned char **pp,
851 906 long length);
852 907 #endif
853 908  
... ... @@ -871,16 +926,19 @@ DECLARE_ASN1_FUNCTIONS(X509_CINF)
871 926 DECLARE_ASN1_FUNCTIONS(X509)
872 927 DECLARE_ASN1_FUNCTIONS(X509_CERT_AUX)
873 928  
  929 +DECLARE_ASN1_FUNCTIONS(X509_CERT_PAIR)
  930 +
874 931 int X509_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
875 932 CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
876 933 int X509_set_ex_data(X509 *r, int idx, void *arg);
877 934 void *X509_get_ex_data(X509 *r, int idx);
878 935 int i2d_X509_AUX(X509 *a,unsigned char **pp);
879   -X509 * d2i_X509_AUX(X509 **a,unsigned char **pp,long length);
  936 +X509 * d2i_X509_AUX(X509 **a,const unsigned char **pp,long length);
880 937  
881 938 int X509_alias_set1(X509 *x, unsigned char *name, int len);
882 939 int X509_keyid_set1(X509 *x, unsigned char *id, int len);
883 940 unsigned char * X509_alias_get0(X509 *x, int *len);
  941 +unsigned char * X509_keyid_get0(X509 *x, int *len);
884 942 int (*X509_TRUST_set_default(int (*trust)(int , X509 *, int)))(int, X509 *, int);
885 943 int X509_TRUST_set(int *t, int trust);
886 944 int X509_add1_trust_object(X509 *x, ASN1_OBJECT *obj);
... ... @@ -897,7 +955,7 @@ int X509_CRL_add0_revoked(X509_CRL *crl, X509_REVOKED *rev);
897 955 X509_PKEY * X509_PKEY_new(void );
898 956 void X509_PKEY_free(X509_PKEY *a);
899 957 int i2d_X509_PKEY(X509_PKEY *a,unsigned char **pp);
900   -X509_PKEY * d2i_X509_PKEY(X509_PKEY **a,unsigned char **pp,long length);
  958 +X509_PKEY * d2i_X509_PKEY(X509_PKEY **a,const unsigned char **pp,long length);
901 959  
902 960 DECLARE_ASN1_FUNCTIONS(NETSCAPE_SPKI)
903 961 DECLARE_ASN1_FUNCTIONS(NETSCAPE_SPKAC)
... ... @@ -908,15 +966,15 @@ X509_INFO * X509_INFO_new(void);
908 966 void X509_INFO_free(X509_INFO *a);
909 967 char * X509_NAME_oneline(X509_NAME *a,char *buf,int size);
910 968  
911   -int ASN1_verify(int (*i2d)(), X509_ALGOR *algor1,
912   - ASN1_BIT_STRING *signature,char *data,EVP_PKEY *pkey);
  969 +int ASN1_verify(i2d_of_void *i2d, X509_ALGOR *algor1,
  970 + ASN1_BIT_STRING *signature,char *data,EVP_PKEY *pkey);
913 971  
914   -int ASN1_digest(int (*i2d)(),const EVP_MD *type,char *data,
915   - unsigned char *md,unsigned int *len);
  972 +int ASN1_digest(i2d_of_void *i2d,const EVP_MD *type,char *data,
  973 + unsigned char *md,unsigned int *len);
916 974  
917   -int ASN1_sign(int (*i2d)(), X509_ALGOR *algor1, X509_ALGOR *algor2,
918   - ASN1_BIT_STRING *signature,
919   - char *data,EVP_PKEY *pkey, const EVP_MD *type);
  975 +int ASN1_sign(i2d_of_void *i2d, X509_ALGOR *algor1,
  976 + X509_ALGOR *algor2, ASN1_BIT_STRING *signature,
  977 + char *data,EVP_PKEY *pkey, const EVP_MD *type);
920 978  
921 979 int ASN1_item_digest(const ASN1_ITEM *it,const EVP_MD *type,void *data,
922 980 unsigned char *md,unsigned int *len);
... ... @@ -981,6 +1039,8 @@ int X509_CRL_sort(X509_CRL *crl);
981 1039 int X509_REVOKED_set_serialNumber(X509_REVOKED *x, ASN1_INTEGER *serial);
982 1040 int X509_REVOKED_set_revocationDate(X509_REVOKED *r, ASN1_TIME *tm);
983 1041  
  1042 +int X509_REQ_check_private_key(X509_REQ *x509,EVP_PKEY *pkey);
  1043 +
984 1044 int X509_check_private_key(X509 *x509,EVP_PKEY *pkey);
985 1045  
986 1046 int X509_issuer_and_serial_cmp(const X509 *a, const X509 *b);
... ... @@ -1037,18 +1097,18 @@ int X509_NAME_add_entry_by_OBJ(X509_NAME *name, ASN1_OBJECT *obj, int type,
1037 1097 int X509_NAME_add_entry_by_NID(X509_NAME *name, int nid, int type,
1038 1098 unsigned char *bytes, int len, int loc, int set);
1039 1099 X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_txt(X509_NAME_ENTRY **ne,
1040   - char *field, int type, unsigned char *bytes, int len);
  1100 + const char *field, int type, const unsigned char *bytes, int len);
1041 1101 X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_NID(X509_NAME_ENTRY **ne, int nid,
1042 1102 int type,unsigned char *bytes, int len);
1043   -int X509_NAME_add_entry_by_txt(X509_NAME *name, char *field, int type,
1044   - unsigned char *bytes, int len, int loc, int set);
  1103 +int X509_NAME_add_entry_by_txt(X509_NAME *name, const char *field, int type,
  1104 + const unsigned char *bytes, int len, int loc, int set);
1045 1105 X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_OBJ(X509_NAME_ENTRY **ne,
1046   - ASN1_OBJECT *obj, int type,unsigned char *bytes,
  1106 + ASN1_OBJECT *obj, int type,const unsigned char *bytes,
1047 1107 int len);
1048 1108 int X509_NAME_ENTRY_set_object(X509_NAME_ENTRY *ne,
1049 1109 ASN1_OBJECT *obj);
1050 1110 int X509_NAME_ENTRY_set_data(X509_NAME_ENTRY *ne, int type,
1051   - unsigned char *bytes, int len);
  1111 + const unsigned char *bytes, int len);
1052 1112 ASN1_OBJECT * X509_NAME_ENTRY_get_object(X509_NAME_ENTRY *ne);
1053 1113 ASN1_STRING * X509_NAME_ENTRY_get_data(X509_NAME_ENTRY *ne);
1054 1114  
... ... @@ -1141,6 +1201,24 @@ int X509_ATTRIBUTE_count(X509_ATTRIBUTE *attr);
1141 1201 ASN1_OBJECT *X509_ATTRIBUTE_get0_object(X509_ATTRIBUTE *attr);
1142 1202 ASN1_TYPE *X509_ATTRIBUTE_get0_type(X509_ATTRIBUTE *attr, int idx);
1143 1203  
  1204 +int EVP_PKEY_get_attr_count(const EVP_PKEY *key);
  1205 +int EVP_PKEY_get_attr_by_NID(const EVP_PKEY *key, int nid,
  1206 + int lastpos);
  1207 +int EVP_PKEY_get_attr_by_OBJ(const EVP_PKEY *key, ASN1_OBJECT *obj,
  1208 + int lastpos);
  1209 +X509_ATTRIBUTE *EVP_PKEY_get_attr(const EVP_PKEY *key, int loc);
  1210 +X509_ATTRIBUTE *EVP_PKEY_delete_attr(EVP_PKEY *key, int loc);
  1211 +int EVP_PKEY_add1_attr(EVP_PKEY *key, X509_ATTRIBUTE *attr);
  1212 +int EVP_PKEY_add1_attr_by_OBJ(EVP_PKEY *key,
  1213 + const ASN1_OBJECT *obj, int type,
  1214 + const unsigned char *bytes, int len);
  1215 +int EVP_PKEY_add1_attr_by_NID(EVP_PKEY *key,
  1216 + int nid, int type,
  1217 + const unsigned char *bytes, int len);
  1218 +int EVP_PKEY_add1_attr_by_txt(EVP_PKEY *key,
  1219 + const char *attrname, int type,
  1220 + const unsigned char *bytes, int len);
  1221 +
1144 1222 int X509_verify_cert(X509_STORE_CTX *ctx);
1145 1223  
1146 1224 /* lookup a cert from a X509 STACK */
... ... @@ -1187,18 +1265,20 @@ void ERR_load_X509_strings(void);
1187 1265 /* Function codes. */
1188 1266 #define X509_F_ADD_CERT_DIR 100
1189 1267 #define X509_F_BY_FILE_CTRL 101
  1268 +#define X509_F_CHECK_POLICY 145
1190 1269 #define X509_F_DIR_CTRL 102
1191 1270 #define X509_F_GET_CERT_BY_SUBJECT 103
1192 1271 #define X509_F_NETSCAPE_SPKI_B64_DECODE 129
1193 1272 #define X509_F_NETSCAPE_SPKI_B64_ENCODE 130
  1273 +#define X509_F_X509AT_ADD1_ATTR 135
1194 1274 #define X509_F_X509V3_ADD_EXT 104
1195   -#define X509_F_X509_ADD_ATTR 135
1196 1275 #define X509_F_X509_ATTRIBUTE_CREATE_BY_NID 136
1197 1276 #define X509_F_X509_ATTRIBUTE_CREATE_BY_OBJ 137
1198 1277 #define X509_F_X509_ATTRIBUTE_CREATE_BY_TXT 140
1199 1278 #define X509_F_X509_ATTRIBUTE_GET0_DATA 139
1200 1279 #define X509_F_X509_ATTRIBUTE_SET1_DATA 138
1201 1280 #define X509_F_X509_CHECK_PRIVATE_KEY 128
  1281 +#define X509_F_X509_CRL_PRINT_FP 147
1202 1282 #define X509_F_X509_EXTENSION_CREATE_BY_NID 108
1203 1283 #define X509_F_X509_EXTENSION_CREATE_BY_OBJ 109
1204 1284 #define X509_F_X509_GET_PUBKEY_PARAMETERS 110
... ... @@ -1211,14 +1291,16 @@ void ERR_load_X509_strings(void);
1211 1291 #define X509_F_X509_NAME_ENTRY_SET_OBJECT 115
1212 1292 #define X509_F_X509_NAME_ONELINE 116
1213 1293 #define X509_F_X509_NAME_PRINT 117
1214   -#define X509_F_X509_PRINT_FP 118
  1294 +#define X509_F_X509_PRINT_EX_FP 118
1215 1295 #define X509_F_X509_PUBKEY_GET 119
1216 1296 #define X509_F_X509_PUBKEY_SET 120
1217   -#define X509_F_X509_REQ_PRINT 121
  1297 +#define X509_F_X509_REQ_CHECK_PRIVATE_KEY 144
  1298 +#define X509_F_X509_REQ_PRINT_EX 121
1218 1299 #define X509_F_X509_REQ_PRINT_FP 122
1219 1300 #define X509_F_X509_REQ_TO_X509 123
1220 1301 #define X509_F_X509_STORE_ADD_CERT 124
1221 1302 #define X509_F_X509_STORE_ADD_CRL 125
  1303 +#define X509_F_X509_STORE_CTX_GET1_ISSUER 146
1222 1304 #define X509_F_X509_STORE_CTX_INIT 143
1223 1305 #define X509_F_X509_STORE_CTX_NEW 142
1224 1306 #define X509_F_X509_STORE_CTX_PURPOSE_INHERIT 134
... ...
third_dev/openssl/include/openssl/x509_vfy.h
... ... @@ -65,6 +65,7 @@
65 65 #ifndef HEADER_X509_VFY_H
66 66 #define HEADER_X509_VFY_H
67 67  
  68 +#include <openssl/opensslconf.h>
68 69 #ifndef OPENSSL_NO_LHASH
69 70 #include <openssl/lhash.h>
70 71 #endif
... ... @@ -155,6 +156,25 @@ typedef struct x509_lookup_method_st
155 156 X509_OBJECT *ret);
156 157 } X509_LOOKUP_METHOD;
157 158  
  159 +/* This structure hold all parameters associated with a verify operation
  160 + * by including an X509_VERIFY_PARAM structure in related structures the
  161 + * parameters used can be customized
  162 + */
  163 +
  164 +typedef struct X509_VERIFY_PARAM_st
  165 + {
  166 + char *name;
  167 + time_t check_time; /* Time to use */
  168 + unsigned long inh_flags; /* Inheritance flags */
  169 + unsigned long flags; /* Various verify flags */
  170 + int purpose; /* purpose to check untrusted certificates */
  171 + int trust; /* trust setting to check */
  172 + int depth; /* Verify depth */
  173 + STACK_OF(ASN1_OBJECT) *policies; /* Permissible policies */
  174 + } X509_VERIFY_PARAM;
  175 +
  176 +DECLARE_STACK_OF(X509_VERIFY_PARAM)
  177 +
158 178 /* This is used to hold everything. It is used for all certificate
159 179 * validation. Once we have a certificate chain, the 'verify'
160 180 * function is then called to actually check the cert chain. */
... ... @@ -167,13 +187,8 @@ struct x509_store_st
167 187 /* These are external lookup methods */
168 188 STACK_OF(X509_LOOKUP) *get_cert_methods;
169 189  
170   - /* The following fields are not used by X509_STORE but are
171   - * inherited by X509_STORE_CTX when it is initialised.
172   - */
  190 + X509_VERIFY_PARAM *param;
173 191  
174   - unsigned long flags; /* Various verify flags */
175   - int purpose;
176   - int trust;
177 192 /* Callbacks for various operations */
178 193 int (*verify)(X509_STORE_CTX *ctx); /* called to verify a certificate */
179 194 int (*verify_cb)(int ok,X509_STORE_CTX *ctx); /* error callback */
... ... @@ -187,10 +202,9 @@ struct x509_store_st
187 202  
188 203 CRYPTO_EX_DATA ex_data;
189 204 int references;
190   - int depth; /* how deep to look (still unused -- X509_STORE_CTX's depth is used) */
191 205 } /* X509_STORE */;
192 206  
193   -#define X509_STORE_set_depth(ctx,d) ((ctx)->depth=(d))
  207 +int X509_STORE_set_depth(X509_STORE *store, int depth);
194 208  
195 209 #define X509_STORE_set_verify_cb_func(ctx,func) ((ctx)->verify_cb=(func))
196 210 #define X509_STORE_set_verify_func(ctx,func) ((ctx)->verify=(func))
... ... @@ -217,10 +231,9 @@ struct x509_store_ctx_st /* X509_STORE_CTX */
217 231 /* The following are set by the caller */
218 232 X509 *cert; /* The cert to check */
219 233 STACK_OF(X509) *untrusted; /* chain of X509s - untrusted - passed in */
220   - int purpose; /* purpose to check untrusted certificates */
221   - int trust; /* trust setting to check */
222   - time_t check_time; /* time to make verify at */
223   - unsigned long flags; /* Various verify flags */
  234 + STACK_OF(X509_CRL) *crls; /* set of CRLs passed in */
  235 +
  236 + X509_VERIFY_PARAM *param;
224 237 void *other_ctx; /* Other info for use with get_issuer() */
225 238  
226 239 /* Callbacks for various operations */
... ... @@ -232,13 +245,16 @@ struct x509_store_ctx_st /* X509_STORE_CTX */
232 245 int (*get_crl)(X509_STORE_CTX *ctx, X509_CRL **crl, X509 *x); /* retrieve CRL */
233 246 int (*check_crl)(X509_STORE_CTX *ctx, X509_CRL *crl); /* Check CRL validity */
234 247 int (*cert_crl)(X509_STORE_CTX *ctx, X509_CRL *crl, X509 *x); /* Check certificate against CRL */
  248 + int (*check_policy)(X509_STORE_CTX *ctx);
235 249 int (*cleanup)(X509_STORE_CTX *ctx);
236 250  
237 251 /* The following is built up */
238   - int depth; /* how far to go looking up certs */
239 252 int valid; /* if 0, rebuild chain */
240 253 int last_untrusted; /* index of last untrusted cert */
241 254 STACK_OF(X509) *chain; /* chain of X509s - built up and trusted */
  255 + X509_POLICY_TREE *tree; /* Valid policy tree */
  256 +
  257 + int explicit_policy; /* Require explicit policy value */
242 258  
243 259 /* When something goes wrong, this is why */
244 260 int error_depth;
... ... @@ -250,7 +266,7 @@ struct x509_store_ctx_st /* X509_STORE_CTX */
250 266 CRYPTO_EX_DATA ex_data;
251 267 } /* X509_STORE_CTX */;
252 268  
253   -#define X509_STORE_CTX_set_depth(ctx,d) ((ctx)->depth=(d))
  269 +void X509_STORE_CTX_set_depth(X509_STORE_CTX *ctx, int depth);
254 270  
255 271 #define X509_STORE_CTX_set_app_data(ctx,data) \
256 272 X509_STORE_CTX_set_ex_data(ctx,0,data)
... ... @@ -276,7 +292,7 @@ struct x509_store_ctx_st /* X509_STORE_CTX */
276 292 #define X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY 6
277 293 #define X509_V_ERR_CERT_SIGNATURE_FAILURE 7
278 294 #define X509_V_ERR_CRL_SIGNATURE_FAILURE 8
279   -#define X509_V_ERR_CERT_NOT_YET_VALID 9
  295 +#define X509_V_ERR_CERT_NOT_YET_VALID 9
280 296 #define X509_V_ERR_CERT_HAS_EXPIRED 10
281 297 #define X509_V_ERR_CRL_NOT_YET_VALID 11
282 298 #define X509_V_ERR_CRL_HAS_EXPIRED 12
... ... @@ -306,6 +322,15 @@ struct x509_store_ctx_st /* X509_STORE_CTX */
306 322 #define X509_V_ERR_UNHANDLED_CRITICAL_EXTENSION 34
307 323 #define X509_V_ERR_KEYUSAGE_NO_CRL_SIGN 35
308 324 #define X509_V_ERR_UNHANDLED_CRITICAL_CRL_EXTENSION 36
  325 +#define X509_V_ERR_INVALID_NON_CA 37
  326 +#define X509_V_ERR_PROXY_PATH_LENGTH_EXCEEDED 38
  327 +#define X509_V_ERR_KEYUSAGE_NO_DIGITAL_SIGNATURE 39
  328 +#define X509_V_ERR_PROXY_CERTIFICATES_NOT_ALLOWED 40
  329 +
  330 +#define X509_V_ERR_INVALID_EXTENSION 41
  331 +#define X509_V_ERR_INVALID_POLICY_EXTENSION 42
  332 +#define X509_V_ERR_NO_EXPLICIT_POLICY 43
  333 +
309 334  
310 335 /* The application is not happy */
311 336 #define X509_V_ERR_APPLICATION_VERIFICATION 50
... ... @@ -324,6 +349,30 @@ struct x509_store_ctx_st /* X509_STORE_CTX */
324 349 #define X509_V_FLAG_IGNORE_CRITICAL 0x10
325 350 /* Disable workarounds for broken certificates */
326 351 #define X509_V_FLAG_X509_STRICT 0x20
  352 +/* Enable proxy certificate validation */
  353 +#define X509_V_FLAG_ALLOW_PROXY_CERTS 0x40
  354 +/* Enable policy checking */
  355 +#define X509_V_FLAG_POLICY_CHECK 0x80
  356 +/* Policy variable require-explicit-policy */
  357 +#define X509_V_FLAG_EXPLICIT_POLICY 0x100
  358 +/* Policy variable inhibit-any-policy */
  359 +#define X509_V_FLAG_INHIBIT_ANY 0x200
  360 +/* Policy variable inhibit-policy-mapping */
  361 +#define X509_V_FLAG_INHIBIT_MAP 0x400
  362 +/* Notify callback that policy is OK */
  363 +#define X509_V_FLAG_NOTIFY_POLICY 0x800
  364 +
  365 +#define X509_VP_FLAG_DEFAULT 0x1
  366 +#define X509_VP_FLAG_OVERWRITE 0x2
  367 +#define X509_VP_FLAG_RESET_FLAGS 0x4
  368 +#define X509_VP_FLAG_LOCKED 0x8
  369 +#define X509_VP_FLAG_ONCE 0x10
  370 +
  371 +/* Internal use: mask of policy related options */
  372 +#define X509_V_FLAG_POLICY_MASK (X509_V_FLAG_POLICY_CHECK \
  373 + | X509_V_FLAG_EXPLICIT_POLICY \
  374 + | X509_V_FLAG_INHIBIT_ANY \
  375 + | X509_V_FLAG_INHIBIT_MAP)
327 376  
328 377 int X509_OBJECT_idx_by_subject(STACK_OF(X509_OBJECT) *h, int type,
329 378 X509_NAME *name);
... ... @@ -334,9 +383,10 @@ void X509_OBJECT_free_contents(X509_OBJECT *a);
334 383 X509_STORE *X509_STORE_new(void );
335 384 void X509_STORE_free(X509_STORE *v);
336 385  
337   -void X509_STORE_set_flags(X509_STORE *ctx, long flags);
  386 +int X509_STORE_set_flags(X509_STORE *ctx, unsigned long flags);
338 387 int X509_STORE_set_purpose(X509_STORE *ctx, int purpose);
339 388 int X509_STORE_set_trust(X509_STORE *ctx, int trust);
  389 +int X509_STORE_set1_param(X509_STORE *ctx, X509_VERIFY_PARAM *pm);
340 390  
341 391 X509_STORE_CTX *X509_STORE_CTX_new(void);
342 392  
... ... @@ -400,14 +450,78 @@ STACK_OF(X509) *X509_STORE_CTX_get_chain(X509_STORE_CTX *ctx);
400 450 STACK_OF(X509) *X509_STORE_CTX_get1_chain(X509_STORE_CTX *ctx);
401 451 void X509_STORE_CTX_set_cert(X509_STORE_CTX *c,X509 *x);
402 452 void X509_STORE_CTX_set_chain(X509_STORE_CTX *c,STACK_OF(X509) *sk);
  453 +void X509_STORE_CTX_set0_crls(X509_STORE_CTX *c,STACK_OF(X509_CRL) *sk);
403 454 int X509_STORE_CTX_set_purpose(X509_STORE_CTX *ctx, int purpose);
404 455 int X509_STORE_CTX_set_trust(X509_STORE_CTX *ctx, int trust);
405 456 int X509_STORE_CTX_purpose_inherit(X509_STORE_CTX *ctx, int def_purpose,
406 457 int purpose, int trust);
407   -void X509_STORE_CTX_set_flags(X509_STORE_CTX *ctx, long flags);
408   -void X509_STORE_CTX_set_time(X509_STORE_CTX *ctx, long flags, time_t t);
  458 +void X509_STORE_CTX_set_flags(X509_STORE_CTX *ctx, unsigned long flags);
  459 +void X509_STORE_CTX_set_time(X509_STORE_CTX *ctx, unsigned long flags,
  460 + time_t t);
409 461 void X509_STORE_CTX_set_verify_cb(X509_STORE_CTX *ctx,
410 462 int (*verify_cb)(int, X509_STORE_CTX *));
  463 +
  464 +X509_POLICY_TREE *X509_STORE_CTX_get0_policy_tree(X509_STORE_CTX *ctx);
  465 +int X509_STORE_CTX_get_explicit_policy(X509_STORE_CTX *ctx);
  466 +
  467 +X509_VERIFY_PARAM *X509_STORE_CTX_get0_param(X509_STORE_CTX *ctx);
  468 +void X509_STORE_CTX_set0_param(X509_STORE_CTX *ctx, X509_VERIFY_PARAM *param);
  469 +int X509_STORE_CTX_set_default(X509_STORE_CTX *ctx, const char *name);
  470 +
  471 +/* X509_VERIFY_PARAM functions */
  472 +
  473 +X509_VERIFY_PARAM *X509_VERIFY_PARAM_new(void);
  474 +void X509_VERIFY_PARAM_free(X509_VERIFY_PARAM *param);
  475 +int X509_VERIFY_PARAM_inherit(X509_VERIFY_PARAM *to,
  476 + const X509_VERIFY_PARAM *from);
  477 +int X509_VERIFY_PARAM_set1(X509_VERIFY_PARAM *to,
  478 + const X509_VERIFY_PARAM *from);
  479 +int X509_VERIFY_PARAM_set1_name(X509_VERIFY_PARAM *param, const char *name);
  480 +int X509_VERIFY_PARAM_set_flags(X509_VERIFY_PARAM *param, unsigned long flags);
  481 +int X509_VERIFY_PARAM_clear_flags(X509_VERIFY_PARAM *param,
  482 + unsigned long flags);
  483 +unsigned long X509_VERIFY_PARAM_get_flags(X509_VERIFY_PARAM *param);
  484 +int X509_VERIFY_PARAM_set_purpose(X509_VERIFY_PARAM *param, int purpose);
  485 +int X509_VERIFY_PARAM_set_trust(X509_VERIFY_PARAM *param, int trust);
  486 +void X509_VERIFY_PARAM_set_depth(X509_VERIFY_PARAM *param, int depth);
  487 +void X509_VERIFY_PARAM_set_time(X509_VERIFY_PARAM *param, time_t t);
  488 +int X509_VERIFY_PARAM_add0_policy(X509_VERIFY_PARAM *param,
  489 + ASN1_OBJECT *policy);
  490 +int X509_VERIFY_PARAM_set1_policies(X509_VERIFY_PARAM *param,
  491 + STACK_OF(ASN1_OBJECT) *policies);
  492 +int X509_VERIFY_PARAM_get_depth(const X509_VERIFY_PARAM *param);
  493 +
  494 +int X509_VERIFY_PARAM_add0_table(X509_VERIFY_PARAM *param);
  495 +const X509_VERIFY_PARAM *X509_VERIFY_PARAM_lookup(const char *name);
  496 +void X509_VERIFY_PARAM_table_cleanup(void);
  497 +
  498 +int X509_policy_check(X509_POLICY_TREE **ptree, int *pexplicit_policy,
  499 + STACK_OF(X509) *certs,
  500 + STACK_OF(ASN1_OBJECT) *policy_oids,
  501 + unsigned int flags);
  502 +
  503 +void X509_policy_tree_free(X509_POLICY_TREE *tree);
  504 +
  505 +int X509_policy_tree_level_count(const X509_POLICY_TREE *tree);
  506 +X509_POLICY_LEVEL *
  507 + X509_policy_tree_get0_level(const X509_POLICY_TREE *tree, int i);
  508 +
  509 +STACK_OF(X509_POLICY_NODE) *
  510 + X509_policy_tree_get0_policies(const X509_POLICY_TREE *tree);
  511 +
  512 +STACK_OF(X509_POLICY_NODE) *
  513 + X509_policy_tree_get0_user_policies(const X509_POLICY_TREE *tree);
  514 +
  515 +int X509_policy_level_node_count(X509_POLICY_LEVEL *level);
  516 +
  517 +X509_POLICY_NODE *X509_policy_level_get0_node(X509_POLICY_LEVEL *level, int i);
  518 +
  519 +const ASN1_OBJECT *X509_policy_node_get0_policy(const X509_POLICY_NODE *node);
  520 +
  521 +STACK_OF(POLICYQUALINFO) *
  522 + X509_policy_node_get0_qualifiers(const X509_POLICY_NODE *node);
  523 +const X509_POLICY_NODE *
  524 + X509_policy_node_get0_parent(const X509_POLICY_NODE *node);
411 525  
412 526 #ifdef __cplusplus
413 527 }
... ...
third_dev/openssl/include/openssl/x509v3.h
... ... @@ -3,7 +3,7 @@
3 3 * project 1999.
4 4 */
5 5 /* ====================================================================
6   - * Copyright (c) 1999 The OpenSSL Project. All rights reserved.
  6 + * Copyright (c) 1999-2004 The OpenSSL Project. All rights reserved.
7 7 *
8 8 * Redistribution and use in source and binary forms, with or without
9 9 * modification, are permitted provided that the following conditions
... ... @@ -74,14 +74,14 @@ struct v3_ext_ctx;
74 74  
75 75 typedef void * (*X509V3_EXT_NEW)(void);
76 76 typedef void (*X509V3_EXT_FREE)(void *);
77   -typedef void * (*X509V3_EXT_D2I)(void *, unsigned char ** , long);
  77 +typedef void * (*X509V3_EXT_D2I)(void *, const unsigned char ** , long);
78 78 typedef int (*X509V3_EXT_I2D)(void *, unsigned char **);
79 79 typedef STACK_OF(CONF_VALUE) * (*X509V3_EXT_I2V)(struct v3_ext_method *method, void *ext, STACK_OF(CONF_VALUE) *extlist);
80 80 typedef void * (*X509V3_EXT_V2I)(struct v3_ext_method *method, struct v3_ext_ctx *ctx, STACK_OF(CONF_VALUE) *values);
81 81 typedef char * (*X509V3_EXT_I2S)(struct v3_ext_method *method, void *ext);
82   -typedef void * (*X509V3_EXT_S2I)(struct v3_ext_method *method, struct v3_ext_ctx *ctx, char *str);
  82 +typedef void * (*X509V3_EXT_S2I)(struct v3_ext_method *method, struct v3_ext_ctx *ctx, const char *str);
83 83 typedef int (*X509V3_EXT_I2R)(struct v3_ext_method *method, void *ext, BIO *out, int indent);
84   -typedef void * (*X509V3_EXT_R2I)(struct v3_ext_method *method, struct v3_ext_ctx *ctx, char *str);
  84 +typedef void * (*X509V3_EXT_R2I)(struct v3_ext_method *method, struct v3_ext_ctx *ctx, const char *str);
85 85  
86 86 /* V3 extension structure */
87 87  
... ... @@ -132,7 +132,6 @@ void *db;
132 132 };
133 133  
134 134 typedef struct v3_ext_method X509V3_EXT_METHOD;
135   -typedef struct v3_ext_ctx X509V3_CTX;
136 135  
137 136 DECLARE_STACK_OF(X509V3_EXT_METHOD)
138 137  
... ... @@ -287,6 +286,50 @@ typedef STACK_OF(POLICYINFO) CERTIFICATEPOLICIES;
287 286 DECLARE_STACK_OF(POLICYINFO)
288 287 DECLARE_ASN1_SET_OF(POLICYINFO)
289 288  
  289 +typedef struct POLICY_MAPPING_st {
  290 + ASN1_OBJECT *issuerDomainPolicy;
  291 + ASN1_OBJECT *subjectDomainPolicy;
  292 +} POLICY_MAPPING;
  293 +
  294 +DECLARE_STACK_OF(POLICY_MAPPING)
  295 +
  296 +typedef STACK_OF(POLICY_MAPPING) POLICY_MAPPINGS;
  297 +
  298 +typedef struct GENERAL_SUBTREE_st {
  299 + GENERAL_NAME *base;
  300 + ASN1_INTEGER *minimum;
  301 + ASN1_INTEGER *maximum;
  302 +} GENERAL_SUBTREE;
  303 +
  304 +DECLARE_STACK_OF(GENERAL_SUBTREE)
  305 +
  306 +typedef struct NAME_CONSTRAINTS_st {
  307 + STACK_OF(GENERAL_SUBTREE) *permittedSubtrees;
  308 + STACK_OF(GENERAL_SUBTREE) *excludedSubtrees;
  309 +} NAME_CONSTRAINTS;
  310 +
  311 +typedef struct POLICY_CONSTRAINTS_st {
  312 + ASN1_INTEGER *requireExplicitPolicy;
  313 + ASN1_INTEGER *inhibitPolicyMapping;
  314 +} POLICY_CONSTRAINTS;
  315 +
  316 +/* Proxy certificate structures, see RFC 3820 */
  317 +typedef struct PROXY_POLICY_st
  318 + {
  319 + ASN1_OBJECT *policyLanguage;
  320 + ASN1_OCTET_STRING *policy;
  321 + } PROXY_POLICY;
  322 +
  323 +typedef struct PROXY_CERT_INFO_EXTENSION_st
  324 + {
  325 + ASN1_INTEGER *pcPathLengthConstraint;
  326 + PROXY_POLICY *proxyPolicy;
  327 + } PROXY_CERT_INFO_EXTENSION;
  328 +
  329 +DECLARE_ASN1_FUNCTIONS(PROXY_POLICY)
  330 +DECLARE_ASN1_FUNCTIONS(PROXY_CERT_INFO_EXTENSION)
  331 +
  332 +
290 333 #define X509V3_conf_err(val) ERR_add_error_data(6, "section:", val->section, \
291 334 ",name:", val->name, ",value:", val->value);
292 335  
... ... @@ -325,6 +368,9 @@ DECLARE_ASN1_SET_OF(POLICYINFO)
325 368 #define EXFLAG_INVALID 0x80
326 369 #define EXFLAG_SET 0x100
327 370 #define EXFLAG_CRITICAL 0x200
  371 +#define EXFLAG_PROXY 0x400
  372 +
  373 +#define EXFLAG_INVALID_POLICY 0x400
328 374  
329 375 #define KU_DIGITAL_SIGNATURE 0x0080
330 376 #define KU_NON_REPUDIATION 0x0040
... ... @@ -424,6 +470,13 @@ DECLARE_ASN1_FUNCTIONS(PKEY_USAGE_PERIOD)
424 470  
425 471 DECLARE_ASN1_FUNCTIONS(GENERAL_NAME)
426 472  
  473 +
  474 +ASN1_BIT_STRING *v2i_ASN1_BIT_STRING(X509V3_EXT_METHOD *method,
  475 + X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *nval);
  476 +STACK_OF(CONF_VALUE) *i2v_ASN1_BIT_STRING(X509V3_EXT_METHOD *method,
  477 + ASN1_BIT_STRING *bits,
  478 + STACK_OF(CONF_VALUE) *extlist);
  479 +
427 480 STACK_OF(CONF_VALUE) *i2v_GENERAL_NAME(X509V3_EXT_METHOD *method, GENERAL_NAME *gen, STACK_OF(CONF_VALUE) *ret);
428 481 int GENERAL_NAME_print(BIO *out, GENERAL_NAME *gen);
429 482  
... ... @@ -456,8 +509,24 @@ DECLARE_ASN1_FUNCTIONS(DIST_POINT_NAME)
456 509 DECLARE_ASN1_FUNCTIONS(ACCESS_DESCRIPTION)
457 510 DECLARE_ASN1_FUNCTIONS(AUTHORITY_INFO_ACCESS)
458 511  
  512 +DECLARE_ASN1_ITEM(POLICY_MAPPING)
  513 +DECLARE_ASN1_ALLOC_FUNCTIONS(POLICY_MAPPING)
  514 +DECLARE_ASN1_ITEM(POLICY_MAPPINGS)
  515 +
  516 +DECLARE_ASN1_ITEM(GENERAL_SUBTREE)
  517 +DECLARE_ASN1_ALLOC_FUNCTIONS(GENERAL_SUBTREE)
  518 +
  519 +DECLARE_ASN1_ITEM(NAME_CONSTRAINTS)
  520 +DECLARE_ASN1_ALLOC_FUNCTIONS(NAME_CONSTRAINTS)
  521 +
  522 +DECLARE_ASN1_ALLOC_FUNCTIONS(POLICY_CONSTRAINTS)
  523 +DECLARE_ASN1_ITEM(POLICY_CONSTRAINTS)
  524 +
459 525 #ifdef HEADER_CONF_H
460   -GENERAL_NAME *v2i_GENERAL_NAME(X509V3_EXT_METHOD *method, X509V3_CTX *ctx, CONF_VALUE *cnf);
  526 +GENERAL_NAME *v2i_GENERAL_NAME(X509V3_EXT_METHOD *method, X509V3_CTX *ctx,
  527 + CONF_VALUE *cnf);
  528 +GENERAL_NAME *v2i_GENERAL_NAME_ex(GENERAL_NAME *out, X509V3_EXT_METHOD *method,
  529 + X509V3_CTX *ctx, CONF_VALUE *cnf, int is_nc);
461 530 void X509V3_conf_free(CONF_VALUE *val);
462 531  
463 532 X509_EXTENSION *X509V3_EXT_nconf_nid(CONF *conf, X509V3_CTX *ctx, int ext_nid, char *value);
... ... @@ -527,6 +596,7 @@ int X509V3_EXT_print_fp(FILE *out, X509_EXTENSION *ext, int flag, int indent);
527 596  
528 597 int X509V3_extensions_print(BIO *out, char *title, STACK_OF(X509_EXTENSION) *exts, unsigned long flag, int indent);
529 598  
  599 +int X509_check_ca(X509 *x);
530 600 int X509_check_purpose(X509 *x, int id, int ca);
531 601 int X509_supported_extension(X509_EXTENSION *ex);
532 602 int X509_PURPOSE_set(int *p, int purpose);
... ... @@ -548,6 +618,12 @@ STACK *X509_get1_email(X509 *x);
548 618 STACK *X509_REQ_get1_email(X509_REQ *x);
549 619 void X509_email_free(STACK *sk);
550 620  
  621 +ASN1_OCTET_STRING *a2i_IPADDRESS(const char *ipasc);
  622 +ASN1_OCTET_STRING *a2i_IPADDRESS_NC(const char *ipasc);
  623 +int X509V3_NAME_from_section(X509_NAME *nm, STACK_OF(CONF_VALUE)*dn_sk,
  624 + unsigned long chtype);
  625 +
  626 +void X509_POLICY_NODE_print(BIO *out, X509_POLICY_NODE *node, int indent);
551 627  
552 628 /* BEGIN ERROR CODES */
553 629 /* The following lines are auto generated by the script mkerr.pl. Any changes
... ... @@ -560,42 +636,56 @@ void ERR_load_X509V3_strings(void);
560 636 /* Function codes. */
561 637 #define X509V3_F_COPY_EMAIL 122
562 638 #define X509V3_F_COPY_ISSUER 123
  639 +#define X509V3_F_DO_DIRNAME 144
563 640 #define X509V3_F_DO_EXT_CONF 124
564 641 #define X509V3_F_DO_EXT_I2D 135
  642 +#define X509V3_F_DO_EXT_NCONF 151
  643 +#define X509V3_F_DO_I2V_NAME_CONSTRAINTS 148
565 644 #define X509V3_F_HEX_TO_STRING 111
566 645 #define X509V3_F_I2S_ASN1_ENUMERATED 121
  646 +#define X509V3_F_I2S_ASN1_IA5STRING 149
567 647 #define X509V3_F_I2S_ASN1_INTEGER 120
568 648 #define X509V3_F_I2V_AUTHORITY_INFO_ACCESS 138
569 649 #define X509V3_F_NOTICE_SECTION 132
570 650 #define X509V3_F_NREF_NOS 133
571 651 #define X509V3_F_POLICY_SECTION 131
  652 +#define X509V3_F_PROCESS_PCI_VALUE 150
572 653 #define X509V3_F_R2I_CERTPOL 130
  654 +#define X509V3_F_R2I_PCI 155
573 655 #define X509V3_F_S2I_ASN1_IA5STRING 100
574 656 #define X509V3_F_S2I_ASN1_INTEGER 108
575 657 #define X509V3_F_S2I_ASN1_OCTET_STRING 112
576 658 #define X509V3_F_S2I_ASN1_SKEY_ID 114
577   -#define X509V3_F_S2I_S2I_SKEY_ID 115
  659 +#define X509V3_F_S2I_SKEY_ID 115
578 660 #define X509V3_F_STRING_TO_HEX 113
579   -#define X509V3_F_SXNET_ADD_ASC 125
  661 +#define X509V3_F_SXNET_ADD_ID_ASC 125
580 662 #define X509V3_F_SXNET_ADD_ID_INTEGER 126
581 663 #define X509V3_F_SXNET_ADD_ID_ULONG 127
582 664 #define X509V3_F_SXNET_GET_ID_ASC 128
583 665 #define X509V3_F_SXNET_GET_ID_ULONG 129
584   -#define X509V3_F_V2I_ACCESS_DESCRIPTION 139
585 666 #define X509V3_F_V2I_ASN1_BIT_STRING 101
  667 +#define X509V3_F_V2I_AUTHORITY_INFO_ACCESS 139
586 668 #define X509V3_F_V2I_AUTHORITY_KEYID 119
587 669 #define X509V3_F_V2I_BASIC_CONSTRAINTS 102
588 670 #define X509V3_F_V2I_CRLD 134
589   -#define X509V3_F_V2I_EXT_KU 103
590   -#define X509V3_F_V2I_GENERAL_NAME 117
  671 +#define X509V3_F_V2I_EXTENDED_KEY_USAGE 103
591 672 #define X509V3_F_V2I_GENERAL_NAMES 118
  673 +#define X509V3_F_V2I_GENERAL_NAME_EX 117
  674 +#define X509V3_F_V2I_ISSUER_ALT 153
  675 +#define X509V3_F_V2I_NAME_CONSTRAINTS 147
  676 +#define X509V3_F_V2I_POLICY_CONSTRAINTS 146
  677 +#define X509V3_F_V2I_POLICY_MAPPINGS 145
  678 +#define X509V3_F_V2I_SUBJECT_ALT 154
592 679 #define X509V3_F_V3_GENERIC_EXTENSION 116
593   -#define X509V3_F_X509V3_ADD_I2D 140
  680 +#define X509V3_F_X509V3_ADD1_I2D 140
594 681 #define X509V3_F_X509V3_ADD_VALUE 105
595 682 #define X509V3_F_X509V3_EXT_ADD 104
596 683 #define X509V3_F_X509V3_EXT_ADD_ALIAS 106
597 684 #define X509V3_F_X509V3_EXT_CONF 107
598 685 #define X509V3_F_X509V3_EXT_I2D 136
  686 +#define X509V3_F_X509V3_EXT_NCONF 152
  687 +#define X509V3_F_X509V3_GET_SECTION 142
  688 +#define X509V3_F_X509V3_GET_STRING 143
599 689 #define X509V3_F_X509V3_GET_VALUE_BOOL 110
600 690 #define X509V3_F_X509V3_PARSE_LIST 109
601 691 #define X509V3_F_X509_PURPOSE_ADD 137
... ... @@ -606,6 +696,7 @@ void ERR_load_X509V3_strings(void);
606 696 #define X509V3_R_BAD_OBJECT 119
607 697 #define X509V3_R_BN_DEC2BN_ERROR 100
608 698 #define X509V3_R_BN_TO_ASN1_INTEGER_ERROR 101
  699 +#define X509V3_R_DIRNAME_ERROR 149
609 700 #define X509V3_R_DUPLICATE_ZONE_ID 133
610 701 #define X509V3_R_ERROR_CONVERTING_ZONE 131
611 702 #define X509V3_R_ERROR_CREATING_EXTENSION 144
... ... @@ -616,7 +707,9 @@ void ERR_load_X509V3_strings(void);
616 707 #define X509V3_R_EXTENSION_NOT_FOUND 102
617 708 #define X509V3_R_EXTENSION_SETTING_NOT_SUPPORTED 103
618 709 #define X509V3_R_EXTENSION_VALUE_ERROR 116
  710 +#define X509V3_R_ILLEGAL_EMPTY_EXTENSION 151
619 711 #define X509V3_R_ILLEGAL_HEX_DIGIT 113
  712 +#define X509V3_R_INCORRECT_POLICY_SYNTAX_TAG 152
620 713 #define X509V3_R_INVALID_BOOLEAN_STRING 104
621 714 #define X509V3_R_INVALID_EXTENSION_STRING 105
622 715 #define X509V3_R_INVALID_NAME 106
... ... @@ -628,6 +721,7 @@ void ERR_load_X509V3_strings(void);
628 721 #define X509V3_R_INVALID_OBJECT_IDENTIFIER 110
629 722 #define X509V3_R_INVALID_OPTION 138
630 723 #define X509V3_R_INVALID_POLICY_IDENTIFIER 134
  724 +#define X509V3_R_INVALID_PROXY_POLICY_SETTING 153
631 725 #define X509V3_R_INVALID_PURPOSE 146
632 726 #define X509V3_R_INVALID_SECTION 135
633 727 #define X509V3_R_INVALID_SYNTAX 143
... ... @@ -638,9 +732,18 @@ void ERR_load_X509V3_strings(void);
638 732 #define X509V3_R_NO_ISSUER_CERTIFICATE 121
639 733 #define X509V3_R_NO_ISSUER_DETAILS 127
640 734 #define X509V3_R_NO_POLICY_IDENTIFIER 139
  735 +#define X509V3_R_NO_PROXY_CERT_POLICY_LANGUAGE_DEFINED 154
641 736 #define X509V3_R_NO_PUBLIC_KEY 114
642 737 #define X509V3_R_NO_SUBJECT_DETAILS 125
643 738 #define X509V3_R_ODD_NUMBER_OF_DIGITS 112
  739 +#define X509V3_R_OPERATION_NOT_DEFINED 148
  740 +#define X509V3_R_OTHERNAME_ERROR 147
  741 +#define X509V3_R_POLICY_LANGUAGE_ALREADTY_DEFINED 155
  742 +#define X509V3_R_POLICY_PATH_LENGTH 156
  743 +#define X509V3_R_POLICY_PATH_LENGTH_ALREADTY_DEFINED 157
  744 +#define X509V3_R_POLICY_SYNTAX_NOT_CURRENTLY_SUPPORTED 158
  745 +#define X509V3_R_POLICY_WHEN_PROXY_LANGUAGE_REQUIRES_NO_POLICY 159
  746 +#define X509V3_R_SECTION_NOT_FOUND 150
644 747 #define X509V3_R_UNABLE_TO_GET_ISSUER_DETAILS 122
645 748 #define X509V3_R_UNABLE_TO_GET_ISSUER_KEYID 123
646 749 #define X509V3_R_UNKNOWN_BIT_STRING_ARGUMENT 111
... ...