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

Replace the macros in asn1.h with function equivalents. Also make UTF8Strings

tolerated in certificates.
parent 023c8d0b
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -4,6 +4,12 @@

 Changes between 0.9.4 and 0.9.5  [xx XXX 1999]

  *) Add function equivalents to the various macros in asn1.h. The old
     macros are retained with an M_ prefix. Code inside the library can
     use the M_ macros. External code (including the openssl utility)
     should *NOT* in order to be "shared library friendly".
     [Steve Henson]

  *) Add various functions that can check a certificate's extensions
     to see if it usable for various purposes such as SSL client,
     server or S/MIME and CAs of these types. This is currently 
+11 −2
Original line number Diff line number Diff line
@@ -60,6 +60,15 @@
#include "cryptlib.h"
#include <openssl/asn1.h>

ASN1_BIT_STRING *ASN1_BIT_STRING_new(void)
{ return M_ASN1_BIT_STRING_new(); }

void ASN1_BIT_STRING_free(ASN1_BIT_STRING *x)
{ return M_ASN1_BIT_STRING_free(x); }

int ASN1_BIT_STRING_set(ASN1_BIT_STRING *x, unsigned char *d, int len)
{ return M_ASN1_BIT_STRING_set(x, d, len); }

int i2d_ASN1_BIT_STRING(ASN1_BIT_STRING *a, unsigned char **pp)
	{
	int ret,j,r,bits,len;
@@ -121,7 +130,7 @@ ASN1_BIT_STRING *d2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a, unsigned char **pp,

	if ((a == NULL) || ((*a) == NULL))
		{
		if ((ret=ASN1_BIT_STRING_new()) == NULL) return(NULL);
		if ((ret=M_ASN1_BIT_STRING_new()) == NULL) return(NULL);
		}
	else
		ret=(*a);
@@ -173,7 +182,7 @@ ASN1_BIT_STRING *d2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a, unsigned char **pp,
err:
	ASN1err(ASN1_F_D2I_ASN1_BIT_STRING,i);
	if ((ret != NULL) && ((a == NULL) || (*a != ret)))
		ASN1_BIT_STRING_free(ret);
		M_ASN1_BIT_STRING_free(ret);
	return(NULL);
	}

+6 −0
Original line number Diff line number Diff line
@@ -60,6 +60,12 @@
#include "cryptlib.h"
#include <openssl/asn1.h>

ASN1_BMPSTRING *ASN1_BMPSTRING_new(void)
{ return M_ASN1_BMPSTRING_new(); }

void ASN1_BMPSTRING_free(ASN1_BMPSTRING *x)
{ return M_ASN1_BMPSTRING_free(x); }

int i2d_ASN1_BMPSTRING(ASN1_BMPSTRING *a, unsigned char **pp)
	{
	return(i2d_ASN1_bytes((ASN1_STRING *)a,pp,
+10 −4
Original line number Diff line number Diff line
@@ -65,6 +65,12 @@
 * for comments on encoding see a_int.c
 */

ASN1_ENUMERATED *ASN1_ENUMERATED_new(void)
{ return M_ASN1_ENUMERATED_new(); }

void ASN1_ENUMERATED_free(ASN1_ENUMERATED *x)
{ return M_ASN1_ENUMERATED_free(x); }

int i2d_ASN1_ENUMERATED(ASN1_ENUMERATED *a, unsigned char **pp)
	{
	int pad=0,ret,r,i,t;
@@ -142,7 +148,7 @@ ASN1_ENUMERATED *d2i_ASN1_ENUMERATED(ASN1_ENUMERATED **a, unsigned char **pp,

	if ((a == NULL) || ((*a) == NULL))
		{
		if ((ret=ASN1_ENUMERATED_new()) == NULL) return(NULL);
		if ((ret=M_ASN1_ENUMERATED_new()) == NULL) return(NULL);
		ret->type=V_ASN1_ENUMERATED;
		}
	else
@@ -217,7 +223,7 @@ ASN1_ENUMERATED *d2i_ASN1_ENUMERATED(ASN1_ENUMERATED **a, unsigned char **pp,
err:
	ASN1err(ASN1_F_D2I_ASN1_ENUMERATED,i);
	if ((ret != NULL) && ((a == NULL) || (*a != ret)))
		ASN1_ENUMERATED_free(ret);
		M_ASN1_ENUMERATED_free(ret);
	return(NULL);
	}

@@ -295,7 +301,7 @@ ASN1_ENUMERATED *BN_to_ASN1_ENUMERATED(BIGNUM *bn, ASN1_ENUMERATED *ai)
	int len,j;

	if (ai == NULL)
		ret=ASN1_ENUMERATED_new();
		ret=M_ASN1_ENUMERATED_new();
	else
		ret=ai;
	if (ret == NULL)
@@ -311,7 +317,7 @@ ASN1_ENUMERATED *BN_to_ASN1_ENUMERATED(BIGNUM *bn, ASN1_ENUMERATED *ai)
	ret->length=BN_bn2bin(bn,ret->data);
	return(ret);
err:
	if (ret != ai) ASN1_ENUMERATED_free(ret);
	if (ret != ai) M_ASN1_ENUMERATED_free(ret);
	return(NULL);
	}

+8 −2
Original line number Diff line number Diff line
@@ -63,6 +63,12 @@
#include "cryptlib.h"
#include <openssl/asn1.h>

ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_new(void)
{ return M_ASN1_GENERALIZEDTIME_new(); }

void ASN1_GENERALIZEDTIME_free(ASN1_GENERALIZEDTIME *x)
{ return M_ASN1_GENERALIZEDTIME_free(x); }

int i2d_ASN1_GENERALIZEDTIME(ASN1_GENERALIZEDTIME *a, unsigned char **pp)
	{
#ifdef CHARSET_EBCDIC
@@ -106,7 +112,7 @@ ASN1_GENERALIZEDTIME *d2i_ASN1_GENERALIZEDTIME(ASN1_GENERALIZEDTIME **a,
	return(ret);
err:
	if ((ret != NULL) && ((a == NULL) || (*a != ret)))
		ASN1_GENERALIZEDTIME_free(ret);
		M_ASN1_GENERALIZEDTIME_free(ret);
	return(NULL);
	}

@@ -193,7 +199,7 @@ ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_set(ASN1_GENERALIZEDTIME *s,
#endif

	if (s == NULL)
		s=ASN1_GENERALIZEDTIME_new();
		s=M_ASN1_GENERALIZEDTIME_new();
	if (s == NULL)
		return(NULL);

Loading