mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-26 00:05:36 +01:00
Merge pull request #5546 from SiliconLabs/mbedtls-2.28/feature/PSEC-3195-PSA-test-suites-NOT-using-UID-0
Backport 2.28: feat: Update test_suite_psa_its to NOT use UID=0
This commit is contained in:
commit
4e921870b1
3
ChangeLog.d/PSA-test-suites-NOT-using-UID-0.txt
Normal file
3
ChangeLog.d/PSA-test-suites-NOT-using-UID-0.txt
Normal file
@ -0,0 +1,3 @@
|
||||
Bugfix
|
||||
* Fix unit tests that used 0 as the file UID. This failed on some
|
||||
implementations of PSA ITS. Fixes #3838.
|
@ -184,6 +184,11 @@ psa_status_t psa_its_set( psa_storage_uid_t uid,
|
||||
const void *p_data,
|
||||
psa_storage_create_flags_t create_flags )
|
||||
{
|
||||
if( uid == 0 )
|
||||
{
|
||||
return( PSA_ERROR_INVALID_HANDLE );
|
||||
}
|
||||
|
||||
psa_status_t status = PSA_ERROR_STORAGE_FAILURE;
|
||||
char filename[PSA_ITS_STORAGE_FILENAME_LENGTH];
|
||||
FILE *stream = NULL;
|
||||
|
@ -1,71 +1,74 @@
|
||||
Set/get/remove 0 bytes
|
||||
set_get_remove:0:0:""
|
||||
set_get_remove:1:0:""
|
||||
|
||||
Set/get/remove 42 bytes
|
||||
set_get_remove:0:0:"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f20212223242526272829"
|
||||
set_get_remove:1:0:"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f20212223242526272829"
|
||||
|
||||
Set/get/remove 1000 bytes
|
||||
set_get_remove:0:0:"6a07ecfcc7c7bfe0129d56d2dcf2955a12845b9e6e0034b0ed7226764261c6222a07b9f654deb682130eb1cd07ed298324e60a46f9c76c8a5a0be000c69e93dd81054ca21fbc6190cef7745e9d5436f70e20e10cbf111d1d40c9ceb83be108775199d81abaf0fecfe30eaa08e7ed82517cba939de4449f7ac5c730fcbbf56e691640b0129db0e178045dd2034262de9138873d9bdca57685146a3d516ff13c29e6628a00097435a8e10fef7faff62d2963c303a93793e2211d8604556fec08cd59c0f5bd1f22eea64be13e88b3f454781e83fe6e771d3d81eb2fbe2021e276f42a93db5343d767d854115e74f5e129a8036b1e81aced9872709d515e00bcf2098ccdee23006b0e836b27dc8aaf30f53fe58a31a6408abb79b13098c22e262a98040f9b09809a3b43bd42eb01cf1d17bbc8b4dfe51fa6573d4d8741943e3ae71a649e194c1218f2e20556c7d8cfe8c64d8cc1aa94531fbf638768c7d19b3c079299cf4f26ed3f964efb8fd23d82b4157a51f46da11156c74e2d6e2fd788869ebb52429e12a82da2ba083e2e74565026162f29ca22582da72a2698e7c5d958b919bc2cdfe12f50364ccfed30efd5cd120a7d5f196b2bd7f911bb44d5871eb3dedcd70ece7faf464988f9fe361f23d7244b1e08bee921d0f28bdb4912675809d099876d4d15b7d13ece356e1f2a5dce64feb3d6749a07a4f2b7721190e17a9ab2966e48b6d25187070b81eb45b1c44608b2f0e175958ba57fcf1b2cd145eea5fd4de858d157ddac69dfbb5d5d6f0c1691b0fae5a143b6e58cdf5000f28d74b3322670ed11e740c828c7bfad4e2f392012da3ac931ea26ed15fd003e604071f5900c6e1329d021805d50da9f1e732a49bcc292d9f8e07737cfd59442e8d7aaa813b18183a68e22bf6b4519545dd7d2d519db3652be4131bad4f4b0625dbaa749e979f6ee8c1b97803cb50a2fa20dc883eac932a824b777b226e15294de6a80be3ddef41478fe18172d64407a004de6bae18bc60e90c902c1cbb0e1633395b42391f5011be0d480541987609b0cd8d902ea29f86f73e7362340119323eb0ea4f672b70d6e9a9df5235f9f1965f5cb0c2998c5a7f4754e83eeda5d95fefbbaaa0875fe37b7ca461e7281cc5479162627c5a709b45fd9ddcde4dfb40659e1d70fa7361d9fc7de24f9b8b13259423fdae4dbb98d691db687467a5a7eb027a4a0552a03e430ac8a32de0c30160ba60a036d6b9db2d6182193283337b92e7438dc5d6eb4fa00200d8efa9127f1c3a32ac8e202262773aaa5a965c6b8035b2e5706c32a55511560429ddf1df4ac34076b7eedd9cf94b6915a894fdd9084ffe3db0e7040f382c3cd04f0484595de95865c36b6bf20f46a78cdfb37228acbeb218de798b9586f6d99a0cbae47e80d"
|
||||
set_get_remove:1:0:"6a07ecfcc7c7bfe0129d56d2dcf2955a12845b9e6e0034b0ed7226764261c6222a07b9f654deb682130eb1cd07ed298324e60a46f9c76c8a5a0be000c69e93dd81054ca21fbc6190cef7745e9d5436f70e20e10cbf111d1d40c9ceb83be108775199d81abaf0fecfe30eaa08e7ed82517cba939de4449f7ac5c730fcbbf56e691640b0129db0e178045dd2034262de9138873d9bdca57685146a3d516ff13c29e6628a00097435a8e10fef7faff62d2963c303a93793e2211d8604556fec08cd59c0f5bd1f22eea64be13e88b3f454781e83fe6e771d3d81eb2fbe2021e276f42a93db5343d767d854115e74f5e129a8036b1e81aced9872709d515e00bcf2098ccdee23006b0e836b27dc8aaf30f53fe58a31a6408abb79b13098c22e262a98040f9b09809a3b43bd42eb01cf1d17bbc8b4dfe51fa6573d4d8741943e3ae71a649e194c1218f2e20556c7d8cfe8c64d8cc1aa94531fbf638768c7d19b3c079299cf4f26ed3f964efb8fd23d82b4157a51f46da11156c74e2d6e2fd788869ebb52429e12a82da2ba083e2e74565026162f29ca22582da72a2698e7c5d958b919bc2cdfe12f50364ccfed30efd5cd120a7d5f196b2bd7f911bb44d5871eb3dedcd70ece7faf464988f9fe361f23d7244b1e08bee921d0f28bdb4912675809d099876d4d15b7d13ece356e1f2a5dce64feb3d6749a07a4f2b7721190e17a9ab2966e48b6d25187070b81eb45b1c44608b2f0e175958ba57fcf1b2cd145eea5fd4de858d157ddac69dfbb5d5d6f0c1691b0fae5a143b6e58cdf5000f28d74b3322670ed11e740c828c7bfad4e2f392012da3ac931ea26ed15fd003e604071f5900c6e1329d021805d50da9f1e732a49bcc292d9f8e07737cfd59442e8d7aaa813b18183a68e22bf6b4519545dd7d2d519db3652be4131bad4f4b0625dbaa749e979f6ee8c1b97803cb50a2fa20dc883eac932a824b777b226e15294de6a80be3ddef41478fe18172d64407a004de6bae18bc60e90c902c1cbb0e1633395b42391f5011be0d480541987609b0cd8d902ea29f86f73e7362340119323eb0ea4f672b70d6e9a9df5235f9f1965f5cb0c2998c5a7f4754e83eeda5d95fefbbaaa0875fe37b7ca461e7281cc5479162627c5a709b45fd9ddcde4dfb40659e1d70fa7361d9fc7de24f9b8b13259423fdae4dbb98d691db687467a5a7eb027a4a0552a03e430ac8a32de0c30160ba60a036d6b9db2d6182193283337b92e7438dc5d6eb4fa00200d8efa9127f1c3a32ac8e202262773aaa5a965c6b8035b2e5706c32a55511560429ddf1df4ac34076b7eedd9cf94b6915a894fdd9084ffe3db0e7040f382c3cd04f0484595de95865c36b6bf20f46a78cdfb37228acbeb218de798b9586f6d99a0cbae47e80d"
|
||||
|
||||
Set/get/remove with flags
|
||||
set_get_remove:0:0x12345678:"abcdef"
|
||||
set_get_remove:1:0x12345678:"abcdef"
|
||||
|
||||
Overwrite 0 -> 3
|
||||
set_overwrite:0:0x12345678:"":0x01020304:"abcdef"
|
||||
set_overwrite:1:0x12345678:"":0x01020304:"abcdef"
|
||||
|
||||
Overwrite 3 -> 0
|
||||
set_overwrite:0:0x12345678:"abcdef":0x01020304:""
|
||||
set_overwrite:1:0x12345678:"abcdef":0x01020304:""
|
||||
|
||||
Overwrite 3 -> 3
|
||||
set_overwrite:0:0x12345678:"123456":0x01020304:"abcdef"
|
||||
set_overwrite:1:0x12345678:"123456":0x01020304:"abcdef"
|
||||
|
||||
Overwrite 3 -> 18
|
||||
set_overwrite:0:0x12345678:"abcdef":0x01020304:"404142434445464748494a4b4c4d4e4f5051"
|
||||
set_overwrite:1:0x12345678:"abcdef":0x01020304:"404142434445464748494a4b4c4d4e4f5051"
|
||||
|
||||
Overwrite 18 -> 3
|
||||
set_overwrite:0:0x12345678:"404142434445464748494a4b4c4d4e4f5051":0x01020304:"abcdef"
|
||||
set_overwrite:1:0x12345678:"404142434445464748494a4b4c4d4e4f5051":0x01020304:"abcdef"
|
||||
|
||||
Multiple files
|
||||
set_multiple:0:5
|
||||
set_multiple:1:5
|
||||
|
||||
Set UID 0
|
||||
set_fail:0:"40414243444546474849":PSA_ERROR_INVALID_HANDLE
|
||||
|
||||
Non-existent file
|
||||
nonexistent:0:0
|
||||
nonexistent:1:0
|
||||
|
||||
Removed file
|
||||
nonexistent:0:1
|
||||
nonexistent:1:1
|
||||
|
||||
Get 0 bytes of 10 at 10
|
||||
get_at:0:"40414243444546474849":10:0:PSA_SUCCESS
|
||||
get_at:1:"40414243444546474849":10:0:PSA_SUCCESS
|
||||
|
||||
Get 1 byte of 10 at 9
|
||||
get_at:0:"40414243444546474849":9:1:PSA_SUCCESS
|
||||
get_at:1:"40414243444546474849":9:1:PSA_SUCCESS
|
||||
|
||||
Get 0 bytes of 10 at 0
|
||||
get_at:0:"40414243444546474849":0:0:PSA_SUCCESS
|
||||
get_at:1:"40414243444546474849":0:0:PSA_SUCCESS
|
||||
|
||||
Get 1 byte of 10 at 0
|
||||
get_at:0:"40414243444546474849":0:1:PSA_SUCCESS
|
||||
get_at:1:"40414243444546474849":0:1:PSA_SUCCESS
|
||||
|
||||
Get 2 bytes of 10 at 1
|
||||
get_at:0:"40414243444546474849":1:2:PSA_SUCCESS
|
||||
get_at:1:"40414243444546474849":1:2:PSA_SUCCESS
|
||||
|
||||
Get 1 byte of 10 at 10: out of range
|
||||
get_at:0:"40414243444546474849":10:1:PSA_ERROR_INVALID_ARGUMENT
|
||||
get_at:1:"40414243444546474849":10:1:PSA_ERROR_INVALID_ARGUMENT
|
||||
|
||||
Get 1 byte of 10 at 11: out of range
|
||||
get_at:0:"40414243444546474849":11:1:PSA_ERROR_INVALID_ARGUMENT
|
||||
get_at:1:"40414243444546474849":11:1:PSA_ERROR_INVALID_ARGUMENT
|
||||
|
||||
Get 0 bytes of 10 at 11: out of range
|
||||
get_at:0:"40414243444546474849":11:0:PSA_ERROR_INVALID_ARGUMENT
|
||||
get_at:1:"40414243444546474849":11:0:PSA_ERROR_INVALID_ARGUMENT
|
||||
|
||||
Get -1 byte of 10 at 10: out of range
|
||||
get_at:0:"40414243444546474849":10:-1:PSA_ERROR_INVALID_ARGUMENT
|
||||
get_at:1:"40414243444546474849":10:-1:PSA_ERROR_INVALID_ARGUMENT
|
||||
|
||||
Get 1 byte of 10 at -1: out of range
|
||||
get_at:0:"40414243444546474849":-1:1:PSA_ERROR_INVALID_ARGUMENT
|
||||
get_at:1:"40414243444546474849":-1:1:PSA_ERROR_INVALID_ARGUMENT
|
||||
|
||||
Overwrite ITS header magic
|
||||
get_fail:0:"40414243444546474849":1:0:PSA_ERROR_DATA_CORRUPT
|
||||
get_fail:1:"40414243444546474849":1:0:PSA_ERROR_DATA_CORRUPT
|
||||
|
||||
Truncate ITS header
|
||||
get_fail:0:"40414243444546474849":0:1:PSA_ERROR_DATA_CORRUPT
|
||||
get_fail:1:"40414243444546474849":0:1:PSA_ERROR_DATA_CORRUPT
|
||||
|
@ -285,3 +285,16 @@ exit:
|
||||
cleanup( );
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE */
|
||||
void set_fail( int uid_arg, data_t *data,
|
||||
int expected_status )
|
||||
{
|
||||
psa_storage_uid_t uid = uid_arg;
|
||||
TEST_ASSERT( psa_its_set_wrap( uid, data->len, data->x, 0 ) ==
|
||||
(psa_status_t) expected_status );
|
||||
|
||||
exit:
|
||||
cleanup( );
|
||||
}
|
||||
/* END_CASE */
|
||||
|
Loading…
Reference in New Issue
Block a user