diff options
author | Richard Levitte <levitte@openssl.org> | 2000-06-19 14:44:57 +0000 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2000-06-19 14:44:57 +0000 |
commit | 7ed20a21587bf02890c4db6b8b5482b823bb9aa6 (patch) | |
tree | 618d3f040dc81dd18e8088955fd40b126801eaa6 | |
parent | 6c621506745b80e6485d5d12416662f0615810ae (diff) | |
download | openssl-7ed20a21587bf02890c4db6b8b5482b823bb9aa6.tar.gz |
Merge of stuff from main trunk, all conflicts resolved.
48 files changed, 1593 insertions, 1558 deletions
@@ -4,6 +4,31 @@ Changes between 0.9.5a and 0.9.6 [xx XXX 2000] + *) Reorganisation of the stack code. The macros are now all + collected in safestack.h . Each macro is defined in terms of + a "stack macro" of the form SKM_<name>(type, a, b). The + DEBUG_SAFESTACK is now handled in terms of function casts, + this has the advantage of retaining type safety without the + use of additional functions. If DEBUG_SAFESTACK is not defined + then the non typesafe macros are used instead. Also modified the + mkstack.pl script to handle the new form. Needs testing to see + if which (if any) compilers it chokes and maybe make DEBUG_SAFESTACK + the default if no major problems. Also need analagous stuff for + ASN1_SET_OF etc. + [Steve Henson] + + *) When some versions of IIS use the 'NET' form of private key the + key derivation algorithm is different. Normally MD5(password) is + used as a 128 bit RC4 key. In the modified case + MD5(MD5(password) + "SGCKEYSALT") is used insted. Added some + new functions i2d_RSA_NET(), d2i_RSA_NET() etc which are the same + as the old Netscape_RSA functions except they have an additional + 'sgckey' parameter which uses the modified algorithm. Also added + an -sgckey command line option to the rsa utility. Thanks to + Adrian Peck <bertie@ncipher.com> for posting details of the modified + algorithm to openssl-dev. + [Steve Henson] + *) The evp_local.h macros were using 'c.##kname' which resulted in invalid expansion on some systems (SCO 5.0.5 for example). Corrected to 'c.kname'. diff --git a/Makefile.org b/Makefile.org index c1a59c4bd8..72b7693e16 100644 --- a/Makefile.org +++ b/Makefile.org @@ -300,7 +300,7 @@ errors: perl util/mkerr.pl -recurse -write stacks: - perl util/mkstack.pl -recurse + perl util/mkstack.pl -write util/libeay.num:: perl util/mkdef.pl crypto update @@ -1,6 +1,6 @@ OpenSSL STATUS Last modified at - ______________ $Date: 2000/05/30 07:16:55 $ + ______________ $Date: 2000/06/19 14:44:56 $ DEVELOPMENT STATE @@ -27,6 +27,12 @@ Private key, certificate and CRL API and implementation. Developing and bugfixing PKCS#7 (S/MIME code). Various X509 issues: character sets, certificate request extensions. + o Geoff and Richard are currently working on: + ENGINE (the new code that gives hardware support among others). + o Richard is currently working on: + UTIL (a new set of library functions to support some higher level + functionality that is currently missing). + Dynamic thread-lock support. NEEDS PATCH diff --git a/VMS/vms_idhacks.h b/VMS/vms_idhacks.h index c2010c91e4..9b31453f5a 100644 --- a/VMS/vms_idhacks.h +++ b/VMS/vms_idhacks.h @@ -59,110 +59,6 @@ /* Hack a long name in crypto/asn1/a_mbstr.c */ #define ASN1_STRING_set_default_mask_asc ASN1_STRING_set_def_mask_asc -/* Hack the names created with DECLARE_STACK_OF(PKCS7_SIGNER_INFO) */ -#define sk_PKCS7_SIGNER_INFO_new sk_PKCS7_SIGINF_new -#define sk_PKCS7_SIGNER_INFO_new_null sk_PKCS7_SIGINF_new_null -#define sk_PKCS7_SIGNER_INFO_free sk_PKCS7_SIGINF_free -#define sk_PKCS7_SIGNER_INFO_num sk_PKCS7_SIGINF_num -#define sk_PKCS7_SIGNER_INFO_value sk_PKCS7_SIGINF_value -#define sk_PKCS7_SIGNER_INFO_set sk_PKCS7_SIGINF_set -#define sk_PKCS7_SIGNER_INFO_zero sk_PKCS7_SIGINF_zero -#define sk_PKCS7_SIGNER_INFO_push sk_PKCS7_SIGINF_push -#define sk_PKCS7_SIGNER_INFO_unshift sk_PKCS7_SIGINF_unshift -#define sk_PKCS7_SIGNER_INFO_find sk_PKCS7_SIGINF_find -#define sk_PKCS7_SIGNER_INFO_delete sk_PKCS7_SIGINF_delete -#define sk_PKCS7_SIGNER_INFO_delete_ptr sk_PKCS7_SIGINF_delete_ptr -#define sk_PKCS7_SIGNER_INFO_insert sk_PKCS7_SIGINF_insert -#define sk_PKCS7_SIGNER_INFO_set_cmp_func sk_PKCS7_SIGINF_set_cmp_func -#define sk_PKCS7_SIGNER_INFO_dup sk_PKCS7_SIGINF_dup -#define sk_PKCS7_SIGNER_INFO_pop_free sk_PKCS7_SIGINF_pop_free -#define sk_PKCS7_SIGNER_INFO_shift sk_PKCS7_SIGINF_shift -#define sk_PKCS7_SIGNER_INFO_pop sk_PKCS7_SIGINF_pop -#define sk_PKCS7_SIGNER_INFO_sort sk_PKCS7_SIGINF_sort - -/* Hack the names created with DECLARE_STACK_OF(PKCS7_RECIP_INFO) */ -#define sk_PKCS7_RECIP_INFO_new sk_PKCS7_RECINF_new -#define sk_PKCS7_RECIP_INFO_new_null sk_PKCS7_RECINF_new_null -#define sk_PKCS7_RECIP_INFO_free sk_PKCS7_RECINF_free -#define sk_PKCS7_RECIP_INFO_num sk_PKCS7_RECINF_num -#define sk_PKCS7_RECIP_INFO_value sk_PKCS7_RECINF_value -#define sk_PKCS7_RECIP_INFO_set sk_PKCS7_RECINF_set -#define sk_PKCS7_RECIP_INFO_zero sk_PKCS7_RECINF_zero -#define sk_PKCS7_RECIP_INFO_push sk_PKCS7_RECINF_push -#define sk_PKCS7_RECIP_INFO_unshift sk_PKCS7_RECINF_unshift -#define sk_PKCS7_RECIP_INFO_find sk_PKCS7_RECINF_find -#define sk_PKCS7_RECIP_INFO_delete sk_PKCS7_RECINF_delete -#define sk_PKCS7_RECIP_INFO_delete_ptr sk_PKCS7_RECINF_delete_ptr -#define sk_PKCS7_RECIP_INFO_insert sk_PKCS7_RECINF_insert -#define sk_PKCS7_RECIP_INFO_set_cmp_func sk_PKCS7_RECINF_set_cmp_func -#define sk_PKCS7_RECIP_INFO_dup sk_PKCS7_RECINF_dup -#define sk_PKCS7_RECIP_INFO_pop_free sk_PKCS7_RECINF_pop_free -#define sk_PKCS7_RECIP_INFO_shift sk_PKCS7_RECINF_shift -#define sk_PKCS7_RECIP_INFO_pop sk_PKCS7_RECINF_pop -#define sk_PKCS7_RECIP_INFO_sort sk_PKCS7_RECINF_sort - -/* Hack the names created with DECLARE_STACK_OF(ASN1_STRING_TABLE) */ -#define sk_ASN1_STRING_TABLE_new sk_ASN1_STRTAB_new -#define sk_ASN1_STRING_TABLE_new_null sk_ASN1_STRTAB_new_null -#define sk_ASN1_STRING_TABLE_free sk_ASN1_STRTAB_free -#define sk_ASN1_STRING_TABLE_num sk_ASN1_STRTAB_num -#define sk_ASN1_STRING_TABLE_value sk_ASN1_STRTAB_value -#define sk_ASN1_STRING_TABLE_set sk_ASN1_STRTAB_set -#define sk_ASN1_STRING_TABLE_zero sk_ASN1_STRTAB_zero -#define sk_ASN1_STRING_TABLE_push sk_ASN1_STRTAB_push -#define sk_ASN1_STRING_TABLE_unshift sk_ASN1_STRTAB_unshift -#define sk_ASN1_STRING_TABLE_find sk_ASN1_STRTAB_find -#define sk_ASN1_STRING_TABLE_delete sk_ASN1_STRTAB_delete -#define sk_ASN1_STRING_TABLE_delete_ptr sk_ASN1_STRTAB_delete_ptr -#define sk_ASN1_STRING_TABLE_insert sk_ASN1_STRTAB_insert -#define sk_ASN1_STRING_TABLE_set_cmp_func sk_ASN1_STRTAB_set_cmp_func -#define sk_ASN1_STRING_TABLE_dup sk_ASN1_STRTAB_dup -#define sk_ASN1_STRING_TABLE_pop_free sk_ASN1_STRTAB_pop_free -#define sk_ASN1_STRING_TABLE_shift sk_ASN1_STRTAB_shift -#define sk_ASN1_STRING_TABLE_pop sk_ASN1_STRTAB_pop -#define sk_ASN1_STRING_TABLE_sort sk_ASN1_STRTAB_sort - -/* Hack the names created with DECLARE_STACK_OF(ACCESS_DESCRIPTION) */ -#define sk_ACCESS_DESCRIPTION_new sk_ACC_DESC_new -#define sk_ACCESS_DESCRIPTION_new_null sk_ACC_DESC_new_null -#define sk_ACCESS_DESCRIPTION_free sk_ACC_DESC_free -#define sk_ACCESS_DESCRIPTION_num sk_ACC_DESC_num -#define sk_ACCESS_DESCRIPTION_value sk_ACC_DESC_value -#define sk_ACCESS_DESCRIPTION_set sk_ACC_DESC_set -#define sk_ACCESS_DESCRIPTION_zero sk_ACC_DESC_zero -#define sk_ACCESS_DESCRIPTION_push sk_ACC_DESC_push -#define sk_ACCESS_DESCRIPTION_unshift sk_ACC_DESC_unshift -#define sk_ACCESS_DESCRIPTION_find sk_ACC_DESC_find -#define sk_ACCESS_DESCRIPTION_delete sk_ACC_DESC_delete -#define sk_ACCESS_DESCRIPTION_delete_ptr sk_ACC_DESC_delete_ptr -#define sk_ACCESS_DESCRIPTION_insert sk_ACC_DESC_insert -#define sk_ACCESS_DESCRIPTION_set_cmp_func sk_ACC_DESC_set_cmp_func -#define sk_ACCESS_DESCRIPTION_dup sk_ACC_DESC_dup -#define sk_ACCESS_DESCRIPTION_pop_free sk_ACC_DESC_pop_free -#define sk_ACCESS_DESCRIPTION_shift sk_ACC_DESC_shift -#define sk_ACCESS_DESCRIPTION_pop sk_ACC_DESC_pop -#define sk_ACCESS_DESCRIPTION_sort sk_ACC_DESC_sort - -/* Hack the names created with DECLARE_STACK_OF(CRYPTO_EX_DATA_FUNCS) */ -#define sk_CRYPTO_EX_DATA_FUNCS_new sk_CRYPT_EX_DATFNS_new -#define sk_CRYPTO_EX_DATA_FUNCS_new_null sk_CRYPT_EX_DATFNS_new_null -#define sk_CRYPTO_EX_DATA_FUNCS_free sk_CRYPT_EX_DATFNS_free -#define sk_CRYPTO_EX_DATA_FUNCS_num sk_CRYPT_EX_DATFNS_num -#define sk_CRYPTO_EX_DATA_FUNCS_value sk_CRYPT_EX_DATFNS_value -#define sk_CRYPTO_EX_DATA_FUNCS_set sk_CRYPT_EX_DATFNS_set -#define sk_CRYPTO_EX_DATA_FUNCS_zero sk_CRYPT_EX_DATFNS_zero -#define sk_CRYPTO_EX_DATA_FUNCS_push sk_CRYPT_EX_DATFNS_push -#define sk_CRYPTO_EX_DATA_FUNCS_unshift sk_CRYPT_EX_DATFNS_unshift -#define sk_CRYPTO_EX_DATA_FUNCS_find sk_CRYPT_EX_DATFNS_find -#define sk_CRYPTO_EX_DATA_FUNCS_delete sk_CRYPT_EX_DATFNS_delete -#define sk_CRYPTO_EX_DATA_FUNCS_delete_ptr sk_CRYPT_EX_DATFNS_delete_ptr -#define sk_CRYPTO_EX_DATA_FUNCS_insert sk_CRYPT_EX_DATFNS_insert -#define sk_CRYPTO_EX_DATA_FUNCS_set_cmp_func sk_CRYPT_EX_DATFNS_set_cmp_func -#define sk_CRYPTO_EX_DATA_FUNCS_dup sk_CRYPT_EX_DATFNS_dup -#define sk_CRYPTO_EX_DATA_FUNCS_pop_free sk_CRYPT_EX_DATFNS_pop_free -#define sk_CRYPTO_EX_DATA_FUNCS_shift sk_CRYPT_EX_DATFNS_shift -#define sk_CRYPTO_EX_DATA_FUNCS_pop sk_CRYPT_EX_DATFNS_pop -#define sk_CRYPTO_EX_DATA_FUNCS_sort sk_CRYPT_EX_DATFNS_sort /* Hack the names created with DECLARE_ASN1_SET_OF(PKCS7_SIGNER_INFO) */ #define i2d_ASN1_SET_OF_PKCS7_SIGNER_INFO i2d_ASN1_SET_OF_PKCS7_SIGINF diff --git a/apps/rsa.c b/apps/rsa.c index 1269f65703..fc8fa54941 100644 --- a/apps/rsa.c +++ b/apps/rsa.c @@ -92,7 +92,7 @@ int MAIN(int argc, char **argv) { int ret=1; RSA *rsa=NULL; - int i,badops=0; + int i,badops=0, sgckey=0; const EVP_CIPHER *enc=NULL; BIO *in=NULL,*out=NULL; int informat,outformat,text=0,check=0,noout=0; @@ -148,6 +148,8 @@ int MAIN(int argc, char **argv) if (--argc < 1) goto bad; passargout= *(++argv); } + else if (strcmp(*argv,"-sgckey") == 0) + sgckey=1; else if (strcmp(*argv,"-pubin") == 0) pubin=1; else if (strcmp(*argv,"-pubout") == 0) @@ -178,6 +180,7 @@ bad: BIO_printf(bio_err," -inform arg input format - one of DER NET PEM\n"); BIO_printf(bio_err," -outform arg output format - one of DER NET PEM\n"); BIO_printf(bio_err," -in arg input file\n"); + BIO_printf(bio_err," -sgckey Use IIS SGC key format\n"); BIO_printf(bio_err," -passin arg input file pass phrase source\n"); BIO_printf(bio_err," -out arg output file\n"); BIO_printf(bio_err," -passout arg output file pass phrase source\n"); @@ -254,7 +257,7 @@ bad: } } p=(unsigned char *)buf->data; - rsa=d2i_Netscape_RSA(NULL,&p,(long)size,NULL); + rsa=d2i_RSA_NET(NULL,&p,(long)size,NULL, sgckey); BUF_MEM_free(buf); } #endif @@ -344,14 +347,14 @@ bad: int size; i=1; - size=i2d_Netscape_RSA(rsa,NULL,NULL); + size=i2d_RSA_NET(rsa,NULL,NULL, sgckey); if ((p=(unsigned char *)OPENSSL_malloc(size)) == NULL) { BIO_printf(bio_err,"Memory allocation failure\n"); goto end; } pp=p; - i2d_Netscape_RSA(rsa,&p,NULL); + i2d_RSA_NET(rsa,&p,NULL, sgckey); BIO_write(out,(char *)pp,size); OPENSSL_free(pp); } diff --git a/crypto/asn1/asn1.h b/crypto/asn1/asn1.h index 791636cbcb..b604712865 100644 --- a/crypto/asn1/asn1.h +++ b/crypto/asn1/asn1.h @@ -248,37 +248,6 @@ typedef struct asn1_string_table_st { } ASN1_STRING_TABLE; DECLARE_STACK_OF(ASN1_STRING_TABLE) -/* This block of defines is updated by a perl script, please do not touch! */ -#ifndef DEBUG_SAFESTACK - #define sk_ASN1_STRING_TABLE_new(a) sk_new((int (*) \ - (const char * const *, const char * const *))(a)) - #define sk_ASN1_STRING_TABLE_new_null() sk_new_null() - #define sk_ASN1_STRING_TABLE_free(a) sk_free(a) - #define sk_ASN1_STRING_TABLE_num(a) sk_num(a) - #define sk_ASN1_STRING_TABLE_value(a,b) ((ASN1_STRING_TABLE *) \ - sk_value((a),(b))) - #define sk_ASN1_STRING_TABLE_set(a,b,c) ((ASN1_STRING_TABLE *) \ - sk_set((a),(b),(char *)(c))) - #define sk_ASN1_STRING_TABLE_zero(a) sk_zero(a) - #define sk_ASN1_STRING_TABLE_push(a,b) sk_push((a),(char *)(b)) - #define sk_ASN1_STRING_TABLE_unshift(a,b) sk_unshift((a),(b)) - #define sk_ASN1_STRING_TABLE_find(a,b) sk_find((a), (char *)(b)) - #define sk_ASN1_STRING_TABLE_delete(a,b) ((ASN1_STRING_TABLE *) \ - sk_delete((a),(b))) - #define sk_ASN1_STRING_TABLE_delete_ptr(a,b) ((ASN1_STRING_TABLE *) \ - sk_delete_ptr((a),(char *)(b))) - #define sk_ASN1_STRING_TABLE_insert(a,b,c) sk_insert((a),(char *)(b),(c)) - #define sk_ASN1_STRING_TABLE_set_cmp_func(a,b) ((int (*) \ - (const ASN1_STRING_TABLE * const *,const ASN1_STRING_TABLE * const *)) \ - sk_set_cmp_func((a),(int (*) \ - (const char * const *, const char * const *))(b))) - #define sk_ASN1_STRING_TABLE_dup(a) sk_dup(a) - #define sk_ASN1_STRING_TABLE_pop_free(a,b) sk_pop_free((a),(void (*)(void *))(b)) - #define sk_ASN1_STRING_TABLE_shift(a) ((ASN1_STRING_TABLE *)sk_shift(a)) - #define sk_ASN1_STRING_TABLE_pop(a) ((ASN1_STRING_TABLE *)sk_pop(a)) - #define sk_ASN1_STRING_TABLE_sort(a) sk_sort(a) -#endif /* !DEBUG_SAFESTACK */ -/* End of perl script block, you may now edit :-) */ /* size limits: this stuff is taken straight from RFC2459 */ @@ -328,37 +297,6 @@ typedef struct asn1_string_st ASN1_UTF8STRING; typedef int ASN1_NULL; DECLARE_STACK_OF(ASN1_INTEGER) -/* This block of defines is updated by a perl script, please do not touch! */ -#ifndef DEBUG_SAFESTACK - #define sk_ASN1_INTEGER_new(a) sk_new((int (*) \ - (const char * const *, const char * const *))(a)) - #define sk_ASN1_INTEGER_new_null() sk_new_null() - #define sk_ASN1_INTEGER_free(a) sk_free(a) - #define sk_ASN1_INTEGER_num(a) sk_num(a) - #define sk_ASN1_INTEGER_value(a,b) ((ASN1_INTEGER *) \ - sk_value((a),(b))) - #define sk_ASN1_INTEGER_set(a,b,c) ((ASN1_INTEGER *) \ - sk_set((a),(b),(char *)(c))) - #define sk_ASN1_INTEGER_zero(a) sk_zero(a) - #define sk_ASN1_INTEGER_push(a,b) sk_push((a),(char *)(b)) - #define sk_ASN1_INTEGER_unshift(a,b) sk_unshift((a),(b)) - #define sk_ASN1_INTEGER_find(a,b) sk_find((a), (char *)(b)) - #define sk_ASN1_INTEGER_delete(a,b) ((ASN1_INTEGER *) \ - sk_delete((a),(b))) - #define sk_ASN1_INTEGER_delete_ptr(a,b) ((ASN1_INTEGER *) \ - sk_delete_ptr((a),(char *)(b))) - #define sk_ASN1_INTEGER_insert(a,b,c) sk_insert((a),(char *)(b),(c)) - #define sk_ASN1_INTEGER_set_cmp_func(a,b) ((int (*) \ - (const ASN1_INTEGER * const *,const ASN1_INTEGER * const *)) \ - sk_set_cmp_func((a),(int (*) \ - (const char * const *, const char * const *))(b))) - #define sk_ASN1_INTEGER_dup(a) sk_dup(a) - #define sk_ASN1_INTEGER_pop_free(a,b) sk_pop_free((a),(void (*)(void *))(b)) - #define sk_ASN1_INTEGER_shift(a) ((ASN1_INTEGER *)sk_shift(a)) - #define sk_ASN1_INTEGER_pop(a) ((ASN1_INTEGER *)sk_pop(a)) - #define sk_ASN1_INTEGER_sort(a) sk_sort(a) -#endif /* !DEBUG_SAFESTACK */ -/* End of perl script block, you may now edit :-) */ DECLARE_ASN1_SET_OF(ASN1_INTEGER) typedef struct asn1_type_st @@ -390,37 +328,6 @@ typedef struct asn1_type_st } ASN1_TYPE; DECLARE_STACK_OF(ASN1_TYPE) -/* This block of defines is updated by a perl script, please do not touch! */ -#ifndef DEBUG_SAFESTACK - #define sk_ASN1_TYPE_new(a) sk_new((int (*) \ - (const char * const *, const char * const *))(a)) - #define sk_ASN1_TYPE_new_null() sk_new_null() - #define sk_ASN1_TYPE_free(a) sk_free(a) - #define sk_ASN1_TYPE_num(a) sk_num(a) - #define sk_ASN1_TYPE_value(a,b) ((ASN1_TYPE *) \ - sk_value((a),(b))) - #define sk_ASN1_TYPE_set(a,b,c) ((ASN1_TYPE *) \ - sk_set((a),(b),(char *)(c))) - #define sk_ASN1_TYPE_zero(a) sk_zero(a) - #define sk_ASN1_TYPE_push(a,b) sk_push((a),(char *)(b)) - #define sk_ASN1_TYPE_unshift(a,b) sk_unshift((a),(b)) - #define sk_ASN1_TYPE_find(a,b) sk_find((a), (char *)(b)) - #define sk_ASN1_TYPE_delete(a,b) ((ASN1_TYPE *) \ - sk_delete((a),(b))) - #define sk_ASN1_TYPE_delete_ptr(a,b) ((ASN1_TYPE *) \ - sk_delete_ptr((a),(char *)(b))) - #define sk_ASN1_TYPE_insert(a,b,c) sk_insert((a),(char *)(b),(c)) - #define sk_ASN1_TYPE_set_cmp_func(a,b) ((int (*) \ - (const ASN1_TYPE * const *,const ASN1_TYPE * const *)) \ - sk_set_cmp_func((a),(int (*) \ - (const char * const *, const char * const *))(b))) - #define sk_ASN1_TYPE_dup(a) sk_dup(a) - #define sk_ASN1_TYPE_pop_free(a,b) sk_pop_free((a),(void (*)(void *))(b)) - #define sk_ASN1_TYPE_shift(a) ((ASN1_TYPE *)sk_shift(a)) - #define sk_ASN1_TYPE_pop(a) ((ASN1_TYPE *)sk_pop(a)) - #define sk_ASN1_TYPE_sort(a) sk_sort(a) -#endif /* !DEBUG_SAFESTACK */ -/* End of perl script block, you may now edit :-) */ DECLARE_ASN1_SET_OF(ASN1_TYPE) typedef struct asn1_method_st @@ -642,37 +549,6 @@ ASN1_OBJECT * d2i_ASN1_OBJECT(ASN1_OBJECT **a,unsigned char **pp, long length); DECLARE_STACK_OF(ASN1_OBJECT) -/* This block of defines is updated by a perl script, please do not touch! */ -#ifndef DEBUG_SAFESTACK - #define sk_ASN1_OBJECT_new(a) sk_new((int (*) \ - (const char * const *, const char * const *))(a)) - #define sk_ASN1_OBJECT_new_null() sk_new_null() - #define sk_ASN1_OBJECT_free(a) sk_free(a) - #define sk_ASN1_OBJECT_num(a) sk_num(a) - #define sk_ASN1_OBJECT_value(a,b) ((ASN1_OBJECT *) \ - sk_value((a),(b))) - #define sk_ASN1_OBJECT_set(a,b,c) ((ASN1_OBJECT *) \ - sk_set((a),(b),(char *)(c))) - #define sk_ASN1_OBJECT_zero(a) sk_zero(a) - #define sk_ASN1_OBJECT_push(a,b) sk_push((a),(char *)(b)) - #define sk_ASN1_OBJECT_unshift(a,b) sk_unshift((a),(b)) - #define sk_ASN1_OBJECT_find(a,b) sk_find((a), (char *)(b)) - #define sk_ASN1_OBJECT_delete(a,b) ((ASN1_OBJECT *) \ - sk_delete((a),(b))) - #define sk_ASN1_OBJECT_delete_ptr(a,b) ((ASN1_OBJECT *) \ - sk_delete_ptr((a),(char *)(b))) - #define sk_ASN1_OBJECT_insert(a,b,c) sk_insert((a),(char *)(b),(c)) - #define sk_ASN1_OBJECT_set_cmp_func(a,b) ((int (*) \ - (const ASN1_OBJECT * const *,const ASN1_OBJECT * const *)) \ - sk_set_cmp_func((a),(int (*) \ - (const char * const *, const char * const *))(b))) - #define sk_ASN1_OBJECT_dup(a) sk_dup(a) - #define sk_ASN1_OBJECT_pop_free(a,b) sk_pop_free((a),(void (*)(void *))(b)) - #define sk_ASN1_OBJECT_shift(a) ((ASN1_OBJECT *)sk_shift(a)) - #define sk_ASN1_OBJECT_pop(a) ((ASN1_OBJECT *)sk_pop(a)) - #define sk_ASN1_OBJECT_sort(a) sk_sort(a) -#endif /* !DEBUG_SAFESTACK */ -/* End of perl script block, you may now edit :-) */ DECLARE_ASN1_SET_OF(ASN1_OBJECT) ASN1_STRING * ASN1_STRING_new(void); diff --git a/crypto/asn1/d2i_s_pr.c b/crypto/asn1/d2i_s_pr.c index dec2a2ebd3..55d5802d70 100644 --- a/crypto/asn1/d2i_s_pr.c +++ b/crypto/asn1/d2i_s_pr.c @@ -92,6 +92,7 @@ DSA *d2i_DSAPrivateKey(DSA **a, unsigned char **pp, long length) == NULL) goto err_bn; M_ASN1_INTEGER_free(bs); + bs = NULL; M_ASN1_D2I_Finish_2(a); err_bn: diff --git a/crypto/asn1/n_pkey.c b/crypto/asn1/n_pkey.c index 63f408885f..9840193538 100644 --- a/crypto/asn1/n_pkey.c +++ b/crypto/asn1/n_pkey.c @@ -81,6 +81,11 @@ static NETSCAPE_PKEY *NETSCAPE_PKEY_new(void); static void NETSCAPE_PKEY_free(NETSCAPE_PKEY *); int i2d_Netscape_RSA(RSA *a, unsigned char **pp, int (*cb)()) +{ + return i2d_RSA_NET(a, pp, cb, 0); +} + +int i2d_RSA_NET(RSA *a, unsigned char **pp, int (*cb)(), int sgckey) { int i,j,l[6]; NETSCAPE_PKEY *pkey; @@ -164,8 +169,18 @@ int i2d_Netscape_RSA(RSA *a, unsigned char **pp, int (*cb)()) ASN1err(ASN1_F_I2D_NETSCAPE_RSA,ASN1_R_BAD_PASSWORD_READ); goto err; } - EVP_BytesToKey(EVP_rc4(),EVP_md5(),NULL,buf, - strlen((char *)buf),1,key,NULL); + i = strlen((char *)buf); + /* If the key is used for SGC the algorithm is modified a little. */ + if(sgckey){ + EVP_MD_CTX mctx; + EVP_DigestInit(&mctx, EVP_md5()); + EVP_DigestUpdate(&mctx, buf, i); + EVP_DigestFinal(&mctx, buf, NULL); + memcpy(buf + 16, "SGCKEYSALT", 10); + i = 26; + } + + EVP_BytesToKey(EVP_rc4(),EVP_md5(),NULL,buf,i,1,key,NULL); memset(buf,0,256); EVP_CIPHER_CTX_init(&ctx); @@ -189,7 +204,13 @@ err: return(ret); } + RSA *d2i_Netscape_RSA(RSA **a, unsigned char **pp, long length, int (*cb)()) +{ + return d2i_RSA_NET(a, pp, length, cb, 0); +} + +RSA *d2i_RSA_NET(RSA **a, unsigned char **pp, long length, int (*cb)(), int sgckey) { RSA *ret=NULL; ASN1_OCTET_STRING *os=NULL; @@ -210,7 +231,7 @@ RSA *d2i_Netscape_RSA(RSA **a, unsigned char **pp, long length, int (*cb)()) } M_ASN1_BIT_STRING_free(os); c.q=c.p; - if ((ret=d2i_Netscape_RSA_2(a,&c.p,c.slen,cb)) == NULL) goto err; + if ((ret=d2i_RSA_NET_2(a,&c.p,c.slen,cb, sgckey)) == NULL) goto err; /* Note: some versions of IIS key files use length values that are * too small for the surrounding SEQUENCEs. This following line * effectively disable length checking. @@ -222,6 +243,12 @@ RSA *d2i_Netscape_RSA(RSA **a, unsigned char **pp, long length, int (*cb)()) RSA *d2i_Netscape_RSA_2(RSA **a, unsigned char **pp, long length, int (*cb)()) +{ + return d2i_RSA_NET_2(a, pp, length, cb, 0); +} + +RSA *d2i_RSA_NET_2(RSA **a, unsigned char **pp, long length, + int (*cb)(), int sgckey) { NETSCAPE_PKEY *pkey=NULL; RSA *ret=NULL; @@ -254,8 +281,17 @@ RSA *d2i_Netscape_RSA_2(RSA **a, unsigned char **pp, long length, goto err; } - EVP_BytesToKey(EVP_rc4(),EVP_md5(),NULL,buf, - strlen((char *)buf),1,key,NULL); + i = strlen((char *)buf); + if(sgckey){ + EVP_MD_CTX mctx; + EVP_DigestInit(&mctx, EVP_md5()); + EVP_DigestUpdate(&mctx, buf, i); + EVP_DigestFinal(&mctx, buf, NULL); + memcpy(buf + 16, "SGCKEYSALT", 10); + i = 26; + } + + EVP_BytesToKey(EVP_rc4(),EVP_md5(),NULL,buf,i,1,key,NULL); memset(buf,0,256); EVP_CIPHER_CTX_init(&ctx); diff --git a/crypto/bio/bio.h b/crypto/bio/bio.h index fa4e0e2225..68107d9798 100644 --- a/crypto/bio/bio.h +++ b/crypto/bio/bio.h @@ -264,37 +264,6 @@ struct bio_st }; DECLARE_STACK_OF(BIO) -/* This block of defines is updated by a perl script, please do not touch! */ -#ifndef DEBUG_SAFESTACK - #define sk_BIO_new(a) sk_new((int (*) \ - (const char * const *, const char * const *))(a)) - #define sk_BIO_new_null() sk_new_null() - #define sk_BIO_free(a) sk_free(a) - #define sk_BIO_num(a) sk_num(a) - #define sk_BIO_value(a,b) ((BIO *) \ - sk_value((a),(b))) - #define sk_BIO_set(a,b,c) ((BIO *) \ - sk_set((a),(b),(char *)(c))) - #define sk_BIO_zero(a) sk_zero(a) - #define sk_BIO_push(a,b) sk_push((a),(char *)(b)) - #define sk_BIO_unshift(a,b) sk_unshift((a),(b)) - #define sk_BIO_find(a,b) sk_find((a), (char *)(b)) - #define sk_BIO_delete(a,b) ((BIO *) \ - sk_delete((a),(b))) - #define sk_BIO_delete_ptr(a,b) ((BIO *) \ - sk_delete_ptr((a),(char *)(b))) - #define sk_BIO_insert(a,b,c) sk_insert((a),(char *)(b),(c)) - #define sk_BIO_set_cmp_func(a,b) ((int (*) \ - (const BIO * const *,const BIO * const *)) \ - sk_set_cmp_func((a),(int (*) \ - (const char * const *, const char * const *))(b))) - #define sk_BIO_dup(a) sk_dup(a) - #define sk_BIO_pop_free(a,b) sk_pop_free((a),(void (*)(void *))(b)) - #define sk_BIO_shift(a) ((BIO *)sk_shift(a)) - #define sk_BIO_pop(a) ((BIO *)sk_pop(a)) - #define sk_BIO_sort(a) sk_sort(a) -#endif /* !DEBUG_SAFESTACK */ -/* End of perl script block, you may now edit :-) */ typedef struct bio_f_buffer_ctx_struct { diff --git a/crypto/bio/bss_log.c b/crypto/bio/bss_log.c index be2ad38383..d5f905b62b 100644 --- a/crypto/bio/bss_log.c +++ b/crypto/bio/bss_log.c @@ -118,6 +118,18 @@ static int MS_CALLBACK slg_free(BIO *data); static void xopenlog(BIO* bp, const char* name, int level); static void xsyslog(BIO* bp, int priority, const char* string); static void xcloselog(BIO* bp); +#ifdef WIN32 +LONG (WINAPI *go_for_advapi)() = RegOpenKeyEx; +HANDLE (WINAPI *register_event_source)() = NULL; +BOOL (WINAPI *deregister_event_source)() = NULL; +BOOL (WINAPI *report_event)() = NULL; +#define DL_PROC(m,f) (GetProcAddress( m, f )) +#ifdef UNICODE +#define DL_PROC_X(m,f) DL_PROC( m, f "W" ) +#else +#define DL_PROC_X(m,f) DL_PROC( m, f "A" ) +#endif +#endif static BIO_METHOD methods_slg= { @@ -213,7 +225,27 @@ static int MS_CALLBACK slg_puts(BIO *bp, const char *str) static void xopenlog(BIO* bp, const char* name, int level) { - bp->ptr= (char *)RegisterEventSource(NULL, name); + if ( !register_event_source ) + { + HANDLE advapi; + if ( !(advapi = GetModuleHandle("advapi32")) ) + return; + register_event_source = (HANDLE (WINAPI *)())DL_PROC_X(advapi, + "RegisterEventSource" ); + deregister_event_source = (BOOL (WINAPI *)())DL_PROC(advapi, + "DeregisterEventSource"); + report_event = (BOOL (WINAPI *)())DL_PROC_X(advapi, + "ReportEvent" ); + if ( !(register_event_source && deregister_event_source && + report_event) ) + { + register_event_source = NULL; + deregister_event_source = NULL; + report_event = NULL; + return; + } + } + bp->ptr= (char *)register_event_source(NULL, name); } static void xsyslog(BIO *bp, int priority, const char *string) @@ -243,15 +275,15 @@ static void xsyslog(BIO *bp, int priority, const char *string) lpszStrings[0] = pidbuf; lpszStrings[1] = string; - if(bp->ptr) - ReportEvent(bp->ptr, evtype, 0, 1024, NULL, 2, 0, + if(report_event && bp->ptr) + report_event(bp->ptr, evtype, 0, 1024, NULL, 2, 0, lpszStrings, NULL); } static void xcloselog(BIO* bp) { - if(bp->ptr) - DeregisterEventSource((HANDLE)(bp->ptr)); + if(deregister_event_source && bp->ptr) + deregister_event_source((HANDLE)(bp->ptr)); bp->ptr= NULL; } diff --git a/crypto/bn/bn_shift.c b/crypto/bn/bn_shift.c index 61aae65a6b..0883247384 100644 --- a/crypto/bn/bn_shift.c +++ b/crypto/bn/bn_shift.c @@ -162,7 +162,7 @@ int BN_rshift(BIGNUM *r, BIGNUM *a, int n) nw=n/BN_BITS2; rb=n%BN_BITS2; lb=BN_BITS2-rb; - if (nw > a->top) + if (nw > a->top || a->top == 0) { BN_zero(r); return(1); diff --git a/crypto/conf/conf.h b/crypto/conf/conf.h index 0adda45dd3..2f70634455 100644 --- a/crypto/conf/conf.h +++ b/crypto/conf/conf.h @@ -77,37 +77,6 @@ typedef struct } CONF_VALUE; DECLARE_STACK_OF(CONF_VALUE) -/* This block of defines is updated by a perl script, please do not touch! */ -#ifndef DEBUG_SAFESTACK - #define sk_CONF_VALUE_new(a) sk_new((int (*) \ - (const char * const *, const char * const *))(a)) - #define sk_CONF_VALUE_new_null() sk_new_null() - #define sk_CONF_VALUE_free(a) sk_free(a) - #define sk_CONF_VALUE_num(a) sk_num(a) - #define sk_CONF_VALUE_value(a,b) ((CONF_VALUE *) \ - sk_value((a),(b))) - #define sk_CONF_VALUE_set(a,b,c) ((CONF_VALUE *) \ - sk_set((a),(b),(char *)(c))) - #define sk_CONF_VALUE_zero(a) sk_zero(a) - #define sk_CONF_VALUE_push(a,b) sk_push((a),(char *)(b)) - #define sk_CONF_VALUE_unshift(a,b) sk_unshift((a),(b)) - #define sk_CONF_VALUE_find(a,b) sk_find((a), (char *)(b)) - #define sk_CONF_VALUE_delete(a,b) ((CONF_VALUE *) \ - sk_delete((a),(b))) - #define sk_CONF_VALUE_delete_ptr(a,b) ((CONF_VALUE *) \ - sk_delete_ptr((a),(char *)(b))) - #define sk_CONF_VALUE_insert(a,b,c) sk_insert((a),(char *)(b),(c)) - #define sk_CONF_VALUE_set_cmp_func(a,b) ((int (*) \ - (const CONF_VALUE * const *,const CONF_VALUE * const *)) \ - sk_set_cmp_func((a),(int (*) \ - (const char * const *, const char * const *))(b))) - #define sk_CONF_VALUE_dup(a) sk_dup(a) - #define sk_CONF_VALUE_pop_free(a,b) sk_pop_free((a),(void (*)(void *))(b)) - #define sk_CONF_VALUE_shift(a) ((CONF_VALUE *)sk_shift(a)) - #define sk_CONF_VALUE_pop(a) ((CONF_VALUE *)sk_pop(a)) - #define sk_CONF_VALUE_sort(a) sk_sort(a) -#endif /* !DEBUG_SAFESTACK */ -/* End of perl script block, you may now edit :-) */ struct conf_st; typedef struct conf_st CONF; diff --git a/crypto/cpt_err.c b/crypto/cpt_err.c index dadd8d8d92..7018b74ca0 100644 --- a/crypto/cpt_err.c +++ b/crypto/cpt_err.c @@ -67,6 +67,7 @@ static ERR_STRING_DATA CRYPTO_str_functs[]= { {ERR_PACK(0,CRYPTO_F_CRYPTO_GET_EX_NEW_INDEX,0), "CRYPTO_get_ex_new_index"}, +{ERR_PACK(0,CRYPTO_F_CRYPTO_GET_NEW_DYNLOCKID,0), "CRYPTO_get_new_dynlockid"}, {ERR_PACK(0,CRYPTO_F_CRYPTO_GET_NEW_LOCKID,0), "CRYPTO_get_new_lockid"}, {ERR_PACK(0,CRYPTO_F_CRYPTO_SET_EX_DATA,0), "CRYPTO_set_ex_data"}, {0,NULL} @@ -74,6 +75,7 @@ static ERR_STRING_DATA CRYPTO_str_functs[]= static ERR_STRING_DATA CRYPTO_str_reasons[]= { +{CRYPTO_R_NO_DYNLOCK_CREATE_CALLBACK ,"no dynlock create callback"}, {0,NULL} }; diff --git a/crypto/cryptlib.c b/crypto/cryptlib.c index 9ff520a6e5..df90841d5a 100644 --- a/crypto/cryptlib.c +++ b/crypto/cryptlib.c @@ -60,11 +60,15 @@ #include <string.h> #include "cryptlib.h" #include <openssl/crypto.h> +#include <openssl/safestack.h> #if defined(WIN32) || defined(WIN16) static double SSLeay_MSVC5_hack=0.0; /* and for VC1.5 */ #endif +DECLARE_STACK_OF(CRYPTO_dynlock); +IMPLEMENT_STACK_OF(CRYPTO_dynlock); + /* real #defines in crypto.h, keep these upto date */ static const char* lock_names[CRYPTO_NUM_LOCKS] = { @@ -95,19 +99,35 @@ static const char* lock_names[CRYPTO_NUM_LOCKS] = "dh", "debug_malloc2", "dso", + "dynlock", "engine", -#if CRYPTO_NUM_LOCKS != 28 +#if CRYPTO_NUM_LOCKS != 29 # error "Inconsistency between crypto.h and cryptlib.c" #endif }; +/* This is for applications to allocate new type names in the non-dynamic + array of lock names. These are numbered with positive numbers. */ static STACK *app_locks=NULL; +/* For applications that want a more dynamic way of handling threads, the + following stack is used. These are externally numbered with negative + numbers. */ +static STACK_OF(CRYPTO_dynlock) *dyn_locks=NULL; + + static void (MS_FAR *locking_callback)(int mode,int type, const char *file,int line)=NULL; static int (MS_FAR *add_lock_callback)(int *pointer,int amount, int type,const char *file,int line)=NULL; static unsigned long (MS_FAR *id_callback)(void)=NULL; +static struct CRYPTO_dynlock_value *(MS_FAR *dynlock_create_callback) + (const char *file,int line)=NULL; +static void (MS_FAR *dynlock_locking_callback)(int mode, + struct CRYPTO_dynlock_value *l, const char *file,int line)=NULL; +static void (MS_FAR *dynlock_destroy_callback)(struct CRYPTO_dynlock_value *l, + const char *file,int line)=NULL; + int CRYPTO_get_new_lockid(char *name) { char *str; @@ -127,7 +147,10 @@ int CRYPTO_get_new_lockid(char *name) return(0); } if ((str=BUF_strdup(name)) == NULL) + { + CRYPTOerr(CRYPTO_F_CRYPTO_GET_NEW_LOCKID,ERR_R_MALLOC_FAILURE); return(0); + } i=sk_push(app_locks,str); if (!i) OPENSSL_free(str); @@ -141,12 +164,127 @@ int CRYPTO_num_locks(void) return CRYPTO_NUM_LOCKS; } +int CRYPTO_get_new_dynlockid(void) + { + int i = 0; + CRYPTO_dynlock *pointer = NULL; + + if (dynlock_create_callback == NULL) + { + CRYPTOerr(CRYPTO_F_CRYPTO_GET_NEW_DYNLOCKID,CRYPTO_R_NO_DYNLOCK_CREATE_CALLBACK); + return(0); + } + CRYPTO_w_lock(CRYPTO_LOCK_DYNLOCK); + if ((dyn_locks == NULL) + && ((dyn_locks=sk_new_null()) == NULL)) + { + CRYPTO_w_unlock(CRYPTO_LOCK_DYNLOCK); + CRYPTOerr(CRYPTO_F_CRYPTO_GET_NEW_DYNLOCKID,ERR_R_MALLOC_FAILURE); + return(0); + } + CRYPTO_w_unlock(CRYPTO_LOCK_DYNLOCK); + + pointer = (CRYPTO_dynlock *)OPENSSL_malloc(sizeof(CRYPTO_dynlock)); + if (pointer == NULL) + { + CRYPTOerr(CRYPTO_F_CRYPTO_GET_NEW_DYNLOCKID,ERR_R_MALLOC_FAILURE); + return(0); + } + pointer->references = 1; + pointer->data = dynlock_create_callback(__FILE__,__LINE__); + if (pointer->data == NULL) + { + OPENSSL_free(pointer); + CRYPTOerr(CRYPTO_F_CRYPTO_GET_NEW_DYNLOCKID,ERR_R_MALLOC_FAILURE); + return(0); + } + + CRYPTO_w_lock(CRYPTO_LOCK_DYNLOCK); + i=sk_CRYPTO_dynlock_push(dyn_locks,pointer); + CRYPTO_w_unlock(CRYPTO_LOCK_DYNLOCK); + + if (!i) + { + dynlock_destroy_callback(pointer->data,__FILE__,__LINE__); + OPENSSL_free(pointer); + } + else + i += 1; /* to avoid 0 */ + return -i; + } + +void CRYPTO_destroy_dynlockid(int i) + { + CRYPTO_dynlock *pointer = NULL; + if (i) + i = -i-1; + if (dynlock_destroy_callback == NULL) + return; + + CRYPTO_w_lock(CRYPTO_LOCK_DYNLOCK); + + if (dyn_locks == NULL || i >= sk_CRYPTO_dynlock_num(dyn_locks)) + return; + pointer = sk_CRYPTO_dynlock_value(dyn_locks, i); + if (pointer != NULL) + { + --pointer->references; +#ifdef REF_CHECK + if (pointer->references < 0) + { + fprintf(stderr,"CRYPTO_destroy_dynlockid, bad reference count\n"); + abort(); + } + else +#endif + if (--(pointer->references) <= 0) + { + sk_CRYPTO_dynlock_set(dyn_locks, i, NULL); + } + else + pointer = NULL; + } + CRYPTO_w_unlock(CRYPTO_LOCK_DYNLOCK); + + if (pointer) + { + dynlock_destroy_callback(pointer->data,__FILE__,__LINE__); + OPENSSL_free(pointer); + } + } + +struct CRYPTO_dynlock_value *CRYPTO_get_dynlock_value(int i) + { + CRYPTO_dynlock *pointer = NULL; + if (i) + i = -i-1; + + CRYPTO_w_lock(CRYPTO_LOCK_DYNLOCK); + + if (dyn_locks != NULL && i < sk_CRYPTO_dynlock_num(dyn_locks)) + pointer = sk_CRYPTO_dynlock_value(dyn_locks, i); + if (pointer) + pointer->references++; + + CRYPTO_w_unlock(CRYPTO_LOCK_DYNLOCK); + + if (pointer) + return pointer->data; + return NULL; + } + void (*CRYPTO_get_locking_callback(void))(int mode,int type,const char *file, int line) { return(locking_callback); } +void (*CRYPTO_get_dynlock_lock_callback(void))(int mode, + struct CRYPTO_dynlock_value *l, const char *file,int line) + { + return(dynlock_locking_callback); + } + int (*CRYPTO_get_add_lock_callback(void))(int *num,int mount,int type, const char *file,int line) { @@ -159,6 +297,12 @@ void CRYPTO_set_locking_callback(void (*func)(int mode,int type, locking_callback=func; } +void CRYPTO_set_dynlock_locking_callback(void (*func)(int mode, + struct CRYPTO_dynlock_value *l, const char *file, int line)) + { + dynlock_locking_callback=func; + } + void CRYPTO_set_add_lock_callback(int (*func)(int *num,int mount,int type, const char *file,int line)) { @@ -221,14 +365,28 @@ void CRYPTO_lock(int mode, int type, const char *file, int line) CRYPTO_get_lock_name(type), file, line); } #endif - if (locking_callback != NULL) - locking_callback(mode,type,file,line); + if (type < 0) + { + int i = -type - 1; + struct CRYPTO_dynlock_value *pointer + = CRYPTO_get_dynlock_value(i); + + if (pointer) + { + dynlock_locking_callback(mode, pointer, file, line); + } + + CRYPTO_destroy_dynlockid(i); + } + else + if (locking_callback != NULL) + locking_callback(mode,type,file,line); } int CRYPTO_add_lock(int *pointer, int amount, int type, const char *file, int line) { - int ret; + int ret = 0; if (add_lock_callback != NULL) { @@ -267,7 +425,7 @@ int CRYPTO_add_lock(int *pointer, int amount, int type, const char *file, const char *CRYPTO_get_lock_name(int type) { if (type < 0) - return("ERROR"); + return("dynamic"); else if (type < CRYPTO_NUM_LOCKS) return(lock_names[type]); else if (type-CRYPTO_NUM_LOCKS >= sk_num(app_locks)) diff --git a/crypto/crypto-lib.com b/crypto/crypto-lib.com index ae347ee1f7..1d9a126800 100644 --- a/crypto/crypto-lib.com +++ b/crypto/crypto-lib.com @@ -216,15 +216,10 @@ $ LIB_RAND = "md_rand,randfile,rand_lib,rand_err,rand_egd" $ LIB_ERR = "err,err_all,err_prn" $ LIB_OBJECTS = "o_names,obj_dat,obj_lib,obj_err" $ LIB_EVP = "encode,digest,evp_enc,evp_key,"+ - - "e_ecb_d,e_cbc_d,e_cfb_d,e_ofb_d,"+ - - "e_ecb_i,e_cbc_i,e_cfb_i,e_ofb_i,"+ - - "e_ecb_3d,e_cbc_3d,e_rc4,names,"+ - - "e_cfb_3d,e_ofb_3d,e_xcbc_d,"+ - - "e_ecb_r2,e_cbc_r2,e_cfb_r2,e_ofb_r2,"+ - - "e_ecb_bf,e_cbc_bf,e_cfb_bf,e_ofb_bf" -$ LIB_EVP_2 = "e_ecb_c,e_cbc_c,e_cfb_c,e_ofb_c,"+ - - "e_ecb_r5,e_cbc_r5,e_cfb_r5,e_ofb_r5,"+ - - "m_null,m_md2,m_md5,m_sha,m_sha1,m_dss,m_dss1,m_mdc2,"+ - + "e_des,e_bf,e_idea,e_des3,"+ - + "e_rc4,names,"+ - + "e_xcbc_d,e_rc2,e_cast,e_rc5," +$ LIB_EVP_2 = "m_null,m_md2,m_md5,m_sha,m_sha1,m_dss,m_dss1,m_mdc2,"+ - "m_ripemd,"+ - "p_open,p_seal,p_sign,p_verify,p_lib,p_enc,p_dec,"+ - "bio_md,bio_b64,bio_enc,evp_err,e_null,"+ - @@ -255,7 +250,7 @@ $ LIB_X509 = "x509_def,x509_d2,x509_r2x,x509_cmp,"+ - $ LIB_X509V3 = "v3_bcons,v3_bitst,v3_conf,v3_extku,v3_ia5,v3_lib,"+ - "v3_prn,v3_utl,v3err,v3_genn,v3_alt,v3_skey,v3_akey,v3_pku,"+ - "v3_int,v3_enum,v3_sxnet,v3_cpols,v3_crld,v3_purp,v3_info" -$ LIB_CONF = "conf,conf_err" +$ LIB_CONF = "conf_err,conf_lib,conf_api,conf_def" $ LIB_TXT_DB = "txt_db" $ LIB_PKCS7 = "pk7_lib,pkcs7err,pk7_doit,pk7_smime,pk7_attr,pk7_mime" $ LIB_PKCS12 = "p12_add,p12_attr,p12_bags,p12_crpt,p12_crt,p12_decr,"+ - diff --git a/crypto/crypto.h b/crypto/crypto.h index 59b4c9b0ef..11f75b7e3a 100644 --- a/crypto/crypto.h +++ b/crypto/crypto.h @@ -122,8 +122,9 @@ extern "C" { #define CRYPTO_LOCK_DH 24 #define CRYPTO_LOCK_MALLOC2 25 #define CRYPTO_LOCK_DSO 26 -#define CRYPTO_LOCK_ENGINE 27 -#define CRYPTO_NUM_LOCKS 28 +#define CRYPTO_LOCK_DYNLOCK 27 +#define CRYPTO_LOCK_ENGINE 28 +#define CRYPTO_NUM_LOCKS 29 #define CRYPTO_LOCK 1 #define CRYPTO_UNLOCK 2 @@ -151,6 +152,17 @@ extern "C" { #define CRYPTO_add(a,b,c) ((*(a))+=(b)) #endif +/* Some applications as well as some parts of OpenSSL need to allocate + and deallocate locks in a dynamic fashion. The following typedef + makes this possible in a type-safe manner. */ +/* struct CRYPTO_dynlock_value has to be defined by the application. */ +typedef struct + { + int references; + struct CRYPTO_dynlock_value *data; + } CRYPTO_dynlock; + + /* The following can be used to detect memory leaks in the SSLeay library. * It used, it turns on malloc checking */ @@ -202,37 +214,6 @@ typedef struct crypto_ex_data_func_st } CRYPTO_EX_DATA_FUNCS; DECLARE_STACK_OF(CRYPTO_EX_DATA_FUNCS) -/* This block of defines is updated by a perl script, please do not touch! */ -#ifndef DEBUG_SAFESTACK - #define sk_CRYPTO_EX_DATA_FUNCS_new(a) sk_new((int (*) \ - (const char * const *, const char * const *))(a)) - #define sk_CRYPTO_EX_DATA_FUNCS_new_null() sk_new_null() - #define sk_CRYPTO_EX_DATA_FUNCS_free(a) sk_free(a) - #define sk_CRYPTO_EX_DATA_FUNCS_num(a) sk_num(a) - #define sk_CRYPTO_EX_DATA_FUNCS_value(a,b) ((CRYPTO_EX_DATA_FUNCS *) \ - sk_value((a),(b))) - #define sk_CRYPTO_EX_DATA_FUNCS_set(a,b,c) ((CRYPTO_EX_DATA_FUNCS *) \ - sk_set((a),(b),(char *)(c))) - #define sk_CRYPTO_EX_DATA_FUNCS_zero(a) sk_zero(a) - #define sk_CRYPTO_EX_DATA_FUNCS_push(a,b) sk_push((a),(char *)(b)) - #define sk_CRYPTO_EX_DATA_FUNCS_unshift(a,b) sk_unshift((a),(b)) - #define sk_CRYPTO_EX_DATA_FUNCS_find(a,b) sk_find((a), (char *)(b)) - #define sk_CRYPTO_EX_DATA_FUNCS_delete(a,b) ((CRYPTO_EX_DATA_FUNCS *) \ - sk_delete((a),(b))) - #define sk_CRYPTO_EX_DATA_FUNCS_delete_ptr(a,b) ((CRYPTO_EX_DATA_FUNCS *) \ - sk_delete_ptr((a),(char *)(b))) - #define sk_CRYPTO_EX_DATA_FUNCS_insert(a,b,c) sk_insert((a),(char *)(b),(c)) - #define sk_CRYPTO_EX_DATA_FUNCS_set_cmp_func(a,b) ((int (*) \ - (const CRYPTO_EX_DATA_FUNCS * const *,const CRYPTO_EX_DATA_FUNCS * const *)) \ - sk_set_cmp_func((a),(int (*) \ - (const char * const *, const char * const *))(b))) - #define sk_CRYPTO_EX_DATA_FUNCS_dup(a) sk_dup(a) - #define sk_CRYPTO_EX_DATA_FUNCS_pop_free(a,b) sk_pop_free((a),(void (*)(void *))(b)) - #define sk_CRYPTO_EX_DATA_FUNCS_shift(a) ((CRYPTO_EX_DATA_FUNCS *)sk_shift(a)) - #define sk_CRYPTO_EX_DATA_FUNCS_pop(a) ((CRYPTO_EX_DATA_FUNCS *)sk_pop(a)) - #define sk_CRYPTO_EX_DATA_FUNCS_sort(a) sk_sort(a) -#endif /* !DEBUG_SAFESTACK */ -/* End of perl script block, you may now edit :-) */ /* Per class, we have a STACK of CRYPTO_EX_DATA_FUNCS for each CRYPTO_EX_DATA * entry. @@ -331,6 +312,17 @@ unsigned long CRYPTO_thread_id(void); const char *CRYPTO_get_lock_name(int type); int CRYPTO_add_lock(int *pointer,int amount,int type, const char *file, int line); +void CRYPTO_set_dynlock_create_callback(struct CRYPTO_dynlock_value *(*dyn_create_function) + (char *file, int line)); +void CRYPTO_set_dynlock_lock_callback(void (*dyn_lock_function) + (int mode, struct CRYPTO_dynlock_value *l, + const char *file, int line)); +void CRYPTO_set_dynlock_destroy_callback(void (*dyn_destroy_function) + (struct CRYPTO_dynlock_value *l, const char *file, int line)); +void CRYPTO_set_dynlock_size(int dynlock_size); +int CRYPTO_get_new_dynlockid(void); +void CRYPTO_destroy_dynlockid(int i); +struct CRYPTO_dynlock_value *CRYPTO_get_dynlock_value(int i); /* CRYPTO_set_mem_functions includes CRYPTO_set_locked_mem_functions -- * call the latter last if you need different functions */ @@ -403,12 +395,15 @@ void ERR_load_CRYPTO_strings(void); /* Function codes. */ #define CRYPTO_F_CRYPTO_GET_EX_NEW_INDEX 100 +#define CRYPTO_F_CRYPTO_GET_NEW_DYNLOCKID 103 #define CRYPTO_F_CRYPTO_GET_NEW_LOCKID 101 #define CRYPTO_F_CRYPTO_SET_EX_DATA 102 /* Reason codes. */ +#define CRYPTO_R_NO_DYNLOCK_CREATE_CALLBACK 100 #ifdef __cplusplus } #endif #endif + diff --git a/crypto/dso/README b/crypto/dso/README index 5a9b86f4c3..6ba03c5631 100644 --- a/crypto/dso/README +++ b/crypto/dso/README @@ -1,12 +1,15 @@ TODO ---- -Get a fix on how the paths should be handled. For now, flags == 0 -and this is currently just passing strings directly onto the -underlying system calls and letting them do what they want with -the paths. However, it may be desirable to implement flags that -control the way the loading is performed (or attempted), and I -invisage that DSO_ctrl() will be used to control this. +Find a way where name-translation can be done in a way that is +sensitive to particular methods (ie. generic code could still do +different path/filename substitutions on win32 to what it does on +*nix) but doesn't assume some canonical form. Already one case +exists where the "blah -> (libblah.so,blah.dll)" mapping doesn't +suffice. I suspect a callback with an enumerated (or string?) +parameter could be the way to go here ... DSO_ctrl the callback +into place and it can be invoked to handle name translation with +some clue to the calling code as to what kind of system it is. NOTES ----- @@ -18,5 +21,4 @@ according to their man page, prefer developers to move to that. I'll leave Richard's changes there as I guess dso_dl is needed for HPUX10.20. -[G-T] diff --git a/crypto/dso/dso.h b/crypto/dso/dso.h index 281af47c26..af51d53dbd 100644 --- a/crypto/dso/dso.h +++ b/crypto/dso/dso.h @@ -80,6 +80,8 @@ extern "C" { */ #define DSO_FLAG_NAME_TRANSLATION 0x01 +typedef void (*DSO_FUNC_TYPE)(void); + typedef struct dso_st DSO; typedef struct dso_meth_st @@ -89,13 +91,22 @@ typedef struct dso_meth_st int (*dso_load)(DSO *dso, const char *filename); /* Unloads a shared library */ int (*dso_unload)(DSO *dso); - /* Binds a function, variable, or whatever */ - int (*dso_bind)(DSO *dso, const char *symname, void **symptr); + /* Binds a variable */ + void *(*dso_bind_var)(DSO *dso, const char *symname); + /* Binds a function - assumes a return type of DSO_FUNC_TYPE. + * This should be cast to the real function prototype by the + * caller. Platforms that don't have compatible representations + * for different prototypes (this is possible within ANSI C) + * are highly unlikely to have shared libraries at all, let + * alone a DSO_METHOD implemented for them. */ + DSO_FUNC_TYPE (*dso_bind_func)(DSO *dso, const char *symname); /* I don't think this would actually be used in any circumstances. */ #if 0 - /* Unbinds a symbol */ - int (*dso_unbind)(DSO *dso, char *symname, void *symptr); + /* Unbinds a variable */ + int (*dso_unbind_var)(DSO *dso, char *symname, void *symptr); + /* Unbinds a function */ + int (*dso_unbind_func)(DSO *dso, char *symname, DSO_FUNC_TYPE symptr); #endif /* The generic (yuck) "ctrl()" function. NB: Negative return * values (rather than zero) indicate errors. */ @@ -146,9 +157,11 @@ DSO_METHOD *DSO_set_method(DSO *dso, DSO_METHOD *meth); * DSO_ctrl(dso, DSO_CTRL_SET_FLAGS, flags, NULL); */ DSO *DSO_load(DSO *dso, const char *filename, DSO_METHOD *meth, int flags); -/* This function binds to a function, variable, whatever inside a - * shared library. */ -void *DSO_bind(DSO *dso, const char *symname); +/* This function binds to a variable inside a shared library. */ +void *DSO_bind_var(DSO *dso, const char *symname); + +/* This function binds to a function inside a shared library. */ +DSO_FUNC_TYPE DSO_bind_func(DSO *dso, const char *symname); /* This method is the default, but will beg, borrow, or steal whatever * method should be the default on any particular platform (including @@ -182,35 +195,39 @@ void ERR_load_DSO_strings(void); /* Error codes for the DSO functions. */ /* Function codes. */ -#define DSO_F_DLFCN_BIND 100 -#define DSO_F_DLFCN_LOAD 101 -#define DSO_F_DLFCN_UNLOAD 102 -#define DSO_F_DLFCN_CTRL 103 -#define DSO_F_DL_BIND 104 -#define DSO_F_DL_LOAD 105 -#define DSO_F_DL_UNLOAD 106 +#define DSO_F_DLFCN_BIND_FUNC 100 +#define DSO_F_DLFCN_BIND_VAR 101 +#define DSO_F_DLFCN_CTRL 102 +#define DSO_F_DLFCN_LOAD 103 +#define DSO_F_DLFCN_UNLOAD 104 +#define DSO_F_DL_BIND_FUNC 105 +#define DSO_F_DL_BIND_VAR 106 #define DSO_F_DL_CTRL 107 -#define DSO_F_DSO_BIND 108 -#define DSO_F_DSO_FREE 109 -#define DSO_F_DSO_LOAD 110 -#define DSO_F_DSO_NEW_METHOD 111 -#define DSO_F_DSO_UP 112 -#define DSO_F_DSO_CTRL 113 -#define DSO_F_WIN32_BIND 114 -#define DSO_F_WIN32_LOAD 115 -#define DSO_F_WIN32_UNLOAD 116 -#define DSO_F_WIN32_CTRL 117 +#define DSO_F_DL_LOAD 108 +#define DSO_F_DL_UNLOAD 109 +#define DSO_F_DSO_BIND_FUNC 110 +#define DSO_F_DSO_BIND_VAR 111 +#define DSO_F_DSO_CTRL 112 +#define DSO_F_DSO_FREE 113 +#define DSO_F_DSO_LOAD 114 +#define DSO_F_DSO_NEW_METHOD 115 +#define DSO_F_DSO_UP 116 +#define DSO_F_WIN32_BIND_FUNC 117 +#define DSO_F_WIN32_BIND_VAR 118 +#define DSO_F_WIN32_CTRL 119 +#define DSO_F_WIN32_LOAD 120 +#define DSO_F_WIN32_UNLOAD 121 /* Reason codes. */ -#define DSO_R_FINISH_FAILED 100 -#define DSO_R_LOAD_FAILED 101 -#define DSO_R_NULL_HANDLE 102 -#define DSO_R_STACK_ERROR 103 -#define DSO_R_SYM_FAILURE 104 -#define DSO_R_UNLOAD_FAILED 105 -#define DSO_R_UNSUPPORTED 106 -#define DSO_R_UNKNOWN_COMMAND 107 -#define DSO_R_CTRL_FAILED 108 +#define DSO_R_CTRL_FAILED 100 +#define DSO_R_FINISH_FAILED 101 +#define DSO_R_LOAD_FAILED 102 +#define DSO_R_NULL_HANDLE 103 +#define DSO_R_STACK_ERROR 104 +#define DSO_R_SYM_FAILURE 105 +#define DSO_R_UNKNOWN_COMMAND 106 +#define DSO_R_UNLOAD_FAILED 107 +#define DSO_R_UNSUPPORTED 108 #ifdef __cplusplus } diff --git a/crypto/dso/dso_dl.c b/crypto/dso/dso_dl.c index bb808ad6fb..69810fc3bb 100644 --- a/crypto/dso/dso_dl.c +++ b/crypto/dso/dso_dl.c @@ -74,9 +74,11 @@ DSO_METHOD *DSO_METHOD_dl(void) static int dl_load(DSO *dso, const char *filename); static int dl_unload(DSO *dso); -static int dl_bind(DSO *dso, const char *symname, void **symptr); +static void *dl_bind_var(DSO *dso, const char *symname); +static DSO_FUNC_TYPE dl_bind_func(DSO *dso, const char *symname); #if 0 -static int dl_unbind(DSO *dso, char *symname, void *symptr); +static int dl_unbind_var(DSO *dso, char *symname, void *symptr); +static int dl_unbind_func(DSO *dso, char *symname, DSO_FUNC_TYPE symptr); static int dl_init(DSO *dso); static int dl_finish(DSO *dso); #endif @@ -86,10 +88,12 @@ static DSO_METHOD dso_meth_dl = { "OpenSSL 'dl' shared library method", dl_load, dl_unload, - dl_bind, + dl_bind_var, + dl_bind_func, /* For now, "unbind" doesn't exist */ #if 0 - NULL, /* unbind */ + NULL, /* unbind_var */ + NULL, /* unbind_func */ #endif dl_ctrl, NULL, /* init */ @@ -162,34 +166,62 @@ static int dl_unload(DSO *dso) return(1); } -static int dl_bind(DSO *dso, const char *symname, void **symptr) +static void *dl_bind_var(DSO *dso, const char *symname) { shl_t ptr; void *sym; - if((dso == NULL) || (symptr == NULL) || (symname == NULL)) + if((dso == NULL) || (symname == NULL)) { - DSOerr(DSO_F_DL_BIND,ERR_R_PASSED_NULL_PARAMETER); - return(0); + DSOerr(DSO_F_DL_BIND_VAR,ERR_R_PASSED_NULL_PARAMETER); + return(NULL); } if(sk_num(dso->meth_data) < 1) { - DSOerr(DSO_F_DL_BIND,DSO_R_STACK_ERROR); - return(0); + DSOerr(DSO_F_DL_BIND_VAR,DSO_R_STACK_ERROR); + return(NULL); } ptr = (shl_t)sk_value(dso->meth_data, sk_num(dso->meth_data) - 1); if(ptr == NULL) { - DSOerr(DSO_F_DL_BIND,DSO_R_NULL_HANDLE); - return(0); + DSOerr(DSO_F_DL_BIND_VAR,DSO_R_NULL_HANDLE); + return(NULL); } if (shl_findsym(ptr, symname, TYPE_UNDEFINED, &sym) < 0) { - DSOerr(DSO_F_DL_BIND,DSO_R_SYM_FAILURE); - return(0); + DSOerr(DSO_F_DL_BIND_VAR,DSO_R_SYM_FAILURE); + return(NULL); } - *symptr = sym; - return(1); + return(sym); + } + +static DSO_FUNC_TYPE dl_bind_func(DSO *dso, const char *symname) + { + shl_t ptr; + void *sym; + + if((dso == NULL) || (symname == NULL)) + { + DSOerr(DSO_F_DL_BIND_FUNC,ERR_R_PASSED_NULL_PARAMETER); + return(NULL); + } + if(sk_num(dso->meth_data) < 1) + { + DSOerr(DSO_F_DL_BIND_FUNC,DSO_R_STACK_ERROR); + return(NULL); + } + ptr = (shl_t)sk_value(dso->meth_data, sk_num(dso->meth_data) - 1); + if(ptr == NULL) + { + DSOerr(DSO_F_DL_BIND_FUNC,DSO_R_NULL_HANDLE); + return(NULL); + } + if (shl_findsym(ptr, symname, TYPE_UNDEFINED, &sym) < 0) + { + DSOerr(DSO_F_DL_BIND_FUNC,DSO_R_SYM_FAILURE); + return(NULL); + } + return((DSO_FUNC_TYPE)sym); } static int dl_ctrl(DSO *dso, int cmd, long larg, void *parg) diff --git a/crypto/dso/dso_dlfcn.c b/crypto/dso/dso_dlfcn.c index 7638724f78..c12583cdc4 100644 --- a/crypto/dso/dso_dlfcn.c +++ b/crypto/dso/dso_dlfcn.c @@ -76,7 +76,8 @@ DSO_METHOD *DSO_METHOD_dlfcn(void) static int dlfcn_load(DSO *dso, const char *filename); static int dlfcn_unload(DSO *dso); -static int dlfcn_bind(DSO *dso, const char *symname, void **symptr); +static void *dlfcn_bind_var(DSO *dso, const char *symname); +static DSO_FUNC_TYPE dlfcn_bind_func(DSO *dso, const char *symname); #if 0 static int dlfcn_unbind(DSO *dso, char *symname, void *symptr); static int dlfcn_init(DSO *dso); @@ -88,10 +89,12 @@ static DSO_METHOD dso_meth_dlfcn = { "OpenSSL 'dlfcn' shared library method", dlfcn_load, dlfcn_unload, - dlfcn_bind, + dlfcn_bind_var, + dlfcn_bind_func, /* For now, "unbind" doesn't exist */ #if 0 - NULL, /* unbind */ + NULL, /* unbind_var */ + NULL, /* unbind_func */ #endif dlfcn_ctrl, NULL, /* init */ @@ -167,34 +170,63 @@ static int dlfcn_unload(DSO *dso) return(1); } -static int dlfcn_bind(DSO *dso, const char *symname, void **symptr) +static void *dlfcn_bind_var(DSO *dso, const char *symname) { void *ptr, *sym; - if((dso == NULL) || (symptr == NULL) || (symname == NULL)) + if((dso == NULL) || (symname == NULL)) { - DSOerr(DSO_F_DLFCN_BIND,ERR_R_PASSED_NULL_PARAMETER); - return(0); + DSOerr(DSO_F_DLFCN_BIND_VAR,ERR_R_PASSED_NULL_PARAMETER); + return(NULL); } if(sk_num(dso->meth_data) < 1) { - DSOerr(DSO_F_DLFCN_BIND,DSO_R_STACK_ERROR); - return(0); + DSOerr(DSO_F_DLFCN_BIND_VAR,DSO_R_STACK_ERROR); + return(NULL); } ptr = (void *)sk_value(dso->meth_data, sk_num(dso->meth_data) - 1); if(ptr == NULL) { - DSOerr(DSO_F_DLFCN_BIND,DSO_R_NULL_HANDLE); - return(0); + DSOerr(DSO_F_DLFCN_BIND_VAR,DSO_R_NULL_HANDLE); + return(NULL); } sym = dlsym(ptr, symname); if(sym == NULL) { - DSOerr(DSO_F_DLFCN_BIND,DSO_R_SYM_FAILURE); - return(0); + DSOerr(DSO_F_DLFCN_BIND_VAR,DSO_R_SYM_FAILURE); + return(NULL); } - *symptr = sym; - return(1); + return(sym); + } + +static DSO_FUNC_TYPE dlfcn_bind_func(DSO *dso, const char *symname) + { + void *ptr; + DSO_FUNC_TYPE sym; + + if((dso == NULL) || (symname == NULL)) + { + DSOerr(DSO_F_DLFCN_BIND_FUNC,ERR_R_PASSED_NULL_PARAMETER); + return(NULL); + } + if(sk_num(dso->meth_data) < 1) + { + DSOerr(DSO_F_DLFCN_BIND_FUNC,DSO_R_STACK_ERROR); + return(NULL); + } + ptr = (void *)sk_value(dso->meth_data, sk_num(dso->meth_data) - 1); + if(ptr == NULL) + { + DSOerr(DSO_F_DLFCN_BIND_FUNC,DSO_R_NULL_HANDLE); + return(NULL); + } + sym = (DSO_FUNC_TYPE)dlsym(ptr, symname); + if(sym == NULL) + { + DSOerr(DSO_F_DLFCN_BIND_FUNC,DSO_R_SYM_FAILURE); + return(NULL); + } + return(sym); } static long dlfcn_ctrl(DSO *dso, int cmd, long larg, void *parg) diff --git a/crypto/dso/dso_err.c b/crypto/dso/dso_err.c index 5d2457a9ff..70d35cea26 100644 --- a/crypto/dso/dso_err.c +++ b/crypto/dso/dso_err.c @@ -66,38 +66,42 @@ #ifndef NO_ERR static ERR_STRING_DATA DSO_str_functs[]= { -{ERR_PACK(0,DSO_F_DLFCN_BIND,0), "dlfcn_bind"}, -{ERR_PACK(0,DSO_F_DLFCN_LOAD,0), "dlfcn_load"}, -{ERR_PACK(0,DSO_F_DLFCN_UNLOAD,0), "dlfcn_unload"}, -{ERR_PACK(0,DSO_F_DLFCN_CTRL,0), "dlfcn_ctrl"}, -{ERR_PACK(0,DSO_F_DL_BIND,0), "dl_bind"}, -{ERR_PACK(0,DSO_F_DL_LOAD,0), "dl_load"}, -{ERR_PACK(0,DSO_F_DL_UNLOAD,0), "dl_unload"}, -{ERR_PACK(0,DSO_F_DL_CTRL,0), "dl_ctrl"}, -{ERR_PACK(0,DSO_F_DSO_BIND,0), "DSO_bind"}, +{ERR_PACK(0,DSO_F_DLFCN_BIND_FUNC,0), "DLFCN_BIND_FUNC"}, +{ERR_PACK(0,DSO_F_DLFCN_BIND_VAR,0), "DLFCN_BIND_VAR"}, +{ERR_PACK(0,DSO_F_DLFCN_CTRL,0), "DLFCN_CTRL"}, +{ERR_PACK(0,DSO_F_DLFCN_LOAD,0), "DLFCN_LOAD"}, +{ERR_PACK(0,DSO_F_DLFCN_UNLOAD,0), "DLFCN_UNLOAD"}, +{ERR_PACK(0,DSO_F_DL_BIND_FUNC,0), "DL_BIND_FUNC"}, +{ERR_PACK(0,DSO_F_DL_BIND_VAR,0), "DL_BIND_VAR"}, +{ERR_PACK(0,DSO_F_DL_CTRL,0), "DL_CTRL"}, +{ERR_PACK(0,DSO_F_DL_LOAD,0), "DL_LOAD"}, +{ERR_PACK(0,DSO_F_DL_UNLOAD,0), "DL_UNLOAD"}, +{ERR_PACK(0,DSO_F_DSO_BIND_FUNC,0), "DSO_bind_func"}, +{ERR_PACK(0,DSO_F_DSO_BIND_VAR,0), "DSO_bind_var"}, +{ERR_PACK(0,DSO_F_DSO_CTRL,0), "DSO_ctrl"}, {ERR_PACK(0,DSO_F_DSO_FREE,0), "DSO_free"}, {ERR_PACK(0,DSO_F_DSO_LOAD,0), "DSO_load"}, {ERR_PACK(0,DSO_F_DSO_NEW_METHOD,0), "DSO_new_method"}, {ERR_PACK(0,DSO_F_DSO_UP,0), "DSO_up"}, -{ERR_PACK(0,DSO_F_DSO_CTRL,0), "DSO_ctrl"}, -{ERR_PACK(0,DSO_F_WIN32_BIND,0), "win32_bind"}, -{ERR_PACK(0,DSO_F_WIN32_LOAD,0), "win32_load"}, -{ERR_PACK(0,DSO_F_WIN32_UNLOAD,0), "win32_unload"}, -{ERR_PACK(0,DSO_F_WIN32_CTRL,0), "win32_ctrl"}, +{ERR_PACK(0,DSO_F_WIN32_BIND_FUNC,0), "WIN32_BIND_FUNC"}, +{ERR_PACK(0,DSO_F_WIN32_BIND_VAR,0), "WIN32_BIND_VAR"}, +{ERR_PACK(0,DSO_F_WIN32_CTRL,0), "WIN32_CTRL"}, +{ERR_PACK(0,DSO_F_WIN32_LOAD,0), "WIN32_LOAD"}, +{ERR_PACK(0,DSO_F_WIN32_UNLOAD,0), "WIN32_UNLOAD"}, {0,NULL} }; static ERR_STRING_DATA DSO_str_reasons[]= { +{DSO_R_CTRL_FAILED ,"control command failed"}, {DSO_R_FINISH_FAILED ,"cleanup method function failed"}, {DSO_R_LOAD_FAILED ,"could not load the shared library"}, {DSO_R_NULL_HANDLE ,"a null shared library handle was used"}, {DSO_R_STACK_ERROR ,"the meth_data stack is corrupt"}, {DSO_R_SYM_FAILURE ,"could not bind to the requested symbol name"}, +{DSO_R_UNKNOWN_COMMAND ,"unknown control command"}, {DSO_R_UNLOAD_FAILED ,"could not unload the shared library"}, {DSO_R_UNSUPPORTED ,"functionality not supported"}, -{DSO_R_UNKNOWN_COMMAND ,"unknown control command"}, -{DSO_R_CTRL_FAILED ,"control command failed"}, {0,NULL} }; diff --git a/crypto/dso/dso_lib.c b/crypto/dso/dso_lib.c index 861f5fb84e..d1d50cc5e6 100644 --- a/crypto/dso/dso_lib.c +++ b/crypto/dso/dso_lib.c @@ -236,23 +236,46 @@ DSO *DSO_load(DSO *dso, const char *filename, DSO_METHOD *meth, int flags) return(ret); } -void *DSO_bind(DSO *dso, const char *symname) +void *DSO_bind_var(DSO *dso, const char *symname) { void *ret = NULL; if((dso == NULL) || (symname == NULL)) { - DSOerr(DSO_F_DSO_BIND,ERR_R_PASSED_NULL_PARAMETER); + DSOerr(DSO_F_DSO_BIND_VAR,ERR_R_PASSED_NULL_PARAMETER); return(NULL); } - if(dso->meth->dso_bind == NULL) + if(dso->meth->dso_bind_var == NULL) { - DSOerr(DSO_F_DSO_BIND,DSO_R_UNSUPPORTED); + DSOerr(DSO_F_DSO_BIND_VAR,DSO_R_UNSUPPORTED); return(NULL); } - if(!dso->meth->dso_bind(dso, symname, &ret)) + if((ret = dso->meth->dso_bind_var(dso, symname)) == NULL) { - DSOerr(DSO_F_DSO_BIND,DSO_R_SYM_FAILURE); + DSOerr(DSO_F_DSO_BIND_VAR,DSO_R_SYM_FAILURE); + return(NULL); + } + /* Success */ + return(ret); + } + +DSO_FUNC_TYPE DSO_bind_func(DSO *dso, const char *symname) + { + DSO_FUNC_TYPE ret = NULL; + + if((dso == NULL) || (symname == NULL)) + { + DSOerr(DSO_F_DSO_BIND_FUNC,ERR_R_PASSED_NULL_PARAMETER); + return(NULL); + } + if(dso->meth->dso_bind_func == NULL) + { + DSOerr(DSO_F_DSO_BIND_FUNC,DSO_R_UNSUPPORTED); + return(NULL); + } + if((ret = dso->meth->dso_bind_func(dso, symname)) == NULL) + { + DSOerr(DSO_F_DSO_BIND_FUNC,DSO_R_SYM_FAILURE); return(NULL); } /* Success */ diff --git a/crypto/dso/dso_null.c b/crypto/dso/dso_null.c index 79e6eddca2..fa13a7cb0f 100644 --- a/crypto/dso/dso_null.c +++ b/crypto/dso/dso_null.c @@ -67,10 +67,12 @@ static DSO_METHOD dso_meth_null = { "NULL shared library method", NULL, /* load */ NULL, /* unload */ - NULL, /* bind */ + NULL, /* bind_var */ + NULL, /* bind_func */ /* For now, "unbind" doesn't exist */ #if 0 - NULL, /* unbind */ + NULL, /* unbind_var */ + NULL, /* unbind_func */ #endif NULL, /* ctrl */ NULL, /* init */ diff --git a/crypto/dso/dso_win32.c b/crypto/dso/dso_win32.c index e204b6b07b..3a2baf2643 100644 --- a/crypto/dso/dso_win32.c +++ b/crypto/dso/dso_win32.c @@ -73,9 +73,11 @@ DSO_METHOD *DSO_METHOD_win32(void) static int win32_load(DSO *dso, const char *filename); static int win32_unload(DSO *dso); -static int win32_bind(DSO *dso, const char *symname, void **symptr); +static void *win32_bind_var(DSO *dso, const char *symname); +static DSO_FUNC_TYPE win32_bind_func(DSO *dso, const char *symname); #if 0 -static int win32_unbind(DSO *dso, char *symname, void *symptr); +static int win32_unbind_var(DSO *dso, char *symname, void *symptr); +static int win32_unbind_func(DSO *dso, char *symname, DSO_FUNC_TYPE symptr); static int win32_init(DSO *dso); static int win32_finish(DSO *dso); #endif @@ -85,10 +87,12 @@ static DSO_METHOD dso_meth_win32 = { "OpenSSL 'win32' shared library method", win32_load, win32_unload, - win32_bind, + win32_bind_var, + win32_bind_func, /* For now, "unbind" doesn't exist */ #if 0 - NULL, /* unbind */ + NULL, /* unbind_var */ + NULL, /* unbind_func */ #endif win32_ctrl, NULL, /* init */ @@ -180,35 +184,66 @@ static int win32_unload(DSO *dso) return(1); } -static int win32_bind(DSO *dso, const char *symname, void **symptr) +/* Using GetProcAddress for variables? TODO: Check this out in + * the Win32 API docs, there's probably a variant for variables. */ +static void *win32_bind_var(DSO *dso, const char *symname) { HINSTANCE *ptr; void *sym; - if((dso == NULL) || (symptr == NULL) || (symname == NULL)) + if((dso == NULL) || (symname == NULL)) { - DSOerr(DSO_F_WIN32_BIND,ERR_R_PASSED_NULL_PARAMETER); - return(0); + DSOerr(DSO_F_WIN32_BIND_VAR,ERR_R_PASSED_NULL_PARAMETER); + return(NULL); } if(sk_num(dso->meth_data) < 1) { - DSOerr(DSO_F_WIN32_BIND,DSO_R_STACK_ERROR); - return(0); + DSOerr(DSO_F_WIN32_BIND_VAR,DSO_R_STACK_ERROR); + return(NULL); } ptr = (HINSTANCE *)sk_value(dso->meth_data, sk_num(dso->meth_data) - 1); if(ptr == NULL) { - DSOerr(DSO_F_WIN32_BIND,DSO_R_NULL_HANDLE); - return(0); + DSOerr(DSO_F_WIN32_BIND_VAR,DSO_R_NULL_HANDLE); + return(NULL); } sym = GetProcAddress(*ptr, symname); if(sym == NULL) { - DSOerr(DSO_F_WIN32_BIND,DSO_R_SYM_FAILURE); - return(0); + DSOerr(DSO_F_WIN32_BIND_VAR,DSO_R_SYM_FAILURE); + return(NULL); } - *symptr = sym; - return(1); + return(sym); + } + +static DSO_FUNC_TYPE win32_bind_func(DSO *dso, const char *symname) + { + HINSTANCE *ptr; + void *sym; + + if((dso == NULL) || (symname == NULL)) + { + DSOerr(DSO_F_WIN32_BIND_FUNC,ERR_R_PASSED_NULL_PARAMETER); + return(NULL); + } + if(sk_num(dso->meth_data) < 1) + { + DSOerr(DSO_F_WIN32_BIND_FUNC,DSO_R_STACK_ERROR); + return(NULL); + } + ptr = (HINSTANCE *)sk_value(dso->meth_data, sk_num(dso->meth_data) - 1); + if(ptr == NULL) + { + DSOerr(DSO_F_WIN32_BIND_FUNC,DSO_R_NULL_HANDLE); + return(NULL); + } + sym = GetProcAddress(*ptr, symname); + if(sym == NULL) + { + DSOerr(DSO_F_WIN32_BIND_FUNC,DSO_R_SYM_FAILURE); + return(NULL); + } + return((DSO_FUNC_TYPE)sym); } static long win32_ctrl(DSO *dso, int cmd, long larg, void *parg) diff --git a/crypto/engine/hw_ncipher.c b/crypto/engine/hw_ncipher.c index 319b2b9ffd..8ffcce7163 100644 --- a/crypto/engine/hw_ncipher.c +++ b/crypto/engine/hw_ncipher.c @@ -680,8 +680,6 @@ static void hwcrhk_ex_free(void *obj, void *item, CRYPTO_EX_DATA *ad, OPENSSL_free(hptr); } -#if 0 /* FIXME: We don't really have any support for dynamically allocated - threads in OpenSSL. */ /* Mutex calls: since the HWCryptoHook model closely follows the POSIX model * these just wrap the POSIX functions and add some logging. */ diff --git a/crypto/evp/evp_key.c b/crypto/evp/evp_key.c index 667c21cca8..09b72bf4bd 100644 --- a/crypto/evp/evp_key.c +++ b/crypto/evp/evp_key.c @@ -116,7 +116,7 @@ int EVP_BytesToKey(const EVP_CIPHER *type, EVP_MD *md, unsigned char *salt, EVP_DigestUpdate(&c,&(md_buf[0]),mds); EVP_DigestUpdate(&c,data,datal); if (salt != NULL) - EVP_DigestUpdate(&c,salt,8); + EVP_DigestUpdate(&c,salt,PKCS5_SALT_LEN); EVP_DigestFinal(&c,&(md_buf[0]),&mds); for (i=1; i<(unsigned int)count; i++) diff --git a/crypto/install.com b/crypto/install.com index 44cfc4e89a..10cfe4e404 100644 --- a/crypto/install.com +++ b/crypto/install.com @@ -68,7 +68,7 @@ $ EXHEADER_ASN1 := asn1.h,asn1_mac.h $ EXHEADER_PEM := pem.h,pem2.h $ EXHEADER_X509 := x509.h,x509_vfy.h $ EXHEADER_X509V3 := x509v3.h -$ EXHEADER_CONF := conf.h +$ EXHEADER_CONF := conf.h,conf_api.h $ EXHEADER_TXT_DB := txt_db.h $ EXHEADER_PKCS7 := pkcs7.h $ EXHEADER_PKCS12 := pkcs12.h diff --git a/crypto/objects/o_names.c b/crypto/objects/o_names.c index aa82a8a07c..f6bb643491 100644 --- a/crypto/objects/o_names.c +++ b/crypto/objects/o_names.c @@ -20,37 +20,6 @@ typedef struct name_funcs_st } NAME_FUNCS; DECLARE_STACK_OF(NAME_FUNCS) -/* This block of defines is updated by a perl script, please do not touch! */ -#ifndef DEBUG_SAFESTACK - #define sk_NAME_FUNCS_new(a) sk_new((int (*) \ - (const char * const *, const char * const *))(a)) - #define sk_NAME_FUNCS_new_null() sk_new_null() - #define sk_NAME_FUNCS_free(a) sk_free(a) - #define sk_NAME_FUNCS_num(a) sk_num(a) - #define sk_NAME_FUNCS_value(a,b) ((NAME_FUNCS *) \ - sk_value((a),(b))) - #define sk_NAME_FUNCS_set(a,b,c) ((NAME_FUNCS *) \ - sk_set((a),(b),(char *)(c))) - #define sk_NAME_FUNCS_zero(a) sk_zero(a) - #define sk_NAME_FUNCS_push(a,b) sk_push((a),(char *)(b)) - #define sk_NAME_FUNCS_unshift(a,b) sk_unshift((a),(b)) - #define sk_NAME_FUNCS_find(a,b) sk_find((a), (char *)(b)) - #define sk_NAME_FUNCS_delete(a,b) ((NAME_FUNCS *) \ - sk_delete((a),(b))) - #define sk_NAME_FUNCS_delete_ptr(a,b) ((NAME_FUNCS *) \ - sk_delete_ptr((a),(char *)(b))) - #define sk_NAME_FUNCS_insert(a,b,c) sk_insert((a),(char *)(b),(c)) - #define sk_NAME_FUNCS_set_cmp_func(a,b) ((int (*) \ - (const NAME_FUNCS * const *,const NAME_FUNCS * const *)) \ - sk_set_cmp_func((a),(int (*) \ - (const char * const *, const char * const *))(b))) - #define sk_NAME_FUNCS_dup(a) sk_dup(a) - #define sk_NAME_FUNCS_pop_free(a,b) sk_pop_free((a),(void (*)(void *))(b)) - #define sk_NAME_FUNCS_shift(a) ((NAME_FUNCS *)sk_shift(a)) - #define sk_NAME_FUNCS_pop(a) ((NAME_FUNCS *)sk_pop(a)) - #define sk_NAME_FUNCS_sort(a) sk_sort(a) -#endif /* !DEBUG_SAFESTACK */ -/* End of perl script block, you may now edit :-) */ IMPLEMENT_STACK_OF(NAME_FUNCS) static STACK_OF(NAME_FUNCS) *name_funcs_stack; diff --git a/crypto/pkcs12/pkcs12.h b/crypto/pkcs12/pkcs12.h index 1e0dc3e189..4cf92b68ea 100644 --- a/crypto/pkcs12/pkcs12.h +++ b/crypto/pkcs12/pkcs12.h @@ -124,37 +124,6 @@ ASN1_TYPE *rest; } PKCS12_SAFEBAG; DECLARE_STACK_OF(PKCS12_SAFEBAG) -/* This block of defines is updated by a perl script, please do not touch! */ -#ifndef DEBUG_SAFESTACK - #define sk_PKCS12_SAFEBAG_new(a) sk_new((int (*) \ - (const char * const *, const char * const *))(a)) - #define sk_PKCS12_SAFEBAG_new_null() sk_new_null() - #define sk_PKCS12_SAFEBAG_free(a) sk_free(a) - #define sk_PKCS12_SAFEBAG_num(a) sk_num(a) - #define sk_PKCS12_SAFEBAG_value(a,b) ((PKCS12_SAFEBAG *) \ - sk_value((a),(b))) - #define sk_PKCS12_SAFEBAG_set(a,b,c) ((PKCS12_SAFEBAG *) \ - sk_set((a),(b),(char *)(c))) - #define sk_PKCS12_SAFEBAG_zero(a) sk_zero(a) - #define sk_PKCS12_SAFEBAG_push(a,b) sk_push((a),(char *)(b)) - #define sk_PKCS12_SAFEBAG_unshift(a,b) sk_unshift((a),(b)) - #define sk_PKCS12_SAFEBAG_find(a,b) sk_find((a), (char *)(b)) - #define sk_PKCS12_SAFEBAG_delete(a,b) ((PKCS12_SAFEBAG *) \ - sk_delete((a),(b))) - #define sk_PKCS12_SAFEBAG_delete_ptr(a,b) ((PKCS12_SAFEBAG *) \ - sk_delete_ptr((a),(char *)(b))) - #define sk_PKCS12_SAFEBAG_insert(a,b,c) sk_insert((a),(char *)(b),(c)) - #define sk_PKCS12_SAFEBAG_set_cmp_func(a,b) ((int (*) \ - (const PKCS12_SAFEBAG * const *,const PKCS12_SAFEBAG * const *)) \ - sk_set_cmp_func((a),(int (*) \ - (const char * const *, const char * const *))(b))) - #define sk_PKCS12_SAFEBAG_dup(a) sk_dup(a) - #define sk_PKCS12_SAFEBAG_pop_free(a,b) sk_pop_free((a),(void (*)(void *))(b)) - #define sk_PKCS12_SAFEBAG_shift(a) ((PKCS12_SAFEBAG *)sk_shift(a)) - #define sk_PKCS12_SAFEBAG_pop(a) ((PKCS12_SAFEBAG *)sk_pop(a)) - #define sk_PKCS12_SAFEBAG_sort(a) sk_sort(a) -#endif /* !DEBUG_SAFESTACK */ -/* End of perl script block, you may now edit :-) */ DECLARE_ASN1_SET_OF(PKCS12_SAFEBAG) DECLARE_PKCS12_STACK_OF(PKCS12_SAFEBAG) diff --git a/crypto/pkcs7/pk7_mime.c b/crypto/pkcs7/pk7_mime.c index 7c6649cc14..9741aa578e 100644 --- a/crypto/pkcs7/pk7_mime.c +++ b/crypto/pkcs7/pk7_mime.c @@ -75,37 +75,6 @@ char *param_value; /* Param value e.g. "sha1" */ } MIME_PARAM; DECLARE_STACK_OF(MIME_PARAM) -/* This block of defines is updated by a perl script, please do not touch! */ -#ifndef DEBUG_SAFESTACK - #define sk_MIME_PARAM_new(a) sk_new((int (*) \ - (const char * const *, const char * const *))(a)) - #define sk_MIME_PARAM_new_null() sk_new_null() - #define sk_MIME_PARAM_free(a) sk_free(a) - #define sk_MIME_PARAM_num(a) sk_num(a) - #define sk_MIME_PARAM_value(a,b) ((MIME_PARAM *) \ - sk_value((a),(b))) - #define sk_MIME_PARAM_set(a,b,c) ((MIME_PARAM *) \ - sk_set((a),(b),(char *)(c))) - #define sk_MIME_PARAM_zero(a) sk_zero(a) - #define sk_MIME_PARAM_push(a,b) sk_push((a),(char *)(b)) - #define sk_MIME_PARAM_unshift(a,b) sk_unshift((a),(b)) - #define sk_MIME_PARAM_find(a,b) sk_find((a), (char *)(b)) - #define sk_MIME_PARAM_delete(a,b) ((MIME_PARAM *) \ - sk_delete((a),(b))) - #define sk_MIME_PARAM_delete_ptr(a,b) ((MIME_PARAM *) \ - sk_delete_ptr((a),(char *)(b))) - #define sk_MIME_PARAM_insert(a,b,c) sk_insert((a),(char *)(b),(c)) - #define sk_MIME_PARAM_set_cmp_func(a,b) ((int (*) \ - (const MIME_PARAM * const *,const MIME_PARAM * const *)) \ - sk_set_cmp_func((a),(int (*) \ - (const char * const *, const char * const *))(b))) - #define sk_MIME_PARAM_dup(a) sk_dup(a) - #define sk_MIME_PARAM_pop_free(a,b) sk_pop_free((a),(void (*)(void *))(b)) - #define sk_MIME_PARAM_shift(a) ((MIME_PARAM *)sk_shift(a)) - #define sk_MIME_PARAM_pop(a) ((MIME_PARAM *)sk_pop(a)) - #define sk_MIME_PARAM_sort(a) sk_sort(a) -#endif /* !DEBUG_SAFESTACK */ -/* End of perl script block, you may now edit :-) */ IMPLEMENT_STACK_OF(MIME_PARAM) typedef struct { @@ -115,37 +84,6 @@ STACK_OF(MIME_PARAM) *params; /* Zero or more parameters */ } MIME_HEADER; DECLARE_STACK_OF(MIME_HEADER) -/* This block of defines is updated by a perl script, please do not touch! */ -#ifndef DEBUG_SAFESTACK - #define sk_MIME_HEADER_new(a) sk_new((int (*) \ - (const char * const *, const char * const *))(a)) - #define sk_MIME_HEADER_new_null() sk_new_null() - #define sk_MIME_HEADER_free(a) sk_free(a) - #define sk_MIME_HEADER_num(a) sk_num(a) - #define sk_MIME_HEADER_value(a,b) ((MIME_HEADER *) \ - sk_value((a),(b))) - #define sk_MIME_HEADER_set(a,b,c) ((MIME_HEADER *) \ - sk_set((a),(b),(char *)(c))) - #define sk_MIME_HEADER_zero(a) sk_zero(a) - #define sk_MIME_HEADER_push(a,b) sk_push((a),(char *)(b)) - #define sk_MIME_HEADER_unshift(a,b) sk_unshift((a),(b)) - #define sk_MIME_HEADER_find(a,b) sk_find((a), (char *)(b)) - #define sk_MIME_HEADER_delete(a,b) ((MIME_HEADER *) \ - sk_delete((a),(b))) - #define sk_MIME_HEADER_delete_ptr(a,b) ((MIME_HEADER *) \ - sk_delete_ptr((a),(char *)(b))) - #define sk_MIME_HEADER_insert(a,b,c) sk_insert((a),(char *)(b),(c)) - #define sk_MIME_HEADER_set_cmp_func(a,b) ((int (*) \ - (const MIME_HEADER * const *,const MIME_HEADER * const *)) \ - sk_set_cmp_func((a),(int (*) \ - (const char * const *, const char * const *))(b))) - #define sk_MIME_HEADER_dup(a) sk_dup(a) - #define sk_MIME_HEADER_pop_free(a,b) sk_pop_free((a),(void (*)(void *))(b)) - #define sk_MIME_HEADER_shift(a) ((MIME_HEADER *)sk_shift(a)) - #define sk_MIME_HEADER_pop(a) ((MIME_HEADER *)sk_pop(a)) - #define sk_MIME_HEADER_sort(a) sk_sort(a) -#endif /* !DEBUG_SAFESTACK */ -/* End of perl script block, you may now edit :-) */ IMPLEMENT_STACK_OF(MIME_HEADER) static int B64_write_PKCS7(BIO *bio, PKCS7 *p7); diff --git a/crypto/pkcs7/pkcs7.h b/crypto/pkcs7/pkcs7.h index 9916a3b1d9..f3f85f57af 100644 --- a/crypto/pkcs7/pkcs7.h +++ b/crypto/pkcs7/pkcs7.h @@ -104,37 +104,6 @@ typedef struct pkcs7_signer_info_st } PKCS7_SIGNER_INFO; DECLARE_STACK_OF(PKCS7_SIGNER_INFO) -/* This block of defines is updated by a perl script, please do not touch! */ -#ifndef DEBUG_SAFESTACK - #define sk_PKCS7_SIGNER_INFO_new(a) sk_new((int (*) \ - (const char * const *, const char * const *))(a)) - #define sk_PKCS7_SIGNER_INFO_new_null() sk_new_null() - #define sk_PKCS7_SIGNER_INFO_free(a) sk_free(a) - #define sk_PKCS7_SIGNER_INFO_num(a) sk_num(a) - #define sk_PKCS7_SIGNER_INFO_value(a,b) ((PKCS7_SIGNER_INFO *) \ - sk_value((a),(b))) - #define sk_PKCS7_SIGNER_INFO_set(a,b,c) ((PKCS7_SIGNER_INFO *) \ - sk_set((a),(b),(char *)(c))) - #define sk_PKCS7_SIGNER_INFO_zero(a) sk_zero(a) - #define sk_PKCS7_SIGNER_INFO_push(a,b) sk_push((a),(char *)(b)) - #define sk_PKCS7_SIGNER_INFO_unshift(a,b) sk_unshift((a),(b)) - #define sk_PKCS7_SIGNER_INFO_find(a,b) sk_find((a), (char *)(b)) - #define sk_PKCS7_SIGNER_INFO_delete(a,b) ((PKCS7_SIGNER_INFO *) \ - sk_delete((a),(b))) - #define sk_PKCS7_SIGNER_INFO_delete_ptr(a,b) ((PKCS7_SIGNER_INFO *) \ - sk_delete_ptr((a),(char *)(b))) - #define sk_PKCS7_SIGNER_INFO_insert(a,b,c) sk_insert((a),(char *)(b),(c)) - #define sk_PKCS7_SIGNER_INFO_set_cmp_func(a,b) ((int (*) \ - (const PKCS7_SIGNER_INFO * const *,const PKCS7_SIGNER_INFO * const *)) \ - sk_set_cmp_func((a),(int (*) \ - (const char * const *, const char * const *))(b))) - #define sk_PKCS7_SIGNER_INFO_dup(a) sk_dup(a) - #define sk_PKCS7_SIGNER_INFO_pop_free(a,b) sk_pop_free((a),(void (*)(void *))(b)) - #define sk_PKCS7_SIGNER_INFO_shift(a) ((PKCS7_SIGNER_INFO *)sk_shift(a)) - #define sk_PKCS7_SIGNER_INFO_pop(a) ((PKCS7_SIGNER_INFO *)sk_pop(a)) - #define sk_PKCS7_SIGNER_INFO_sort(a) sk_sort(a) -#endif /* !DEBUG_SAFESTACK */ -/* End of perl script block, you may now edit :-) */ DECLARE_ASN1_SET_OF(PKCS7_SIGNER_INFO) typedef struct pkcs7_recip_info_st @@ -147,37 +116,6 @@ typedef struct pkcs7_recip_info_st } PKCS7_RECIP_INFO; DECLARE_STACK_OF(PKCS7_RECIP_INFO) -/* This block of defines is updated by a perl script, please do not touch! */ -#ifndef DEBUG_SAFESTACK - #define sk_PKCS7_RECIP_INFO_new(a) sk_new((int (*) \ - (const char * const *, const char * const *))(a)) - #define sk_PKCS7_RECIP_INFO_new_null() sk_new_null() - #define sk_PKCS7_RECIP_INFO_free(a) sk_free(a) - #define sk_PKCS7_RECIP_INFO_num(a) sk_num(a) - #define sk_PKCS7_RECIP_INFO_value(a,b) ((PKCS7_RECIP_INFO *) \ - sk_value((a),(b))) - #define sk_PKCS7_RECIP_INFO_set(a,b,c) ((PKCS7_RECIP_INFO *) \ - sk_set((a),(b),(char *)(c))) - #define sk_PKCS7_RECIP_INFO_zero(a) sk_zero(a) - #define sk_PKCS7_RECIP_INFO_push(a,b) sk_push((a),(char *)(b)) - #define sk_PKCS7_RECIP_INFO_unshift(a,b) sk_unshift((a),(b)) - #define sk_PKCS7_RECIP_INFO_find(a,b) sk_find((a), (char *)(b)) - #define sk_PKCS7_RECIP_INFO_delete(a,b) ((PKCS7_RECIP_INFO *) \ - sk_delete((a),(b))) - #define sk_PKCS7_RECIP_INFO_delete_ptr(a,b) ((PKCS7_RECIP_INFO *) \ - sk_delete_ptr((a),(char *)(b))) - #define sk_PKCS7_RECIP_INFO_insert(a,b,c) sk_insert((a),(char *)(b),(c)) - #define sk_PKCS7_RECIP_INFO_set_cmp_func(a,b) ((int (*) \ - (const PKCS7_RECIP_INFO * const *,const PKCS7_RECIP_INFO * const *)) \ - sk_set_cmp_func((a),(int (*) \ - (const char * const *, const char * const *))(b))) - #define sk_PKCS7_RECIP_INFO_dup(a) sk_dup(a) - #define sk_PKCS7_RECIP_INFO_pop_free(a,b) sk_pop_free((a),(void (*)(void *))(b)) - #define sk_PKCS7_RECIP_INFO_shift(a) ((PKCS7_RECIP_INFO *)sk_shift(a)) - #define sk_PKCS7_RECIP_INFO_pop(a) ((PKCS7_RECIP_INFO *)sk_pop(a)) - #define sk_PKCS7_RECIP_INFO_sort(a) sk_sort(a) -#endif /* !DEBUG_SAFESTACK */ -/* End of perl script block, you may now edit :-) */ DECLARE_ASN1_SET_OF(PKCS7_RECIP_INFO) typedef struct pkcs7_signed_st @@ -276,37 +214,6 @@ typedef struct pkcs7_st } PKCS7; DECLARE_STACK_OF(PKCS7) -/* This block of defines is updated by a perl script, please do not touch! */ -#ifndef DEBUG_SAFESTACK - #define sk_PKCS7_new(a) sk_new((int (*) \ - (const char * const *, const char * const *))(a)) - #define sk_PKCS7_new_null() sk_new_null() - #define sk_PKCS7_free(a) sk_free(a) - #define sk_PKCS7_num(a) sk_num(a) - #define sk_PKCS7_value(a,b) ((PKCS7 *) \ - sk_value((a),(b))) - #define sk_PKCS7_set(a,b,c) ((PKCS7 *) \ - sk_set((a),(b),(char *)(c))) - #define sk_PKCS7_zero(a) sk_zero(a) - #define sk_PKCS7_push(a,b) sk_push((a),(char *)(b)) - #define sk_PKCS7_unshift(a,b) sk_unshift((a),(b)) - #define sk_PKCS7_find(a,b) sk_find((a), (char *)(b)) - #define sk_PKCS7_delete(a,b) ((PKCS7 *) \ - sk_delete((a),(b))) - #define sk_PKCS7_delete_ptr(a,b) ((PKCS7 *) \ - sk_delete_ptr((a),(char *)(b))) - #define sk_PKCS7_insert(a,b,c) sk_insert((a),(char *)(b),(c)) - #define sk_PKCS7_set_cmp_func(a,b) ((int (*) \ - (const PKCS7 * const *,const PKCS7 * const *)) \ - sk_set_cmp_func((a),(int (*) \ - (const char * const *, const char * const *))(b))) - #define sk_PKCS7_dup(a) sk_dup(a) - #define sk_PKCS7_pop_free(a,b) sk_pop_free((a),(void (*)(void *))(b)) - #define sk_PKCS7_shift(a) ((PKCS7 *)sk_shift(a)) - #define sk_PKCS7_pop(a) ((PKCS7 *)sk_pop(a)) - #define sk_PKCS7_sort(a) sk_sort(a) -#endif /* !DEBUG_SAFESTACK */ -/* End of perl script block, you may now edit :-) */ DECLARE_ASN1_SET_OF(PKCS7) DECLARE_PKCS12_STACK_OF(PKCS7) diff --git a/crypto/rand/randfile.c b/crypto/rand/randfile.c index 830d6168e6..f6dc880fed 100644 --- a/crypto/rand/randfile.c +++ b/crypto/rand/randfile.c @@ -130,7 +130,7 @@ err: int RAND_write_file(const char *file) { unsigned char buf[BUFSIZE]; - int i,ret=0,err=0; + int i,ret=0,rand_err=0; FILE *out = NULL; int n; @@ -156,7 +156,7 @@ int RAND_write_file(const char *file) i=(n > BUFSIZE)?BUFSIZE:n; n-=BUFSIZE; if (RAND_bytes(buf,i) <= 0) - err=1; + rand_err=1; i=fwrite(buf,1,i,out); if (i <= 0) { @@ -189,7 +189,7 @@ int RAND_write_file(const char *file) fclose(out); memset(buf,0,BUFSIZE); err: - return(err ? -1 : ret); + return (rand_err ? -1 : ret); } const char *RAND_file_name(char *buf, int size) diff --git a/crypto/rsa/rsa.h b/crypto/rsa/rsa.h index e629c534b0..bda636a365 100644 --- a/crypto/rsa/rsa.h +++ b/crypto/rsa/rsa.h @@ -228,6 +228,10 @@ int RSA_print_fp(FILE *fp, RSA *r,int offset); int RSA_print(BIO *bp, RSA *r,int offset); #endif +int i2d_RSA_NET(RSA *a, unsigned char **pp, int (*cb)(), int sgckey); +RSA *d2i_RSA_NET(RSA **a, unsigned char **pp, long length, int (*cb)(), int sgckey); +RSA *d2i_RSA_NET_2(RSA **a, unsigned char **pp, long length, int (*cb)(), int sgckey); + int i2d_Netscape_RSA(RSA *a, unsigned char **pp, int (*cb)()); RSA *d2i_Netscape_RSA(RSA **a, unsigned char **pp, long length, int (*cb)()); /* Naughty internal function required elsewhere, to handle a MS structure diff --git a/crypto/stack/safestack.h b/crypto/stack/safestack.h index 228b4f8184..1a550244ac 100644 --- a/crypto/stack/safestack.h +++ b/crypto/stack/safestack.h @@ -66,74 +66,53 @@ STACK_OF(type) \ { \ STACK stack; \ - }; \ -STACK_OF(type) *sk_##type##_new(int (*cmp)(const type * const *, \ - const type * const *)); \ -STACK_OF(type) *sk_##type##_new_null(void); \ -void sk_##type##_free(STACK_OF(type) *sk); \ -int sk_##type##_num(const STACK_OF(type) *sk); \ -type *sk_##type##_value(const STACK_OF(type) *sk,int n); \ -type *sk_##type##_set(STACK_OF(type) *sk,int n,type *v); \ -void sk_##type##_zero(STACK_OF(type) *sk); \ -int sk_##type##_push(STACK_OF(type) *sk,type *v); \ -int sk_##type##_unshift(STACK_OF(type) *sk,type *v); \ -int sk_##type##_find(STACK_OF(type) *sk,type *v); \ -type *sk_##type##_delete(STACK_OF(type) *sk,int n); \ -type *sk_##type##_delete_ptr(STACK_OF(type) *sk,type *v); \ -int sk_##type##_insert(STACK_OF(type) *sk,type *v,int n); \ -int (*sk_##type##_set_cmp_func(STACK_OF(type) *sk, \ - int (*cmp)(const type * const *,const type * const *))) \ - (const type * const *,const type * const *); \ -STACK_OF(type) *sk_##type##_dup(STACK_OF(type) *sk); \ -void sk_##type##_pop_free(STACK_OF(type) *sk,void (*func)(type *)); \ -type *sk_##type##_shift(STACK_OF(type) *sk); \ -type *sk_##type##_pop(STACK_OF(type) *sk); \ -void sk_##type##_sort(STACK_OF(type) *sk); - -#define IMPLEMENT_STACK_OF(type) \ -STACK_OF(type) *sk_##type##_new(int (*cmp)(const type * const *, \ - const type * const *)) \ - { return (STACK_OF(type) *)sk_new( \ - (int (*)(const char * const *,const char * const *))cmp); } \ -STACK_OF(type) *sk_##type##_new_null() \ - { return (STACK_OF(type) *)sk_new_null(); } \ -void sk_##type##_free(STACK_OF(type) *sk) \ - { sk_free((STACK *)sk); } \ -int sk_##type##_num(const STACK_OF(type) *sk) \ - { return M_sk_num((const STACK *)sk); } \ -type *sk_##type##_value(const STACK_OF(type) *sk,int n) \ - { return (type *)sk_value((STACK *)sk,n); } \ -type *sk_##type##_set(STACK_OF(type) *sk,int n,type *v) \ - { return (type *)(sk_set((STACK *)sk,n,(char *)v)); } \ -void sk_##type##_zero(STACK_OF(type) *sk) \ - { sk_zero((STACK *)sk); } \ -int sk_##type##_push(STACK_OF(type) *sk,type *v) \ - { return sk_push((STACK *)sk,(char *)v); } \ -int sk_##type##_unshift(STACK_OF(type) *sk,type *v) \ - { return sk_unshift((STACK *)sk,(char *)v); } \ -int sk_##type##_find(STACK_OF(type) *sk,type *v) \ - { return sk_find((STACK *)sk,(char *)v); } \ -type *sk_##type##_delete(STACK_OF(type) *sk,int n) \ - { return (type *)sk_delete((STACK *)sk,n); } \ -type *sk_##type##_delete_ptr(STACK_OF(type) *sk,type *v) \ - { return (type *)sk_delete_ptr((STACK *)sk,(char *)v); } \ -int sk_##type##_insert(STACK_OF(type) *sk,type *v,int n) \ - { return sk_insert((STACK *)sk,(char *)v,n); } \ -int (*sk_##type##_set_cmp_func(STACK_OF(type) *sk, \ - int (*cmp)(const type * const *,const type * const *))) \ - (const type * const *,const type * const *) \ - { return (int (*)(const type * const *,const type * const *))sk_set_cmp_func( \ - (STACK *)sk, (int(*)(const char * const *, const char * const *))cmp); } \ -STACK_OF(type) *sk_##type##_dup(STACK_OF(type) *sk) \ - { return (STACK_OF(type) *)sk_dup((STACK *)sk); } \ -void sk_##type##_pop_free(STACK_OF(type) *sk,void (*func)(type *)) \ - { sk_pop_free((STACK *)sk,(void (*)(void *))func); } \ -type *sk_##type##_shift(STACK_OF(type) *sk) \ - { return (type *)sk_shift((STACK *)sk); } \ -type *sk_##type##_pop(STACK_OF(type) *sk) \ - { return (type *)sk_pop((STACK *)sk); } \ -void sk_##type##_sort(STACK_OF(type) *sk) \ - { sk_sort((STACK *)sk); } + }; + +#define IMPLEMENT_STACK_OF(type) /* nada (obsolete in new safestack approach)*/ + +/* SKM_sk_... stack macros are internal to safestack.h: + * never use them directly, use sk_<type>_... instead */ +#define SKM_sk_new(type, cmp) \ + ((STACK_OF(type) * (*)(int (*)(const type * const *, const type * const *)))sk_new)(cmp) +#define SKM_sk_new_null(type) \ + ((STACK_OF(type) * (*)(void))sk_new_null)() +#define SKM_sk_free(type, st) \ + ((void (*)(STACK_OF(type) *))sk_free)(st) +#define SKM_sk_num(type, st) \ + ((int (*)(const STACK_OF(type) *))sk_num)(st) +#define SKM_sk_value(type, st,i) \ + ((type * (*)(const STACK_OF(type) *, int))sk_value)(st, i) +#define SKM_sk_set(type, st,i,val) \ + ((type * (*)(STACK_OF(type) *, int, type *))sk_set)(st, i, val) +#define SKM_sk_zero(type, st) \ + ((void (*)(STACK_OF(type) *))sk_zero)(st) +#define SKM_sk_push(type, st,val) \ + ((int (*)(STACK_OF(type) *, type *))sk_push)(st, val) +#define SKM_sk_unshift(type, st,val) \ + ((int (*)(STACK_OF(type) *, type *))sk_unshift)(st, val) +#define SKM_sk_find(type, st,val) \ + ((int (*)(STACK_OF(type) *, type *))sk_find)(st, val) +#define SKM_sk_delete(type, st,i) \ + ((type * (*)(STACK_OF(type) *, int))sk_delete)(st, i) +#define SKM_sk_delete_ptr(type, st,ptr) \ + ((type * (*)(STACK_OF(type) *, type *))sk_delete_ptr)(st, ptr) +#define SKM_sk_insert(type, st,val,i) \ + ((int (*)(STACK_OF(type) *, type *, int))sk_insert)(st, val, i) +#define SKM_sk_set_cmp_func(type, st,cmp) \ + ((int (*(*)(STACK_OF(type) *, int (*)(const type * const *, const type * const *))) \ + (const type * const *, const type * const *))sk_set_cmp_func)\ + (st, cmp) +#define SKM_sk_dup(type, st) \ + ((STACK_OF(type) *(*)(STACK_OF(type) *))sk_dup)(st) +#define SKM_sk_pop_free(type, st,free_func) \ + ((void (*)(STACK_OF(type) *, void (*)(type *)))sk_pop_free)\ + (st, free_func) +#define SKM_sk_shift(type, st) \ + ((type * (*)(STACK_OF(type) *))sk_shift)(st) +#define SKM_sk_pop(type, st) \ + ((type * (*)(STACK_OF(type) *))sk_pop)(st) +#define SKM_sk_sort(type, st) \ + ((void (*)(STACK_OF(type) *))sk_sort)(st) #else @@ -142,6 +121,768 @@ void sk_##type##_sort(STACK_OF(type) *sk) \ #define DECLARE_STACK_OF(type) /* nada */ #define IMPLEMENT_STACK_OF(type) /* nada */ +#define SKM_sk_new(type, cmp) \ + sk_new((int (*)(const char * const *, const char * const *))(cmp)) +#define SKM_sk_new_null(type) \ + sk_new_null() +#define SKM_sk_free(type, st) \ + sk_free(st) +#define SKM_sk_num(type, st) \ + sk_num(st) +#define SKM_sk_value(type, st,i) \ + ((type *)sk_value(st, i)) +#define SKM_sk_set(type, st,i,val) \ + ((type *)sk_set(st, i,(char *)val)) +#define SKM_sk_zero(type, st) \ + sk_zero(st) +#define SKM_sk_push(type, st,val) \ + sk_push(st, (char *)val) +#define SKM_sk_unshift(type, st,val) \ + sk_unshift(st, val) +#define SKM_sk_find(type, st,val) \ + sk_find(st, (char *)val) +#define SKM_sk_delete(type, st,i) \ + ((type *)sk_delete(st, i)) +#define SKM_sk_delete_ptr(type, st,ptr) \ + ((type *)sk_delete_ptr(st,(char *)ptr)) +#define SKM_sk_insert(type, st,val,i) \ + sk_insert(st, (char *)val, i) +#define SKM_sk_set_cmp_func(type, st,cmp) \ + ((int (*)(const type * const *,const type * const *)) \ + sk_set_cmp_func(st, (int (*)(const char * const *, const char * const *))(cmp))) +#define SKM_sk_dup(type, st) \ + sk_dup(st) +#define SKM_sk_pop_free(type, st,free_func) \ + sk_pop_free(st, (void (*)(void *))free_func) +#define SKM_sk_shift(type, st) \ + ((type *)sk_shift(st)) +#define SKM_sk_pop(type, st) \ + ((type *)sk_pop(st)) +#define SKM_sk_sort(type, st) \ + sk_sort(st) + #endif -#endif /* ndef HEADER_SAFESTACK_H */ +/* This block of defines is updated by util/mkstack.pl, please do not touch! */ +#define sk_CRYPTO_dynlock_new(st) SKM_sk_new(CRYPTO_dynlock, (st)) +#define sk_CRYPTO_dynlock_new_null() SKM_sk_new_null(CRYPTO_dynlock) +#define sk_CRYPTO_dynlock_free(st) SKM_sk_free(CRYPTO_dynlock, (st)) +#define sk_CRYPTO_dynlock_num(st) SKM_sk_num(CRYPTO_dynlock, (st)) +#define sk_CRYPTO_dynlock_value(st, i) SKM_sk_value(CRYPTO_dynlock, (st), (i)) +#define sk_CRYPTO_dynlock_set(st, i, val) SKM_sk_set(CRYPTO_dynlock, (st), (i), (val)) +#define sk_CRYPTO_dynlock_zero(st) SKM_sk_zero(CRYPTO_dynlock, (st)) +#define sk_CRYPTO_dynlock_push(st, val) SKM_sk_push(CRYPTO_dynlock, (st), (val)) +#define sk_CRYPTO_dynlock_unshift(st, val) SKM_sk_unshift(CRYPTO_dynlock, (st), (val)) +#define sk_CRYPTO_dynlock_find(st, val) SKM_sk_find(CRYPTO_dynlock, (st), (val)) +#define sk_CRYPTO_dynlock_delete(st, i) SKM_sk_delete(CRYPTO_dynlock, (st), (i)) +#define sk_CRYPTO_dynlock_delete_ptr(st, ptr) SKM_sk_delete_ptr(CRYPTO_dynlock, (st), (ptr)) +#define sk_CRYPTO_dynlock_insert(st, val, i) SKM_sk_insert(CRYPTO_dynlock, (st), (val), (i)) +#define sk_CRYPTO_dynlock_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(CRYPTO_dynlock, (st), (cmp)) +#define sk_CRYPTO_dynlock_dup(st) SKM_sk_dup(CRYPTO_dynlock, st) +#define sk_CRYPTO_dynlock_pop_free(st, free_func) SKM_sk_pop_free(CRYPTO_dynlock, (st), (free_func)) +#define sk_CRYPTO_dynlock_shift(st) SKM_sk_shift(CRYPTO_dynlock, (st)) +#define sk_CRYPTO_dynlock_pop(st) SKM_sk_pop(CRYPTO_dynlock, (st)) +#define sk_CRYPTO_dynlock_sort(st) SKM_sk_sort(CRYPTO_dynlock, (st)) + +#define sk_CRYPTO_EX_DATA_FUNCS_new(st) SKM_sk_new(CRYPTO_EX_DATA_FUNCS, (st)) +#define sk_CRYPTO_EX_DATA_FUNCS_new_null() SKM_sk_new_null(CRYPTO_EX_DATA_FUNCS) +#define sk_CRYPTO_EX_DATA_FUNCS_free(st) SKM_sk_free(CRYPTO_EX_DATA_FUNCS, (st)) +#define sk_CRYPTO_EX_DATA_FUNCS_num(st) SKM_sk_num(CRYPTO_EX_DATA_FUNCS, (st)) +#define sk_CRYPTO_EX_DATA_FUNCS_value(st, i) SKM_sk_value(CRYPTO_EX_DATA_FUNCS, (st), (i)) +#define sk_CRYPTO_EX_DATA_FUNCS_set(st, i, val) SKM_sk_set(CRYPTO_EX_DATA_FUNCS, (st), (i), (val)) +#define sk_CRYPTO_EX_DATA_FUNCS_zero(st) SKM_sk_zero(CRYPTO_EX_DATA_FUNCS, (st)) +#define sk_CRYPTO_EX_DATA_FUNCS_push(st, val) SKM_sk_push(CRYPTO_EX_DATA_FUNCS, (st), (val)) +#define sk_CRYPTO_EX_DATA_FUNCS_unshift(st, val) SKM_sk_unshift(CRYPTO_EX_DATA_FUNCS, (st), (val)) +#define sk_CRYPTO_EX_DATA_FUNCS_find(st, val) SKM_sk_find(CRYPTO_EX_DATA_FUNCS, (st), (val)) +#define sk_CRYPTO_EX_DATA_FUNCS_delete(st, i) SKM_sk_delete(CRYPTO_EX_DATA_FUNCS, (st), (i)) +#define sk_CRYPTO_EX_DATA_FUNCS_delete_ptr(st, ptr) SKM_sk_delete_ptr(CRYPTO_EX_DATA_FUNCS, (st), (ptr)) +#define sk_CRYPTO_EX_DATA_FUNCS_insert(st, val, i) SKM_sk_insert(CRYPTO_EX_DATA_FUNCS, (st), (val), (i)) +#define sk_CRYPTO_EX_DATA_FUNCS_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(CRYPTO_EX_DATA_FUNCS, (st), (cmp)) +#define sk_CRYPTO_EX_DATA_FUNCS_dup(st) SKM_sk_dup(CRYPTO_EX_DATA_FUNCS, st) +#define sk_CRYPTO_EX_DATA_FUNCS_pop_free(st, free_func) SKM_sk_pop_free(CRYPTO_EX_DATA_FUNCS, (st), (free_func)) +#define sk_CRYPTO_EX_DATA_FUNCS_shift(st) SKM_sk_shift(CRYPTO_EX_DATA_FUNCS, (st)) +#define sk_CRYPTO_EX_DATA_FUNCS_pop(st) SKM_sk_pop(CRYPTO_EX_DATA_FUNCS, (st)) +#define sk_CRYPTO_EX_DATA_FUNCS_sort(st) SKM_sk_sort(CRYPTO_EX_DATA_FUNCS, (st)) + +#define sk_ASN1_STRING_TABLE_new(st) SKM_sk_new(ASN1_STRING_TABLE, (st)) +#define sk_ASN1_STRING_TABLE_new_null() SKM_sk_new_null(ASN1_STRING_TABLE) +#define sk_ASN1_STRING_TABLE_free(st) SKM_sk_free(ASN1_STRING_TABLE, (st)) +#define sk_ASN1_STRING_TABLE_num(st) SKM_sk_num(ASN1_STRING_TABLE, (st)) +#define sk_ASN1_STRING_TABLE_value(st, i) SKM_sk_value(ASN1_STRING_TABLE, (st), (i)) +#define sk_ASN1_STRING_TABLE_set(st, i, val) SKM_sk_set(ASN1_STRING_TABLE, (st), (i), (val)) +#define sk_ASN1_STRING_TABLE_zero(st) SKM_sk_zero(ASN1_STRING_TABLE, (st)) +#define sk_ASN1_STRING_TABLE_push(st, val) SKM_sk_push(ASN1_STRING_TABLE, (st), (val)) +#define sk_ASN1_STRING_TABLE_unshift(st, val) SKM_sk_unshift(ASN1_STRING_TABLE, (st), (val)) +#define sk_ASN1_STRING_TABLE_find(st, val) SKM_sk_find(ASN1_STRING_TABLE, (st), (val)) +#define sk_ASN1_STRING_TABLE_delete(st, i) SKM_sk_delete(ASN1_STRING_TABLE, (st), (i)) +#define sk_ASN1_STRING_TABLE_delete_ptr(st, ptr) SKM_sk_delete_ptr(ASN1_STRING_TABLE, (st), (ptr)) +#define sk_ASN1_STRING_TABLE_insert(st, val, i) SKM_sk_insert(ASN1_STRING_TABLE, (st), (val), (i)) +#define sk_ASN1_STRING_TABLE_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(ASN1_STRING_TABLE, (st), (cmp)) +#define sk_ASN1_STRING_TABLE_dup(st) SKM_sk_dup(ASN1_STRING_TABLE, st) +#define sk_ASN1_STRING_TABLE_pop_free(st, free_func) SKM_sk_pop_free(ASN1_STRING_TABLE, (st), (free_func)) +#define sk_ASN1_STRING_TABLE_shift(st) SKM_sk_shift(ASN1_STRING_TABLE, (st)) +#define sk_ASN1_STRING_TABLE_pop(st) SKM_sk_pop(ASN1_STRING_TABLE, (st)) +#define sk_ASN1_STRING_TABLE_sort(st) SKM_sk_sort(ASN1_STRING_TABLE, (st)) + +#define sk_ASN1_INTEGER_new(st) SKM_sk_new(ASN1_INTEGER, (st)) +#define sk_ASN1_INTEGER_new_null() SKM_sk_new_null(ASN1_INTEGER) +#define sk_ASN1_INTEGER_free(st) SKM_sk_free(ASN1_INTEGER, (st)) +#define sk_ASN1_INTEGER_num(st) SKM_sk_num(ASN1_INTEGER, (st)) +#define sk_ASN1_INTEGER_value(st, i) SKM_sk_value(ASN1_INTEGER, (st), (i)) +#define sk_ASN1_INTEGER_set(st, i, val) SKM_sk_set(ASN1_INTEGER, (st), (i), (val)) +#define sk_ASN1_INTEGER_zero(st) SKM_sk_zero(ASN1_INTEGER, (st)) +#define sk_ASN1_INTEGER_push(st, val) SKM_sk_push(ASN1_INTEGER, (st), (val)) +#define sk_ASN1_INTEGER_unshift(st, val) SKM_sk_unshift(ASN1_INTEGER, (st), (val)) +#define sk_ASN1_INTEGER_find(st, val) SKM_sk_find(ASN1_INTEGER, (st), (val)) +#define sk_ASN1_INTEGER_delete(st, i) SKM_sk_delete(ASN1_INTEGER, (st), (i)) +#define sk_ASN1_INTEGER_delete_ptr(st, ptr) SKM_sk_delete_ptr(ASN1_INTEGER, (st), (ptr)) +#define sk_ASN1_INTEGER_insert(st, val, i) SKM_sk_insert(ASN1_INTEGER, (st), (val), (i)) +#define sk_ASN1_INTEGER_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(ASN1_INTEGER, (st), (cmp)) +#define sk_ASN1_INTEGER_dup(st) SKM_sk_dup(ASN1_INTEGER, st) +#define sk_ASN1_INTEGER_pop_free(st, free_func) SKM_sk_pop_free(ASN1_INTEGER, (st), (free_func)) +#define sk_ASN1_INTEGER_shift(st) SKM_sk_shift(ASN1_INTEGER, (st)) +#define sk_ASN1_INTEGER_pop(st) SKM_sk_pop(ASN1_INTEGER, (st)) +#define sk_ASN1_INTEGER_sort(st) SKM_sk_sort(ASN1_INTEGER, (st)) + +#define sk_ASN1_TYPE_new(st) SKM_sk_new(ASN1_TYPE, (st)) +#define sk_ASN1_TYPE_new_null() SKM_sk_new_null(ASN1_TYPE) +#define sk_ASN1_TYPE_free(st) SKM_sk_free(ASN1_TYPE, (st)) +#define sk_ASN1_TYPE_num(st) SKM_sk_num(ASN1_TYPE, (st)) +#define sk_ASN1_TYPE_value(st, i) SKM_sk_value(ASN1_TYPE, (st), (i)) +#define sk_ASN1_TYPE_set(st, i, val) SKM_sk_set(ASN1_TYPE, (st), (i), (val)) +#define sk_ASN1_TYPE_zero(st) SKM_sk_zero(ASN1_TYPE, (st)) +#define sk_ASN1_TYPE_push(st, val) SKM_sk_push(ASN1_TYPE, (st), (val)) +#define sk_ASN1_TYPE_unshift(st, val) SKM_sk_unshift(ASN1_TYPE, (st), (val)) +#define sk_ASN1_TYPE_find(st, val) SKM_sk_find(ASN1_TYPE, (st), (val)) +#define sk_ASN1_TYPE_delete(st, i) SKM_sk_delete(ASN1_TYPE, (st), (i)) +#define sk_ASN1_TYPE_delete_ptr(st, ptr) SKM_sk_delete_ptr(ASN1_TYPE, (st), (ptr)) +#define sk_ASN1_TYPE_insert(st, val, i) SKM_sk_insert(ASN1_TYPE, (st), (val), (i)) +#define sk_ASN1_TYPE_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(ASN1_TYPE, (st), (cmp)) +#define sk_ASN1_TYPE_dup(st) SKM_sk_dup(ASN1_TYPE, st) +#define sk_ASN1_TYPE_pop_free(st, free_func) SKM_sk_pop_free(ASN1_TYPE, (st), (free_func)) +#define sk_ASN1_TYPE_shift(st) SKM_sk_shift(ASN1_TYPE, (st)) +#define sk_ASN1_TYPE_pop(st) SKM_sk_pop(ASN1_TYPE, (st)) +#define sk_ASN1_TYPE_sort(st) SKM_sk_sort(ASN1_TYPE, (st)) + +#define sk_ASN1_OBJECT_new(st) SKM_sk_new(ASN1_OBJECT, (st)) +#define sk_ASN1_OBJECT_new_null() SKM_sk_new_null(ASN1_OBJECT) +#define sk_ASN1_OBJECT_free(st) SKM_sk_free(ASN1_OBJECT, (st)) +#define sk_ASN1_OBJECT_num(st) SKM_sk_num(ASN1_OBJECT, (st)) +#define sk_ASN1_OBJECT_value(st, i) SKM_sk_value(ASN1_OBJECT, (st), (i)) +#define sk_ASN1_OBJECT_set(st, i, val) SKM_sk_set(ASN1_OBJECT, (st), (i), (val)) +#define sk_ASN1_OBJECT_zero(st) SKM_sk_zero(ASN1_OBJECT, (st)) +#define sk_ASN1_OBJECT_push(st, val) SKM_sk_push(ASN1_OBJECT, (st), (val)) +#define sk_ASN1_OBJECT_unshift(st, val) SKM_sk_unshift(ASN1_OBJECT, (st), (val)) +#define sk_ASN1_OBJECT_find(st, val) SKM_sk_find(ASN1_OBJECT, (st), (val)) +#define sk_ASN1_OBJECT_delete(st, i) SKM_sk_delete(ASN1_OBJECT, (st), (i)) +#define sk_ASN1_OBJECT_delete_ptr(st, ptr) SKM_sk_delete_ptr(ASN1_OBJECT, (st), (ptr)) +#define sk_ASN1_OBJECT_insert(st, val, i) SKM_sk_insert(ASN1_OBJECT, (st), (val), (i)) +#define sk_ASN1_OBJECT_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(ASN1_OBJECT, (st), (cmp)) +#define sk_ASN1_OBJECT_dup(st) SKM_sk_dup(ASN1_OBJECT, st) +#define sk_ASN1_OBJECT_pop_free(st, free_func) SKM_sk_pop_free(ASN1_OBJECT, (st), (free_func)) +#define sk_ASN1_OBJECT_shift(st) SKM_sk_shift(ASN1_OBJECT, (st)) +#define sk_ASN1_OBJECT_pop(st) SKM_sk_pop(ASN1_OBJECT, (st)) +#define sk_ASN1_OBJECT_sort(st) SKM_sk_sort(ASN1_OBJECT, (st)) + +#define sk_BIO_new(st) SKM_sk_new(BIO, (st)) +#define sk_BIO_new_null() SKM_sk_new_null(BIO) +#define sk_BIO_free(st) SKM_sk_free(BIO, (st)) +#define sk_BIO_num(st) SKM_sk_num(BIO, (st)) +#define sk_BIO_value(st, i) SKM_sk_value(BIO, (st), (i)) +#define sk_BIO_set(st, i, val) SKM_sk_set(BIO, (st), (i), (val)) +#define sk_BIO_zero(st) SKM_sk_zero(BIO, (st)) +#define sk_BIO_push(st, val) SKM_sk_push(BIO, (st), (val)) +#define sk_BIO_unshift(st, val) SKM_sk_unshift(BIO, (st), (val)) +#define sk_BIO_find(st, val) SKM_sk_find(BIO, (st), (val)) +#define sk_BIO_delete(st, i) SKM_sk_delete(BIO, (st), (i)) +#define sk_BIO_delete_ptr(st, ptr) SKM_sk_delete_ptr(BIO, (st), (ptr)) +#define sk_BIO_insert(st, val, i) SKM_sk_insert(BIO, (st), (val), (i)) +#define sk_BIO_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(BIO, (st), (cmp)) +#define sk_BIO_dup(st) SKM_sk_dup(BIO, st) +#define sk_BIO_pop_free(st, free_func) SKM_sk_pop_free(BIO, (st), (free_func)) +#define sk_BIO_shift(st) SKM_sk_shift(BIO, (st)) +#define sk_BIO_pop(st) SKM_sk_pop(BIO, (st)) +#define sk_BIO_sort(st) SKM_sk_sort(BIO, (st)) + +#define sk_CONF_VALUE_new(st) SKM_sk_new(CONF_VALUE, (st)) +#define sk_CONF_VALUE_new_null() SKM_sk_new_null(CONF_VALUE) +#define sk_CONF_VALUE_free(st) SKM_sk_free(CONF_VALUE, (st)) +#define sk_CONF_VALUE_num(st) SKM_sk_num(CONF_VALUE, (st)) +#define sk_CONF_VALUE_value(st, i) SKM_sk_value(CONF_VALUE, (st), (i)) +#define sk_CONF_VALUE_set(st, i, val) SKM_sk_set(CONF_VALUE, (st), (i), (val)) +#define sk_CONF_VALUE_zero(st) SKM_sk_zero(CONF_VALUE, (st)) +#define sk_CONF_VALUE_push(st, val) SKM_sk_push(CONF_VALUE, (st), (val)) +#define sk_CONF_VALUE_unshift(st, val) SKM_sk_unshift(CONF_VALUE, (st), (val)) +#define sk_CONF_VALUE_find(st, val) SKM_sk_find(CONF_VALUE, (st), (val)) +#define sk_CONF_VALUE_delete(st, i) SKM_sk_delete(CONF_VALUE, (st), (i)) +#define sk_CONF_VALUE_delete_ptr(st, ptr) SKM_sk_delete_ptr(CONF_VALUE, (st), (ptr)) +#define sk_CONF_VALUE_insert(st, val, i) SKM_sk_insert(CONF_VALUE, (st), (val), (i)) +#define sk_CONF_VALUE_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(CONF_VALUE, (st), (cmp)) +#define sk_CONF_VALUE_dup(st) SKM_sk_dup(CONF_VALUE, st) +#define sk_CONF_VALUE_pop_free(st, free_func) SKM_sk_pop_free(CONF_VALUE, (st), (free_func)) +#define sk_CONF_VALUE_shift(st) SKM_sk_shift(CONF_VALUE, (st)) +#define sk_CONF_VALUE_pop(st) SKM_sk_pop(CONF_VALUE, (st)) +#define sk_CONF_VALUE_sort(st) SKM_sk_sort(CONF_VALUE, (st)) + +#define sk_NAME_FUNCS_new(st) SKM_sk_new(NAME_FUNCS, (st)) +#define sk_NAME_FUNCS_new_null() SKM_sk_new_null(NAME_FUNCS) +#define sk_NAME_FUNCS_free(st) SKM_sk_free(NAME_FUNCS, (st)) +#define sk_NAME_FUNCS_num(st) SKM_sk_num(NAME_FUNCS, (st)) +#define sk_NAME_FUNCS_value(st, i) SKM_sk_value(NAME_FUNCS, (st), (i)) +#define sk_NAME_FUNCS_set(st, i, val) SKM_sk_set(NAME_FUNCS, (st), (i), (val)) +#define sk_NAME_FUNCS_zero(st) SKM_sk_zero(NAME_FUNCS, (st)) +#define sk_NAME_FUNCS_push(st, val) SKM_sk_push(NAME_FUNCS, (st), (val)) +#define sk_NAME_FUNCS_unshift(st, val) SKM_sk_unshift(NAME_FUNCS, (st), (val)) +#define sk_NAME_FUNCS_find(st, val) SKM_sk_find(NAME_FUNCS, (st), (val)) +#define sk_NAME_FUNCS_delete(st, i) SKM_sk_delete(NAME_FUNCS, (st), (i)) +#define sk_NAME_FUNCS_delete_ptr(st, ptr) SKM_sk_delete_ptr(NAME_FUNCS, (st), (ptr)) +#define sk_NAME_FUNCS_insert(st, val, i) SKM_sk_insert(NAME_FUNCS, (st), (val), (i)) +#define sk_NAME_FUNCS_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(NAME_FUNCS, (st), (cmp)) +#define sk_NAME_FUNCS_dup(st) SKM_sk_dup(NAME_FUNCS, st) +#define sk_NAME_FUNCS_pop_free(st, free_func) SKM_sk_pop_free(NAME_FUNCS, (st), (free_func)) +#define sk_NAME_FUNCS_shift(st) SKM_sk_shift(NAME_FUNCS, (st)) +#define sk_NAME_FUNCS_pop(st) SKM_sk_pop(NAME_FUNCS, (st)) +#define sk_NAME_FUNCS_sort(st) SKM_sk_sort(NAME_FUNCS, (st)) + +#define sk_PKCS12_SAFEBAG_new(st) SKM_sk_new(PKCS12_SAFEBAG, (st)) +#define sk_PKCS12_SAFEBAG_new_null() SKM_sk_new_null(PKCS12_SAFEBAG) +#define sk_PKCS12_SAFEBAG_free(st) SKM_sk_free(PKCS12_SAFEBAG, (st)) +#define sk_PKCS12_SAFEBAG_num(st) SKM_sk_num(PKCS12_SAFEBAG, (st)) +#define sk_PKCS12_SAFEBAG_value(st, i) SKM_sk_value(PKCS12_SAFEBAG, (st), (i)) +#define sk_PKCS12_SAFEBAG_set(st, i, val) SKM_sk_set(PKCS12_SAFEBAG, (st), (i), (val)) +#define sk_PKCS12_SAFEBAG_zero(st) SKM_sk_zero(PKCS12_SAFEBAG, (st)) +#define sk_PKCS12_SAFEBAG_push(st, val) SKM_sk_push(PKCS12_SAFEBAG, (st), (val)) +#define sk_PKCS12_SAFEBAG_unshift(st, val) SKM_sk_unshift(PKCS12_SAFEBAG, (st), (val)) +#define sk_PKCS12_SAFEBAG_find(st, val) SKM_sk_find(PKCS12_SAFEBAG, (st), (val)) +#define sk_PKCS12_SAFEBAG_delete(st, i) SKM_sk_delete(PKCS12_SAFEBAG, (st), (i)) +#define sk_PKCS12_SAFEBAG_delete_ptr(st, ptr) SKM_sk_delete_ptr(PKCS12_SAFEBAG, (st), (ptr)) +#define sk_PKCS12_SAFEBAG_insert(st, val, i) SKM_sk_insert(PKCS12_SAFEBAG, (st), (val), (i)) +#define sk_PKCS12_SAFEBAG_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(PKCS12_SAFEBAG, (st), (cmp)) +#define sk_PKCS12_SAFEBAG_dup(st) SKM_sk_dup(PKCS12_SAFEBAG, st) +#define sk_PKCS12_SAFEBAG_pop_free(st, free_func) SKM_sk_pop_free(PKCS12_SAFEBAG, (st), (free_func)) +#define sk_PKCS12_SAFEBAG_shift(st) SKM_sk_shift(PKCS12_SAFEBAG, (st)) +#define sk_PKCS12_SAFEBAG_pop(st) SKM_sk_pop(PKCS12_SAFEBAG, (st)) +#define sk_PKCS12_SAFEBAG_sort(st) SKM_sk_sort(PKCS12_SAFEBAG, (st)) + +#define sk_MIME_PARAM_new(st) SKM_sk_new(MIME_PARAM, (st)) +#define sk_MIME_PARAM_new_null() SKM_sk_new_null(MIME_PARAM) +#define sk_MIME_PARAM_free(st) SKM_sk_free(MIME_PARAM, (st)) +#define sk_MIME_PARAM_num(st) SKM_sk_num(MIME_PARAM, (st)) +#define sk_MIME_PARAM_value(st, i) SKM_sk_value(MIME_PARAM, (st), (i)) +#define sk_MIME_PARAM_set(st, i, val) SKM_sk_set(MIME_PARAM, (st), (i), (val)) +#define sk_MIME_PARAM_zero(st) SKM_sk_zero(MIME_PARAM, (st)) +#define sk_MIME_PARAM_push(st, val) SKM_sk_push(MIME_PARAM, (st), (val)) +#define sk_MIME_PARAM_unshift(st, val) SKM_sk_unshift(MIME_PARAM, (st), (val)) +#define sk_MIME_PARAM_find(st, val) SKM_sk_find(MIME_PARAM, (st), (val)) +#define sk_MIME_PARAM_delete(st, i) SKM_sk_delete(MIME_PARAM, (st), (i)) +#define sk_MIME_PARAM_delete_ptr(st, ptr) SKM_sk_delete_ptr(MIME_PARAM, (st), (ptr)) +#define sk_MIME_PARAM_insert(st, val, i) SKM_sk_insert(MIME_PARAM, (st), (val), (i)) +#define sk_MIME_PARAM_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(MIME_PARAM, (st), (cmp)) +#define sk_MIME_PARAM_dup(st) SKM_sk_dup(MIME_PARAM, st) +#define sk_MIME_PARAM_pop_free(st, free_func) SKM_sk_pop_free(MIME_PARAM, (st), (free_func)) +#define sk_MIME_PARAM_shift(st) SKM_sk_shift(MIME_PARAM, (st)) +#define sk_MIME_PARAM_pop(st) SKM_sk_pop(MIME_PARAM, (st)) +#define sk_MIME_PARAM_sort(st) SKM_sk_sort(MIME_PARAM, (st)) + +#define sk_MIME_HEADER_new(st) SKM_sk_new(MIME_HEADER, (st)) +#define sk_MIME_HEADER_new_null() SKM_sk_new_null(MIME_HEADER) +#define sk_MIME_HEADER_free(st) SKM_sk_free(MIME_HEADER, (st)) +#define sk_MIME_HEADER_num(st) SKM_sk_num(MIME_HEADER, (st)) +#define sk_MIME_HEADER_value(st, i) SKM_sk_value(MIME_HEADER, (st), (i)) +#define sk_MIME_HEADER_set(st, i, val) SKM_sk_set(MIME_HEADER, (st), (i), (val)) +#define sk_MIME_HEADER_zero(st) SKM_sk_zero(MIME_HEADER, (st)) +#define sk_MIME_HEADER_push(st, val) SKM_sk_push(MIME_HEADER, (st), (val)) +#define sk_MIME_HEADER_unshift(st, val) SKM_sk_unshift(MIME_HEADER, (st), (val)) +#define sk_MIME_HEADER_find(st, val) SKM_sk_find(MIME_HEADER, (st), (val)) +#define sk_MIME_HEADER_delete(st, i) SKM_sk_delete(MIME_HEADER, (st), (i)) +#define sk_MIME_HEADER_delete_ptr(st, ptr) SKM_sk_delete_ptr(MIME_HEADER, (st), (ptr)) +#define sk_MIME_HEADER_insert(st, val, i) SKM_sk_insert(MIME_HEADER, (st), (val), (i)) +#define sk_MIME_HEADER_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(MIME_HEADER, (st), (cmp)) +#define sk_MIME_HEADER_dup(st) SKM_sk_dup(MIME_HEADER, st) +#define sk_MIME_HEADER_pop_free(st, free_func) SKM_sk_pop_free(MIME_HEADER, (st), (free_func)) +#define sk_MIME_HEADER_shift(st) SKM_sk_shift(MIME_HEADER, (st)) +#define sk_MIME_HEADER_pop(st) SKM_sk_pop(MIME_HEADER, (st)) +#define sk_MIME_HEADER_sort(st) SKM_sk_sort(MIME_HEADER, (st)) + +#define sk_PKCS7_SIGNER_INFO_new(st) SKM_sk_new(PKCS7_SIGNER_INFO, (st)) +#define sk_PKCS7_SIGNER_INFO_new_null() SKM_sk_new_null(PKCS7_SIGNER_INFO) +#define sk_PKCS7_SIGNER_INFO_free(st) SKM_sk_free(PKCS7_SIGNER_INFO, (st)) +#define sk_PKCS7_SIGNER_INFO_num(st) SKM_sk_num(PKCS7_SIGNER_INFO, (st)) +#define sk_PKCS7_SIGNER_INFO_value(st, i) SKM_sk_value(PKCS7_SIGNER_INFO, (st), (i)) +#define sk_PKCS7_SIGNER_INFO_set(st, i, val) SKM_sk_set(PKCS7_SIGNER_INFO, (st), (i), (val)) +#define sk_PKCS7_SIGNER_INFO_zero(st) SKM_sk_zero(PKCS7_SIGNER_INFO, (st)) +#define sk_PKCS7_SIGNER_INFO_push(st, val) SKM_sk_push(PKCS7_SIGNER_INFO, (st), (val)) +#define sk_PKCS7_SIGNER_INFO_unshift(st, val) SKM_sk_unshift(PKCS7_SIGNER_INFO, (st), (val)) +#define sk_PKCS7_SIGNER_INFO_find(st, val) SKM_sk_find(PKCS7_SIGNER_INFO, (st), (val)) +#define sk_PKCS7_SIGNER_INFO_delete(st, i) SKM_sk_delete(PKCS7_SIGNER_INFO, (st), (i)) +#define sk_PKCS7_SIGNER_INFO_delete_ptr(st, ptr) SKM_sk_delete_ptr(PKCS7_SIGNER_INFO, (st), (ptr)) +#define sk_PKCS7_SIGNER_INFO_insert(st, val, i) SKM_sk_insert(PKCS7_SIGNER_INFO, (st), (val), (i)) +#define sk_PKCS7_SIGNER_INFO_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(PKCS7_SIGNER_INFO, (st), (cmp)) +#define sk_PKCS7_SIGNER_INFO_dup(st) SKM_sk_dup(PKCS7_SIGNER_INFO, st) +#define sk_PKCS7_SIGNER_INFO_pop_free(st, free_func) SKM_sk_pop_free(PKCS7_SIGNER_INFO, (st), (free_func)) +#define sk_PKCS7_SIGNER_INFO_shift(st) SKM_sk_shift(PKCS7_SIGNER_INFO, (st)) +#define sk_PKCS7_SIGNER_INFO_pop(st) SKM_sk_pop(PKCS7_SIGNER_INFO, (st)) +#define sk_PKCS7_SIGNER_INFO_sort(st) SKM_sk_sort(PKCS7_SIGNER_INFO, (st)) + +#define sk_PKCS7_RECIP_INFO_new(st) SKM_sk_new(PKCS7_RECIP_INFO, (st)) +#define sk_PKCS7_RECIP_INFO_new_null() SKM_sk_new_null(PKCS7_RECIP_INFO) +#define sk_PKCS7_RECIP_INFO_free(st) SKM_sk_free(PKCS7_RECIP_INFO, (st)) +#define sk_PKCS7_RECIP_INFO_num(st) SKM_sk_num(PKCS7_RECIP_INFO, (st)) +#define sk_PKCS7_RECIP_INFO_value(st, i) SKM_sk_value(PKCS7_RECIP_INFO, (st), (i)) +#define sk_PKCS7_RECIP_INFO_set(st, i, val) SKM_sk_set(PKCS7_RECIP_INFO, (st), (i), (val)) +#define sk_PKCS7_RECIP_INFO_zero(st) SKM_sk_zero(PKCS7_RECIP_INFO, (st)) +#define sk_PKCS7_RECIP_INFO_push(st, val) SKM_sk_push(PKCS7_RECIP_INFO, (st), (val)) +#define sk_PKCS7_RECIP_INFO_unshift(st, val) SKM_sk_unshift(PKCS7_RECIP_INFO, (st), (val)) +#define sk_PKCS7_RECIP_INFO_find(st, val) SKM_sk_find(PKCS7_RECIP_INFO, (st), (val)) +#define sk_PKCS7_RECIP_INFO_delete(st, i) SKM_sk_delete(PKCS7_RECIP_INFO, (st), (i)) +#define sk_PKCS7_RECIP_INFO_delete_ptr(st, ptr) SKM_sk_delete_ptr(PKCS7_RECIP_INFO, (st), (ptr)) +#define sk_PKCS7_RECIP_INFO_insert(st, val, i) SKM_sk_insert(PKCS7_RECIP_INFO, (st), (val), (i)) +#define sk_PKCS7_RECIP_INFO_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(PKCS7_RECIP_INFO, (st), (cmp)) +#define sk_PKCS7_RECIP_INFO_dup(st) SKM_sk_dup(PKCS7_RECIP_INFO, st) +#define sk_PKCS7_RECIP_INFO_pop_free(st, free_func) SKM_sk_pop_free(PKCS7_RECIP_INFO, (st), (free_func)) +#define sk_PKCS7_RECIP_INFO_shift(st) SKM_sk_shift(PKCS7_RECIP_INFO, (st)) +#define sk_PKCS7_RECIP_INFO_pop(st) SKM_sk_pop(PKCS7_RECIP_INFO, (st)) +#define sk_PKCS7_RECIP_INFO_sort(st) SKM_sk_sort(PKCS7_RECIP_INFO, (st)) + +#define sk_PKCS7_new(st) SKM_sk_new(PKCS7, (st)) +#define sk_PKCS7_new_null() SKM_sk_new_null(PKCS7) +#define sk_PKCS7_free(st) SKM_sk_free(PKCS7, (st)) +#define sk_PKCS7_num(st) SKM_sk_num(PKCS7, (st)) +#define sk_PKCS7_value(st, i) SKM_sk_value(PKCS7, (st), (i)) +#define sk_PKCS7_set(st, i, val) SKM_sk_set(PKCS7, (st), (i), (val)) +#define sk_PKCS7_zero(st) SKM_sk_zero(PKCS7, (st)) +#define sk_PKCS7_push(st, val) SKM_sk_push(PKCS7, (st), (val)) +#define sk_PKCS7_unshift(st, val) SKM_sk_unshift(PKCS7, (st), (val)) +#define sk_PKCS7_find(st, val) SKM_sk_find(PKCS7, (st), (val)) +#define sk_PKCS7_delete(st, i) SKM_sk_delete(PKCS7, (st), (i)) +#define sk_PKCS7_delete_ptr(st, ptr) SKM_sk_delete_ptr(PKCS7, (st), (ptr)) +#define sk_PKCS7_insert(st, val, i) SKM_sk_insert(PKCS7, (st), (val), (i)) +#define sk_PKCS7_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(PKCS7, (st), (cmp)) +#define sk_PKCS7_dup(st) SKM_sk_dup(PKCS7, st) +#define sk_PKCS7_pop_free(st, free_func) SKM_sk_pop_free(PKCS7, (st), (free_func)) +#define sk_PKCS7_shift(st) SKM_sk_shift(PKCS7, (st)) +#define sk_PKCS7_pop(st) SKM_sk_pop(PKCS7, (st)) +#define sk_PKCS7_sort(st) SKM_sk_sort(PKCS7, (st)) + +#define sk_X509_ALGOR_new(st) SKM_sk_new(X509_ALGOR, (st)) +#define sk_X509_ALGOR_new_null() SKM_sk_new_null(X509_ALGOR) +#define sk_X509_ALGOR_free(st) SKM_sk_free(X509_ALGOR, (st)) +#define sk_X509_ALGOR_num(st) SKM_sk_num(X509_ALGOR, (st)) +#define sk_X509_ALGOR_value(st, i) SKM_sk_value(X509_ALGOR, (st), (i)) +#define sk_X509_ALGOR_set(st, i, val) SKM_sk_set(X509_ALGOR, (st), (i), (val)) +#define sk_X509_ALGOR_zero(st) SKM_sk_zero(X509_ALGOR, (st)) +#define sk_X509_ALGOR_push(st, val) SKM_sk_push(X509_ALGOR, (st), (val)) +#define sk_X509_ALGOR_unshift(st, val) SKM_sk_unshift(X509_ALGOR, (st), (val)) +#define sk_X509_ALGOR_find(st, val) SKM_sk_find(X509_ALGOR, (st), (val)) +#define sk_X509_ALGOR_delete(st, i) SKM_sk_delete(X509_ALGOR, (st), (i)) +#define sk_X509_ALGOR_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_ALGOR, (st), (ptr)) +#define sk_X509_ALGOR_insert(st, val, i) SKM_sk_insert(X509_ALGOR, (st), (val), (i)) +#define sk_X509_ALGOR_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_ALGOR, (st), (cmp)) +#define sk_X509_ALGOR_dup(st) SKM_sk_dup(X509_ALGOR, st) +#define sk_X509_ALGOR_pop_free(st, free_func) SKM_sk_pop_free(X509_ALGOR, (st), (free_func)) +#define sk_X509_ALGOR_shift(st) SKM_sk_shift(X509_ALGOR, (st)) +#define sk_X509_ALGOR_pop(st) SKM_sk_pop(X509_ALGOR, (st)) +#define sk_X509_ALGOR_sort(st) SKM_sk_sort(X509_ALGOR, (st)) + +#define sk_X509_NAME_ENTRY_new(st) SKM_sk_new(X509_NAME_ENTRY, (st)) +#define sk_X509_NAME_ENTRY_new_null() SKM_sk_new_null(X509_NAME_ENTRY) +#define sk_X509_NAME_ENTRY_free(st) SKM_sk_free(X509_NAME_ENTRY, (st)) +#define sk_X509_NAME_ENTRY_num(st) SKM_sk_num(X509_NAME_ENTRY, (st)) +#define sk_X509_NAME_ENTRY_value(st, i) SKM_sk_value(X509_NAME_ENTRY, (st), (i)) +#define sk_X509_NAME_ENTRY_set(st, i, val) SKM_sk_set(X509_NAME_ENTRY, (st), (i), (val)) +#define sk_X509_NAME_ENTRY_zero(st) SKM_sk_zero(X509_NAME_ENTRY, (st)) +#define sk_X509_NAME_ENTRY_push(st, val) SKM_sk_push(X509_NAME_ENTRY, (st), (val)) +#define sk_X509_NAME_ENTRY_unshift(st, val) SKM_sk_unshift(X509_NAME_ENTRY, (st), (val)) +#define sk_X509_NAME_ENTRY_find(st, val) SKM_sk_find(X509_NAME_ENTRY, (st), (val)) +#define sk_X509_NAME_ENTRY_delete(st, i) SKM_sk_delete(X509_NAME_ENTRY, (st), (i)) +#define sk_X509_NAME_ENTRY_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_NAME_ENTRY, (st), (ptr)) +#define sk_X509_NAME_ENTRY_insert(st, val, i) SKM_sk_insert(X509_NAME_ENTRY, (st), (val), (i)) +#define sk_X509_NAME_ENTRY_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_NAME_ENTRY, (st), (cmp)) +#define sk_X509_NAME_ENTRY_dup(st) SKM_sk_dup(X509_NAME_ENTRY, st) +#define sk_X509_NAME_ENTRY_pop_free(st, free_func) SKM_sk_pop_free(X509_NAME_ENTRY, (st), (free_func)) +#define sk_X509_NAME_ENTRY_shift(st) SKM_sk_shift(X509_NAME_ENTRY, (st)) +#define sk_X509_NAME_ENTRY_pop(st) SKM_sk_pop(X509_NAME_ENTRY, (st)) +#define sk_X509_NAME_ENTRY_sort(st) SKM_sk_sort(X509_NAME_ENTRY, (st)) + +#define sk_X509_NAME_new(st) SKM_sk_new(X509_NAME, (st)) +#define sk_X509_NAME_new_null() SKM_sk_new_null(X509_NAME) +#define sk_X509_NAME_free(st) SKM_sk_free(X509_NAME, (st)) +#define sk_X509_NAME_num(st) SKM_sk_num(X509_NAME, (st)) +#define sk_X509_NAME_value(st, i) SKM_sk_value(X509_NAME, (st), (i)) +#define sk_X509_NAME_set(st, i, val) SKM_sk_set(X509_NAME, (st), (i), (val)) +#define sk_X509_NAME_zero(st) SKM_sk_zero(X509_NAME, (st)) +#define sk_X509_NAME_push(st, val) SKM_sk_push(X509_NAME, (st), (val)) +#define sk_X509_NAME_unshift(st, val) SKM_sk_unshift(X509_NAME, (st), (val)) +#define sk_X509_NAME_find(st, val) SKM_sk_find(X509_NAME, (st), (val)) +#define sk_X509_NAME_delete(st, i) SKM_sk_delete(X509_NAME, (st), (i)) +#define sk_X509_NAME_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_NAME, (st), (ptr)) +#define sk_X509_NAME_insert(st, val, i) SKM_sk_insert(X509_NAME, (st), (val), (i)) +#define sk_X509_NAME_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_NAME, (st), (cmp)) +#define sk_X509_NAME_dup(st) SKM_sk_dup(X509_NAME, st) +#define sk_X509_NAME_pop_free(st, free_func) SKM_sk_pop_free(X509_NAME, (st), (free_func)) +#define sk_X509_NAME_shift(st) SKM_sk_shift(X509_NAME, (st)) +#define sk_X509_NAME_pop(st) SKM_sk_pop(X509_NAME, (st)) +#define sk_X509_NAME_sort(st) SKM_sk_sort(X509_NAME, (st)) + +#define sk_X509_EXTENSION_new(st) SKM_sk_new(X509_EXTENSION, (st)) +#define sk_X509_EXTENSION_new_null() SKM_sk_new_null(X509_EXTENSION) +#define sk_X509_EXTENSION_free(st) SKM_sk_free(X509_EXTENSION, (st)) +#define sk_X509_EXTENSION_num(st) SKM_sk_num(X509_EXTENSION, (st)) +#define sk_X509_EXTENSION_value(st, i) SKM_sk_value(X509_EXTENSION, (st), (i)) +#define sk_X509_EXTENSION_set(st, i, val) SKM_sk_set(X509_EXTENSION, (st), (i), (val)) +#define sk_X509_EXTENSION_zero(st) SKM_sk_zero(X509_EXTENSION, (st)) +#define sk_X509_EXTENSION_push(st, val) SKM_sk_push(X509_EXTENSION, (st), (val)) +#define sk_X509_EXTENSION_unshift(st, val) SKM_sk_unshift(X509_EXTENSION, (st), (val)) +#define sk_X509_EXTENSION_find(st, val) SKM_sk_find(X509_EXTENSION, (st), (val)) +#define sk_X509_EXTENSION_delete(st, i) SKM_sk_delete(X509_EXTENSION, (st), (i)) +#define sk_X509_EXTENSION_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_EXTENSION, (st), (ptr)) +#define sk_X509_EXTENSION_insert(st, val, i) SKM_sk_insert(X509_EXTENSION, (st), (val), (i)) +#define sk_X509_EXTENSION_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_EXTENSION, (st), (cmp)) +#define sk_X509_EXTENSION_dup(st) SKM_sk_dup(X509_EXTENSION, st) +#define sk_X509_EXTENSION_pop_free(st, free_func) SKM_sk_pop_free(X509_EXTENSION, (st), (free_func)) +#define sk_X509_EXTENSION_shift(st) SKM_sk_shift(X509_EXTENSION, (st)) +#define sk_X509_EXTENSION_pop(st) SKM_sk_pop(X509_EXTENSION, (st)) +#define sk_X509_EXTENSION_sort(st) SKM_sk_sort(X509_EXTENSION, (st)) + +#define sk_X509_ATTRIBUTE_new(st) SKM_sk_new(X509_ATTRIBUTE, (st)) +#define sk_X509_ATTRIBUTE_new_null() SKM_sk_new_null(X509_ATTRIBUTE) +#define sk_X509_ATTRIBUTE_free(st) SKM_sk_free(X509_ATTRIBUTE, (st)) +#define sk_X509_ATTRIBUTE_num(st) SKM_sk_num(X509_ATTRIBUTE, (st)) +#define sk_X509_ATTRIBUTE_value(st, i) SKM_sk_value(X509_ATTRIBUTE, (st), (i)) +#define sk_X509_ATTRIBUTE_set(st, i, val) SKM_sk_set(X509_ATTRIBUTE, (st), (i), (val)) +#define sk_X509_ATTRIBUTE_zero(st) SKM_sk_zero(X509_ATTRIBUTE, (st)) +#define sk_X509_ATTRIBUTE_push(st, val) SKM_sk_push(X509_ATTRIBUTE, (st), (val)) +#define sk_X509_ATTRIBUTE_unshift(st, val) SKM_sk_unshift(X509_ATTRIBUTE, (st), (val)) +#define sk_X509_ATTRIBUTE_find(st, val) SKM_sk_find(X509_ATTRIBUTE, (st), (val)) +#define sk_X509_ATTRIBUTE_delete(st, i) SKM_sk_delete(X509_ATTRIBUTE, (st), (i)) +#define sk_X509_ATTRIBUTE_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_ATTRIBUTE, (st), (ptr)) +#define sk_X509_ATTRIBUTE_insert(st, val, i) SKM_sk_insert(X509_ATTRIBUTE, (st), (val), (i)) +#define sk_X509_ATTRIBUTE_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_ATTRIBUTE, (st), (cmp)) +#define sk_X509_ATTRIBUTE_dup(st) SKM_sk_dup(X509_ATTRIBUTE, st) +#define sk_X509_ATTRIBUTE_pop_free(st, free_func) SKM_sk_pop_free(X509_ATTRIBUTE, (st), (free_func)) +#define sk_X509_ATTRIBUTE_shift(st) SKM_sk_shift(X509_ATTRIBUTE, (st)) +#define sk_X509_ATTRIBUTE_pop(st) SKM_sk_pop(X509_ATTRIBUTE, (st)) +#define sk_X509_ATTRIBUTE_sort(st) SKM_sk_sort(X509_ATTRIBUTE, (st)) + +#define sk_X509_new(st) SKM_sk_new(X509, (st)) +#define sk_X509_new_null() SKM_sk_new_null(X509) +#define sk_X509_free(st) SKM_sk_free(X509, (st)) +#define sk_X509_num(st) SKM_sk_num(X509, (st)) +#define sk_X509_value(st, i) SKM_sk_value(X509, (st), (i)) +#define sk_X509_set(st, i, val) SKM_sk_set(X509, (st), (i), (val)) +#define sk_X509_zero(st) SKM_sk_zero(X509, (st)) +#define sk_X509_push(st, val) SKM_sk_push(X509, (st), (val)) +#define sk_X509_unshift(st, val) SKM_sk_unshift(X509, (st), (val)) +#define sk_X509_find(st, val) SKM_sk_find(X509, (st), (val)) +#define sk_X509_delete(st, i) SKM_sk_delete(X509, (st), (i)) +#define sk_X509_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509, (st), (ptr)) +#define sk_X509_insert(st, val, i) SKM_sk_insert(X509, (st), (val), (i)) +#define sk_X509_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509, (st), (cmp)) +#define sk_X509_dup(st) SKM_sk_dup(X509, st) +#define sk_X509_pop_free(st, free_func) SKM_sk_pop_free(X509, (st), (free_func)) +#define sk_X509_shift(st) SKM_sk_shift(X509, (st)) +#define sk_X509_pop(st) SKM_sk_pop(X509, (st)) +#define sk_X509_sort(st) SKM_sk_sort(X509, (st)) + +#define sk_X509_TRUST_new(st) SKM_sk_new(X509_TRUST, (st)) +#define sk_X509_TRUST_new_null() SKM_sk_new_null(X509_TRUST) +#define sk_X509_TRUST_free(st) SKM_sk_free(X509_TRUST, (st)) +#define sk_X509_TRUST_num(st) SKM_sk_num(X509_TRUST, (st)) +#define sk_X509_TRUST_value(st, i) SKM_sk_value(X509_TRUST, (st), (i)) +#define sk_X509_TRUST_set(st, i, val) SKM_sk_set(X509_TRUST, (st), (i), (val)) +#define sk_X509_TRUST_zero(st) SKM_sk_zero(X509_TRUST, (st)) +#define sk_X509_TRUST_push(st, val) SKM_sk_push(X509_TRUST, (st), (val)) +#define sk_X509_TRUST_unshift(st, val) SKM_sk_unshift(X509_TRUST, (st), (val)) +#define sk_X509_TRUST_find(st, val) SKM_sk_find(X509_TRUST, (st), (val)) +#define sk_X509_TRUST_delete(st, i) SKM_sk_delete(X509_TRUST, (st), (i)) +#define sk_X509_TRUST_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_TRUST, (st), (ptr)) +#define sk_X509_TRUST_insert(st, val, i) SKM_sk_insert(X509_TRUST, (st), (val), (i)) +#define sk_X509_TRUST_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_TRUST, (st), (cmp)) +#define sk_X509_TRUST_dup(st) SKM_sk_dup(X509_TRUST, st) +#define sk_X509_TRUST_pop_free(st, free_func) SKM_sk_pop_free(X509_TRUST, (st), (free_func)) +#define sk_X509_TRUST_shift(st) SKM_sk_shift(X509_TRUST, (st)) +#define sk_X509_TRUST_pop(st) SKM_sk_pop(X509_TRUST, (st)) +#define sk_X509_TRUST_sort(st) SKM_sk_sort(X509_TRUST, (st)) + +#define sk_X509_REVOKED_new(st) SKM_sk_new(X509_REVOKED, (st)) +#define sk_X509_REVOKED_new_null() SKM_sk_new_null(X509_REVOKED) +#define sk_X509_REVOKED_free(st) SKM_sk_free(X509_REVOKED, (st)) +#define sk_X509_REVOKED_num(st) SKM_sk_num(X509_REVOKED, (st)) +#define sk_X509_REVOKED_value(st, i) SKM_sk_value(X509_REVOKED, (st), (i)) +#define sk_X509_REVOKED_set(st, i, val) SKM_sk_set(X509_REVOKED, (st), (i), (val)) +#define sk_X509_REVOKED_zero(st) SKM_sk_zero(X509_REVOKED, (st)) +#define sk_X509_REVOKED_push(st, val) SKM_sk_push(X509_REVOKED, (st), (val)) +#define sk_X509_REVOKED_unshift(st, val) SKM_sk_unshift(X509_REVOKED, (st), (val)) +#define sk_X509_REVOKED_find(st, val) SKM_sk_find(X509_REVOKED, (st), (val)) +#define sk_X509_REVOKED_delete(st, i) SKM_sk_delete(X509_REVOKED, (st), (i)) +#define sk_X509_REVOKED_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_REVOKED, (st), (ptr)) +#define sk_X509_REVOKED_insert(st, val, i) SKM_sk_insert(X509_REVOKED, (st), (val), (i)) +#define sk_X509_REVOKED_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_REVOKED, (st), (cmp)) +#define sk_X509_REVOKED_dup(st) SKM_sk_dup(X509_REVOKED, st) +#define sk_X509_REVOKED_pop_free(st, free_func) SKM_sk_pop_free(X509_REVOKED, (st), (free_func)) +#define sk_X509_REVOKED_shift(st) SKM_sk_shift(X509_REVOKED, (st)) +#define sk_X509_REVOKED_pop(st) SKM_sk_pop(X509_REVOKED, (st)) +#define sk_X509_REVOKED_sort(st) SKM_sk_sort(X509_REVOKED, (st)) + +#define sk_X509_CRL_new(st) SKM_sk_new(X509_CRL, (st)) +#define sk_X509_CRL_new_null() SKM_sk_new_null(X509_CRL) +#define sk_X509_CRL_free(st) SKM_sk_free(X509_CRL, (st)) +#define sk_X509_CRL_num(st) SKM_sk_num(X509_CRL, (st)) +#define sk_X509_CRL_value(st, i) SKM_sk_value(X509_CRL, (st), (i)) +#define sk_X509_CRL_set(st, i, val) SKM_sk_set(X509_CRL, (st), (i), (val)) +#define sk_X509_CRL_zero(st) SKM_sk_zero(X509_CRL, (st)) +#define sk_X509_CRL_push(st, val) SKM_sk_push(X509_CRL, (st), (val)) +#define sk_X509_CRL_unshift(st, val) SKM_sk_unshift(X509_CRL, (st), (val)) +#define sk_X509_CRL_find(st, val) SKM_sk_find(X509_CRL, (st), (val)) +#define sk_X509_CRL_delete(st, i) SKM_sk_delete(X509_CRL, (st), (i)) +#define sk_X509_CRL_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_CRL, (st), (ptr)) +#define sk_X509_CRL_insert(st, val, i) SKM_sk_insert(X509_CRL, (st), (val), (i)) +#define sk_X509_CRL_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_CRL, (st), (cmp)) +#define sk_X509_CRL_dup(st) SKM_sk_dup(X509_CRL, st) +#define sk_X509_CRL_pop_free(st, free_func) SKM_sk_pop_free(X509_CRL, (st), (free_func)) +#define sk_X509_CRL_shift(st) SKM_sk_shift(X509_CRL, (st)) +#define sk_X509_CRL_pop(st) SKM_sk_pop(X509_CRL, (st)) +#define sk_X509_CRL_sort(st) SKM_sk_sort(X509_CRL, (st)) + +#define sk_X509_INFO_new(st) SKM_sk_new(X509_INFO, (st)) +#define sk_X509_INFO_new_null() SKM_sk_new_null(X509_INFO) +#define sk_X509_INFO_free(st) SKM_sk_free(X509_INFO, (st)) +#define sk_X509_INFO_num(st) SKM_sk_num(X509_INFO, (st)) +#define sk_X509_INFO_value(st, i) SKM_sk_value(X509_INFO, (st), (i)) +#define sk_X509_INFO_set(st, i, val) SKM_sk_set(X509_INFO, (st), (i), (val)) +#define sk_X509_INFO_zero(st) SKM_sk_zero(X509_INFO, (st)) +#define sk_X509_INFO_push(st, val) SKM_sk_push(X509_INFO, (st), (val)) +#define sk_X509_INFO_unshift(st, val) SKM_sk_unshift(X509_INFO, (st), (val)) +#define sk_X509_INFO_find(st, val) SKM_sk_find(X509_INFO, (st), (val)) +#define sk_X509_INFO_delete(st, i) SKM_sk_delete(X509_INFO, (st), (i)) +#define sk_X509_INFO_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_INFO, (st), (ptr)) +#define sk_X509_INFO_insert(st, val, i) SKM_sk_insert(X509_INFO, (st), (val), (i)) +#define sk_X509_INFO_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_INFO, (st), (cmp)) +#define sk_X509_INFO_dup(st) SKM_sk_dup(X509_INFO, st) +#define sk_X509_INFO_pop_free(st, free_func) SKM_sk_pop_free(X509_INFO, (st), (free_func)) +#define sk_X509_INFO_shift(st) SKM_sk_shift(X509_INFO, (st)) +#define sk_X509_INFO_pop(st) SKM_sk_pop(X509_INFO, (st)) +#define sk_X509_INFO_sort(st) SKM_sk_sort(X509_INFO, (st)) + +#define sk_X509_LOOKUP_new(st) SKM_sk_new(X509_LOOKUP, (st)) +#define sk_X509_LOOKUP_new_null() SKM_sk_new_null(X509_LOOKUP) +#define sk_X509_LOOKUP_free(st) SKM_sk_free(X509_LOOKUP, (st)) +#define sk_X509_LOOKUP_num(st) SKM_sk_num(X509_LOOKUP, (st)) +#define sk_X509_LOOKUP_value(st, i) SKM_sk_value(X509_LOOKUP, (st), (i)) +#define sk_X509_LOOKUP_set(st, i, val) SKM_sk_set(X509_LOOKUP, (st), (i), (val)) +#define sk_X509_LOOKUP_zero(st) SKM_sk_zero(X509_LOOKUP, (st)) +#define sk_X509_LOOKUP_push(st, val) SKM_sk_push(X509_LOOKUP, (st), (val)) +#define sk_X509_LOOKUP_unshift(st, val) SKM_sk_unshift(X509_LOOKUP, (st), (val)) +#define sk_X509_LOOKUP_find(st, val) SKM_sk_find(X509_LOOKUP, (st), (val)) +#define sk_X509_LOOKUP_delete(st, i) SKM_sk_delete(X509_LOOKUP, (st), (i)) +#define sk_X509_LOOKUP_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_LOOKUP, (st), (ptr)) +#define sk_X509_LOOKUP_insert(st, val, i) SKM_sk_insert(X509_LOOKUP, (st), (val), (i)) +#define sk_X509_LOOKUP_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_LOOKUP, (st), (cmp)) +#define sk_X509_LOOKUP_dup(st) SKM_sk_dup(X509_LOOKUP, st) +#define sk_X509_LOOKUP_pop_free(st, free_func) SKM_sk_pop_free(X509_LOOKUP, (st), (free_func)) +#define sk_X509_LOOKUP_shift(st) SKM_sk_shift(X509_LOOKUP, (st)) +#define sk_X509_LOOKUP_pop(st) SKM_sk_pop(X509_LOOKUP, (st)) +#define sk_X509_LOOKUP_sort(st) SKM_sk_sort(X509_LOOKUP, (st)) + +#define sk_X509V3_EXT_METHOD_new(st) SKM_sk_new(X509V3_EXT_METHOD, (st)) +#define sk_X509V3_EXT_METHOD_new_null() SKM_sk_new_null(X509V3_EXT_METHOD) +#define sk_X509V3_EXT_METHOD_free(st) SKM_sk_free(X509V3_EXT_METHOD, (st)) +#define sk_X509V3_EXT_METHOD_num(st) SKM_sk_num(X509V3_EXT_METHOD, (st)) +#define sk_X509V3_EXT_METHOD_value(st, i) SKM_sk_value(X509V3_EXT_METHOD, (st), (i)) +#define sk_X509V3_EXT_METHOD_set(st, i, val) SKM_sk_set(X509V3_EXT_METHOD, (st), (i), (val)) +#define sk_X509V3_EXT_METHOD_zero(st) SKM_sk_zero(X509V3_EXT_METHOD, (st)) +#define sk_X509V3_EXT_METHOD_push(st, val) SKM_sk_push(X509V3_EXT_METHOD, (st), (val)) +#define sk_X509V3_EXT_METHOD_unshift(st, val) SKM_sk_unshift(X509V3_EXT_METHOD, (st), (val)) +#define sk_X509V3_EXT_METHOD_find(st, val) SKM_sk_find(X509V3_EXT_METHOD, (st), (val)) +#define sk_X509V3_EXT_METHOD_delete(st, i) SKM_sk_delete(X509V3_EXT_METHOD, (st), (i)) +#define sk_X509V3_EXT_METHOD_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509V3_EXT_METHOD, (st), (ptr)) +#define sk_X509V3_EXT_METHOD_insert(st, val, i) SKM_sk_insert(X509V3_EXT_METHOD, (st), (val), (i)) +#define sk_X509V3_EXT_METHOD_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509V3_EXT_METHOD, (st), (cmp)) +#define sk_X509V3_EXT_METHOD_dup(st) SKM_sk_dup(X509V3_EXT_METHOD, st) +#define sk_X509V3_EXT_METHOD_pop_free(st, free_func) SKM_sk_pop_free(X509V3_EXT_METHOD, (st), (free_func)) +#define sk_X509V3_EXT_METHOD_shift(st) SKM_sk_shift(X509V3_EXT_METHOD, (st)) +#define sk_X509V3_EXT_METHOD_pop(st) SKM_sk_pop(X509V3_EXT_METHOD, (st)) +#define sk_X509V3_EXT_METHOD_sort(st) SKM_sk_sort(X509V3_EXT_METHOD, (st)) + +#define sk_GENERAL_NAME_new(st) SKM_sk_new(GENERAL_NAME, (st)) +#define sk_GENERAL_NAME_new_null() SKM_sk_new_null(GENERAL_NAME) +#define sk_GENERAL_NAME_free(st) SKM_sk_free(GENERAL_NAME, (st)) +#define sk_GENERAL_NAME_num(st) SKM_sk_num(GENERAL_NAME, (st)) +#define sk_GENERAL_NAME_value(st, i) SKM_sk_value(GENERAL_NAME, (st), (i)) +#define sk_GENERAL_NAME_set(st, i, val) SKM_sk_set(GENERAL_NAME, (st), (i), (val)) +#define sk_GENERAL_NAME_zero(st) SKM_sk_zero(GENERAL_NAME, (st)) +#define sk_GENERAL_NAME_push(st, val) SKM_sk_push(GENERAL_NAME, (st), (val)) +#define sk_GENERAL_NAME_unshift(st, val) SKM_sk_unshift(GENERAL_NAME, (st), (val)) +#define sk_GENERAL_NAME_find(st, val) SKM_sk_find(GENERAL_NAME, (st), (val)) +#define sk_GENERAL_NAME_delete(st, i) SKM_sk_delete(GENERAL_NAME, (st), (i)) +#define sk_GENERAL_NAME_delete_ptr(st, ptr) SKM_sk_delete_ptr(GENERAL_NAME, (st), (ptr)) +#define sk_GENERAL_NAME_insert(st, val, i) SKM_sk_insert(GENERAL_NAME, (st), (val), (i)) +#define sk_GENERAL_NAME_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(GENERAL_NAME, (st), (cmp)) +#define sk_GENERAL_NAME_dup(st) SKM_sk_dup(GENERAL_NAME, st) +#define sk_GENERAL_NAME_pop_free(st, free_func) SKM_sk_pop_free(GENERAL_NAME, (st), (free_func)) +#define sk_GENERAL_NAME_shift(st) SKM_sk_shift(GENERAL_NAME, (st)) +#define sk_GENERAL_NAME_pop(st) SKM_sk_pop(GENERAL_NAME, (st)) +#define sk_GENERAL_NAME_sort(st) SKM_sk_sort(GENERAL_NAME, (st)) + +#define sk_ACCESS_DESCRIPTION_new(st) SKM_sk_new(ACCESS_DESCRIPTION, (st)) +#define sk_ACCESS_DESCRIPTION_new_null() SKM_sk_new_null(ACCESS_DESCRIPTION) +#define sk_ACCESS_DESCRIPTION_free(st) SKM_sk_free(ACCESS_DESCRIPTION, (st)) +#define sk_ACCESS_DESCRIPTION_num(st) SKM_sk_num(ACCESS_DESCRIPTION, (st)) +#define sk_ACCESS_DESCRIPTION_value(st, i) SKM_sk_value(ACCESS_DESCRIPTION, (st), (i)) +#define sk_ACCESS_DESCRIPTION_set(st, i, val) SKM_sk_set(ACCESS_DESCRIPTION, (st), (i), (val)) +#define sk_ACCESS_DESCRIPTION_zero(st) SKM_sk_zero(ACCESS_DESCRIPTION, (st)) +#define sk_ACCESS_DESCRIPTION_push(st, val) SKM_sk_push(ACCESS_DESCRIPTION, (st), (val)) +#define sk_ACCESS_DESCRIPTION_unshift(st, val) SKM_sk_unshift(ACCESS_DESCRIPTION, (st), (val)) +#define sk_ACCESS_DESCRIPTION_find(st, val) SKM_sk_find(ACCESS_DESCRIPTION, (st), (val)) +#define sk_ACCESS_DESCRIPTION_delete(st, i) SKM_sk_delete(ACCESS_DESCRIPTION, (st), (i)) +#define sk_ACCESS_DESCRIPTION_delete_ptr(st, ptr) SKM_sk_delete_ptr(ACCESS_DESCRIPTION, (st), (ptr)) +#define sk_ACCESS_DESCRIPTION_insert(st, val, i) SKM_sk_insert(ACCESS_DESCRIPTION, (st), (val), (i)) +#define sk_ACCESS_DESCRIPTION_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(ACCESS_DESCRIPTION, (st), (cmp)) +#define sk_ACCESS_DESCRIPTION_dup(st) SKM_sk_dup(ACCESS_DESCRIPTION, st) +#define sk_ACCESS_DESCRIPTION_pop_free(st, free_func) SKM_sk_pop_free(ACCESS_DESCRIPTION, (st), (free_func)) +#define sk_ACCESS_DESCRIPTION_shift(st) SKM_sk_shift(ACCESS_DESCRIPTION, (st)) +#define sk_ACCESS_DESCRIPTION_pop(st) SKM_sk_pop(ACCESS_DESCRIPTION, (st)) +#define sk_ACCESS_DESCRIPTION_sort(st) SKM_sk_sort(ACCESS_DESCRIPTION, (st)) + +#define sk_DIST_POINT_new(st) SKM_sk_new(DIST_POINT, (st)) +#define sk_DIST_POINT_new_null() SKM_sk_new_null(DIST_POINT) +#define sk_DIST_POINT_free(st) SKM_sk_free(DIST_POINT, (st)) +#define sk_DIST_POINT_num(st) SKM_sk_num(DIST_POINT, (st)) +#define sk_DIST_POINT_value(st, i) SKM_sk_value(DIST_POINT, (st), (i)) +#define sk_DIST_POINT_set(st, i, val) SKM_sk_set(DIST_POINT, (st), (i), (val)) +#define sk_DIST_POINT_zero(st) SKM_sk_zero(DIST_POINT, (st)) +#define sk_DIST_POINT_push(st, val) SKM_sk_push(DIST_POINT, (st), (val)) +#define sk_DIST_POINT_unshift(st, val) SKM_sk_unshift(DIST_POINT, (st), (val)) +#define sk_DIST_POINT_find(st, val) SKM_sk_find(DIST_POINT, (st), (val)) +#define sk_DIST_POINT_delete(st, i) SKM_sk_delete(DIST_POINT, (st), (i)) +#define sk_DIST_POINT_delete_ptr(st, ptr) SKM_sk_delete_ptr(DIST_POINT, (st), (ptr)) +#define sk_DIST_POINT_insert(st, val, i) SKM_sk_insert(DIST_POINT, (st), (val), (i)) +#define sk_DIST_POINT_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(DIST_POINT, (st), (cmp)) +#define sk_DIST_POINT_dup(st) SKM_sk_dup(DIST_POINT, st) +#define sk_DIST_POINT_pop_free(st, free_func) SKM_sk_pop_free(DIST_POINT, (st), (free_func)) +#define sk_DIST_POINT_shift(st) SKM_sk_shift(DIST_POINT, (st)) +#define sk_DIST_POINT_pop(st) SKM_sk_pop(DIST_POINT, (st)) +#define sk_DIST_POINT_sort(st) SKM_sk_sort(DIST_POINT, (st)) + +#define sk_SXNETID_new(st) SKM_sk_new(SXNETID, (st)) +#define sk_SXNETID_new_null() SKM_sk_new_null(SXNETID) +#define sk_SXNETID_free(st) SKM_sk_free(SXNETID, (st)) +#define sk_SXNETID_num(st) SKM_sk_num(SXNETID, (st)) +#define sk_SXNETID_value(st, i) SKM_sk_value(SXNETID, (st), (i)) +#define sk_SXNETID_set(st, i, val) SKM_sk_set(SXNETID, (st), (i), (val)) +#define sk_SXNETID_zero(st) SKM_sk_zero(SXNETID, (st)) +#define sk_SXNETID_push(st, val) SKM_sk_push(SXNETID, (st), (val)) +#define sk_SXNETID_unshift(st, val) SKM_sk_unshift(SXNETID, (st), (val)) +#define sk_SXNETID_find(st, val) SKM_sk_find(SXNETID, (st), (val)) +#define sk_SXNETID_delete(st, i) SKM_sk_delete(SXNETID, (st), (i)) +#define sk_SXNETID_delete_ptr(st, ptr) SKM_sk_delete_ptr(SXNETID, (st), (ptr)) +#define sk_SXNETID_insert(st, val, i) SKM_sk_insert(SXNETID, (st), (val), (i)) +#define sk_SXNETID_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(SXNETID, (st), (cmp)) +#define sk_SXNETID_dup(st) SKM_sk_dup(SXNETID, st) +#define sk_SXNETID_pop_free(st, free_func) SKM_sk_pop_free(SXNETID, (st), (free_func)) +#define sk_SXNETID_shift(st) SKM_sk_shift(SXNETID, (st)) +#define sk_SXNETID_pop(st) SKM_sk_pop(SXNETID, (st)) +#define sk_SXNETID_sort(st) SKM_sk_sort(SXNETID, (st)) + +#define sk_POLICYQUALINFO_new(st) SKM_sk_new(POLICYQUALINFO, (st)) +#define sk_POLICYQUALINFO_new_null() SKM_sk_new_null(POLICYQUALINFO) +#define sk_POLICYQUALINFO_free(st) SKM_sk_free(POLICYQUALINFO, (st)) +#define sk_POLICYQUALINFO_num(st) SKM_sk_num(POLICYQUALINFO, (st)) +#define sk_POLICYQUALINFO_value(st, i) SKM_sk_value(POLICYQUALINFO, (st), (i)) +#define sk_POLICYQUALINFO_set(st, i, val) SKM_sk_set(POLICYQUALINFO, (st), (i), (val)) +#define sk_POLICYQUALINFO_zero(st) SKM_sk_zero(POLICYQUALINFO, (st)) +#define sk_POLICYQUALINFO_push(st, val) SKM_sk_push(POLICYQUALINFO, (st), (val)) +#define sk_POLICYQUALINFO_unshift(st, val) SKM_sk_unshift(POLICYQUALINFO, (st), (val)) +#define sk_POLICYQUALINFO_find(st, val) SKM_sk_find(POLICYQUALINFO, (st), (val)) +#define sk_POLICYQUALINFO_delete(st, i) SKM_sk_delete(POLICYQUALINFO, (st), (i)) +#define sk_POLICYQUALINFO_delete_ptr(st, ptr) SKM_sk_delete_ptr(POLICYQUALINFO, (st), (ptr)) +#define sk_POLICYQUALINFO_insert(st, val, i) SKM_sk_insert(POLICYQUALINFO, (st), (val), (i)) +#define sk_POLICYQUALINFO_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(POLICYQUALINFO, (st), (cmp)) +#define sk_POLICYQUALINFO_dup(st) SKM_sk_dup(POLICYQUALINFO, st) +#define sk_POLICYQUALINFO_pop_free(st, free_func) SKM_sk_pop_free(POLICYQUALINFO, (st), (free_func)) +#define sk_POLICYQUALINFO_shift(st) SKM_sk_shift(POLICYQUALINFO, (st)) +#define sk_POLICYQUALINFO_pop(st) SKM_sk_pop(POLICYQUALINFO, (st)) +#define sk_POLICYQUALINFO_sort(st) SKM_sk_sort(POLICYQUALINFO, (st)) + +#define sk_POLICYINFO_new(st) SKM_sk_new(POLICYINFO, (st)) +#define sk_POLICYINFO_new_null() SKM_sk_new_null(POLICYINFO) +#define sk_POLICYINFO_free(st) SKM_sk_free(POLICYINFO, (st)) +#define sk_POLICYINFO_num(st) SKM_sk_num(POLICYINFO, (st)) +#define sk_POLICYINFO_value(st, i) SKM_sk_value(POLICYINFO, (st), (i)) +#define sk_POLICYINFO_set(st, i, val) SKM_sk_set(POLICYINFO, (st), (i), (val)) +#define sk_POLICYINFO_zero(st) SKM_sk_zero(POLICYINFO, (st)) +#define sk_POLICYINFO_push(st, val) SKM_sk_push(POLICYINFO, (st), (val)) +#define sk_POLICYINFO_unshift(st, val) SKM_sk_unshift(POLICYINFO, (st), (val)) +#define sk_POLICYINFO_find(st, val) SKM_sk_find(POLICYINFO, (st), (val)) +#define sk_POLICYINFO_delete(st, i) SKM_sk_delete(POLICYINFO, (st), (i)) +#define sk_POLICYINFO_delete_ptr(st, ptr) SKM_sk_delete_ptr(POLICYINFO, (st), (ptr)) +#define sk_POLICYINFO_insert(st, val, i) SKM_sk_insert(POLICYINFO, (st), (val), (i)) +#define sk_POLICYINFO_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(POLICYINFO, (st), (cmp)) +#define sk_POLICYINFO_dup(st) SKM_sk_dup(POLICYINFO, st) +#define sk_POLICYINFO_pop_free(st, free_func) SKM_sk_pop_free(POLICYINFO, (st), (free_func)) +#define sk_POLICYINFO_shift(st) SKM_sk_shift(POLICYINFO, (st)) +#define sk_POLICYINFO_pop(st) SKM_sk_pop(POLICYINFO, (st)) +#define sk_POLICYINFO_sort(st) SKM_sk_sort(POLICYINFO, (st)) + +#define sk_X509_PURPOSE_new(st) SKM_sk_new(X509_PURPOSE, (st)) +#define sk_X509_PURPOSE_new_null() SKM_sk_new_null(X509_PURPOSE) +#define sk_X509_PURPOSE_free(st) SKM_sk_free(X509_PURPOSE, (st)) +#define sk_X509_PURPOSE_num(st) SKM_sk_num(X509_PURPOSE, (st)) +#define sk_X509_PURPOSE_value(st, i) SKM_sk_value(X509_PURPOSE, (st), (i)) +#define sk_X509_PURPOSE_set(st, i, val) SKM_sk_set(X509_PURPOSE, (st), (i), (val)) +#define sk_X509_PURPOSE_zero(st) SKM_sk_zero(X509_PURPOSE, (st)) +#define sk_X509_PURPOSE_push(st, val) SKM_sk_push(X509_PURPOSE, (st), (val)) +#define sk_X509_PURPOSE_unshift(st, val) SKM_sk_unshift(X509_PURPOSE, (st), (val)) +#define sk_X509_PURPOSE_find(st, val) SKM_sk_find(X509_PURPOSE, (st), (val)) +#define sk_X509_PURPOSE_delete(st, i) SKM_sk_delete(X509_PURPOSE, (st), (i)) +#define sk_X509_PURPOSE_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_PURPOSE, (st), (ptr)) +#define sk_X509_PURPOSE_insert(st, val, i) SKM_sk_insert(X509_PURPOSE, (st), (val), (i)) +#define sk_X509_PURPOSE_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_PURPOSE, (st), (cmp)) +#define sk_X509_PURPOSE_dup(st) SKM_sk_dup(X509_PURPOSE, st) +#define sk_X509_PURPOSE_pop_free(st, free_func) SKM_sk_pop_free(X509_PURPOSE, (st), (free_func)) +#define sk_X509_PURPOSE_shift(st) SKM_sk_shift(X509_PURPOSE, (st)) +#define sk_X509_PURPOSE_pop(st) SKM_sk_pop(X509_PURPOSE, (st)) +#define sk_X509_PURPOSE_sort(st) SKM_sk_sort(X509_PURPOSE, (st)) + +#define sk_SSL_CIPHER_new(st) SKM_sk_new(SSL_CIPHER, (st)) +#define sk_SSL_CIPHER_new_null() SKM_sk_new_null(SSL_CIPHER) +#define sk_SSL_CIPHER_free(st) SKM_sk_free(SSL_CIPHER, (st)) +#define sk_SSL_CIPHER_num(st) SKM_sk_num(SSL_CIPHER, (st)) +#define sk_SSL_CIPHER_value(st, i) SKM_sk_value(SSL_CIPHER, (st), (i)) +#define sk_SSL_CIPHER_set(st, i, val) SKM_sk_set(SSL_CIPHER, (st), (i), (val)) +#define sk_SSL_CIPHER_zero(st) SKM_sk_zero(SSL_CIPHER, (st)) +#define sk_SSL_CIPHER_push(st, val) SKM_sk_push(SSL_CIPHER, (st), (val)) +#define sk_SSL_CIPHER_unshift(st, val) SKM_sk_unshift(SSL_CIPHER, (st), (val)) +#define sk_SSL_CIPHER_find(st, val) SKM_sk_find(SSL_CIPHER, (st), (val)) +#define sk_SSL_CIPHER_delete(st, i) SKM_sk_delete(SSL_CIPHER, (st), (i)) +#define sk_SSL_CIPHER_delete_ptr(st, ptr) SKM_sk_delete_ptr(SSL_CIPHER, (st), (ptr)) +#define sk_SSL_CIPHER_insert(st, val, i) SKM_sk_insert(SSL_CIPHER, (st), (val), (i)) +#define sk_SSL_CIPHER_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(SSL_CIPHER, (st), (cmp)) +#define sk_SSL_CIPHER_dup(st) SKM_sk_dup(SSL_CIPHER, st) +#define sk_SSL_CIPHER_pop_free(st, free_func) SKM_sk_pop_free(SSL_CIPHER, (st), (free_func)) +#define sk_SSL_CIPHER_shift(st) SKM_sk_shift(SSL_CIPHER, (st)) +#define sk_SSL_CIPHER_pop(st) SKM_sk_pop(SSL_CIPHER, (st)) +#define sk_SSL_CIPHER_sort(st) SKM_sk_sort(SSL_CIPHER, (st)) + +#define sk_SSL_COMP_new(st) SKM_sk_new(SSL_COMP, (st)) +#define sk_SSL_COMP_new_null() SKM_sk_new_null(SSL_COMP) +#define sk_SSL_COMP_free(st) SKM_sk_free(SSL_COMP, (st)) +#define sk_SSL_COMP_num(st) SKM_sk_num(SSL_COMP, (st)) +#define sk_SSL_COMP_value(st, i) SKM_sk_value(SSL_COMP, (st), (i)) +#define sk_SSL_COMP_set(st, i, val) SKM_sk_set(SSL_COMP, (st), (i), (val)) +#define sk_SSL_COMP_zero(st) SKM_sk_zero(SSL_COMP, (st)) +#define sk_SSL_COMP_push(st, val) SKM_sk_push(SSL_COMP, (st), (val)) +#define sk_SSL_COMP_unshift(st, val) SKM_sk_unshift(SSL_COMP, (st), (val)) +#define sk_SSL_COMP_find(st, val) SKM_sk_find(SSL_COMP, (st), (val)) +#define sk_SSL_COMP_delete(st, i) SKM_sk_delete(SSL_COMP, (st), (i)) +#define sk_SSL_COMP_delete_ptr(st, ptr) SKM_sk_delete_ptr(SSL_COMP, (st), (ptr)) +#define sk_SSL_COMP_insert(st, val, i) SKM_sk_insert(SSL_COMP, (st), (val), (i)) +#define sk_SSL_COMP_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(SSL_COMP, (st), (cmp)) +#define sk_SSL_COMP_dup(st) SKM_sk_dup(SSL_COMP, st) +#define sk_SSL_COMP_pop_free(st, free_func) SKM_sk_pop_free(SSL_COMP, (st), (free_func)) +#define sk_SSL_COMP_shift(st) SKM_sk_shift(SSL_COMP, (st)) +#define sk_SSL_COMP_pop(st) SKM_sk_pop(SSL_COMP, (st)) +#define sk_SSL_COMP_sort(st) SKM_sk_sort(SSL_COMP, (st)) +/* End of util/mkstack.pl block, you may now edit :-) */ + +#endif /* !defined HEADER_SAFESTACK_H */ diff --git a/crypto/stack/stack.c b/crypto/stack/stack.c index b3e32a7597..2eb531fd0d 100644 --- a/crypto/stack/stack.c +++ b/crypto/stack/stack.c @@ -109,6 +109,11 @@ err: return(NULL); } +STACK *sk_new_null(void) + { + return sk_new((int (*)(const char * const *, const char * const *))NULL); + } + STACK *sk_new(int (*c)(const char * const *, const char * const *)) { STACK *ret; diff --git a/crypto/stack/stack.h b/crypto/stack/stack.h index 6f5b4bdce2..8b436ca4b9 100644 --- a/crypto/stack/stack.h +++ b/crypto/stack/stack.h @@ -73,9 +73,6 @@ typedef struct stack_st int (*comp)(const char * const *, const char * const *); } STACK; -#define sk_new_null() sk_new((int (*)(const char * const *, \ - const char * const *))NULL) - #define M_sk_num(sk) ((sk) ? (sk)->num:-1) #define M_sk_value(sk,n) ((sk) ? (sk)->data[n] : NULL) @@ -85,6 +82,7 @@ char *sk_value(const STACK *, int); char *sk_set(STACK *, int, char *); STACK *sk_new(int (*cmp)(const char * const *, const char * const *)); +STACK *sk_new_null(void); void sk_free(STACK *); void sk_pop_free(STACK *st, void (*func)(void *)); int sk_insert(STACK *sk,char *data,int where); diff --git a/crypto/x509/x509.h b/crypto/x509/x509.h index 87f192fa80..baf76f3e1e 100644 --- a/crypto/x509/x509.h +++ b/crypto/x509/x509.h @@ -152,37 +152,6 @@ typedef struct X509_algor_st } X509_ALGOR; DECLARE_STACK_OF(X509_ALGOR) -/* This block of defines is updated by a perl script, please do not touch! */ -#ifndef DEBUG_SAFESTACK - #define sk_X509_ALGOR_new(a) sk_new((int (*) \ - (const char * const *, const char * const *))(a)) - #define sk_X509_ALGOR_new_null() sk_new_null() - #define sk_X509_ALGOR_free(a) sk_free(a) - #define sk_X509_ALGOR_num(a) sk_num(a) - #define sk_X509_ALGOR_value(a,b) ((X509_ALGOR *) \ - sk_value((a),(b))) - #define sk_X509_ALGOR_set(a,b,c) ((X509_ALGOR *) \ - sk_set((a),(b),(char *)(c))) - #define sk_X509_ALGOR_zero(a) sk_zero(a) - #define sk_X509_ALGOR_push(a,b) sk_push((a),(char *)(b)) - #define sk_X509_ALGOR_unshift(a,b) sk_unshift((a),(b)) - #define sk_X509_ALGOR_find(a,b) sk_find((a), (char *)(b)) - #define sk_X509_ALGOR_delete(a,b) ((X509_ALGOR *) \ - sk_delete((a),(b))) - #define sk_X509_ALGOR_delete_ptr(a,b) ((X509_ALGOR *) \ - sk_delete_ptr((a),(char *)(b))) - #define sk_X509_ALGOR_insert(a,b,c) sk_insert((a),(char *)(b),(c)) - #define sk_X509_ALGOR_set_cmp_func(a,b) ((int (*) \ - (const X509_ALGOR * const *,const X509_ALGOR * const *)) \ - sk_set_cmp_func((a),(int (*) \ - (const char * const *, const char * const *))(b))) - #define sk_X509_ALGOR_dup(a) sk_dup(a) - #define sk_X509_ALGOR_pop_free(a,b) sk_pop_free((a),(void (*)(void *))(b)) - #define sk_X509_ALGOR_shift(a) ((X509_ALGOR *)sk_shift(a)) - #define sk_X509_ALGOR_pop(a) ((X509_ALGOR *)sk_pop(a)) - #define sk_X509_ALGOR_sort(a) sk_sort(a) -#endif /* !DEBUG_SAFESTACK */ -/* End of perl script block, you may now edit :-) */ DECLARE_ASN1_SET_OF(X509_ALGOR) typedef struct X509_val_st @@ -213,37 +182,6 @@ typedef struct X509_name_entry_st } X509_NAME_ENTRY; DECLARE_STACK_OF(X509_NAME_ENTRY) -/* This block of defines is updated by a perl script, please do not touch! */ -#ifndef DEBUG_SAFESTACK - #define sk_X509_NAME_ENTRY_new(a) sk_new((int (*) \ - (const char * const *, const char * const *))(a)) - #define sk_X509_NAME_ENTRY_new_null() sk_new_null() - #define sk_X509_NAME_ENTRY_free(a) sk_free(a) - #define sk_X509_NAME_ENTRY_num(a) sk_num(a) - #define sk_X509_NAME_ENTRY_value(a,b) ((X509_NAME_ENTRY *) \ - sk_value((a),(b))) - #define sk_X509_NAME_ENTRY_set(a,b,c) ((X509_NAME_ENTRY *) \ - sk_set((a),(b),(char *)(c))) - #define sk_X509_NAME_ENTRY_zero(a) sk_zero(a) - #define sk_X509_NAME_ENTRY_push(a,b) sk_push((a),(char *)(b)) - #define sk_X509_NAME_ENTRY_unshift(a,b) sk_unshift((a),(b)) - #define sk_X509_NAME_ENTRY_find(a,b) sk_find((a), (char *)(b)) - #define sk_X509_NAME_ENTRY_delete(a,b) ((X509_NAME_ENTRY *) \ - sk_delete((a),(b))) - #define sk_X509_NAME_ENTRY_delete_ptr(a,b) ((X509_NAME_ENTRY *) \ - sk_delete_ptr((a),(char *)(b))) - #define sk_X509_NAME_ENTRY_insert(a,b,c) sk_insert((a),(char *)(b),(c)) - #define sk_X509_NAME_ENTRY_set_cmp_func(a,b) ((int (*) \ - (const X509_NAME_ENTRY * const *,const X509_NAME_ENTRY * const *)) \ - sk_set_cmp_func((a),(int (*) \ - (const char * const *, const char * const *))(b))) - #define sk_X509_NAME_ENTRY_dup(a) sk_dup(a) - #define sk_X509_NAME_ENTRY_pop_free(a,b) sk_pop_free((a),(void (*)(void *))(b)) - #define sk_X509_NAME_ENTRY_shift(a) ((X509_NAME_ENTRY *)sk_shift(a)) - #define sk_X509_NAME_ENTRY_pop(a) ((X509_NAME_ENTRY *)sk_pop(a)) - #define sk_X509_NAME_ENTRY_sort(a) sk_sort(a) -#endif /* !DEBUG_SAFESTACK */ -/* End of perl script block, you may now edit :-) */ DECLARE_ASN1_SET_OF(X509_NAME_ENTRY) /* we always keep X509_NAMEs in 2 forms. */ @@ -260,37 +198,6 @@ typedef struct X509_name_st } X509_NAME; DECLARE_STACK_OF(X509_NAME) -/* This block of defines is updated by a perl script, please do not touch! */ -#ifndef DEBUG_SAFESTACK - #define sk_X509_NAME_new(a) sk_new((int (*) \ - (const char * const *, const char * const *))(a)) - #define sk_X509_NAME_new_null() sk_new_null() - #define sk_X509_NAME_free(a) sk_free(a) - #define sk_X509_NAME_num(a) sk_num(a) - #define sk_X509_NAME_value(a,b) ((X509_NAME *) \ - sk_value((a),(b))) - #define sk_X509_NAME_set(a,b,c) ((X509_NAME *) \ - sk_set((a),(b),(char *)(c))) - #define sk_X509_NAME_zero(a) sk_zero(a) - #define sk_X509_NAME_push(a,b) sk_push((a),(char *)(b)) - #define sk_X509_NAME_unshift(a,b) sk_unshift((a),(b)) - #define sk_X509_NAME_find(a,b) sk_find((a), (char *)(b)) - #define sk_X509_NAME_delete(a,b) ((X509_NAME *) \ - sk_delete((a),(b))) - #define sk_X509_NAME_delete_ptr(a,b) ((X509_NAME *) \ - sk_delete_ptr((a),(char *)(b))) - #define sk_X509_NAME_insert(a,b,c) sk_insert((a),(char *)(b),(c)) - #define sk_X509_NAME_set_cmp_func(a,b) ((int (*) \ - (const X509_NAME * const *,const X509_NAME * const *)) \ - sk_set_cmp_func((a),(int (*) \ - (const char * const *, const char * const *))(b))) - #define sk_X509_NAME_dup(a) sk_dup(a) - #define sk_X509_NAME_pop_free(a,b) sk_pop_free((a),(void (*)(void *))(b)) - #define sk_X509_NAME_shift(a) ((X509_NAME *)sk_shift(a)) - #define sk_X509_NAME_pop(a) ((X509_NAME *)sk_pop(a)) - #define sk_X509_NAME_sort(a) sk_sort(a) -#endif /* !DEBUG_SAFESTACK */ -/* End of perl script block, you may now edit :-) */ #define X509_EX_V_NETSCAPE_HACK 0x8000 #define X509_EX_V_INIT 0x0001 @@ -305,37 +212,6 @@ typedef struct X509_extension_st } X509_EXTENSION; DECLARE_STACK_OF(X509_EXTENSION) -/* This block of defines is updated by a perl script, please do not touch! */ -#ifndef DEBUG_SAFESTACK - #define sk_X509_EXTENSION_new(a) sk_new((int (*) \ - (const char * const *, const char * const *))(a)) - #define sk_X509_EXTENSION_new_null() sk_new_null() - #define sk_X509_EXTENSION_free(a) sk_free(a) - #define sk_X509_EXTENSION_num(a) sk_num(a) - #define sk_X509_EXTENSION_value(a,b) ((X509_EXTENSION *) \ - sk_value((a),(b))) - #define sk_X509_EXTENSION_set(a,b,c) ((X509_EXTENSION *) \ - sk_set((a),(b),(char *)(c))) - #define sk_X509_EXTENSION_zero(a) sk_zero(a) - #define sk_X509_EXTENSION_push(a,b) sk_push((a),(char *)(b)) - #define sk_X509_EXTENSION_unshift(a,b) sk_unshift((a),(b)) - #define sk_X509_EXTENSION_find(a,b) sk_find((a), (char *)(b)) - #define sk_X509_EXTENSION_delete(a,b) ((X509_EXTENSION *) \ - sk_delete((a),(b))) - #define sk_X509_EXTENSION_delete_ptr(a,b) ((X509_EXTENSION *) \ - sk_delete_ptr((a),(char *)(b))) - #define sk_X509_EXTENSION_insert(a,b,c) sk_insert((a),(char *)(b),(c)) - #define sk_X509_EXTENSION_set_cmp_func(a,b) ((int (*) \ - (const X509_EXTENSION * const *,const X509_EXTENSION * const *)) \ - sk_set_cmp_func((a),(int (*) \ - (const char * const *, const char * const *))(b))) - #define sk_X509_EXTENSION_dup(a) sk_dup(a) - #define sk_X509_EXTENSION_pop_free(a,b) sk_pop_free((a),(void (*)(void *))(b)) - #define sk_X509_EXTENSION_shift(a) ((X509_EXTENSION *)sk_shift(a)) - #define sk_X509_EXTENSION_pop(a) ((X509_EXTENSION *)sk_pop(a)) - #define sk_X509_EXTENSION_sort(a) sk_sort(a) -#endif /* !DEBUG_SAFESTACK */ -/* End of perl script block, you may now edit :-) */ DECLARE_ASN1_SET_OF(X509_EXTENSION) /* a sequence of these are used */ @@ -351,37 +227,6 @@ typedef struct x509_attributes_st } X509_ATTRIBUTE; DECLARE_STACK_OF(X509_ATTRIBUTE) -/* This block of defines is updated by a perl script, please do not touch! */ -#ifndef DEBUG_SAFESTACK - #define sk_X509_ATTRIBUTE_new(a) sk_new((int (*) \ - (const char * const *, const char * const *))(a)) - #define sk_X509_ATTRIBUTE_new_null() sk_new_null() - #define sk_X509_ATTRIBUTE_free(a) sk_free(a) - #define sk_X509_ATTRIBUTE_num(a) sk_num(a) - #define sk_X509_ATTRIBUTE_value(a,b) ((X509_ATTRIBUTE *) \ - sk_value((a),(b))) - #define sk_X509_ATTRIBUTE_set(a,b,c) ((X509_ATTRIBUTE *) \ - sk_set((a),(b),(char *)(c))) - #define sk_X509_ATTRIBUTE_zero(a) sk_zero(a) - #define sk_X509_ATTRIBUTE_push(a,b) sk_push((a),(char *)(b)) - #define sk_X509_ATTRIBUTE_unshift(a,b) sk_unshift((a),(b)) - #define sk_X509_ATTRIBUTE_find(a,b) sk_find((a), (char *)(b)) - #define sk_X509_ATTRIBUTE_delete(a,b) ((X509_ATTRIBUTE *) \ - sk_delete((a),(b))) - #define sk_X509_ATTRIBUTE_delete_ptr(a,b) ((X509_ATTRIBUTE *) \ - sk_delete_ptr((a),(char *)(b))) - #define sk_X509_ATTRIBUTE_insert(a,b,c) sk_insert((a),(char *)(b),(c)) - #define sk_X509_ATTRIBUTE_set_cmp_func(a,b) ((int (*) \ - (const X509_ATTRIBUTE * const *,const X509_ATTRIBUTE * const *)) \ - sk_set_cmp_func((a),(int (*) \ - (const char * const *, const char * const *))(b))) - #define sk_X509_ATTRIBUTE_dup(a) sk_dup(a) - #define sk_X509_ATTRIBUTE_pop_free(a,b) sk_pop_free((a),(void (*)(void *))(b)) - #define sk_X509_ATTRIBUTE_shift(a) ((X509_ATTRIBUTE *)sk_shift(a)) - #define sk_X509_ATTRIBUTE_pop(a) ((X509_ATTRIBUTE *)sk_pop(a)) - #define sk_X509_ATTRIBUTE_sort(a) sk_sort(a) -#endif /* !DEBUG_SAFESTACK */ -/* End of perl script block, you may now edit :-) */ DECLARE_ASN1_SET_OF(X509_ATTRIBUTE) typedef struct X509_req_info_st @@ -453,37 +298,6 @@ typedef struct x509_st } X509; DECLARE_STACK_OF(X509) -/* This block of defines is updated by a perl script, please do not touch! */ -#ifndef DEBUG_SAFESTACK - #define sk_X509_new(a) sk_new((int (*) \ - (const char * const *, const char * const *))(a)) - #define sk_X509_new_null() sk_new_null() - #define sk_X509_free(a) sk_free(a) - #define sk_X509_num(a) sk_num(a) - #define sk_X509_value(a,b) ((X509 *) \ - sk_value((a),(b))) - #define sk_X509_set(a,b,c) ((X509 *) \ - sk_set((a),(b),(char *)(c))) - #define sk_X509_zero(a) sk_zero(a) - #define sk_X509_push(a,b) sk_push((a),(char *)(b)) - #define sk_X509_unshift(a,b) sk_unshift((a),(b)) - #define sk_X509_find(a,b) sk_find((a), (char *)(b)) - #define sk_X509_delete(a,b) ((X509 *) \ - sk_delete((a),(b))) - #define sk_X509_delete_ptr(a,b) ((X509 *) \ - sk_delete_ptr((a),(char *)(b))) - #define sk_X509_insert(a,b,c) sk_insert((a),(char *)(b),(c)) - #define sk_X509_set_cmp_func(a,b) ((int (*) \ - (const X509 * const *,const X509 * const *)) \ - sk_set_cmp_func((a),(int (*) \ - (const char * const *, const char * const *))(b))) - #define sk_X509_dup(a) sk_dup(a) - #define sk_X509_pop_free(a,b) sk_pop_free((a),(void (*)(void *))(b)) - #define sk_X509_shift(a) ((X509 *)sk_shift(a)) - #define sk_X509_pop(a) ((X509 *)sk_pop(a)) - #define sk_X509_sort(a) sk_sort(a) -#endif /* !DEBUG_SAFESTACK */ -/* End of perl script block, you may now edit :-) */ DECLARE_ASN1_SET_OF(X509) /* This is used for a table of trust checking functions */ @@ -498,37 +312,6 @@ typedef struct x509_trust_st { } X509_TRUST; DECLARE_STACK_OF(X509_TRUST) -/* This block of defines is updated by a perl script, please do not touch! */ -#ifndef DEBUG_SAFESTACK - #define sk_X509_TRUST_new(a) sk_new((int (*) \ - (const char * const *, const char * const *))(a)) - #define sk_X509_TRUST_new_null() sk_new_null() - #define sk_X509_TRUST_free(a) sk_free(a) - #define sk_X509_TRUST_num(a) sk_num(a) - #define sk_X509_TRUST_value(a,b) ((X509_TRUST *) \ - sk_value((a),(b))) - #define sk_X509_TRUST_set(a,b,c) ((X509_TRUST *) \ - sk_set((a),(b),(char *)(c))) - #define sk_X509_TRUST_zero(a) sk_zero(a) - #define sk_X509_TRUST_push(a,b) sk_push((a),(char *)(b)) - #define sk_X509_TRUST_unshift(a,b) sk_unshift((a),(b)) - #define sk_X509_TRUST_find(a,b) sk_find((a), (char *)(b)) - #define sk_X509_TRUST_delete(a,b) ((X509_TRUST *) \ - sk_delete((a),(b))) - #define sk_X509_TRUST_delete_ptr(a,b) ((X509_TRUST *) \ - sk_delete_ptr((a),(char *)(b))) - #define sk_X509_TRUST_insert(a,b,c) sk_insert((a),(char *)(b),(c)) - #define sk_X509_TRUST_set_cmp_func(a,b) ((int (*) \ - (const X509_TRUST * const *,const X509_TRUST * const *)) \ - sk_set_cmp_func((a),(int (*) \ - (const char * const *, const char * const *))(b))) - #define sk_X509_TRUST_dup(a) sk_dup(a) - #define sk_X509_TRUST_pop_free(a,b) sk_pop_free((a),(void (*)(void *))(b)) - #define sk_X509_TRUST_shift(a) ((X509_TRUST *)sk_shift(a)) - #define sk_X509_TRUST_pop(a) ((X509_TRUST *)sk_pop(a)) - #define sk_X509_TRUST_sort(a) sk_sort(a) -#endif /* !DEBUG_SAFESTACK */ -/* End of perl script block, you may now edit :-) */ /* standard trust ids */ @@ -564,37 +347,6 @@ typedef struct X509_revoked_st } X509_REVOKED; DECLARE_STACK_OF(X509_REVOKED) -/* This block of defines is updated by a perl script, please do not touch! */ -#ifndef DEBUG_SAFESTACK - #define sk_X509_REVOKED_new(a) sk_new((int (*) \ - (const char * const *, const char * const *))(a)) - #define sk_X509_REVOKED_new_null() sk_new_null() - #define sk_X509_REVOKED_free(a) sk_free(a) - #define sk_X509_REVOKED_num(a) sk_num(a) - #define sk_X509_REVOKED_value(a,b) ((X509_REVOKED *) \ - sk_value((a),(b))) - #define sk_X509_REVOKED_set(a,b,c) ((X509_REVOKED *) \ - sk_set((a),(b),(char *)(c))) - #define sk_X509_REVOKED_zero(a) sk_zero(a) - #define sk_X509_REVOKED_push(a,b) sk_push((a),(char *)(b)) - #define sk_X509_REVOKED_unshift(a,b) sk_unshift((a),(b)) - #define sk_X509_REVOKED_find(a,b) sk_find((a), (char *)(b)) - #define sk_X509_REVOKED_delete(a,b) ((X509_REVOKED *) \ - sk_delete((a),(b))) - #define sk_X509_REVOKED_delete_ptr(a,b) ((X509_REVOKED *) \ - sk_delete_ptr((a),(char *)(b))) - #define sk_X509_REVOKED_insert(a,b,c) sk_insert((a),(char *)(b),(c)) - #define sk_X509_REVOKED_set_cmp_func(a,b) ((int (*) \ - (const X509_REVOKED * const *,const X509_REVOKED * const *)) \ - sk_set_cmp_func((a),(int (*) \ - (const char * const *, const char * const *))(b))) - #define sk_X509_REVOKED_dup(a) sk_dup(a) - #define sk_X509_REVOKED_pop_free(a,b) sk_pop_free((a),(void (*)(void *))(b)) - #define sk_X509_REVOKED_shift(a) ((X509_REVOKED *)sk_shift(a)) - #define sk_X509_REVOKED_pop(a) ((X509_REVOKED *)sk_pop(a)) - #define sk_X509_REVOKED_sort(a) sk_sort(a) -#endif /* !DEBUG_SAFESTACK */ -/* End of perl script block, you may now edit :-) */ DECLARE_ASN1_SET_OF(X509_REVOKED) typedef struct X509_crl_info_st @@ -618,37 +370,6 @@ typedef struct X509_crl_st } X509_CRL; DECLARE_STACK_OF(X509_CRL) -/* This block of defines is updated by a perl script, please do not touch! */ -#ifndef DEBUG_SAFESTACK - #define sk_X509_CRL_new(a) sk_new((int (*) \ - (const char * const *, const char * const *))(a)) - #define sk_X509_CRL_new_null() sk_new_null() - #define sk_X509_CRL_free(a) sk_free(a) - #define sk_X509_CRL_num(a) sk_num(a) - #define sk_X509_CRL_value(a,b) ((X509_CRL *) \ - sk_value((a),(b))) - #define sk_X509_CRL_set(a,b,c) ((X509_CRL *) \ - sk_set((a),(b),(char *)(c))) - #define sk_X509_CRL_zero(a) sk_zero(a) - #define sk_X509_CRL_push(a,b) sk_push((a),(char *)(b)) - #define sk_X509_CRL_unshift(a,b) sk_unshift((a),(b)) - #define sk_X509_CRL_find(a,b) sk_find((a), (char *)(b)) - #define sk_X509_CRL_delete(a,b) ((X509_CRL *) \ - sk_delete((a),(b))) - #define sk_X509_CRL_delete_ptr(a,b) ((X509_CRL *) \ - sk_delete_ptr((a),(char *)(b))) - #define sk_X509_CRL_insert(a,b,c) sk_insert((a),(char *)(b),(c)) - #define sk_X509_CRL_set_cmp_func(a,b) ((int (*) \ - (const X509_CRL * const *,const X509_CRL * const *)) \ - sk_set_cmp_func((a),(int (*) \ - (const char * const *, const char * const *))(b))) - #define sk_X509_CRL_dup(a) sk_dup(a) - #define sk_X509_CRL_pop_free(a,b) sk_pop_free((a),(void (*)(void *))(b)) - #define sk_X509_CRL_shift(a) ((X509_CRL *)sk_shift(a)) - #define sk_X509_CRL_pop(a) ((X509_CRL *)sk_pop(a)) - #define sk_X509_CRL_sort(a) sk_sort(a) -#endif /* !DEBUG_SAFESTACK */ -/* End of perl script block, you may now edit :-) */ DECLARE_ASN1_SET_OF(X509_CRL) typedef struct private_key_st @@ -687,37 +408,6 @@ typedef struct X509_info_st } X509_INFO; DECLARE_STACK_OF(X509_INFO) -/* This block of defines is updated by a perl script, please do not touch! */ -#ifndef DEBUG_SAFESTACK - #define sk_X509_INFO_new(a) sk_new((int (*) \ - (const char * const *, const char * const *))(a)) - #define sk_X509_INFO_new_null() sk_new_null() - #define sk_X509_INFO_free(a) sk_free(a) - #define sk_X509_INFO_num(a) sk_num(a) - #define sk_X509_INFO_value(a,b) ((X509_INFO *) \ - sk_value((a),(b))) - #define sk_X509_INFO_set(a,b,c) ((X509_INFO *) \ - sk_set((a),(b),(char *)(c))) - #define sk_X509_INFO_zero(a) sk_zero(a) - #define sk_X509_INFO_push(a,b) sk_push((a),(char *)(b)) - #define sk_X509_INFO_unshift(a,b) sk_unshift((a),(b)) - #define sk_X509_INFO_find(a,b) sk_find((a), (char *)(b)) - #define sk_X509_INFO_delete(a,b) ((X509_INFO *) \ - sk_delete((a),(b))) - #define sk_X509_INFO_delete_ptr(a,b) ((X509_INFO *) \ - sk_delete_ptr((a),(char *)(b))) - #define sk_X509_INFO_insert(a,b,c) sk_insert((a),(char *)(b),(c)) - #define sk_X509_INFO_set_cmp_func(a,b) ((int (*) \ - (const X509_INFO * const *,const X509_INFO * const *)) \ - sk_set_cmp_func((a),(int (*) \ - (const char * const *, const char * const *))(b))) - #define sk_X509_INFO_dup(a) sk_dup(a) - #define sk_X509_INFO_pop_free(a,b) sk_pop_free((a),(void (*)(void *))(b)) - #define sk_X509_INFO_shift(a) ((X509_INFO *)sk_shift(a)) - #define sk_X509_INFO_pop(a) ((X509_INFO *)sk_pop(a)) - #define sk_X509_INFO_sort(a) sk_sort(a) -#endif /* !DEBUG_SAFESTACK */ -/* End of perl script block, you may now edit :-) */ #endif /* The next 2 structures and their 8 routines were sent to me by diff --git a/crypto/x509/x509_vfy.h b/crypto/x509/x509_vfy.h index f842e4ac72..cc0bd3dbc2 100644 --- a/crypto/x509/x509_vfy.h +++ b/crypto/x509/x509_vfy.h @@ -131,37 +131,6 @@ typedef struct x509_object_st typedef struct x509_lookup_st X509_LOOKUP; DECLARE_STACK_OF(X509_LOOKUP) -/* This block of defines is updated by a perl script, please do not touch! */ -#ifndef DEBUG_SAFESTACK - #define sk_X509_LOOKUP_new(a) sk_new((int (*) \ - (const char * const *, const char * const *))(a)) - #define sk_X509_LOOKUP_new_null() sk_new_null() - #define sk_X509_LOOKUP_free(a) sk_free(a) - #define sk_X509_LOOKUP_num(a) sk_num(a) - #define sk_X509_LOOKUP_value(a,b) ((X509_LOOKUP *) \ - sk_value((a),(b))) - #define sk_X509_LOOKUP_set(a,b,c) ((X509_LOOKUP *) \ - sk_set((a),(b),(char *)(c))) - #define sk_X509_LOOKUP_zero(a) sk_zero(a) - #define sk_X509_LOOKUP_push(a,b) sk_push((a),(char *)(b)) - #define sk_X509_LOOKUP_unshift(a,b) sk_unshift((a),(b)) - #define sk_X509_LOOKUP_find(a,b) sk_find((a), (char *)(b)) - #define sk_X509_LOOKUP_delete(a,b) ((X509_LOOKUP *) \ - sk_delete((a),(b))) - #define sk_X509_LOOKUP_delete_ptr(a,b) ((X509_LOOKUP *) \ - sk_delete_ptr((a),(char *)(b))) - #define sk_X509_LOOKUP_insert(a,b,c) sk_insert((a),(char *)(b),(c)) - #define sk_X509_LOOKUP_set_cmp_func(a,b) ((int (*) \ - (const X509_LOOKUP * const *,const X509_LOOKUP * const *)) \ - sk_set_cmp_func((a),(int (*) \ - (const char * const *, const char * const *))(b))) - #define sk_X509_LOOKUP_dup(a) sk_dup(a) - #define sk_X509_LOOKUP_pop_free(a,b) sk_pop_free((a),(void (*)(void *))(b)) - #define sk_X509_LOOKUP_shift(a) ((X509_LOOKUP *)sk_shift(a)) - #define sk_X509_LOOKUP_pop(a) ((X509_LOOKUP *)sk_pop(a)) - #define sk_X509_LOOKUP_sort(a) sk_sort(a) -#endif /* !DEBUG_SAFESTACK */ -/* End of perl script block, you may now edit :-) */ /* This is a static that defines the function interface */ typedef struct x509_lookup_method_st diff --git a/crypto/x509v3/x509v3.h b/crypto/x509v3/x509v3.h index c66b5c3ebc..5f00ed5f7a 100644 --- a/crypto/x509v3/x509v3.h +++ b/crypto/x509v3/x509v3.h @@ -132,37 +132,6 @@ typedef struct v3_ext_method X509V3_EXT_METHOD; typedef struct v3_ext_ctx X509V3_CTX; DECLARE_STACK_OF(X509V3_EXT_METHOD) -/* This block of defines is updated by a perl script, please do not touch! */ -#ifndef DEBUG_SAFESTACK - #define sk_X509V3_EXT_METHOD_new(a) sk_new((int (*) \ - (const char * const *, const char * const *))(a)) - #define sk_X509V3_EXT_METHOD_new_null() sk_new_null() - #define sk_X509V3_EXT_METHOD_free(a) sk_free(a) - #define sk_X509V3_EXT_METHOD_num(a) sk_num(a) - #define sk_X509V3_EXT_METHOD_value(a,b) ((X509V3_EXT_METHOD *) \ - sk_value((a),(b))) - #define sk_X509V3_EXT_METHOD_set(a,b,c) ((X509V3_EXT_METHOD *) \ - sk_set((a),(b),(char *)(c))) - #define sk_X509V3_EXT_METHOD_zero(a) sk_zero(a) - #define sk_X509V3_EXT_METHOD_push(a,b) sk_push((a),(char *)(b)) - #define sk_X509V3_EXT_METHOD_unshift(a,b) sk_unshift((a),(b)) - #define sk_X509V3_EXT_METHOD_find(a,b) sk_find((a), (char *)(b)) - #define sk_X509V3_EXT_METHOD_delete(a,b) ((X509V3_EXT_METHOD *) \ - sk_delete((a),(b))) - #define sk_X509V3_EXT_METHOD_delete_ptr(a,b) ((X509V3_EXT_METHOD *) \ - sk_delete_ptr((a),(char *)(b))) - #define sk_X509V3_EXT_METHOD_insert(a,b,c) sk_insert((a),(char *)(b),(c)) - #define sk_X509V3_EXT_METHOD_set_cmp_func(a,b) ((int (*) \ - (const X509V3_EXT_METHOD * const *,const X509V3_EXT_METHOD * const *)) \ - sk_set_cmp_func((a),(int (*) \ - (const char * const *, const char * const *))(b))) - #define sk_X509V3_EXT_METHOD_dup(a) sk_dup(a) - #define sk_X509V3_EXT_METHOD_pop_free(a,b) sk_pop_free((a),(void (*)(void *))(b)) - #define sk_X509V3_EXT_METHOD_shift(a) ((X509V3_EXT_METHOD *)sk_shift(a)) - #define sk_X509V3_EXT_METHOD_pop(a) ((X509V3_EXT_METHOD *)sk_pop(a)) - #define sk_X509V3_EXT_METHOD_sort(a) sk_sort(a) -#endif /* !DEBUG_SAFESTACK */ -/* End of perl script block, you may now edit :-) */ /* ext_flags values */ #define X509V3_EXT_DYNAMIC 0x1 @@ -217,71 +186,9 @@ typedef struct ACCESS_DESCRIPTION_st { } ACCESS_DESCRIPTION; DECLARE_STACK_OF(GENERAL_NAME) -/* This block of defines is updated by a perl script, please do not touch! */ -#ifndef DEBUG_SAFESTACK - #define sk_GENERAL_NAME_new(a) sk_new((int (*) \ - (const char * const *, const char * const *))(a)) - #define sk_GENERAL_NAME_new_null() sk_new_null() - #define sk_GENERAL_NAME_free(a) sk_free(a) - #define sk_GENERAL_NAME_num(a) sk_num(a) - #define sk_GENERAL_NAME_value(a,b) ((GENERAL_NAME *) \ - sk_value((a),(b))) - #define sk_GENERAL_NAME_set(a,b,c) ((GENERAL_NAME *) \ - sk_set((a),(b),(char *)(c))) - #define sk_GENERAL_NAME_zero(a) sk_zero(a) - #define sk_GENERAL_NAME_push(a,b) sk_push((a),(char *)(b)) - #define sk_GENERAL_NAME_unshift(a,b) sk_unshift((a),(b)) - #define sk_GENERAL_NAME_find(a,b) sk_find((a), (char *)(b)) - #define sk_GENERAL_NAME_delete(a,b) ((GENERAL_NAME *) \ - sk_delete((a),(b))) - #define sk_GENERAL_NAME_delete_ptr(a,b) ((GENERAL_NAME *) \ - sk_delete_ptr((a),(char *)(b))) - #define sk_GENERAL_NAME_insert(a,b,c) sk_insert((a),(char *)(b),(c)) - #define sk_GENERAL_NAME_set_cmp_func(a,b) ((int (*) \ - (const GENERAL_NAME * const *,const GENERAL_NAME * const *)) \ - sk_set_cmp_func((a),(int (*) \ - (const char * const *, const char * const *))(b))) - #define sk_GENERAL_NAME_dup(a) sk_dup(a) - #define sk_GENERAL_NAME_pop_free(a,b) sk_pop_free((a),(void (*)(void *))(b)) - #define sk_GENERAL_NAME_shift(a) ((GENERAL_NAME *)sk_shift(a)) - #define sk_GENERAL_NAME_pop(a) ((GENERAL_NAME *)sk_pop(a)) - #define sk_GENERAL_NAME_sort(a) sk_sort(a) -#endif /* !DEBUG_SAFESTACK */ -/* End of perl script block, you may now edit :-) */ DECLARE_ASN1_SET_OF(GENERAL_NAME) DECLARE_STACK_OF(ACCESS_DESCRIPTION) -/* This block of defines is updated by a perl script, please do not touch! */ -#ifndef DEBUG_SAFESTACK - #define sk_ACCESS_DESCRIPTION_new(a) sk_new((int (*) \ - (const char * const *, const char * const *))(a)) - #define sk_ACCESS_DESCRIPTION_new_null() sk_new_null() - #define sk_ACCESS_DESCRIPTION_free(a) sk_free(a) - #define sk_ACCESS_DESCRIPTION_num(a) sk_num(a) - #define sk_ACCESS_DESCRIPTION_value(a,b) ((ACCESS_DESCRIPTION *) \ - sk_value((a),(b))) - #define sk_ACCESS_DESCRIPTION_set(a,b,c) ((ACCESS_DESCRIPTION *) \ - sk_set((a),(b),(char *)(c))) - #define sk_ACCESS_DESCRIPTION_zero(a) sk_zero(a) - #define sk_ACCESS_DESCRIPTION_push(a,b) sk_push((a),(char *)(b)) - #define sk_ACCESS_DESCRIPTION_unshift(a,b) sk_unshift((a),(b)) - #define sk_ACCESS_DESCRIPTION_find(a,b) sk_find((a), (char *)(b)) - #define sk_ACCESS_DESCRIPTION_delete(a,b) ((ACCESS_DESCRIPTION *) \ - sk_delete((a),(b))) - #define sk_ACCESS_DESCRIPTION_delete_ptr(a,b) ((ACCESS_DESCRIPTION *) \ - sk_delete_ptr((a),(char *)(b))) - #define sk_ACCESS_DESCRIPTION_insert(a,b,c) sk_insert((a),(char *)(b),(c)) - #define sk_ACCESS_DESCRIPTION_set_cmp_func(a,b) ((int (*) \ - (const ACCESS_DESCRIPTION * const *,const ACCESS_DESCRIPTION * const *)) \ - sk_set_cmp_func((a),(int (*) \ - (const char * const *, const char * const *))(b))) - #define sk_ACCESS_DESCRIPTION_dup(a) sk_dup(a) - #define sk_ACCESS_DESCRIPTION_pop_free(a,b) sk_pop_free((a),(void (*)(void *))(b)) - #define sk_ACCESS_DESCRIPTION_shift(a) ((ACCESS_DESCRIPTION *)sk_shift(a)) - #define sk_ACCESS_DESCRIPTION_pop(a) ((ACCESS_DESCRIPTION *)sk_pop(a)) - #define sk_ACCESS_DESCRIPTION_sort(a) sk_sort(a) -#endif /* !DEBUG_SAFESTACK */ -/* End of perl script block, you may now edit :-) */ DECLARE_ASN1_SET_OF(ACCESS_DESCRIPTION) typedef struct DIST_POINT_NAME_st { @@ -297,37 +204,6 @@ STACK_OF(GENERAL_NAME) *CRLissuer; } DIST_POINT; DECLARE_STACK_OF(DIST_POINT) -/* This block of defines is updated by a perl script, please do not touch! */ -#ifndef DEBUG_SAFESTACK - #define sk_DIST_POINT_new(a) sk_new((int (*) \ - (const char * const *, const char * const *))(a)) - #define sk_DIST_POINT_new_null() sk_new_null() - #define sk_DIST_POINT_free(a) sk_free(a) - #define sk_DIST_POINT_num(a) sk_num(a) - #define sk_DIST_POINT_value(a,b) ((DIST_POINT *) \ - sk_value((a),(b))) - #define sk_DIST_POINT_set(a,b,c) ((DIST_POINT *) \ - sk_set((a),(b),(char *)(c))) - #define sk_DIST_POINT_zero(a) sk_zero(a) - #define sk_DIST_POINT_push(a,b) sk_push((a),(char *)(b)) - #define sk_DIST_POINT_unshift(a,b) sk_unshift((a),(b)) - #define sk_DIST_POINT_find(a,b) sk_find((a), (char *)(b)) - #define sk_DIST_POINT_delete(a,b) ((DIST_POINT *) \ - sk_delete((a),(b))) - #define sk_DIST_POINT_delete_ptr(a,b) ((DIST_POINT *) \ - sk_delete_ptr((a),(char *)(b))) - #define sk_DIST_POINT_insert(a,b,c) sk_insert((a),(char *)(b),(c)) - #define sk_DIST_POINT_set_cmp_func(a,b) ((int (*) \ - (const DIST_POINT * const *,const DIST_POINT * const *)) \ - sk_set_cmp_func((a),(int (*) \ - (const char * const *, const char * const *))(b))) - #define sk_DIST_POINT_dup(a) sk_dup(a) - #define sk_DIST_POINT_pop_free(a,b) sk_pop_free((a),(void (*)(void *))(b)) - #define sk_DIST_POINT_shift(a) ((DIST_POINT *)sk_shift(a)) - #define sk_DIST_POINT_pop(a) ((DIST_POINT *)sk_pop(a)) - #define sk_DIST_POINT_sort(a) sk_sort(a) -#endif /* !DEBUG_SAFESTACK */ -/* End of perl script block, you may now edit :-) */ DECLARE_ASN1_SET_OF(DIST_POINT) typedef struct AUTHORITY_KEYID_st { @@ -344,37 +220,6 @@ typedef struct SXNET_ID_st { } SXNETID; DECLARE_STACK_OF(SXNETID) -/* This block of defines is updated by a perl script, please do not touch! */ -#ifndef DEBUG_SAFESTACK - #define sk_SXNETID_new(a) sk_new((int (*) \ - (const char * const *, const char * const *))(a)) - #define sk_SXNETID_new_null() sk_new_null() - #define sk_SXNETID_free(a) sk_free(a) - #define sk_SXNETID_num(a) sk_num(a) - #define sk_SXNETID_value(a,b) ((SXNETID *) \ - sk_value((a),(b))) - #define sk_SXNETID_set(a,b,c) ((SXNETID *) \ - sk_set((a),(b),(char *)(c))) - #define sk_SXNETID_zero(a) sk_zero(a) - #define sk_SXNETID_push(a,b) sk_push((a),(char *)(b)) - #define sk_SXNETID_unshift(a,b) sk_unshift((a),(b)) - #define sk_SXNETID_find(a,b) sk_find((a), (char *)(b)) - #define sk_SXNETID_delete(a,b) ((SXNETID *) \ - sk_delete((a),(b))) - #define sk_SXNETID_delete_ptr(a,b) ((SXNETID *) \ - sk_delete_ptr((a),(char *)(b))) - #define sk_SXNETID_insert(a,b,c) sk_insert((a),(char *)(b),(c)) - #define sk_SXNETID_set_cmp_func(a,b) ((int (*) \ - (const SXNETID * const *,const SXNETID * const *)) \ - sk_set_cmp_func((a),(int (*) \ - (const char * const *, const char * const *))(b))) - #define sk_SXNETID_dup(a) sk_dup(a) - #define sk_SXNETID_pop_free(a,b) sk_pop_free((a),(void (*)(void *))(b)) - #define sk_SXNETID_shift(a) ((SXNETID *)sk_shift(a)) - #define sk_SXNETID_pop(a) ((SXNETID *)sk_pop(a)) - #define sk_SXNETID_sort(a) sk_sort(a) -#endif /* !DEBUG_SAFESTACK */ -/* End of perl script block, you may now edit :-) */ DECLARE_ASN1_SET_OF(SXNETID) typedef struct SXNET_st { @@ -402,37 +247,6 @@ typedef struct POLICYQUALINFO_st { } POLICYQUALINFO; DECLARE_STACK_OF(POLICYQUALINFO) -/* This block of defines is updated by a perl script, please do not touch! */ -#ifndef DEBUG_SAFESTACK - #define sk_POLICYQUALINFO_new(a) sk_new((int (*) \ - (const char * const *, const char * const *))(a)) - #define sk_POLICYQUALINFO_new_null() sk_new_null() - #define sk_POLICYQUALINFO_free(a) sk_free(a) - #define sk_POLICYQUALINFO_num(a) sk_num(a) - #define sk_POLICYQUALINFO_value(a,b) ((POLICYQUALINFO *) \ - sk_value((a),(b))) - #define sk_POLICYQUALINFO_set(a,b,c) ((POLICYQUALINFO *) \ - sk_set((a),(b),(char *)(c))) - #define sk_POLICYQUALINFO_zero(a) sk_zero(a) - #define sk_POLICYQUALINFO_push(a,b) sk_push((a),(char *)(b)) - #define sk_POLICYQUALINFO_unshift(a,b) sk_unshift((a),(b)) - #define sk_POLICYQUALINFO_find(a,b) sk_find((a), (char *)(b)) - #define sk_POLICYQUALINFO_delete(a,b) ((POLICYQUALINFO *) \ - sk_delete((a),(b))) - #define sk_POLICYQUALINFO_delete_ptr(a,b) ((POLICYQUALINFO *) \ - sk_delete_ptr((a),(char *)(b))) - #define sk_POLICYQUALINFO_insert(a,b,c) sk_insert((a),(char *)(b),(c)) - #define sk_POLICYQUALINFO_set_cmp_func(a,b) ((int (*) \ - (const POLICYQUALINFO * const *,const POLICYQUALINFO * const *)) \ - sk_set_cmp_func((a),(int (*) \ - (const char * const *, const char * const *))(b))) - #define sk_POLICYQUALINFO_dup(a) sk_dup(a) - #define sk_POLICYQUALINFO_pop_free(a,b) sk_pop_free((a),(void (*)(void *))(b)) - #define sk_POLICYQUALINFO_shift(a) ((POLICYQUALINFO *)sk_shift(a)) - #define sk_POLICYQUALINFO_pop(a) ((POLICYQUALINFO *)sk_pop(a)) - #define sk_POLICYQUALINFO_sort(a) sk_sort(a) -#endif /* !DEBUG_SAFESTACK */ -/* End of perl script block, you may now edit :-) */ DECLARE_ASN1_SET_OF(POLICYQUALINFO) typedef struct POLICYINFO_st { @@ -441,37 +255,6 @@ typedef struct POLICYINFO_st { } POLICYINFO; DECLARE_STACK_OF(POLICYINFO) -/* This block of defines is updated by a perl script, please do not touch! */ -#ifndef DEBUG_SAFESTACK - #define sk_POLICYINFO_new(a) sk_new((int (*) \ - (const char * const *, const char * const *))(a)) - #define sk_POLICYINFO_new_null() sk_new_null() - #define sk_POLICYINFO_free(a) sk_free(a) - #define sk_POLICYINFO_num(a) sk_num(a) - #define sk_POLICYINFO_value(a,b) ((POLICYINFO *) \ - sk_value((a),(b))) - #define sk_POLICYINFO_set(a,b,c) ((POLICYINFO *) \ - sk_set((a),(b),(char *)(c))) - #define sk_POLICYINFO_zero(a) sk_zero(a) - #define sk_POLICYINFO_push(a,b) sk_push((a),(char *)(b)) - #define sk_POLICYINFO_unshift(a,b) sk_unshift((a),(b)) - #define sk_POLICYINFO_find(a,b) sk_find((a), (char *)(b)) - #define sk_POLICYINFO_delete(a,b) ((POLICYINFO *) \ - sk_delete((a),(b))) - #define sk_POLICYINFO_delete_ptr(a,b) ((POLICYINFO *) \ - sk_delete_ptr((a),(char *)(b))) - #define sk_POLICYINFO_insert(a,b,c) sk_insert((a),(char *)(b),(c)) - #define sk_POLICYINFO_set_cmp_func(a,b) ((int (*) \ - (const POLICYINFO * const *,const POLICYINFO * const *)) \ - sk_set_cmp_func((a),(int (*) \ - (const char * const *, const char * const *))(b))) - #define sk_POLICYINFO_dup(a) sk_dup(a) - #define sk_POLICYINFO_pop_free(a,b) sk_pop_free((a),(void (*)(void *))(b)) - #define sk_POLICYINFO_shift(a) ((POLICYINFO *)sk_shift(a)) - #define sk_POLICYINFO_pop(a) ((POLICYINFO *)sk_pop(a)) - #define sk_POLICYINFO_sort(a) sk_sort(a) -#endif /* !DEBUG_SAFESTACK */ -/* End of perl script block, you may now edit :-) */ DECLARE_ASN1_SET_OF(POLICYINFO) #define X509V3_conf_err(val) ERR_add_error_data(6, "section:", val->section, \ @@ -570,37 +353,6 @@ typedef struct x509_purpose_st { #define X509_PURPOSE_MAX 7 DECLARE_STACK_OF(X509_PURPOSE) -/* This block of defines is updated by a perl script, please do not touch! */ -#ifndef DEBUG_SAFESTACK - #define sk_X509_PURPOSE_new(a) sk_new((int (*) \ - (const char * const *, const char * const *))(a)) - #define sk_X509_PURPOSE_new_null() sk_new_null() - #define sk_X509_PURPOSE_free(a) sk_free(a) - #define sk_X509_PURPOSE_num(a) sk_num(a) - #define sk_X509_PURPOSE_value(a,b) ((X509_PURPOSE *) \ - sk_value((a),(b))) - #define sk_X509_PURPOSE_set(a,b,c) ((X509_PURPOSE *) \ - sk_set((a),(b),(char *)(c))) - #define sk_X509_PURPOSE_zero(a) sk_zero(a) - #define sk_X509_PURPOSE_push(a,b) sk_push((a),(char *)(b)) - #define sk_X509_PURPOSE_unshift(a,b) sk_unshift((a),(b)) - #define sk_X509_PURPOSE_find(a,b) sk_find((a), (char *)(b)) - #define sk_X509_PURPOSE_delete(a,b) ((X509_PURPOSE *) \ - sk_delete((a),(b))) - #define sk_X509_PURPOSE_delete_ptr(a,b) ((X509_PURPOSE *) \ - sk_delete_ptr((a),(char *)(b))) - #define sk_X509_PURPOSE_insert(a,b,c) sk_insert((a),(char *)(b),(c)) - #define sk_X509_PURPOSE_set_cmp_func(a,b) ((int (*) \ - (const X509_PURPOSE * const *,const X509_PURPOSE * const *)) \ - sk_set_cmp_func((a),(int (*) \ - (const char * const *, const char * const *))(b))) - #define sk_X509_PURPOSE_dup(a) sk_dup(a) - #define sk_X509_PURPOSE_pop_free(a,b) sk_pop_free((a),(void (*)(void *))(b)) - #define sk_X509_PURPOSE_shift(a) ((X509_PURPOSE *)sk_shift(a)) - #define sk_X509_PURPOSE_pop(a) ((X509_PURPOSE *)sk_pop(a)) - #define sk_X509_PURPOSE_sort(a) sk_sort(a) -#endif /* !DEBUG_SAFESTACK */ -/* End of perl script block, you may now edit :-) */ void ERR_load_X509V3_strings(void); int i2d_BASIC_CONSTRAINTS(BASIC_CONSTRAINTS *a, unsigned char **pp); diff --git a/doc/apps/rsa.pod b/doc/apps/rsa.pod index 62ad62e23d..f0e613ed05 100644 --- a/doc/apps/rsa.pod +++ b/doc/apps/rsa.pod @@ -14,6 +14,7 @@ B<openssl> B<rsa> [B<-passin arg>] [B<-out filename>] [B<-passout arg>] +[B<-sgckey>] [B<-des>] [B<-des3>] [B<-idea>] @@ -42,9 +43,8 @@ This specifies the input format. The B<DER> option uses an ASN1 DER encoded form compatible with the PKCS#1 RSAPrivateKey or SubjectPublicKeyInfo format. The B<PEM> form is the default format: it consists of the B<DER> format base64 encoded with additional header and footer lines. On input PKCS#8 format private -keys are also accepted. The B<NET> form is a format compatible with older Netscape -servers and MS IIS, this uses unsalted RC4 for its encryption. It is not very -secure and so should only be used when necessary. +keys are also accepted. The B<NET> form is a format is described in the B<NOTES> +section. =item B<-outform DER|NET|PEM> @@ -74,6 +74,11 @@ filename. the output file password source. For more information about the format of B<arg> see the B<PASS PHRASE ARGUMENTS> section in L<openssl(1)|openssl(1)>. +=item B<-sgckey> + +use the modified NET algorithm used with some versions of Microsoft IIS and SGC +keys. + =item B<-des|-des3|-idea> These options encrypt the private key with the DES, triple DES, or the @@ -126,6 +131,18 @@ The PEM public key format uses the header and footer lines: -----BEGIN PUBLIC KEY----- -----END PUBLIC KEY----- +The B<NET> form is a format compatible with older Netscape servers +and Microsoft IIS .key files, this uses unsalted RC4 for its encryption. +It is not very secure and so should only be used when necessary. + +Some newer version of IIS have additional data in the exported .key +files. To use thse with the utility view the file with a binary editor +and look for the string "private-key", then trace back to the byte +sequence 0x30, 0x82 (this is an ASN1 SEQUENCE). Copy all the data +from this point onwards to another file and use that as the input +to the B<rsa> utility with the B<-inform NET> option. If you get +an error after entering the password try the B<-sgckey> option. + =head1 EXAMPLES To remove the pass phrase on an RSA private key: @@ -148,6 +165,14 @@ To just output the public part of a private key: openssl rsa -in key.pem -pubout -out pubkey.pem +=head1 BUGS + +The command line password arguments don't currently work with +B<NET> format. + +There should be an option that automatically handles .key files, +without having to manually edit them. + =head1 SEE ALSO L<pkcs8(1)|pkcs8(1)>, L<dsa(1)|dsa(1)>, L<genrsa(1)|genrsa(1)>, diff --git a/doc/c-indentation.el b/doc/c-indentation.el index 9111450915..48ca3cf69b 100644 --- a/doc/c-indentation.el +++ b/doc/c-indentation.el @@ -39,7 +39,8 @@ (label . -) (arglist-cont-nonempty . +) (topmost-intro . -) - (brace-list-close . +) - (brace-list-intro . +) + (brace-list-close . 0) + (brace-list-intro . 0) + (brace-list-open . +) )))) diff --git a/doc/crypto/threads.pod b/doc/crypto/threads.pod index 5da056f3f8..a31b170806 100644 --- a/doc/crypto/threads.pod +++ b/doc/crypto/threads.pod @@ -15,10 +15,27 @@ CRYPTO_set_locking_callback, CRYPTO_set_id_callback - OpenSSL thread support int CRYPTO_num_locks(void); + + /* struct CRYPTO_dynlock_value needs to be defined by the user */ + typedef struct CRYPTO_dynlock_value CRYPTO_dynlock; + + void CRYPTO_set_dynlock_create_callback(CRYPTO_dynlock *(*dyn_create_function) + (char *file, int line)); + void CRYPTO_set_dynlock_lock_callback(void (*dyn_lock_function) + (int mode, CRYPTO_dynlock *l, const char *file, int line)); + void CRYPTO_set_dynlock_destroy_callback(void (*dyn_destroy_function) + (CRYPTO_dynlock *l, const char *file, int line)); + + int CRYPTO_get_new_dynlockid(void); + + void CRYPTO_destroy_dynlockid(int i); + + void CRYPTO_lock(int mode, int n, const char *file, int line); + =head1 DESCRIPTION OpenSSL can safely be used in multi-threaded applications provided -that two callback functions are set. +that at least two callback functions are set. locking_function(int mode, int n, const char *file, int line) is needed to perform locking on shared data stuctures. Multi-threaded @@ -35,9 +52,55 @@ id_function(void) is a function that returns a thread ID. It is not needed on Windows nor on platforms where getpid() returns a different ID for each thread (most notably Linux). +Additionally, OpenSSL supports dynamic locks, and sometimes, some parts +of OpenSSL need it for better performance. To enable this, the following +is required: + +=item * +Three additional callback function, dyn_create_function, dyn_lock_function +and dyn_destroy_function. + +=item * +A structure defined with the data that each lock needs to handle. + +struct CRYPTO_dynlock_value has to be defined to contain whatever structure +is needed to handle locks. + +dyn_create_function(const char *file, int line) is needed to create a +lock. Multi-threaded applications might crash at random if it is not set. + +dyn_lock_function(int mode, CRYPTO_dynlock *l, const char *file, int line) +is needed to perform locking off dynamic lock nunmbered n. Multi-threaded +applications might crash at random if it is not set. + +dyn_destroy_function(CRYPTO_dynlock *l, const char *file, int line) is +needed to destroy the lock l. Multi-threaded applications might crash at +random if it is not set. + +CRYPTO_get_new_dynlockid() is used to create locks. It will call +dyn_create_function for the actual creation. + +CRYPTO_destroy_dynlockid() is used to destroy locks. It will call +dyn_destroy_function for the actual destruction. + +CRYPTO_lock() is used to lock and unlock the locks. mode is a bitfield +describing what should be done with the lock. n is the number of the +lock as returned from CRYPTO_get_new_dynlockid(). mode can be combined +from the following values. These values are pairwise exclusive, with +undefined behavior if misused (for example, CRYPTO_READ and CRYPTO_WRITE +should not be used together): + + CRYPTO_LOCK 0x01 + CRYPTO_UNLOCK 0x02 + CRYPTO_READ 0x04 + CRYPTO_WRITE 0x08 + =head1 RETURN VALUES CRYPTO_num_locks() returns the required number of locks. + +CRYPTO_get_new_dynlockid() returns the index to the newly created lock. + The other functions return no values. =head1 NOTE @@ -62,6 +125,7 @@ Solaris, Irix and Win32. CRYPTO_set_locking_callback() and CRYPTO_set_id_callback() are available in all versions of SSLeay and OpenSSL. CRYPTO_num_locks() was added in OpenSSL 0.9.4. +All functions dealing with dynamic locks were added in OpenSSL 0.9.5b-dev. =head1 SEE ALSO diff --git a/makevms.com b/makevms.com index 21462f3621..0371fa8cf5 100755 --- a/makevms.com +++ b/makevms.com @@ -395,7 +395,7 @@ $ EXHEADER_ASN1 := asn1.h,asn1_mac.h $ EXHEADER_PEM := pem.h,pem2.h $ EXHEADER_X509 := x509.h,x509_vfy.h $ EXHEADER_X509V3 := x509v3.h -$ EXHEADER_CONF := conf.h +$ EXHEADER_CONF := conf.h,conf_api.h $ EXHEADER_TXT_DB := txt_db.h $ EXHEADER_PKCS7 := pkcs7.h $ EXHEADER_PKCS12 := pkcs12.h @@ -192,37 +192,6 @@ typedef struct ssl_cipher_st } SSL_CIPHER; DECLARE_STACK_OF(SSL_CIPHER) -/* This block of defines is updated by a perl script, please do not touch! */ -#ifndef DEBUG_SAFESTACK - #define sk_SSL_CIPHER_new(a) sk_new((int (*) \ - (const char * const *, const char * const *))(a)) - #define sk_SSL_CIPHER_new_null() sk_new_null() - #define sk_SSL_CIPHER_free(a) sk_free(a) - #define sk_SSL_CIPHER_num(a) sk_num(a) - #define sk_SSL_CIPHER_value(a,b) ((SSL_CIPHER *) \ - sk_value((a),(b))) - #define sk_SSL_CIPHER_set(a,b,c) ((SSL_CIPHER *) \ - sk_set((a),(b),(char *)(c))) - #define sk_SSL_CIPHER_zero(a) sk_zero(a) - #define sk_SSL_CIPHER_push(a,b) sk_push((a),(char *)(b)) - #define sk_SSL_CIPHER_unshift(a,b) sk_unshift((a),(b)) - #define sk_SSL_CIPHER_find(a,b) sk_find((a), (char *)(b)) - #define sk_SSL_CIPHER_delete(a,b) ((SSL_CIPHER *) \ - sk_delete((a),(b))) - #define sk_SSL_CIPHER_delete_ptr(a,b) ((SSL_CIPHER *) \ - sk_delete_ptr((a),(char *)(b))) - #define sk_SSL_CIPHER_insert(a,b,c) sk_insert((a),(char *)(b),(c)) - #define sk_SSL_CIPHER_set_cmp_func(a,b) ((int (*) \ - (const SSL_CIPHER * const *,const SSL_CIPHER * const *)) \ - sk_set_cmp_func((a),(int (*) \ - (const char * const *, const char * const *))(b))) - #define sk_SSL_CIPHER_dup(a) sk_dup(a) - #define sk_SSL_CIPHER_pop_free(a,b) sk_pop_free((a),(void (*)(void *))(b)) - #define sk_SSL_CIPHER_shift(a) ((SSL_CIPHER *)sk_shift(a)) - #define sk_SSL_CIPHER_pop(a) ((SSL_CIPHER *)sk_pop(a)) - #define sk_SSL_CIPHER_sort(a) sk_sort(a) -#endif /* !DEBUG_SAFESTACK */ -/* End of perl script block, you may now edit :-) */ typedef struct ssl_st SSL; typedef struct ssl_ctx_st SSL_CTX; @@ -402,37 +371,6 @@ typedef struct ssl_comp_st } SSL_COMP; DECLARE_STACK_OF(SSL_COMP) -/* This block of defines is updated by a perl script, please do not touch! */ -#ifndef DEBUG_SAFESTACK - #define sk_SSL_COMP_new(a) sk_new((int (*) \ - (const char * const *, const char * const *))(a)) - #define sk_SSL_COMP_new_null() sk_new_null() - #define sk_SSL_COMP_free(a) sk_free(a) - #define sk_SSL_COMP_num(a) sk_num(a) - #define sk_SSL_COMP_value(a,b) ((SSL_COMP *) \ - sk_value((a),(b))) - #define sk_SSL_COMP_set(a,b,c) ((SSL_COMP *) \ - sk_set((a),(b),(char *)(c))) - #define sk_SSL_COMP_zero(a) sk_zero(a) - #define sk_SSL_COMP_push(a,b) sk_push((a),(char *)(b)) - #define sk_SSL_COMP_unshift(a,b) sk_unshift((a),(b)) - #define sk_SSL_COMP_find(a,b) sk_find((a), (char *)(b)) - #define sk_SSL_COMP_delete(a,b) ((SSL_COMP *) \ - sk_delete((a),(b))) - #define sk_SSL_COMP_delete_ptr(a,b) ((SSL_COMP *) \ - sk_delete_ptr((a),(char *)(b))) - #define sk_SSL_COMP_insert(a,b,c) sk_insert((a),(char *)(b),(c)) - #define sk_SSL_COMP_set_cmp_func(a,b) ((int (*) \ - (const SSL_COMP * const *,const SSL_COMP * const *)) \ - sk_set_cmp_func((a),(int (*) \ - (const char * const *, const char * const *))(b))) - #define sk_SSL_COMP_dup(a) sk_dup(a) - #define sk_SSL_COMP_pop_free(a,b) sk_pop_free((a),(void (*)(void *))(b)) - #define sk_SSL_COMP_shift(a) ((SSL_COMP *)sk_shift(a)) - #define sk_SSL_COMP_pop(a) ((SSL_COMP *)sk_pop(a)) - #define sk_SSL_COMP_sort(a) sk_sort(a) -#endif /* !DEBUG_SAFESTACK */ -/* End of perl script block, you may now edit :-) */ struct ssl_ctx_st { diff --git a/util/libeay.num b/util/libeay.num index 85b99f0010..5500838638 100755 --- a/util/libeay.num +++ b/util/libeay.num @@ -1786,7 +1786,7 @@ DSO_get_default_method 2265 DSO_get_method 2266 DSO_set_method 2267 DSO_load 2268 -DSO_bind 2269 +DSO_bind_var 2269 DSO_METHOD_null 2270 DSO_METHOD_openssl 2271 DSO_METHOD_dlfcn 2272 @@ -1827,50 +1827,14 @@ RAND_egd_bytes 2402 X509_REQ_get1_email 2403 X509_get1_email 2404 X509_email_free 2405 -ERR_load_ENGINE_strings 2406 -ENGINE_set_DSA 2407 -ENGINE_get_default_RSA 2408 -ENGINE_get_BN_mod_exp 2409 -DSA_get_default_openssl_method 2410 -ENGINE_set_DH 2411 -ENGINE_set_default_BN_mod_exp_crt 2412 -ENGINE_init 2413 -DH_get_default_openssl_method 2414 -RSA_set_default_openssl_method 2415 -ENGINE_finish 2416 -ENGINE_get_DH 2417 -ENGINE_set_default_DSA 2418 -ENGINE_get_name 2419 -ENGINE_get_last 2420 -ENGINE_get_prev 2421 -ENGINE_get_default_DH 2422 -ENGINE_get_RSA 2423 -ENGINE_set_default 2424 -ENGINE_get_RAND 2425 -ENGINE_get_first 2426 -ENGINE_by_id 2427 -ENGINE_get_default_BN_mod_exp_crt 2428 -RSA_get_default_openssl_method 2429 -ENGINE_set_RSA 2430 -ENGINE_set_default_RAND 2431 -ENGINE_set_BN_mod_exp 2432 -ENGINE_remove 2433 -ENGINE_free 2434 -ENGINE_get_BN_mod_exp_crt 2435 -ENGINE_get_next 2436 -ENGINE_set_name 2437 -ENGINE_get_default_DSA 2438 -ENGINE_set_default_BN_mod_exp 2439 -ENGINE_set_default_RSA 2440 -ENGINE_get_default_RAND 2441 -ENGINE_get_default_BN_mod_exp 2442 -ENGINE_set_RAND 2443 -ENGINE_set_id 2444 -ENGINE_set_BN_mod_exp_crt 2445 -ENGINE_set_default_DH 2446 -ENGINE_new 2447 -ENGINE_get_id 2448 -DSA_set_default_openssl_method 2449 -ENGINE_add 2450 -DH_set_default_openssl_method 2451 -ENGINE_get_DSA 2452 +i2d_RSA_NET 2406 +d2i_RSA_NET_2 2407 +d2i_RSA_NET 2408 +DSO_bind_func 2409 +CRYPTO_get_new_dynlockid 2410 +sk_new_null 2411 +CRYPTO_set_dynlock_destroy_callback 2412 +CRYPTO_destroy_dynlockid 2413 +CRYPTO_set_dynlock_size 2414 +CRYPTO_set_dynlock_create_callback 2415 +CRYPTO_set_dynlock_lock_callback 2416 diff --git a/util/mkdef.pl b/util/mkdef.pl index 74d1b5d9bd..09c242c478 100755 --- a/util/mkdef.pl +++ b/util/mkdef.pl @@ -49,7 +49,7 @@ foreach (@ARGV, split(/ /, $options)) $do_update=1 if $_ eq "update"; $do_ctest=1 if $_ eq "ctest"; $rsaref=1 if $_ eq "rsaref"; - $safe_stack_def=1 if $_ eq "-DDEBUG_SAFESTACK"; + #$safe_stack_def=1 if $_ eq "-DDEBUG_SAFESTACK"; if (/^no-rc2$/) { $no_rc2=1; } elsif (/^no-rc4$/) { $no_rc4=1; } @@ -271,7 +271,10 @@ sub do_defs } elsif (/^\#/) { next; } - if ($safe_stack_def && + if (!$safe_stack_def && + /^\s*DECLARE_STACK_OF\s*\(\s*(\w*)\s*\)/) { + next; + } elsif ($safe_stack_def && /^\s*DECLARE_STACK_OF\s*\(\s*(\w*)\s*\)/) { $funcs{"sk_${1}_new"} = 1; $funcs{"sk_${1}_new_null"} = 1; @@ -292,6 +295,9 @@ sub do_defs $funcs{"sk_${1}_shift"} = 1; $funcs{"sk_${1}_pop"} = 1; $funcs{"sk_${1}_sort"} = 1; + } if (!$safe_stack_def && + /^\s*DECLARE_ASN1_SET_OF\s*\(\s*(\w*)\s*\)/) { + next; } elsif ($safe_stack_def && /^\s*DECLARE_ASN1_SET_OF\s*\(\s*(\w*)\s*\)/) { $funcs{"d2i_ASN1_SET_OF_${1}"} = 1; diff --git a/util/mklink.pl b/util/mklink.pl index de555820ec..d7b997ada7 100755 --- a/util/mklink.pl +++ b/util/mklink.pl @@ -49,7 +49,7 @@ my $to = join('/', @to_path); my $file; foreach $file (@files) { -# print "ln -s $to/$file $from/$file\n"; - symlink("$to/$file", "$from/$file"); - print $file . " => $from/$file\n"; + my $err = ""; + symlink("$to/$file", "$from/$file") or $err = " [$!]"; + print $file . " => $from/$file$err\n"; } diff --git a/util/mkstack.pl b/util/mkstack.pl index 30f1722312..ec76351bca 100755 --- a/util/mkstack.pl +++ b/util/mkstack.pl @@ -1,112 +1,99 @@ #!/usr/local/bin/perl -w -# + # This is a utility that searches out "DECLARE_STACK_OF()" -# declarations in header files, and updates/creates/replaces -# the corresponding macro declarations that follow it. The -# reason is that with "DEBUG_SAFESTACK" defined, each type -# will generate 19 functions, all type-safe variants of the -# base "sk_***" functions for the general STACK type. Without -# DEBUG_SAFESTACK defined, we need to macro define all the -# "type'd sk_##type##_***" functions as mapping directly to -# the standard sk_*** equivalents. As it's not generally -# possible to have macros that generate macros, we need to -# control this from the "outside", here in this script. +# declarations in .h and .c files, and updates/creates/replaces +# the corresponding macro declarations in crypto/stack/safestack.h. +# As it's not generally possible to have macros that generate macros, +# we need to control this from the "outside", here in this script. # # Geoff Thorpe, June, 2000 (with massive Perl-hacking # help from Steve Robb) -my $type_thing; -my $recurse = 0; -my @files = @ARGV; +my $safestack = "crypto/stack/safestack"; +my $do_write; while (@ARGV) { my $arg = $ARGV[0]; - if($arg eq "-recurse") { - $recurse = 1; - shift @ARGV; - } else { - last; + if($arg eq "-write") { + $do_write = 1; } + shift @ARGV; } -if($recurse) { - @source = (<crypto/*.[ch]>, <crypto/*/*.[ch]>, <rsaref/*.[ch]>, <ssl/*.[ch]>); -} else { - @source = @ARGV; -} +@source = (<crypto/*.[ch]>, <crypto/*/*.[ch]>, <rsaref/*.[ch]>, <ssl/*.[ch]>); foreach $file (@source) { - # After "Configure" has been run, we need to make sure we don't - # overwrite symbollic links with new header files! next if -l $file; # Open the .c/.h file for reading open(IN, "< $file") || die "Can't open $file for reading: $!"; - open(OUT, "> $file.tmp") || die "Can't open $file.tmp for writing: $!"; - select(OUT); - process_the_file(); - - close(OUT); + while(<IN>) { + if (/^DECLARE_STACK_OF\(([^)]+)\)/) { + push @stacklst, $1; + } + } close(IN); - - unlink($file); - rename("$file.tmp", $file); } -sub process_the_file { - my $inside_block = 0; - my $output_defines = 0; +my $old_stackfile = ""; +my $new_stackfile = ""; +my $inside_block = 0; +my $type_thing; - while(<IN>) { - if (/^DECLARE_STACK_OF\(([^)]+)\)/) { - $type_thing = $1; - $output_defines = 1; - } - if (m|^/\* This block of defines is updated by a perl script, please do not touch! \*/|) { - $inside_block = 1; - } - if (m|^/\* End of perl script block, you may now edit :-\) \*/|) { - $inside_block = 0; - } elsif ($inside_block == 0) { - print; - } - if($output_defines == 1) { - print <<EOF; -/* This block of defines is updated by a perl script, please do not touch! */ -#ifndef DEBUG_SAFESTACK - #define sk_${type_thing}_new(a) sk_new((int (*) \\ - (const char * const *, const char * const *))(a)) - #define sk_${type_thing}_new_null() sk_new_null() - #define sk_${type_thing}_free(a) sk_free(a) - #define sk_${type_thing}_num(a) sk_num(a) - #define sk_${type_thing}_value(a,b) ((${type_thing} *) \\ - sk_value((a),(b))) - #define sk_${type_thing}_set(a,b,c) ((${type_thing} *) \\ - sk_set((a),(b),(char *)(c))) - #define sk_${type_thing}_zero(a) sk_zero(a) - #define sk_${type_thing}_push(a,b) sk_push((a),(char *)(b)) - #define sk_${type_thing}_unshift(a,b) sk_unshift((a),(b)) - #define sk_${type_thing}_find(a,b) sk_find((a), (char *)(b)) - #define sk_${type_thing}_delete(a,b) ((${type_thing} *) \\ - sk_delete((a),(b))) - #define sk_${type_thing}_delete_ptr(a,b) ((${type_thing} *) \\ - sk_delete_ptr((a),(char *)(b))) - #define sk_${type_thing}_insert(a,b,c) sk_insert((a),(char *)(b),(c)) - #define sk_${type_thing}_set_cmp_func(a,b) ((int (*) \\ - (const ${type_thing} * const *,const ${type_thing} * const *)) \\ - sk_set_cmp_func((a),(int (*) \\ - (const char * const *, const char * const *))(b))) - #define sk_${type_thing}_dup(a) sk_dup(a) - #define sk_${type_thing}_pop_free(a,b) sk_pop_free((a),(void (*)(void *))(b)) - #define sk_${type_thing}_shift(a) ((${type_thing} *)sk_shift(a)) - #define sk_${type_thing}_pop(a) ((${type_thing} *)sk_pop(a)) - #define sk_${type_thing}_sort(a) sk_sort(a) -#endif /* !DEBUG_SAFESTACK */ -/* End of perl script block, you may now edit :-) */ +open(IN, "< $safestack.h") || die "Can't open input file: $!"; +while(<IN>) { + $old_stackfile .= $_; + + if (m|^/\* This block of defines is updated by util/mkstack.pl, please do not touch! \*/|) { + $inside_block = 1; + } + if (m|^/\* End of util/mkstack.pl block, you may now edit :-\) \*/|) { + $inside_block = 0; + } elsif ($inside_block == 0) { + $new_stackfile .= $_; + } + next if($inside_block != 1); + $new_stackfile .= "/* This block of defines is updated by util/mkstack.pl, please do not touch! */"; + + foreach $type_thing (@stacklst) { + $new_stackfile .= <<EOF; + +#define sk_${type_thing}_new(st) SKM_sk_new($type_thing, (st)) +#define sk_${type_thing}_new_null() SKM_sk_new_null($type_thing) +#define sk_${type_thing}_free(st) SKM_sk_free($type_thing, (st)) +#define sk_${type_thing}_num(st) SKM_sk_num($type_thing, (st)) +#define sk_${type_thing}_value(st, i) SKM_sk_value($type_thing, (st), (i)) +#define sk_${type_thing}_set(st, i, val) SKM_sk_set($type_thing, (st), (i), (val)) +#define sk_${type_thing}_zero(st) SKM_sk_zero($type_thing, (st)) +#define sk_${type_thing}_push(st, val) SKM_sk_push($type_thing, (st), (val)) +#define sk_${type_thing}_unshift(st, val) SKM_sk_unshift($type_thing, (st), (val)) +#define sk_${type_thing}_find(st, val) SKM_sk_find($type_thing, (st), (val)) +#define sk_${type_thing}_delete(st, i) SKM_sk_delete($type_thing, (st), (i)) +#define sk_${type_thing}_delete_ptr(st, ptr) SKM_sk_delete_ptr($type_thing, (st), (ptr)) +#define sk_${type_thing}_insert(st, val, i) SKM_sk_insert($type_thing, (st), (val), (i)) +#define sk_${type_thing}_set_cmp_func(st, cmp) SKM_sk_set_cmp_func($type_thing, (st), (cmp)) +#define sk_${type_thing}_dup(st) SKM_sk_dup($type_thing, st) +#define sk_${type_thing}_pop_free(st, free_func) SKM_sk_pop_free($type_thing, (st), (free_func)) +#define sk_${type_thing}_shift(st) SKM_sk_shift($type_thing, (st)) +#define sk_${type_thing}_pop(st) SKM_sk_pop($type_thing, (st)) +#define sk_${type_thing}_sort(st) SKM_sk_sort($type_thing, (st)) EOF - $output_defines = 0; - } } + $new_stackfile .= "/* End of util/mkstack.pl block, you may now edit :-) */\n"; + $inside_block = 2; +} + + +if ($new_stackfile eq $old_stackfile) { + print "No changes to $safestack.h.\n"; + exit 0; # avoid unnecessary rebuild +} + +if ($do_write) { + print "Writing new $safestack.h.\n"; + open OUT, ">$safestack.h" || die "Can't open output file"; + print OUT $new_stackfile; + close OUT; } |