#include <stdio.h>
#include "cryptlib.h"
-#include "objects.h"
-#include "asn1_mac.h"
-
-/*
- * 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,ERR_R_ASN1_LENGTH_MISMATCH);
- * ASN1err(ASN1_F_X509_NAME_ENTRY_NEW,ASN1_R_UNKNOWN_ATTRIBUTE_TYPE);
- */
+#include <openssl/objects.h>
+#include <openssl/asn1_mac.h>
-#ifndef NOPROTO
static int i2d_X509_NAME_entries(X509_NAME *a);
-#else
-static int i2d_X509_NAME_entries();
-#endif
-
int i2d_X509_NAME_ENTRY(X509_NAME_ENTRY *a, unsigned char **pp)
{
M_ASN1_I2D_vars(a);
static int i2d_X509_NAME_entries(X509_NAME *a)
{
X509_NAME_ENTRY *ne,*fe=NULL;
- STACK *sk;
+ STACK_OF(X509_NAME_ENTRY) *sk;
BUF_MEM *buf=NULL;
int set=0,r,ret=0;
int i;
int size=0;
sk=a->entries;
- for (i=0; i<sk_num(sk); i++)
+ for (i=0; i<sk_X509_NAME_ENTRY_num(sk); i++)
{
- ne=(X509_NAME_ENTRY *)sk_value(sk,i);
+ ne=sk_X509_NAME_ENTRY_value(sk,i);
if (fe == NULL)
{
fe=ne;
ASN1_put_object(&p,1,ret,V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL);
set= -1;
- for (i=0; i<sk_num(sk); i++)
+ for (i=0; i<sk_X509_NAME_ENTRY_num(sk); i++)
{
- ne=(X509_NAME_ENTRY *)sk_value(sk,i);
+ ne=sk_X509_NAME_ENTRY_value(sk,i);
if (set != ne->set)
{
set=ne->set;
M_ASN1_D2I_vars(a,X509_NAME *,X509_NAME_new);
orig= *pp;
- if (sk_num(ret->entries) > 0)
+ if (sk_X509_NAME_ENTRY_num(ret->entries) > 0)
{
- while (sk_num(ret->entries) > 0)
- X509_NAME_ENTRY_free((X509_NAME_ENTRY *)
- sk_pop(ret->entries));
+ while (sk_X509_NAME_ENTRY_num(ret->entries) > 0)
+ X509_NAME_ENTRY_free(
+ sk_X509_NAME_ENTRY_pop(ret->entries));
}
M_ASN1_D2I_Init();
for (;;)
{
if (M_ASN1_D2I_end_sequence()) break;
- M_ASN1_D2I_get_set(ret->entries,d2i_X509_NAME_ENTRY,
- X509_NAME_ENTRY_free);
- for (; idx < sk_num(ret->entries); idx++)
+ M_ASN1_D2I_get_set_type(X509_NAME_ENTRY,ret->entries,
+ d2i_X509_NAME_ENTRY,
+ X509_NAME_ENTRY_free);
+ for (; idx < sk_X509_NAME_ENTRY_num(ret->entries); idx++)
{
- ((X509_NAME_ENTRY *)sk_value(ret->entries,idx))->set=
- set;
+ sk_X509_NAME_ENTRY_value(ret->entries,idx)->set=set;
}
set++;
}
ASN1_CTX c;
M_ASN1_New_Malloc(ret,X509_NAME);
- if ((ret->entries=sk_new(NULL)) == NULL)
+ if ((ret->entries=sk_X509_NAME_ENTRY_new(NULL)) == NULL)
{ c.line=__LINE__; goto err2; }
M_ASN1_New(ret->bytes,BUF_MEM_new);
ret->modified=1;
return;
BUF_MEM_free(a->bytes);
- sk_pop_free(a->entries,X509_NAME_ENTRY_free);
- Free((char *)a);
+ sk_X509_NAME_ENTRY_pop_free(a->entries,X509_NAME_ENTRY_free);
+ Free(a);
}
void X509_NAME_ENTRY_free(X509_NAME_ENTRY *a)
if (a == NULL) return;
ASN1_OBJECT_free(a->object);
ASN1_BIT_STRING_free(a->value);
- Free((char *)a);
+ Free(a);
}
int X509_NAME_set(X509_NAME **xn, X509_NAME *name)
return(*xn != NULL);
}
+IMPLEMENT_STACK_OF(X509_NAME_ENTRY)
+IMPLEMENT_ASN1_SET_OF(X509_NAME_ENTRY)