70 const
unsigned char **in,
long len,
72 int tag,
int aclass,
char opt,
ASN1_TLC *ctx);
74 static
int x509_name_ex_i2d(
ASN1_VALUE **val,
unsigned char **out,
75 const
ASN1_ITEM *it,
int tag,
int aclass);
82 static
int i2d_name_canon(
STACK_OF(STACK_OF_X509_NAME_ENTRY) *intname,
136 if(!ret)
goto memerr;
173 const unsigned char **in,
long len,
const ASN1_ITEM *it,
174 int tag,
int aclass,
char opt,
ASN1_TLC *ctx)
176 const unsigned char *
p = *in, *
q;
177 union {
STACK_OF(STACK_OF_X509_NAME_ENTRY) *s;
188 tag, aclass, opt, ctx);
190 if(ret <= 0)
return ret;
192 if(*val) x509_name_ex_free(val, NULL);
193 if(!x509_name_ex_new(&
nm.a, NULL))
goto err;
210 ret = x509_name_canon(
nm.x);
219 X509_NAME_free(
nm.x);
224 static int x509_name_ex_i2d(
ASN1_VALUE **val,
unsigned char **out,
const ASN1_ITEM *it,
int tag,
int aclass)
229 ret = x509_name_encode(a);
232 ret = x509_name_canon(a);
254 static int x509_name_encode(
X509_NAME *a)
256 union {
STACK_OF(STACK_OF_X509_NAME_ENTRY) *s;
264 if(!intname.s)
goto memerr;
267 if(entry->
set !=
set) {
269 if(!entries)
goto memerr;
284 local_sk_X509_NAME_ENTRY_free);
289 local_sk_X509_NAME_ENTRY_free);
321 STACK_OF(STACK_OF_X509_NAME_ENTRY) *intname = NULL;
324 int i,
set = -1, ret = 0;
343 if(entry->
set !=
set)
352 tmpentry = X509_NAME_ENTRY_new();
354 if (!asn1_string_canon(tmpentry->
value, entry->
value))
372 i2d_name_canon(intname, &p);
379 X509_NAME_ENTRY_free(tmpentry);
382 local_sk_X509_NAME_ENTRY_pop_free);
388 #define ASN1_MASK_CANON \
389 (B_ASN1_UTF8STRING | B_ASN1_BMPSTRING | B_ASN1_UNIVERSALSTRING \
390 | B_ASN1_PRINTABLESTRING | B_ASN1_T61STRING | B_ASN1_IA5STRING \
391 | B_ASN1_VISIBLESTRING)
396 unsigned char *to, *from;
424 while((len > 0) && !(*from & 0x80) && isspace(*from))
433 while ((len > 0) && !(*to & 0x80) && isspace(*to))
451 else if (isspace(*from))
464 while(!(*from & 0x80) && isspace(*from));
468 *to++ = tolower(*from);
480 static int i2d_name_canon(
STACK_OF(STACK_OF_X509_NAME_ENTRY) *_intname,
504 if (!xn || !name)
return(0);