47#if !defined(MBEDTLS_CONFIG_FILE)
50#include MBEDTLS_CONFIG_FILE
53#if defined(MBEDTLS_X509_CREATE_C)
72} x509_attr_descriptor_t;
74#define ADD_STRLEN( s ) s, sizeof( s ) - 1
77static const x509_attr_descriptor_t x509_attrs[] =
81 { ADD_STRLEN(
"commonName" ),
85 { ADD_STRLEN(
"countryName" ),
89 { ADD_STRLEN(
"organizationName" ),
93 { ADD_STRLEN(
"locality" ),
99 { ADD_STRLEN(
"organizationalUnitName" ),
101 { ADD_STRLEN(
"ST" ),
103 { ADD_STRLEN(
"stateOrProvinceName" ),
105 { ADD_STRLEN(
"emailAddress" ),
107 { ADD_STRLEN(
"serialNumber" ),
109 { ADD_STRLEN(
"postalAddress" ),
111 { ADD_STRLEN(
"postalCode" ),
113 { ADD_STRLEN(
"dnQualifier" ),
115 { ADD_STRLEN(
"title" ),
117 { ADD_STRLEN(
"surName" ),
119 { ADD_STRLEN(
"SN" ),
121 { ADD_STRLEN(
"givenName" ),
123 { ADD_STRLEN(
"GN" ),
125 { ADD_STRLEN(
"initials" ),
127 { ADD_STRLEN(
"pseudonym" ),
129 { ADD_STRLEN(
"generationQualifier" ),
131 { ADD_STRLEN(
"domainComponent" ),
133 { ADD_STRLEN(
"DC" ),
138static const x509_attr_descriptor_t *x509_attr_descr_from_name(
const char *
name,
size_t name_len )
140 const x509_attr_descriptor_t *
cur;
143 if(
cur->name_len == name_len &&
158 const char *oid =
NULL;
159 const x509_attr_descriptor_t* attr_descr =
NULL;
169 if( in_tag && *
c ==
'=' )
171 if( ( attr_descr = x509_attr_descr_from_name(
s,
c -
s ) ) ==
NULL )
177 oid = attr_descr->oid;
183 if( !in_tag && *
c ==
'\\' &&
c !=
end )
188 if(
c ==
end || *
c !=
',' )
194 else if( !in_tag && ( *
c ==
',' ||
c ==
end ) )
198 (
unsigned char *)
data,
207 cur->val.tag = attr_descr->default_tag;
209 while(
c <
end && *(
c + 1) ==
' ' )
216 if( !in_tag &&
s !=
c + 1 )
239 int critical,
const unsigned char *
val,
size_t val_len )
249 cur->val.p[0] = critical;
271 const char *oid = (
const char*)cur_name->
oid.
p;
272 size_t oid_len = cur_name->
oid.
len;
273 const unsigned char *
name = cur_name->
val.
p;
274 size_t name_len = cur_name->
val.
len;
320 const char *oid,
size_t oid_len,
321 unsigned char *sig,
size_t size )
350static int x509_write_extension(
unsigned char **
p,
unsigned char *
start,
357 ext->val.len - 1 ) );
361 if(
ext->val.p[0] != 0 )
395 while( cur_ext !=
NULL )
398 cur_ext = cur_ext->
next;
ACPI_SIZE strlen(const char *String)
int strncmp(const char *String1, const char *String2, ACPI_SIZE Count)
struct outqueuenode * head
ASN.1 buffer writing functionality.
int mbedtls_asn1_write_raw_buffer(unsigned char **p, unsigned char *start, const unsigned char *buf, size_t size)
Write raw buffer data.
int mbedtls_asn1_write_tag(unsigned char **p, unsigned char *start, unsigned char tag)
Write an ASN.1 tag in ASN.1 format.
#define MBEDTLS_ASN1_CHK_ADD(g, f)
mbedtls_asn1_named_data * mbedtls_asn1_store_named_data(mbedtls_asn1_named_data **list, const char *oid, size_t oid_len, const unsigned char *val, size_t val_len)
Create or find a specific named_data entry for writing in a sequence or list based on the OID....
int mbedtls_asn1_write_len(unsigned char **p, unsigned char *start, size_t len)
Write a length field in ASN.1 format.
int mbedtls_asn1_write_algorithm_identifier(unsigned char **p, unsigned char *start, const char *oid, size_t oid_len, size_t par_len)
Write an AlgorithmIdentifier sequence in ASN.1 format.
int mbedtls_asn1_write_oid(unsigned char **p, unsigned char *start, const char *oid, size_t oid_len)
Write an OID tag (MBEDTLS_ASN1_OID) and data in ASN.1 format.
int mbedtls_asn1_write_tagged_string(unsigned char **p, unsigned char *start, int tag, const char *text, size_t text_len)
Write a string in ASN.1 format using a specific string encoding tag.
int mbedtls_asn1_write_bool(unsigned char **p, unsigned char *start, int boolean)
Write a boolean tag (MBEDTLS_ASN1_BOOLEAN) and value in ASN.1 format.
static const WCHAR *const ext[]
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
#define MBEDTLS_ASN1_OCTET_STRING
#define MBEDTLS_ASN1_IA5_STRING
struct mbedtls_asn1_named_data * next
#define MBEDTLS_ASN1_PRINTABLE_STRING
#define MBEDTLS_ASN1_SEQUENCE
#define MBEDTLS_ASN1_CONSTRUCTED
#define MBEDTLS_ASN1_NULL
#define MBEDTLS_ERR_ASN1_BUF_TOO_SMALL
#define MBEDTLS_ASN1_UTF8_STRING
void mbedtls_asn1_free_named_data_list(mbedtls_asn1_named_data **head)
Free all entries in a mbedtls_asn1_named_data list Head will be set to NULL.
#define MBEDTLS_ASN1_BIT_STRING
int mbedtls_x509_write_extensions(unsigned char **p, unsigned char *start, mbedtls_asn1_named_data *first)
int mbedtls_x509_write_sig(unsigned char **p, unsigned char *start, const char *oid, size_t oid_len, unsigned char *sig, size_t size)
int mbedtls_x509_set_extension(mbedtls_asn1_named_data **head, const char *oid, size_t oid_len, int critical, const unsigned char *val, size_t val_len)
int mbedtls_x509_write_names(unsigned char **p, unsigned char *start, mbedtls_asn1_named_data *first)
#define MBEDTLS_ERR_X509_INVALID_NAME
#define MBEDTLS_ERR_X509_UNKNOWN_OID
#define MBEDTLS_ERR_X509_ALLOC_FAILED
#define MBEDTLS_X509_MAX_DN_NAME_SIZE
int mbedtls_x509_string_to_names(mbedtls_asn1_named_data **head, const char *name)
#define memcpy(s1, s2, n)
Object Identifier (OID) database.
#define MBEDTLS_OID_AT_GENERATION_QUALIFIER
#define MBEDTLS_OID_AT_POSTAL_ADDRESS
#define MBEDTLS_OID_AT_SERIAL_NUMBER
#define MBEDTLS_OID_AT_DN_QUALIFIER
#define MBEDTLS_OID_AT_INITIALS
#define MBEDTLS_OID_AT_LOCALITY
#define MBEDTLS_OID_AT_POSTAL_CODE
#define MBEDTLS_OID_AT_SUR_NAME
#define MBEDTLS_OID_AT_STATE
#define MBEDTLS_OID_PKCS9_EMAIL
#define MBEDTLS_OID_AT_TITLE
#define MBEDTLS_OID_AT_COUNTRY
#define MBEDTLS_OID_AT_PSEUDONYM
#define MBEDTLS_OID_DOMAIN_COMPONENT
#define MBEDTLS_OID_AT_GIVEN_NAME
#define MBEDTLS_OID_AT_ORGANIZATION
#define MBEDTLS_OID_AT_CN
#define MBEDTLS_OID_AT_ORG_UNIT
Configuration options (set of defines)
X.509 generic defines and structures.