1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-08-08 17:42:09 +03:00

Migrated from x509_req_name to asn1_named_data structure

This commit is contained in:
Paul Bakker
2013-09-09 12:02:36 +02:00
parent c547cc992e
commit 5f45e62afe
4 changed files with 67 additions and 110 deletions

View File

@@ -105,10 +105,12 @@ int asn1_write_null( unsigned char **p, unsigned char *start );
* \param p reference to current position pointer
* \param start start of the buffer (for bounds-checking)
* \param oid the OID to write
* \param oid_len length of the OID
*
* \return the length written or a negative error code
*/
int asn1_write_oid( unsigned char **p, unsigned char *start, const char *oid );
int asn1_write_oid( unsigned char **p, unsigned char *start,
const char *oid, size_t oid_len );
/**
* \brief Write an AlgorithmIdentifier sequence in ASN.1 format
@@ -118,11 +120,12 @@ int asn1_write_oid( unsigned char **p, unsigned char *start, const char *oid );
* \param p reference to current position pointer
* \param start start of the buffer (for bounds-checking)
* \param oid the OID of the algorithm
* \param oid_len length of the OID
*
* \return the length written or a negative error code
*/
int asn1_write_algorithm_identifier( unsigned char **p, unsigned char *start,
const char *oid );
const char *oid, size_t oid_len );
/**
* \brief Write a boolean tag (ASN1_BOOLEAN) and value in ASN.1 format
@@ -156,11 +159,12 @@ int asn1_write_int( unsigned char **p, unsigned char *start, int val );
* \param p reference to current position pointer
* \param start start of the buffer (for bounds-checking)
* \param text the text to write
* \param text_len length of the text
*
* \return the length written or a negative error code
*/
int asn1_write_printable_string( unsigned char **p, unsigned char *start,
char *text );
const char *text, size_t text_len );
/**
* \brief Write an IA5 string tag (ASN1_IA5_STRING) and
@@ -170,11 +174,12 @@ int asn1_write_printable_string( unsigned char **p, unsigned char *start,
* \param p reference to current position pointer
* \param start start of the buffer (for bounds-checking)
* \param text the text to write
* \param text_len length of the text
*
* \return the length written or a negative error code
*/
int asn1_write_ia5_string( unsigned char **p, unsigned char *start,
char *text );
const char *text, size_t text_len );
/**
* \brief Write a bitstring tag (ASN1_BIT_STRING) and

View File

@@ -60,25 +60,13 @@ extern "C" {
* \{
*/
/**
* Container for CSR named objects
*/
typedef struct _x509_req_name
{
char oid[128];
char name[128];
struct _x509_req_name *next;
}
x509_req_name;
/**
* Container for a CSR
*/
typedef struct _x509_csr
{
rsa_context *rsa;
x509_req_name *subject;
asn1_named_data *subject;
md_type_t md_alg;
asn1_named_data *extensions;
}
@@ -100,8 +88,8 @@ typedef struct _x509write_cert
mpi serial;
rsa_context *subject_key;
rsa_context *issuer_key;
x509_req_name *subject;
x509_req_name *issuer;
asn1_named_data *subject;
asn1_named_data *issuer;
md_type_t md_alg;
char not_before[X509_RFC5280_UTC_TIME_LEN + 1];
char not_after[X509_RFC5280_UTC_TIME_LEN + 1];