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

Initial, incomplete support for typesafe macros without using function

casts.
parent 28b987ae
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -4,6 +4,13 @@

 Changes between 0.9.8e and 0.9.9  [xx XXX xxxx]

  *) Initial incomplete changes to avoid need for function casts in OpenSSL
     when OPENSSL_NO_FCAST is set: some compilers (gcc 4.2 and later) reject
     their use. Safestack is reimplemented using inline functions: tests show
     that these calls are typically optimized away by compilers so they have
     no additional overhead. Update ASN1 to avoid use of legacy functions. 
     [Steve Henson]

  *) Win32/64 targets are linked with Winsock2.
     [Andy Polyakov]

+6 −0
Original line number Diff line number Diff line
@@ -518,12 +518,18 @@ typedef struct asn1_type_st
		 * contain the set or sequence bytes */
		ASN1_STRING *		set;
		ASN1_STRING *		sequence;
		ASN1_VALUE *		asn1_value;
		} value;
	} ASN1_TYPE;

DECLARE_STACK_OF(ASN1_TYPE)
DECLARE_ASN1_SET_OF(ASN1_TYPE)

typedef STACK_OF(ASN1_TYPE) ASN1_SEQUENCE_ANY;

DECLARE_ASN1_ENCODE_FUNCTIONS_const(ASN1_SEQUENCE_ANY, ASN1_SEQUENCE_ANY)
DECLARE_ASN1_ENCODE_FUNCTIONS_const(ASN1_SEQUENCE_ANY, ASN1_SET_ANY)

typedef struct NETSCAPE_X509_st
	{
	ASN1_OCTET_STRING *header;
+4 −12
Original line number Diff line number Diff line
@@ -442,9 +442,9 @@ static ASN1_TYPE *asn1_multi(int utype, const char *section, X509V3_CTX *cnf)
	ASN1_TYPE *ret = NULL;
	STACK_OF(ASN1_TYPE) *sk = NULL;
	STACK_OF(CONF_VALUE) *sect = NULL;
	unsigned char *der = NULL, *p;
	unsigned char *der = NULL;
	int derlen;
	int i, is_set;
	int i;
	sk = sk_ASN1_TYPE_new_null();
	if (section)
		{
@@ -465,17 +465,9 @@ static ASN1_TYPE *asn1_multi(int utype, const char *section, X509V3_CTX *cnf)
	/* Now we has a STACK of the components, convert to the correct form */

	if (utype == V_ASN1_SET)
		is_set = 1;
		derlen = i2d_ASN1_SET_ANY(sk, &der);
	else
		is_set = 0;


	derlen = i2d_ASN1_SET_OF_ASN1_TYPE(sk, NULL, i2d_ASN1_TYPE, utype,
					   V_ASN1_UNIVERSAL, is_set);
	der = OPENSSL_malloc(derlen);
	p = der;
	i2d_ASN1_SET_OF_ASN1_TYPE(sk, &p, i2d_ASN1_TYPE, utype,
				  V_ASN1_UNIVERSAL, is_set);
		derlen = i2d_ASN1_SEQUENCE_ANY(sk, &der);

	if (!(ret = ASN1_TYPE_new()))
		goto bad;
+1 −2
Original line number Diff line number Diff line
@@ -124,8 +124,7 @@ EVP_PKEY *d2i_AutoPrivateKey(EVP_PKEY **a, const unsigned char **pp,
	 * by analyzing it we can determine the passed structure: this
	 * assumes the input is surrounded by an ASN1 SEQUENCE.
	 */
	inkey = d2i_ASN1_SET_OF_ASN1_TYPE(NULL, &p, length, d2i_ASN1_TYPE, 
			ASN1_TYPE_free, V_ASN1_SEQUENCE, V_ASN1_UNIVERSAL);
	inkey = d2i_ASN1_SEQUENCE_ANY(NULL, &p, length);
	/* Since we only need to discern "traditional format" RSA and DSA
	 * keys we can just count the elements.
         */
+1 −1
Original line number Diff line number Diff line
@@ -106,7 +106,7 @@ X509_ALGOR *PKCS5_pbe_set(int alg, int iter, unsigned char *salt,
	}

	astype->type = V_ASN1_SEQUENCE;
	if(!ASN1_pack_string_of(PBEPARAM, pbe, i2d_PBEPARAM,
	if(!ASN1_item_pack(pbe, ASN1_ITEM_rptr(PBEPARAM),
				&astype->value.sequence)) {
		ASN1err(ASN1_F_PKCS5_PBE_SET,ERR_R_MALLOC_FAILURE);
		goto err;
Loading