Manuel Pégourié-Gonnard
12df5f3a16
Improve unit tests for mbedtls_asn1_store_named_data
...
Every time we check found->val.p we should also check found->val.len.
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com >
2025-05-26 10:55:59 +02:00
Michael Schuster
31b1cb8601
Adjust spacing in tests/suites function sources
...
Signed-off-by: Michael Schuster <michael@schuster.ms >
2024-08-06 12:09:13 +01:00
Michael Schuster
b1e33fb707
Fix missing-prototype errors in tests/suites
...
Signed-off-by: Michael Schuster <michael@schuster.ms >
2024-08-06 12:09:13 +01:00
Tom Cosgrove
e7700a7d0a
Merge pull request #7936 from AgathiyanB/assert-false-macro
...
Add TEST_FAIL macro for tests
2023-08-10 15:01:34 +00:00
Tom Cosgrove
0540fe74e3
Fix code style
...
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com >
2023-07-27 14:17:27 +01:00
Tom Cosgrove
e4e9e7da58
For tests, rename TEST_BUFFERS_EQUAL() to TEST_MEMORY_COMPARE()
...
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com >
2023-07-21 11:45:25 +01:00
Tom Cosgrove
05b2a87ea0
For tests, rename TEST_CALLOC_OR_FAIL() to just TEST_CALLOC()
...
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com >
2023-07-21 11:32:25 +01:00
Tom Cosgrove
f9ffd11e7a
For tests, rename ASSERT_ALLOC() to TEST_CALLOC_OR_FAIL()
...
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com >
2023-07-20 16:51:21 +01:00
Tom Cosgrove
65cd8519f7
For tests, rename ASSERT_COMPARE() to TEST_BUFFERS_EQUAL()
...
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com >
2023-07-20 16:51:15 +01:00
Agathiyan Bragadeesh
dc28a5a105
Rename ASSERT_FALSE to TEST_FAIL
...
Signed-off-by: Agathiyan Bragadeesh <agathiyan.bragadeesh2@arm.com >
2023-07-18 11:45:28 +01:00
Agathiyan Bragadeesh
ebb40bc336
Add ASSERT_FALSE macro for tests
...
Signed-off-by: Agathiyan Bragadeesh <agathiyan.bragadeesh2@arm.com >
2023-07-18 11:38:04 +01:00
Gilles Peskine
449bd8303e
Switch to the new code style
...
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com >
2023-01-11 14:50:10 +01:00
Gilles Peskine
5969a4b5e0
Don't call memcpy(NULL, 0) which has undefined behavior
...
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com >
2022-06-27 23:59:53 +02:00
Gilles Peskine
6194053feb
ASN.1: test that we can parse what we can write
...
In asn1_write tests, when there's a parsing function corresponding to the
write function, call it and check that it can parse what we wrote.
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com >
2022-06-15 21:17:25 +02:00
Gilles Peskine
2c2730a372
ASN.1 write tests: test with larger buffer
...
Test with the output buffer size up to *and including* the expected output
size plus one. `... < expected->len + 1` was evidently a mistake.
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com >
2022-06-10 20:15:44 +02:00
Werner Lewis
e59a531455
Fix memcpy() UB in mbedtls_asn1_named_data()
...
Removes a case in mbedtls_asn1_named_data() where memcpy() could be
called with a null pointer and zero length. A test case is added for
this code path, to catch the undefined behavior when running tests with
UBSan.
Signed-off-by: Werner Lewis <werner.lewis@arm.com >
2022-05-04 11:45:06 +01:00
Dave Rodgman
73e3e2cb1a
Merge remote-tracking branch 'origin/development' into development_new
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com >
Conflicts:
include/mbedtls/check_config.h: nearby edits
library/entropy.c: nearby edits
programs/random/gen_random_havege.c: modification vs. removal
programs/ssl/ssl_test_lib.h: nearby edits
programs/test/cpp_dummy_build.cpp: nearby edits
visualc/VS2010/mbedTLS.vcxproj: automatically generated file,
regenerated with scripts/generate_visualc_files.pl
2021-04-07 16:31:09 +01:00
Mateusz Starzyk
4e300d00e8
Add missing const attribute to asn1write api
...
Signed-off-by: Mateusz Starzyk <mateusz.starzyk@mobica.com >
2021-01-27 15:37:12 +01:00
Chris Jones
9634bb10d9
Move helper testing functions to tests/src/helpers.c
...
Moves the functions `test_fail`, `test_set_step`, `test_skip` and the struct
`test_info` from `tests/suites/helpers.function` to `tests/src/helpers.*`.
This is done to open these functions up to the API where they can be used by
other functions in the 'src' test infrastructure module.
As the functions are now contained within the src folder of the testing
infrastructure, the `mbedtls_` prefix has been added to the functions.
Signed-off-by: Chris Jones <christopher.jones@arm.com >
2021-01-20 15:56:42 +00:00
Mykhailo Sopiha
6af7bf91f2
Add test cases for ASN.1 ENUMERATED tag
...
Add test cases for writing and parsing ASN.1 ENUMERATED
tag values.
Signed-off-by: Mykhailo Sopiha <mykhailo.sopiha@linaro.org >
2019-10-31 19:17:36 +02:00
Gilles Peskine
a902303587
Test mbedtls_asn1_store_named_data
2019-09-11 15:46:45 +02:00
Gilles Peskine
9311cf5093
asn1write: test NULL, OID and AlgorithmIdentifier
2019-09-11 15:46:45 +02:00
Gilles Peskine
91d8d023c2
Fix typo that prevented mbedtls_asn1_write_len tests from running
2019-09-11 15:46:45 +02:00
Gilles Peskine
3f37dca794
asn1write: Test short and large buffers more systematically
...
Use the test-many-sizes framework for string writes as
well (previously, it was only used for booleans and integers). This
way, more edge cases are tested with less test code.
This commit removes buffer overwrite checks. Instead of these checks,
run the test suite under a memory sanitizer (which we do in our CI).
2019-09-11 15:46:45 +02:00
Gilles Peskine
3a032c36c1
Add test cases for BOOLEANs and INTEGERs
...
Omit negative integers and MPIs that would result in values that look
like negative INTEGERs, since the library doesn't respect the
specifications there, but fixing it has a serious risk of breaking
interoperability when ASN.1 is used in X.509 and other
cryptography-related applications.
2019-09-11 15:46:44 +02:00
Andres Amaya Garcia
5d26163db4
Add tests for (named) bitstring to suite_asn1write
2019-01-16 18:59:07 +00:00
Hanno Becker
0fbbc64fee
Add dependency of mbedtls_asn1_write_len() test on ASN.1 parsing
2018-10-16 13:48:23 +01:00
Azim Khan
5fcca46a3a
Rename HexParam_t -> data_t for consistent coding style
2018-08-06 11:42:06 +01:00
Azim Khan
d30ca130e8
Combine hex parameters in a struct
2018-08-06 11:40:57 +01:00
Azim Khan
f1aaec9888
Intermediate hexify out change
2018-08-06 11:40:57 +01:00
Azim Khan
9079170f6e
Adapt code for scripting out hexify/unhexify code
2018-08-06 11:40:57 +01:00
Paul Bakker
5e8b77cd8c
Test result of mbedtls_asn1_write_len() through mbedtls_asn1_get_len()
2016-08-25 15:42:27 +01:00
Paul Bakker
58bfb83bb0
Add buffer length tests for mbedtls_asn1_write_len()
2016-08-25 15:42:27 +01:00
Paul Bakker
e325db9055
Add explicit test coverage for mbedtls_asn1_write_len()
2016-08-25 15:42:27 +01:00
Manuel Pégourié-Gonnard
2cf5a7c98e
The Great Renaming
...
A simple execution of tmp/invoke-rename.pl
2015-04-08 13:25:31 +02:00
Manuel Pégourié-Gonnard
7f8099773e
Rename include directory to mbedtls
2015-03-10 11:23:56 +00:00
Rich Evans
ce2f237697
change test function includes to use one convention
2015-02-10 11:28:46 +00:00
Manuel Pégourié-Gonnard
c22bb4994c
Add tests for asn1_write_ia5_string()
2014-06-10 15:38:43 +02:00
Manuel Pégourié-Gonnard
36178ffb87
Add tests for asn1_write_octet_string()
2014-06-10 15:38:43 +02:00