mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-04-16 08:42:50 +00:00
Switched order of storing x509_req_names to match inputed order
This commit is contained in:
parent
8eabfc1461
commit
2130796658
@ -76,7 +76,7 @@ int x509cert_req_set_subject_name( x509_cert_req *ctx, char *subject_name )
|
|||||||
char *end = s + strlen( s );
|
char *end = s + strlen( s );
|
||||||
char *oid = NULL;
|
char *oid = NULL;
|
||||||
int in_tag = 1;
|
int in_tag = 1;
|
||||||
x509_req_name *cur = ctx->subject;
|
x509_req_name *cur;
|
||||||
|
|
||||||
while( ctx->subject )
|
while( ctx->subject )
|
||||||
{
|
{
|
||||||
@ -121,15 +121,7 @@ int x509cert_req_set_subject_name( x509_cert_req *ctx, char *subject_name )
|
|||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( cur == NULL )
|
cur = polarssl_malloc( sizeof(x509_req_name) );
|
||||||
{
|
|
||||||
ctx->subject = cur = polarssl_malloc( sizeof(x509_req_name) );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
cur->next = polarssl_malloc( sizeof(x509_req_name) );
|
|
||||||
cur = cur->next;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( cur == NULL )
|
if( cur == NULL )
|
||||||
{
|
{
|
||||||
@ -139,6 +131,9 @@ int x509cert_req_set_subject_name( x509_cert_req *ctx, char *subject_name )
|
|||||||
|
|
||||||
memset( cur, 0, sizeof(x509_req_name) );
|
memset( cur, 0, sizeof(x509_req_name) );
|
||||||
|
|
||||||
|
cur->next = ctx->subject;
|
||||||
|
ctx->subject = cur;
|
||||||
|
|
||||||
strncpy( cur->oid, oid, strlen( oid ) );
|
strncpy( cur->oid, oid, strlen( oid ) );
|
||||||
strncpy( cur->name, s, c - s );
|
strncpy( cur->name, s, c - s );
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ void x509_cert_req_check( char *key_file, int md_type,
|
|||||||
int ret;
|
int ret;
|
||||||
size_t olen = 2000;
|
size_t olen = 2000;
|
||||||
FILE *f;
|
FILE *f;
|
||||||
char *subject_name = "CN=PolarSSL Server 1,O=PolarSSL,C=NL";
|
char *subject_name = "C=NL,O=PolarSSL,CN=PolarSSL Server 1";
|
||||||
|
|
||||||
memset( &rsa, 0, sizeof(rsa_context) );
|
memset( &rsa, 0, sizeof(rsa_context) );
|
||||||
ret = x509parse_keyfile_rsa( &rsa, key_file, NULL );
|
ret = x509parse_keyfile_rsa( &rsa, key_file, NULL );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user