mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-22 11:55:42 +01:00
Added asn1_write_raw_buffer()
This commit is contained in:
parent
8adf13bd92
commit
6db915b5a9
@ -52,6 +52,8 @@ int asn1_write_bitstring( unsigned char **p, unsigned char *start,
|
||||
const unsigned char *buf, size_t bits );
|
||||
int asn1_write_octet_string( unsigned char **p, unsigned char *start,
|
||||
const unsigned char *buf, size_t size );
|
||||
int asn1_write_raw_buffer( unsigned char **p, unsigned char *start,
|
||||
const unsigned char *buf, size_t size );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -272,7 +272,7 @@ int asn1_write_octet_string( unsigned char **p, unsigned char *start,
|
||||
int ret;
|
||||
size_t len = 0;
|
||||
|
||||
if( *p - start < (int) size + 1 )
|
||||
if( *p - start < (int) size )
|
||||
return( POLARSSL_ERR_ASN1_BUF_TOO_SMALL );
|
||||
|
||||
len = size;
|
||||
@ -285,4 +285,19 @@ int asn1_write_octet_string( unsigned char **p, unsigned char *start,
|
||||
return( len );
|
||||
}
|
||||
|
||||
int asn1_write_raw_buffer( unsigned char **p, unsigned char *start,
|
||||
const unsigned char *buf, size_t size )
|
||||
{
|
||||
size_t len = 0;
|
||||
|
||||
if( *p - start < (int) size )
|
||||
return( POLARSSL_ERR_ASN1_BUF_TOO_SMALL );
|
||||
|
||||
len = size;
|
||||
(*p) -= len;
|
||||
memcpy( *p, buf, len );
|
||||
|
||||
return( len );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user