diff options
author | Richard Levitte <levitte@openssl.org> | 2017-04-11 01:38:00 +0200 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2017-04-12 12:30:38 +0200 |
commit | c983bc4fb2a501df36b95da160ef9002c15cb8fe (patch) | |
tree | 9ee7f611afe950d59465ec5ea04f83fe6c15fc9f /test/asn1_encode_test.c | |
parent | 9fea3a51e5a1816c95bb687ebab4b64656e1b2bb (diff) | |
download | openssl-c983bc4fb2a501df36b95da160ef9002c15cb8fe.zip openssl-c983bc4fb2a501df36b95da160ef9002c15cb8fe.tar.gz openssl-c983bc4fb2a501df36b95da160ef9002c15cb8fe.tar.bz2 |
Add tests of custom negative 1
Reviewed-by: Andy Polyakov <appro@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3174)
Diffstat (limited to 'test/asn1_encode_test.c')
-rw-r--r-- | test/asn1_encode_test.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/asn1_encode_test.c b/test/asn1_encode_test.c index 68a0696..763c427 100644 --- a/test/asn1_encode_test.c +++ b/test/asn1_encode_test.c @@ -38,6 +38,9 @@ static unsigned char t_zero[] = { static unsigned char t_one[] = { 0x01 }; +static unsigned char t_one_neg[] = { + 0xff +}; static unsigned char t_longundef[] = { 0x7f, 0xff, 0xff, 0xff }; @@ -95,6 +98,7 @@ static TEST_CUSTOM_DATA test_custom_data[] = { CUSTOM_DATA(t_zero), CUSTOM_DATA(t_longundef), CUSTOM_DATA(t_one), + CUSTOM_DATA(t_one_neg), CUSTOM_DATA(t_9bytes_1), CUSTOM_DATA(t_8bytes_1), CUSTOM_DATA(t_8bytes_2), @@ -194,6 +198,7 @@ static ASN1_LONG_DATA long_expected_32bit[] = { { 0xff, 0, 1 }, { 0, 0, 0 }, /* t_zero */ { 0, 0, 0 }, { 0xff, 1, 0x7fffffff }, /* t_longundef */ CUSTOM_EXPECTED_SUCCESS(1, 1), /* t_one */ + CUSTOM_EXPECTED_SUCCESS(-1, -1), /* t_one_neg */ CUSTOM_EXPECTED_FAILURE, /* t_9bytes_1 */ CUSTOM_EXPECTED_FAILURE, /* t_8bytes_1 */ CUSTOM_EXPECTED_FAILURE, /* t_8bytes_2 */ @@ -228,6 +233,7 @@ static ASN1_LONG_DATA long_expected_64bit[] = { { 0xff, 0, 1 }, { 0, 0, 0 }, /* t_zero */ { 0, 0, 0 }, { 0xff, 1, 0x7fffffff }, /* t_longundef */ CUSTOM_EXPECTED_SUCCESS(1, 1), /* t_one */ + CUSTOM_EXPECTED_SUCCESS(-1, -1), /* t_one_neg */ CUSTOM_EXPECTED_FAILURE, /* t_9bytes_1 */ CUSTOM_EXPECTED_FAILURE, /* t_8bytes_1 */ CUSTOM_EXPECTED_SUCCESS(LONG_MAX, LONG_MAX), /* t_8bytes_2 */ @@ -279,6 +285,7 @@ static ASN1_INT32_DATA int32_expected[] = { CUSTOM_EXPECTED_SUCCESS(0, 0), /* t_zero */ CUSTOM_EXPECTED_SUCCESS(ASN1_LONG_UNDEF, ASN1_LONG_UNDEF), /* t_zero */ CUSTOM_EXPECTED_SUCCESS(1, 1), /* t_one */ + CUSTOM_EXPECTED_SUCCESS(-1, -1), /* t_one_neg */ CUSTOM_EXPECTED_FAILURE, /* t_9bytes_1 */ CUSTOM_EXPECTED_FAILURE, /* t_8bytes_1 */ CUSTOM_EXPECTED_FAILURE, /* t_8bytes_2 */ @@ -325,6 +332,7 @@ static ASN1_UINT32_DATA uint32_expected[] = { CUSTOM_EXPECTED_SUCCESS(0, 0), /* t_zero */ CUSTOM_EXPECTED_SUCCESS(ASN1_LONG_UNDEF, ASN1_LONG_UNDEF), /* t_zero */ CUSTOM_EXPECTED_SUCCESS(1, 1), /* t_one */ + CUSTOM_EXPECTED_FAILURE, /* t_one_neg (illegal negative value) */ CUSTOM_EXPECTED_FAILURE, /* t_9bytes_1 */ CUSTOM_EXPECTED_FAILURE, /* t_8bytes_1 */ CUSTOM_EXPECTED_FAILURE, /* t_8bytes_2 */ @@ -371,6 +379,7 @@ static ASN1_INT64_DATA int64_expected[] = { CUSTOM_EXPECTED_SUCCESS(0, 0), /* t_zero */ CUSTOM_EXPECTED_SUCCESS(ASN1_LONG_UNDEF, ASN1_LONG_UNDEF), /* t_zero */ CUSTOM_EXPECTED_SUCCESS(1, 1), /* t_one */ + CUSTOM_EXPECTED_SUCCESS(-1, -1), /* t_one_neg */ CUSTOM_EXPECTED_FAILURE, /* t_9bytes_1 */ CUSTOM_EXPECTED_FAILURE, /* t_8bytes_1 (too large positive) */ CUSTOM_EXPECTED_SUCCESS(INT64_MAX, INT64_MAX), /* t_8bytes_2 */ @@ -418,6 +427,7 @@ static ASN1_UINT64_DATA uint64_expected[] = { CUSTOM_EXPECTED_SUCCESS(0, 0), /* t_zero */ CUSTOM_EXPECTED_SUCCESS(ASN1_LONG_UNDEF, ASN1_LONG_UNDEF), /* t_zero */ CUSTOM_EXPECTED_SUCCESS(1, 1), /* t_one */ + CUSTOM_EXPECTED_FAILURE, /* t_one_neg (illegal negative value) */ CUSTOM_EXPECTED_FAILURE, /* t_9bytes_1 */ CUSTOM_EXPECTED_SUCCESS((uint64_t)INT64_MAX+1, (uint64_t)INT64_MAX+1), /* t_8bytes_1 */ |