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

Changed naming and prototype convention for x509write functions

CSR writing functions now start with x509write_csr_*()
DER writing functions now have the context at the start instead of the
end conforming to other modules.
This commit is contained in:
Paul Bakker
2013-08-25 11:01:31 +02:00
parent 384d4351ce
commit 82e2945ed2
5 changed files with 44 additions and 49 deletions

View File

@@ -41,12 +41,12 @@
#define polarssl_free free
#endif
void x509cert_req_init( x509_cert_req *ctx )
void x509write_csr_init( x509_csr *ctx )
{
memset( ctx, 0, sizeof(x509_cert_req) );
memset( ctx, 0, sizeof(x509_csr) );
}
void x509cert_req_free( x509_cert_req *ctx )
void x509write_csr_free( x509_csr *ctx )
{
x509_req_name *cur;
@@ -56,20 +56,20 @@ void x509cert_req_free( x509_cert_req *ctx )
polarssl_free( cur );
}
memset( ctx, 0, sizeof(x509_cert_req) );
memset( ctx, 0, sizeof(x509_csr) );
}
void x509cert_req_set_md_alg( x509_cert_req *ctx, md_type_t md_alg )
void x509write_csr_set_md_alg( x509_csr *ctx, md_type_t md_alg )
{
ctx->md_alg = md_alg;
}
void x509cert_req_set_rsa_key( x509_cert_req *ctx, rsa_context *rsa )
void x509write_csr_set_rsa_key( x509_csr *ctx, rsa_context *rsa )
{
ctx->rsa = rsa;
}
int x509cert_req_set_subject_name( x509_cert_req *ctx, char *subject_name )
int x509write_csr_set_subject_name( x509_csr *ctx, char *subject_name )
{
int ret = 0;
char *s = subject_name, *c = s;
@@ -148,7 +148,7 @@ exit:
return( ret );
}
int x509_write_pubkey_der( unsigned char *buf, size_t size, rsa_context *rsa )
int x509write_pubkey_der( rsa_context *rsa, unsigned char *buf, size_t size )
{
int ret;
unsigned char *c;
@@ -190,7 +190,7 @@ int x509_write_pubkey_der( unsigned char *buf, size_t size, rsa_context *rsa )
return( len );
}
int x509_write_key_der( unsigned char *buf, size_t size, rsa_context *rsa )
int x509write_key_der( rsa_context *rsa, unsigned char *buf, size_t size )
{
int ret;
unsigned char *c;
@@ -293,8 +293,7 @@ static int x509_write_sig( unsigned char **p, unsigned char *start,
return( len );
}
int x509_write_cert_req( x509_cert_req *ctx, unsigned char *buf,
size_t size )
int x509write_csr_der( x509_csr *ctx, unsigned char *buf, size_t size )
{
int ret;
const char *sig_oid;