mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-01-17 16:13:48 +00:00
Add tests for Issue #8687
Signed-off-by: Jonathan Winzig <jwinzig@hilscher.com>
This commit is contained in:
parent
4aad0ff510
commit
2bd2b788cf
@ -265,3 +265,9 @@ mbedtls_x509_string_to_names:"C=NL, 2.5.4.10.234.532=#0C084F6666737061726B, OU=P
|
||||
|
||||
Check max serial length
|
||||
x509_set_serial_check:
|
||||
|
||||
Check max extension length (Max-1)
|
||||
x509_set_extension_length_check:0xFFFFFFFE
|
||||
|
||||
Check max extension length (Max)
|
||||
x509_set_extension_length_check:0xFFFFFFFF
|
@ -752,3 +752,24 @@ exit:
|
||||
USE_PSA_DONE();
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE */
|
||||
void x509_set_extension_length_check(int val_len)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
mbedtls_x509write_csr ctx;
|
||||
mbedtls_x509write_csr_init(&ctx);
|
||||
|
||||
unsigned char buf[EXT_KEY_USAGE_TMP_BUF_MAX_LENGTH] = { 0 };
|
||||
unsigned char *p = buf + sizeof(buf);
|
||||
|
||||
ret = mbedtls_x509_set_extension(&(ctx.MBEDTLS_PRIVATE(extensions)),
|
||||
MBEDTLS_OID_EXTENDED_KEY_USAGE,
|
||||
MBEDTLS_OID_SIZE(MBEDTLS_OID_EXTENDED_KEY_USAGE),
|
||||
0,
|
||||
p,
|
||||
val_len);
|
||||
TEST_ASSERT(ret == MBEDTLS_ERR_X509_BAD_INPUT_DATA || ret == MBEDTLS_ERR_X509_ALLOC_FAILED);
|
||||
}
|
||||
/* END_CASE */
|
||||
|
Loading…
Reference in New Issue
Block a user