Commit 7ef82068 authored by Dr. Stephen Henson's avatar Dr. Stephen Henson
Browse files

Handle ASN1_SET_OF and PKCS12_STACK_OF using function
casts in the same way as STACK_OF.
parent 438fa2fd
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -13,8 +13,8 @@
     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.
     the default if no major problems. Similar behaviour for ASN1_SET_OF
     and PKCS12_STACK_OF.
     [Steve Henson]

  *) When some versions of IIS use the 'NET' form of private key the
+2 −43
Original line number Diff line number Diff line
@@ -145,49 +145,8 @@ extern "C" {

struct X509_algor_st;

#define DECLARE_ASN1_SET_OF(type) \
int i2d_ASN1_SET_OF_##type(STACK_OF(type) *a,unsigned char **pp, \
			   int (*func)(type *,unsigned char **), int ex_tag, \
			   int ex_class, int is_set); \
STACK_OF(type) *d2i_ASN1_SET_OF_##type(STACK_OF(type) **a,unsigned char **pp, \
				       long length, \
				       type *(*func)(type **, \
						     unsigned char **,long), \
				       void (*free_func)(type *), \
				       int ex_tag,int ex_class); \
unsigned char *ASN1_seq_pack_##type(STACK_OF(type) *st, \
				    int (*i2d)(type *,unsigned char **), \
				    unsigned char **buf,int *len); \
STACK_OF(type) *ASN1_seq_unpack_##type(unsigned char *buf,int len, \
				       type *(*d2i)(type **,unsigned char **, \
						    long), \
				       void (*free_func)(type *));

#define IMPLEMENT_ASN1_SET_OF(type) \
int i2d_ASN1_SET_OF_##type(STACK_OF(type) *a,unsigned char **pp, \
			   int (*func)(type *,unsigned char **), int ex_tag, \
			   int ex_class, int is_set) \
    { return i2d_ASN1_SET((STACK *)a,pp,func,ex_tag,ex_class,is_set); } \
STACK_OF(type) *d2i_ASN1_SET_OF_##type(STACK_OF(type) **a,unsigned char **pp, \
				       long length, \
				       type *(*func)(type **, \
						     unsigned char **,long), \
				       void (*free_func)(type *), \
				       int ex_tag,int ex_class) \
    { return (STACK_OF(type) *)d2i_ASN1_SET((STACK **)a,pp,length, \
					    (char *(*)())func, \
					    (void (*)())free_func, \
					    ex_tag,ex_class); } \
unsigned char *ASN1_seq_pack_##type(STACK_OF(type) *st, \
				    int (*i2d)(type *,unsigned char **), \
				    unsigned char **buf,int *len) \
    { return ASN1_seq_pack((STACK *)st,i2d,buf,len); } \
STACK_OF(type) *ASN1_seq_unpack_##type(unsigned char *buf,int len, \
				       type *(*d2i)(type **,unsigned char **, \
						    long), \
				       void (*free_func)(type *)) \
    { return (STACK_OF(type) *)ASN1_seq_unpack(buf,len,(char *(*)())d2i, \
					       (void(*)(void *))free_func); }
#define DECLARE_ASN1_SET_OF(type) /* filled in by mkstack.pl */
#define IMPLEMENT_ASN1_SET_OF(type) /* nothing, no longer needed */

typedef struct asn1_ctx_st
	{
+3 −3
Original line number Diff line number Diff line
@@ -66,8 +66,8 @@
static double SSLeay_MSVC5_hack=0.0; /* and for VC1.5 */
#endif

DECLARE_STACK_OF(CRYPTO_dynlock);
IMPLEMENT_STACK_OF(CRYPTO_dynlock);
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] =
@@ -175,7 +175,7 @@ int CRYPTO_get_new_dynlockid(void)
		}
	CRYPTO_w_lock(CRYPTO_LOCK_DYNLOCK);
	if ((dyn_locks == NULL)
		&& ((dyn_locks=sk_new_null()) == NULL))
		&& ((dyn_locks=sk_CRYPTO_dynlock_new_null()) == NULL))
		{
		CRYPTO_w_unlock(CRYPTO_LOCK_DYNLOCK);
		CRYPTOerr(CRYPTO_F_CRYPTO_GET_NEW_DYNLOCKID,ERR_R_MALLOC_FAILURE);
+333 −0

File changed.

Preview size limit exceeded, changes collapsed.

+2 −20
Original line number Diff line number Diff line
@@ -102,26 +102,8 @@ extern "C" {
#endif

  /* If placed in pkcs12.h, we end up with a circular depency with pkcs7.h */
#define DECLARE_PKCS12_STACK_OF(type) \
STACK_OF(type) *PKCS12_decrypt_d2i_##type(struct X509_algor_st *algor, \
				          type *(*d2i)(type **, \
						       unsigned char **, \
						       long), \
					  void (*free_func)(type *), \
					  const char *pass, int passlen, \
					  ASN1_STRING *oct, int seq);

#define IMPLEMENT_PKCS12_STACK_OF(type) \
STACK_OF(type) *PKCS12_decrypt_d2i_##type(struct X509_algor_st *algor, \
				          type *(*d2i)(type **, \
						       unsigned char **, \
						       long), \
					  void (*free_func)(type *), \
					  const char *pass, int passlen, \
					  ASN1_STRING *oct, int seq) \
    { return (STACK_OF(type) *)PKCS12_decrypt_d2i(algor,(char *(*)())d2i, \
						  (void(*)(void *))free_func, \
						  pass,passlen,oct,seq); }
#define DECLARE_PKCS12_STACK_OF(type) /* Nothing */
#define IMPLEMENT_PKCS12_STACK_OF(type) /* Nothing */

#define X509_FILETYPE_PEM	1
#define X509_FILETYPE_ASN1	2
Loading