#include <stdio.h>
#include "cryptlib.h"
-#include "objects.h"
-#include "asn1_mac.h"
+#include <openssl/objects.h>
+#include <openssl/asn1_mac.h>
/*
- * ASN1err(ASN1_F_D2I_X509_NAME,ASN1_R_LENGTH_MISMATCH);
+ * ASN1err(ASN1_F_D2I_X509_NAME,ERR_R_ASN1_LENGTH_MISMATCH);
* ASN1err(ASN1_F_X509_NAME_NEW,ASN1_R_UNKNOWN_ATTRIBUTE_TYPE);
- * ASN1err(ASN1_F_D2I_X509_NAME_ENTRY,ASN1_R_LENGTH_MISMATCH);
+ * ASN1err(ASN1_F_D2I_X509_NAME_ENTRY,ERR_R_ASN1_LENGTH_MISMATCH);
* ASN1err(ASN1_F_X509_NAME_ENTRY_NEW,ASN1_R_UNKNOWN_ATTRIBUTE_TYPE);
*/
static int i2d_X509_NAME_entries();
#endif
-int i2d_X509_NAME_ENTRY(a,pp)
-X509_NAME_ENTRY *a;
-unsigned char **pp;
+int i2d_X509_NAME_ENTRY(X509_NAME_ENTRY *a, unsigned char **pp)
{
M_ASN1_I2D_vars(a);
M_ASN1_I2D_finish();
}
-X509_NAME_ENTRY *d2i_X509_NAME_ENTRY(a,pp,length)
-X509_NAME_ENTRY **a;
-unsigned char **pp;
-long length;
+X509_NAME_ENTRY *d2i_X509_NAME_ENTRY(X509_NAME_ENTRY **a, unsigned char **pp,
+ long length)
{
M_ASN1_D2I_vars(a,X509_NAME_ENTRY *,X509_NAME_ENTRY_new);
M_ASN1_D2I_Finish(a,X509_NAME_ENTRY_free,ASN1_F_D2I_X509_NAME_ENTRY);
}
-int i2d_X509_NAME(a,pp)
-X509_NAME *a;
-unsigned char **pp;
+int i2d_X509_NAME(X509_NAME *a, unsigned char **pp)
{
int ret;
return(ret);
}
-static int i2d_X509_NAME_entries(a)
-X509_NAME *a;
+static int i2d_X509_NAME_entries(X509_NAME *a)
{
X509_NAME_ENTRY *ne,*fe=NULL;
STACK *sk;
return(-1);
}
-X509_NAME *d2i_X509_NAME(a,pp,length)
-X509_NAME **a;
-unsigned char **pp;
-long length;
+X509_NAME *d2i_X509_NAME(X509_NAME **a, unsigned char **pp, long length)
{
int set=0,i;
int idx=0;
for (;;)
{
if (M_ASN1_D2I_end_sequence()) break;
- M_ASN1_D2I_get_set(ret->entries,d2i_X509_NAME_ENTRY);
+ M_ASN1_D2I_get_set(ret->entries,d2i_X509_NAME_ENTRY,
+ X509_NAME_ENTRY_free);
for (; idx < sk_num(ret->entries); idx++)
{
((X509_NAME_ENTRY *)sk_value(ret->entries,idx))->set=
M_ASN1_D2I_Finish(a,X509_NAME_free,ASN1_F_D2I_X509_NAME);
}
-X509_NAME *X509_NAME_new()
+X509_NAME *X509_NAME_new(void)
{
X509_NAME *ret=NULL;
+ ASN1_CTX c;
M_ASN1_New_Malloc(ret,X509_NAME);
- if ((ret->entries=sk_new(NULL)) == NULL) goto err2;
+ if ((ret->entries=sk_new(NULL)) == NULL)
+ { c.line=__LINE__; goto err2; }
M_ASN1_New(ret->bytes,BUF_MEM_new);
ret->modified=1;
return(ret);
M_ASN1_New_Error(ASN1_F_X509_NAME_NEW);
}
-X509_NAME_ENTRY *X509_NAME_ENTRY_new()
+X509_NAME_ENTRY *X509_NAME_ENTRY_new(void)
{
X509_NAME_ENTRY *ret=NULL;
+ ASN1_CTX c;
M_ASN1_New_Malloc(ret,X509_NAME_ENTRY);
/* M_ASN1_New(ret->object,ASN1_OBJECT_new);*/
M_ASN1_New_Error(ASN1_F_X509_NAME_ENTRY_NEW);
}
-void X509_NAME_free(a)
-X509_NAME *a;
+void X509_NAME_free(X509_NAME *a)
{
+ if(a == NULL)
+ return;
+
BUF_MEM_free(a->bytes);
sk_pop_free(a->entries,X509_NAME_ENTRY_free);
Free((char *)a);
}
-void X509_NAME_ENTRY_free(a)
-X509_NAME_ENTRY *a;
+void X509_NAME_ENTRY_free(X509_NAME_ENTRY *a)
{
if (a == NULL) return;
ASN1_OBJECT_free(a->object);
Free((char *)a);
}
-int X509_NAME_set(xn,name)
-X509_NAME **xn;
-X509_NAME *name;
+int X509_NAME_set(X509_NAME **xn, X509_NAME *name)
{
X509_NAME *in;