1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-08-01 10:06:53 +03:00

modify library/x509*.c to use polarssl_snprintf

This commit is contained in:
Rich Evans
2015-01-30 11:00:01 +00:00
parent a18b11f285
commit fac657fd52
4 changed files with 50 additions and 46 deletions

View File

@ -51,8 +51,9 @@
#include "polarssl/platform.h"
#else
#include <stdlib.h>
#define polarssl_malloc malloc
#define polarssl_free free
#define polarssl_malloc malloc
#define polarssl_snprintf snprintf
#endif
#if defined(_WIN32) && !defined(EFIX64) && !defined(EFI32)
@ -630,23 +631,23 @@ int x509_crl_info( char *buf, size_t size, const char *prefix,
p = buf;
n = size;
ret = snprintf( p, n, "%sCRL version : %d",
ret = polarssl_snprintf( p, n, "%sCRL version : %d",
prefix, crl->version );
SAFE_SNPRINTF();
ret = snprintf( p, n, "\n%sissuer name : ", prefix );
ret = polarssl_snprintf( p, n, "\n%sissuer name : ", prefix );
SAFE_SNPRINTF();
ret = x509_dn_gets( p, n, &crl->issuer );
SAFE_SNPRINTF();
ret = snprintf( p, n, "\n%sthis update : " \
ret = polarssl_snprintf( p, n, "\n%sthis update : " \
"%04d-%02d-%02d %02d:%02d:%02d", prefix,
crl->this_update.year, crl->this_update.mon,
crl->this_update.day, crl->this_update.hour,
crl->this_update.min, crl->this_update.sec );
SAFE_SNPRINTF();
ret = snprintf( p, n, "\n%snext update : " \
ret = polarssl_snprintf( p, n, "\n%snext update : " \
"%04d-%02d-%02d %02d:%02d:%02d", prefix,
crl->next_update.year, crl->next_update.mon,
crl->next_update.day, crl->next_update.hour,
@ -655,20 +656,20 @@ int x509_crl_info( char *buf, size_t size, const char *prefix,
entry = &crl->entry;
ret = snprintf( p, n, "\n%sRevoked certificates:",
ret = polarssl_snprintf( p, n, "\n%sRevoked certificates:",
prefix );
SAFE_SNPRINTF();
while( entry != NULL && entry->raw.len != 0 )
{
ret = snprintf( p, n, "\n%sserial number: ",
ret = polarssl_snprintf( p, n, "\n%sserial number: ",
prefix );
SAFE_SNPRINTF();
ret = x509_serial_gets( p, n, &entry->serial );
SAFE_SNPRINTF();
ret = snprintf( p, n, " revocation date: " \
ret = polarssl_snprintf( p, n, " revocation date: " \
"%04d-%02d-%02d %02d:%02d:%02d",
entry->revocation_date.year, entry->revocation_date.mon,
entry->revocation_date.day, entry->revocation_date.hour,
@ -678,14 +679,14 @@ int x509_crl_info( char *buf, size_t size, const char *prefix,
entry = entry->next;
}
ret = snprintf( p, n, "\n%ssigned using : ", prefix );
ret = polarssl_snprintf( p, n, "\n%ssigned using : ", prefix );
SAFE_SNPRINTF();
ret = x509_sig_alg_gets( p, n, &crl->sig_oid1, crl->sig_pk, crl->sig_md,
crl->sig_opts );
SAFE_SNPRINTF();
ret = snprintf( p, n, "\n" );
ret = polarssl_snprintf( p, n, "\n" );
SAFE_SNPRINTF();
return( (int) ( size - n ) );