3 years agoREADME: Add DEPRECATED notice for this repository ti-optee-test 07.00.00.002 07.00.00.003 07.00.00.004 07.00.00.005 07.01.00.001 07.01.00.002 07.01.00.003 07.01.00.004 07.01.00.005 07.01.00.006 07.02.00.002 07.02.00.003 07.02.00.004 07.03.00.000 07.03.00.001 07.03.00.002 07.03.00.003 07.03.00.004 07.03.00.005 08.00.00.000 08.00.00.001 08.00.00.002 08.00.00.003 08.00.00.004 08.01.00.001 08.01.00.002 08.01.00.003 08.01.00.004 08.01.00.005 08.01.00.006 08.02.00.001 08.02.00.002 08.02.00.003 08.02.00.004 08.02.00.005 08.02.00.006 08.03.00.001 08.03.00.002 08.03.00.003 08.03.00.004 08.03.00.005 08.04.00.001 08.04.00.002 2021.00.001 2021.00.002 2021.00.003 ti2020.01.00
README: Add DEPRECATED notice for this repository
Signed-off-by: Andrew F. Davis <afd@ti.com>
Signed-off-by: Andrew F. Davis <afd@ti.com>
regression 1014: out of bounds memref tests ensure TA is not reached
Fix regression 1014 (SDP) similar to commit 48fa1b25eed7 ("regression
1018: out of bounds memref tests ensure TA is not reached").
Signed-off-by: Jerome Forissier <jerome@forissier.org>
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
Fix regression 1014 (SDP) similar to commit 48fa1b25eed7 ("regression
1018: out of bounds memref tests ensure TA is not reached").
Signed-off-by: Jerome Forissier <jerome@forissier.org>
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
regression 1014: fix return status condition
When passing an invalid reference to the TA, we expect the TEE to catch
the error and return either TEE_ERROR_GENERIC or
TEE_ERROR_BAD_PARAMETERS (not any other unrelated error). The condition
on the return code is not written correctly, fix it.
Signed-off-by: Jerome Forissier <jerome@forissier.org>
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
When passing an invalid reference to the TA, we expect the TEE to catch
the error and return either TEE_ERROR_GENERIC or
TEE_ERROR_BAD_PARAMETERS (not any other unrelated error). The condition
on the return code is not written correctly, fix it.
Signed-off-by: Jerome Forissier <jerome@forissier.org>
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
regression 1018: out of bounds memref tests ensure TA is not reached
Change regression test 1018 to allow any layer if the TEE invocation
channel to report outbound memory reference as long as it is the the
TA itself since outbound memory reference should be caught before the
TA is invoked by the TEE.
This change makes xtest regression test 1018 more flexible towards
changes in the OP-TEE components that can catch invalid memory reference
in invocation parameters depending on the OP-TEE configuration.
Fixes: 84382b31d3a3 ("regression 1018: add 1byte out of bounds reference test sub cases")
Reported-by: Sumit Garg <sumit.garg@linaro.org>
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Acked-by: Jerome Forissier <jerome@forissier.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
Change regression test 1018 to allow any layer if the TEE invocation
channel to report outbound memory reference as long as it is the the
TA itself since outbound memory reference should be caught before the
TA is invoked by the TEE.
This change makes xtest regression test 1018 more flexible towards
changes in the OP-TEE components that can catch invalid memory reference
in invocation parameters depending on the OP-TEE configuration.
Fixes: 84382b31d3a3 ("regression 1018: add 1byte out of bounds reference test sub cases")
Reported-by: Sumit Garg <sumit.garg@linaro.org>
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Acked-by: Jerome Forissier <jerome@forissier.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
xtest_1000.c: fix spelling errors
Fix various spelling errors found in the 1xxx tests.
Signed-off-by: Joakim Bech <joakim.bech@linaro.org>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
Fix various spelling errors found in the 1xxx tests.
Signed-off-by: Joakim Bech <joakim.bech@linaro.org>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
Allow memrefs with size 0
Add test 1025 verifying temporary memref of 0 bytes or NULL pointer
buffer conforming with:
GlobalPlatform Client API v1.0c (section 3.2.5 memory references), which
can be found at [1].
Link: [1] http://www.globalplatform.org/specificationsdevice.asp
Signed-off-by: Cedric Neveux <cedric.neveux@nxp.com>
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
Reviewed-by: Joakim Bech <joakim.bech@linaro.org>
Tested-by: Joakim Bech <joakim.bech@linaro.org> (QEMU)
Add test 1025 verifying temporary memref of 0 bytes or NULL pointer
buffer conforming with:
GlobalPlatform Client API v1.0c (section 3.2.5 memory references), which
can be found at [1].
Link: [1] http://www.globalplatform.org/specificationsdevice.asp
Signed-off-by: Cedric Neveux <cedric.neveux@nxp.com>
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
Reviewed-by: Joakim Bech <joakim.bech@linaro.org>
Tested-by: Joakim Bech <joakim.bech@linaro.org> (QEMU)
pkcs11 100x: rename tee_test into pkcs1_test
Rename xtest_tee_test_100x() into xtest_pkcs11_test_100x() for
consistency.
Fix a coding style alignment in test 1001.
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Reviewed-by: Jerome Forissier <jerome@forissier.org>
Rename xtest_tee_test_100x() into xtest_pkcs11_test_100x() for
consistency.
Fix a coding style alignment in test 1001.
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Reviewed-by: Jerome Forissier <jerome@forissier.org>
pkcs11 1002: test session API functions
Add test of C_OpenSession(), C_GetSessionInfo(), C_CloseSession() and
C_CloseAllSessions() from PKCS11 TA test token in pkcs11 regression
test 1002.
Test token over which test is made is the last slot found if the slot
list reported by the Cryptoki library. Helper function
init_lib_and_find_token_slot() takes care of Cryptoki pre-session setup.
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
Add test of C_OpenSession(), C_GetSessionInfo(), C_CloseSession() and
C_CloseAllSessions() from PKCS11 TA test token in pkcs11 regression
test 1002.
Test token over which test is made is the last slot found if the slot
list reported by the Cryptoki library. Helper function
init_lib_and_find_token_slot() takes care of Cryptoki pre-session setup.
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
pkcs11 1001: get mechanism info from tokens
Add test of C_GetMechanismList() and C_GetMechanismInfo() from
PKCS11 TA token(s) in pkcs11 regression test 1001.
When test level is greater than 1, test pkcs11_1001 prints to ADBG log
the list of the mechanisms supported by token.
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
Add test of C_GetMechanismList() and C_GetMechanismInfo() from
PKCS11 TA token(s) in pkcs11 regression test 1001.
When test level is greater than 1, test pkcs11_1001 prints to ADBG log
the list of the mechanisms supported by token.
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
Regression 1024: add tests cases for PTA_SYSTEM_GET_TPM_EVENT_LOG service.
Adds test cases to exercise the PTA_SYSTEM_GET_TPM_EVENT_LOG service.
Signed-off-by: Javier Almansa Sobrino <javier.almansasobrino@arm.com>
Reviewed-by: Jerome Forissier <jerome@forissier.org>
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
Adds test cases to exercise the PTA_SYSTEM_GET_TPM_EVENT_LOG service.
Signed-off-by: Javier Almansa Sobrino <javier.almansasobrino@arm.com>
Reviewed-by: Jerome Forissier <jerome@forissier.org>
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
os_test: call_longjmp(): add __noreturn attribute
call_longjmp() does not return so it should have a __noreturn attribute.
Fixes a Clang warning:
$ make COMPILER=clang
...
CC out/os_test.o
os_test.c:667:1: warning: function 'call_longjmp' could be declared with attribute 'noreturn' [-Wmissing-noreturn]
{
^
Signed-off-by: Jerome Forissier <jerome@forissier.org>
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
call_longjmp() does not return so it should have a __noreturn attribute.
Fixes a Clang warning:
$ make COMPILER=clang
...
CC out/os_test.o
os_test.c:667:1: warning: function 'call_longjmp' could be declared with attribute 'noreturn' [-Wmissing-noreturn]
{
^
Signed-off-by: Jerome Forissier <jerome@forissier.org>
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
pkcs11 1001: test C_GetSlotList() for zero-count non-NULL buffer case
Check C_GetSlotList() returns CKR_BUFFER_TOO_SMALL, not CKR_OK when
called with a non-NULL ID buffer reference and a count info to ID.
Prior this change was this specific test not covered in case TA
implements more than 1 token.
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
Check C_GetSlotList() returns CKR_BUFFER_TOO_SMALL, not CKR_OK when
called with a non-NULL ID buffer reference and a count info to ID.
Prior this change was this specific test not covered in case TA
implements more than 1 token.
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
pkcs11 1001: get info from tokens
Get information from tokens implemented by the PKCS11 TA. This change
tests Cryptoki API function C_GetTokenInfo().
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
Get information from tokens implemented by the PKCS11 TA. This change
tests Cryptoki API function C_GetTokenInfo().
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
pkcs11 1001: split in sub tests
Define ADBG sub tests per tested API for the friendly traces generated by
xtest.
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
Define ADBG sub tests per tested API for the friendly traces generated by
xtest.
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
pkcs11 1001: get info from slots
Add test to list slots implemented by the PKCS11 TA and get
information from. This change tests Cryptoki API functions
C_GetFunctionList(), C_GetInfo(), C_GetSlotList() and
C_GetSlotInfo().
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
Add test to list slots implemented by the PKCS11 TA and get
information from. This change tests Cryptoki API functions
C_GetFunctionList(), C_GetInfo(), C_GetSlotList() and
C_GetSlotInfo().
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
regression 1014: test out of bounds SDP references
Invoke the SDP test TA with output SDP memory reference outside the
allocated SDP buffers. Such invocation with invalid references should
not reach the trusted application and be nicely rejected from either
TEE client library, TEE Linux driver or the TEE core itself.
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
Invoke the SDP test TA with output SDP memory reference outside the
allocated SDP buffers. Such invocation with invalid references should
not reach the trusted application and be nicely rejected from either
TEE client library, TEE Linux driver or the TEE core itself.
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
regression 1018: add 1byte out of bounds reference test sub cases
Test short out of bounds reference in regression test 1018. The added
sub tests ensure OP-TEE components detects out of bounds memory reference
when the referred buffer exceeds the allocated shm by only 1 byte.
The test expects that the TEE communication layer traps the malformed
reference and return a "bad parameters" status.
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
Test short out of bounds reference in regression test 1018. The added
sub tests ensure OP-TEE components detects out of bounds memory reference
when the referred buffer exceeds the allocated shm by only 1 byte.
The test expects that the TEE communication layer traps the malformed
reference and return a "bad parameters" status.
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
Add regression 1023 (ELF initialization via .init_array)
Adds a test case for the ELF initialization functions (.init_array
section).
Signed-off-by: Jerome Forissier <jerome@forissier.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
Adds a test case for the ELF initialization functions (.init_array
section).
Signed-off-by: Jerome Forissier <jerome@forissier.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
regression 6020: fix a session not closed
Resource leak in core can be observed when this test case is repeated
many times.
Signed-off-by: Oliver Chiang <sticfeynman@gmail.com>
Reviewed-by: Joakim Bech <joakim.bech@linaro.org>
[jf: fix Author to use first S-o-b; minor commit text reformatting]
Signed-off-by: Jerome Forissier <jerome@forissier.org>
Resource leak in core can be observed when this test case is repeated
many times.
Signed-off-by: Oliver Chiang <sticfeynman@gmail.com>
Reviewed-by: Joakim Bech <joakim.bech@linaro.org>
[jf: fix Author to use first S-o-b; minor commit text reformatting]
Signed-off-by: Jerome Forissier <jerome@forissier.org>
Redirect checkpatch.sh to ../optee_os
use the checkpatch-helper scripts from optee_os repo
Signed-off-by: Markus S. Wamser <markus.wamser@mixed-mode.de>
Acked-by: Jerome Forissier <jerome@forissier.org>
use the checkpatch-helper scripts from optee_os repo
Signed-off-by: Markus S. Wamser <markus.wamser@mixed-mode.de>
Acked-by: Jerome Forissier <jerome@forissier.org>
fix resource leak in sock_server_init
Free addrinfo obtained through getaddrinfo().
Otherwise, it results in resource leak.
Signed-off-by: Rajesh Ravi <rajesh.ravi@broadcom.com>
Signed-off-by: Scott Branden <scott.branden@broadcom.com>
Acked-by: Etienne Carriere <etienne.carriere@linaro.org>
Free addrinfo obtained through getaddrinfo().
Otherwise, it results in resource leak.
Signed-off-by: Rajesh Ravi <rajesh.ravi@broadcom.com>
Signed-off-by: Scott Branden <scott.branden@broadcom.com>
Acked-by: Etienne Carriere <etienne.carriere@linaro.org>
Fix link to readthedocs.io
Signed-off-by: Markus S. Wamser <markus.wamser@mixed-mode.de>
Acked-by: Jerome Forissier <jerome@forissier.org>
Signed-off-by: Markus S. Wamser <markus.wamser@mixed-mode.de>
Acked-by: Jerome Forissier <jerome@forissier.org>
GitHub: sync GitHub templates and actions from build.git
The GitHub templates and actions are useful to the "optee_test" git
also, therefore recursively sync up (copy) the .github folder from
build.git.
Signed-off-by: Joakim Bech <joakim.bech@linaro.org>
Acked-by: Jerome Forissier <jerome@forissier.org>
The GitHub templates and actions are useful to the "optee_test" git
also, therefore recursively sync up (copy) the .github folder from
build.git.
Signed-off-by: Joakim Bech <joakim.bech@linaro.org>
Acked-by: Jerome Forissier <jerome@forissier.org>
regression_1008: skip subtests if PTA is unavailable
Replaces the compile time configuration based on CFG_SECSTOR_TA_MGMT_PTA
with a runtime test if PTA_SECSTOR_TA_MGMT_UUID is available.
Skips the "Load corrupt TA" substests if PTA_SECSTOR_TA_MGMT_UUID isn't
available.
Reviewed-by: Jerome Forissier <jerome@forissier.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Replaces the compile time configuration based on CFG_SECSTOR_TA_MGMT_PTA
with a runtime test if PTA_SECSTOR_TA_MGMT_UUID is available.
Skips the "Load corrupt TA" substests if PTA_SECSTOR_TA_MGMT_UUID isn't
available.
Reviewed-by: Jerome Forissier <jerome@forissier.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
4 years agopkcs11 1000: test finalize against non-initiated library ti2020-rc1 ti2020.00 ti2020.00-rc1 ti2020.00-rc2 ti2020.00-rc3 ti2020.00-rc4
pkcs11 1000: test finalize against non-initiated library
Call C_Finalize() without prior C_Initialize(). Library shall
return CKR_CRYPTOKI_NOT_INITIALIZED.
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
Call C_Finalize() without prior C_Initialize(). Library shall
return CKR_CRYPTOKI_NOT_INITIALIZED.
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
Add regression 4014 (SM2 KEP)
Adds a test for the SM2 Key Exchange Protocol.
Signed-off-by: Jerome Forissier <jerome@forissier.org>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
Acked-by: Etienne Carriere <etienne.carriere@linaro.org>
Adds a test for the SM2 Key Exchange Protocol.
Signed-off-by: Jerome Forissier <jerome@forissier.org>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
Acked-by: Etienne Carriere <etienne.carriere@linaro.org>
xtest: pkcs11 test through libckteec and the PKCS11 TA
Introduce pkcs11 tests for PKCS#11 services through the PKCS11 TA.
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Signed-off-by: Victor Chong <victor.chong@linaro.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
Introduce pkcs11 tests for PKCS#11 services through the PKCS11 TA.
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Signed-off-by: Victor Chong <victor.chong@linaro.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
regression 4003: do not fail if TEE_ALG_SM4 is not supported
Support for TEE_ALG_SM4 by the TEE is optional (CFG_CRYPTO_SM4).
Therefore, use TEE_IsAlgorithmSupported() and skip the sub-case if
needed.
Signed-off-by: Jerome Forissier <jerome@forissier.org>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
Support for TEE_ALG_SM4 by the TEE is optional (CFG_CRYPTO_SM4).
Therefore, use TEE_IsAlgorithmSupported() and skip the sub-case if
needed.
Signed-off-by: Jerome Forissier <jerome@forissier.org>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
regression 4001: do not fail if TEE_ALG_SM3 is not supported
Support for TEE_ALG_SM3 by the TEE is optional (CFG_CRYPTO_SM3).
Therefore, use TEE_IsAlgorithmSupported() and skip the sub-case if
needed.
Signed-off-by: Jerome Forissier <jerome@forissier.org>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
Support for TEE_ALG_SM3 by the TEE is optional (CFG_CRYPTO_SM3).
Therefore, use TEE_IsAlgorithmSupported() and skip the sub-case if
needed.
Signed-off-by: Jerome Forissier <jerome@forissier.org>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
regression 4006: do not fail if TEE_ALG_SM2* are not supported
Support for TEE_ALG_SM2* by the TEE is optional (CFG_CRYPTO_SM2_*).
Therefore, use TEE_IsAlgorithmSupported() and skip the sub-case if
needed.
Signed-off-by: Jerome Forissier <jerome@forissier.org>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
Support for TEE_ALG_SM2* by the TEE is optional (CFG_CRYPTO_SM2_*).
Therefore, use TEE_IsAlgorithmSupported() and skip the sub-case if
needed.
Signed-off-by: Jerome Forissier <jerome@forissier.org>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
Add helper function ta_crypt_cmd_is_algo_supported()
This commit adds a helper function to the xtest application so that we
can skip test cases for cryptographic algorithms that are not supported
by the TEE. The crypto TA is updated accordingly.
Signed-off-by: Jerome Forissier <jerome@forissier.org>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
This commit adds a helper function to the xtest application so that we
can skip test cases for cryptographic algorithms that are not supported
by the TEE. The crypto TA is updated accordingly.
Signed-off-by: Jerome Forissier <jerome@forissier.org>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
aes-perf, sha-perf: fix build with 64bit time_t on 32bit arches
| host/xtest/aes_perf.c: In function 'aes_perf_run_test':
| host/xtest/aes_perf.c:473:11: error: format '%lu' expects argument of type 'long unsigned int', but argument 2 has type 'time_t' {aka 'long long int'} [-Werror=format=]
| 473 | vverbose("Clock resolution is %lu ns\n",
| | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| 474 | ts.tv_sec * 1000000000 + ts.tv_nsec);
| | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| | |
| | time_t {aka long long int}
| host/xtest/crypto_common.h:56:11: note: in definition of macro '_verbose'
| 56 | printf(__VA_ARGS__); \
| | ^~~~~~~~~~~
| host/xtest/aes_perf.c:473:2: note: in expansion of macro 'vverbose'
| 473 | vverbose("Clock resolution is %lu ns\n",
| | ^~~~~~~~
| host/xtest/aes_perf.c:473:34: note: format string is defined here
| 473 | vverbose("Clock resolution is %lu ns\n",
| | ~~^
| | |
| | long unsigned int
| | %llu
| host/xtest/sha_perf.c: In function 'sha_perf_run_test':
| host/xtest/sha_perf.c:323:11: error: format '%lu' expects argument of type 'long unsigned int', but argument 2 has type 'time_t' {aka 'long long int'} [-Werror=format=]
| 323 | vverbose("Clock resolution is %lu ns\n", ts.tv_sec*1000000000 +
| | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~
| | |
| | time_t {aka long long int}
| 324 | ts.tv_nsec);
| | ~~~~~~~~~~
| host/xtest/crypto_common.h:56:11: note: in definition of macro '_verbose'
| 56 | printf(__VA_ARGS__); \
| | ^~~~~~~~~~~
| host/xtest/sha_perf.c:323:2: note: in expansion of macro 'vverbose'
| 323 | vverbose("Clock resolution is %lu ns\n", ts.tv_sec*1000000000 +
| | ^~~~~~~~
| host/xtest/sha_perf.c:323:34: note: format string is defined here
| 323 | vverbose("Clock resolution is %lu ns\n", ts.tv_sec*1000000000 +
| | ~~^
| | |
| | long unsigned int
| | %llu
| cc1: all warnings being treated as errors
The code has two problems:
1) it assumes time_t is unsigned
2) it assumes time_t is the same as unsigned long
1) rarely is true
2) is not true on 32bit architectures which have a 64bit time_t
Fix by appropriate casting and an updated printf format specifier.
Signed-off-by: André Draszik <andre.draszik@jci.com>
Reviewed-by: Jerome Forissier <jerome@forissier.org>
| host/xtest/aes_perf.c: In function 'aes_perf_run_test':
| host/xtest/aes_perf.c:473:11: error: format '%lu' expects argument of type 'long unsigned int', but argument 2 has type 'time_t' {aka 'long long int'} [-Werror=format=]
| 473 | vverbose("Clock resolution is %lu ns\n",
| | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| 474 | ts.tv_sec * 1000000000 + ts.tv_nsec);
| | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| | |
| | time_t {aka long long int}
| host/xtest/crypto_common.h:56:11: note: in definition of macro '_verbose'
| 56 | printf(__VA_ARGS__); \
| | ^~~~~~~~~~~
| host/xtest/aes_perf.c:473:2: note: in expansion of macro 'vverbose'
| 473 | vverbose("Clock resolution is %lu ns\n",
| | ^~~~~~~~
| host/xtest/aes_perf.c:473:34: note: format string is defined here
| 473 | vverbose("Clock resolution is %lu ns\n",
| | ~~^
| | |
| | long unsigned int
| | %llu
| host/xtest/sha_perf.c: In function 'sha_perf_run_test':
| host/xtest/sha_perf.c:323:11: error: format '%lu' expects argument of type 'long unsigned int', but argument 2 has type 'time_t' {aka 'long long int'} [-Werror=format=]
| 323 | vverbose("Clock resolution is %lu ns\n", ts.tv_sec*1000000000 +
| | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~
| | |
| | time_t {aka long long int}
| 324 | ts.tv_nsec);
| | ~~~~~~~~~~
| host/xtest/crypto_common.h:56:11: note: in definition of macro '_verbose'
| 56 | printf(__VA_ARGS__); \
| | ^~~~~~~~~~~
| host/xtest/sha_perf.c:323:2: note: in expansion of macro 'vverbose'
| 323 | vverbose("Clock resolution is %lu ns\n", ts.tv_sec*1000000000 +
| | ^~~~~~~~
| host/xtest/sha_perf.c:323:34: note: format string is defined here
| 323 | vverbose("Clock resolution is %lu ns\n", ts.tv_sec*1000000000 +
| | ~~^
| | |
| | long unsigned int
| | %llu
| cc1: all warnings being treated as errors
The code has two problems:
1) it assumes time_t is unsigned
2) it assumes time_t is the same as unsigned long
1) rarely is true
2) is not true on 32bit architectures which have a 64bit time_t
Fix by appropriate casting and an updated printf format specifier.
Signed-off-by: André Draszik <andre.draszik@jci.com>
Reviewed-by: Jerome Forissier <jerome@forissier.org>
regression 4006: add test cases for SM2 DSA
Adds a test vector for the SM2 Digital Signature Algorithm.
Signed-off-by: Jerome Forissier <jerome@forissier.org>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
Adds a test vector for the SM2 Digital Signature Algorithm.
Signed-off-by: Jerome Forissier <jerome@forissier.org>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
regression 4006: add test cases for SM2 PKE
Adds test cases for SM2 Public Key Encryption.
Signed-off-by: Jerome Forissier <jerome@forissier.org>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
Adds test cases for SM2 Public Key Encryption.
Signed-off-by: Jerome Forissier <jerome@forissier.org>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
regression_4000.c: rename .ecdsa member of struct xtest_ac_case to .ecc
xtest 4006 uses field .ecdsa of struct xtest_ac_case to read the key
parameters for ECDSA tests. These parameters can be re-used for other
elliptic curve algorithms. Therefore, rename .ecdsa to .ecc.
Similarly, the macro XTEST_AC_ECDSA_CASE() is not specific to ECDSA and
had better be called XTEST_AC_ECC_CASE().
Signed-off-by: Jerome Forissier <jerome@forissier.org>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
xtest 4006 uses field .ecdsa of struct xtest_ac_case to read the key
parameters for ECDSA tests. These parameters can be re-used for other
elliptic curve algorithms. Therefore, rename .ecdsa to .ecc.
Similarly, the macro XTEST_AC_ECDSA_CASE() is not specific to ECDSA and
had better be called XTEST_AC_ECC_CASE().
Signed-off-by: Jerome Forissier <jerome@forissier.org>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
use python3 instead of python
use python3 instead of python as python2 is EOL January 2020.
Signed-off-by: Scott Branden <scott.branden@broadcom.com>
Reviewed-by: Jerome Forissier <jerome@forissier.org>
Tested-by: Jerome Forissier <jerome@forissier.org> (QEMU, CFG_GCM_NIST_VECTORS=y)
use python3 instead of python as python2 is EOL January 2020.
Signed-off-by: Scott Branden <scott.branden@broadcom.com>
Reviewed-by: Jerome Forissier <jerome@forissier.org>
Tested-by: Jerome Forissier <jerome@forissier.org> (QEMU, CFG_GCM_NIST_VECTORS=y)
regression 4002: add test cases for SM3 HMAC
Adds test cases for the HMAC based on the Chinese SM3 hash.
Signed-off-by: Jerome Forissier <jerome@forissier.org>
Acked-by: Etienne Carriere <etienne.carriere@linaro.org>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
Adds test cases for the HMAC based on the Chinese SM3 hash.
Signed-off-by: Jerome Forissier <jerome@forissier.org>
Acked-by: Etienne Carriere <etienne.carriere@linaro.org>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
regression 4001: add test cases for SM3
Adds test cases for the Chinese SM3 cryptographic hash.
Signed-off-by: Jerome Forissier <jerome@forissier.org>
Acked-by: Etienne Carriere <etienne.carriere@linaro.org>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
Adds test cases for the Chinese SM3 cryptographic hash.
Signed-off-by: Jerome Forissier <jerome@forissier.org>
Acked-by: Etienne Carriere <etienne.carriere@linaro.org>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
regression 4003: add test cases for SM4
Adds test cases for the Chinese SM4 cipher in ECB, CBC and CTR modes.
Signed-off-by: Jerome Forissier <jerome@forissier.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
Adds test cases for the Chinese SM4 cipher in ECB, CBC and CTR modes.
Signed-off-by: Jerome Forissier <jerome@forissier.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
regression_4100.c: convert_from_string(): fix length of output buffer
convert_from_string() takes an hexadecimal character string and
converts it to binary. The size of the output buffer is computed from
the length of the input string, but the computation is wrong. Fix it.
Signed-off-by: Jerome Forissier <jerome@forissier.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
convert_from_string() takes an hexadecimal character string and
converts it to binary. The size of the output buffer is computed from
the length of the input string, but the computation is wrong. Fix it.
Signed-off-by: Jerome Forissier <jerome@forissier.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
4 years agoregression 1022: return TEE_ERROR_GENERIC on failure ti2019.05 ti2019.05-rc1 ti2019.05-rc2 ti2019.05-rc3 ti2019.05-rc4 ti2019.06 ti2019.06-rc1 ti2019.06-rc2 ti2019.06-rc3 ti2019.06-rc4 ti2019.06-rc5
regression 1022: return TEE_ERROR_GENERIC on failure
When dlopen() or dlsym() fail in regression test 1022, the error status
is set to TEE_ERROR_OUT_OF_MEMORY which is inappropriate since the true
cause of the error is unknown. Use TEE_ERROR_GENERIC instead. This is
essentially cosmetic to avoid confusion when debugging.
Signed-off-by: Jerome Forissier <jerome@forissier.org>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
When dlopen() or dlsym() fail in regression test 1022, the error status
is set to TEE_ERROR_OUT_OF_MEMORY which is inappropriate since the true
cause of the error is unknown. Use TEE_ERROR_GENERIC instead. This is
essentially cosmetic to avoid confusion when debugging.
Signed-off-by: Jerome Forissier <jerome@forissier.org>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
xtest/Makefile: drop COMPILE_NS_USER and detect arch automatically
COMPILE_NS_USER is used by the xtest Makefile to link against either
the 32-bit or 64-bit version of OpenSSL (libcrypto.a). Historically,
the top level Makefile of the OP-TEE build project would take
COMPILE_NS_USER as an input, with value 32 or 64, and derive the path
to the appropriate cross-compiler. But given that the cross-compiler
may also be customized via CROSS_COMPILE/CROSS_COMPILE_HOST,
inconsistencies can happen.
There is no reason to keep COMPILE_NS_USER, since its value can be
derived from the compiler itself. This commit adds macros to do just
that and uses them to select the proper libcrypto library.
Signed-off-by: Jerome Forissier <jerome@forissier.org>
Reported-by: Denys Dmytriyenko <denys@ti.com>
Acked-by: Andrew F. Davis <afd@ti.com>
COMPILE_NS_USER is used by the xtest Makefile to link against either
the 32-bit or 64-bit version of OpenSSL (libcrypto.a). Historically,
the top level Makefile of the OP-TEE build project would take
COMPILE_NS_USER as an input, with value 32 or 64, and derive the path
to the appropriate cross-compiler. But given that the cross-compiler
may also be customized via CROSS_COMPILE/CROSS_COMPILE_HOST,
inconsistencies can happen.
There is no reason to keep COMPILE_NS_USER, since its value can be
derived from the compiler itself. This commit adds macros to do just
that and uses them to select the proper libcrypto library.
Signed-off-by: Jerome Forissier <jerome@forissier.org>
Reported-by: Denys Dmytriyenko <denys@ti.com>
Acked-by: Andrew F. Davis <afd@ti.com>
regression 1010: Clang: prevent unwanted optimization
Calling a NULL function pointer is undefined behavior in C, therefore
when the compiler identifies such a pattern it is allowed to do pretty
much anything. Clang simply does not take the "case 3" branch in
ta_entry_bad_mem_access().
In order to force the call, this patch uses a volatile function pointer
so that the compiler cannot assume anything about its value.
Signed-off-by: Jerome Forissier <jerome@forissier.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
Calling a NULL function pointer is undefined behavior in C, therefore
when the compiler identifies such a pattern it is allowed to do pretty
much anything. Clang simply does not take the "case 3" branch in
ta_entry_bad_mem_access().
In order to force the call, this patch uses a volatile function pointer
so that the compiler cannot assume anything about its value.
Signed-off-by: Jerome Forissier <jerome@forissier.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
regression 1010: fix Clang warning and prevent unwanted optimization
Fixes the following Clang warning:
os_test.c:906:3: warning: indirection of non-volatile null pointer will be deleted, not trap [-Wnull-dereference]
*((uint32_t *) 0) = 0;
^~~~~~~~~~~~~~~~~
os_test.c:906:3: note: consider using __builtin_trap() or qualifying pointer with 'volatile'
Signed-off-by: Jerome Forissier <jerome@forissier.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
Fixes the following Clang warning:
os_test.c:906:3: warning: indirection of non-volatile null pointer will be deleted, not trap [-Wnull-dereference]
*((uint32_t *) 0) = 0;
^~~~~~~~~~~~~~~~~
os_test.c:906:3: note: consider using __builtin_trap() or qualifying pointer with 'volatile'
Signed-off-by: Jerome Forissier <jerome@forissier.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
regression 4009: always provide a valid public key to ECDSA
The comment states something true, X and Y are not used
(otherwise the test would fail). But some implementations might check
the validity of the point in order to accept populating the key.
Signed-off-by: Cedric Auger <cedric.auger@provenrun.com>
Reviewed-by: Jerome Forissier <jerome@forissier.org>
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
The comment states something true, X and Y are not used
(otherwise the test would fail). But some implementations might check
the validity of the point in order to accept populating the key.
Signed-off-by: Cedric Auger <cedric.auger@provenrun.com>
Reviewed-by: Jerome Forissier <jerome@forissier.org>
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
Call TEE_CreatePersistentObject() with a valid pointer
According to GP specification, passing a NULL pointer to
TEE_OpenPersistentObject() and TEE_CreatePersistentObject()
should panic the trusted application.
Current code is using a NULL pointer and expects success.
After creation (and opening) of the new object,
it should also be closed: we cannot expect to do anything on it.
Signed-off-by: Cedric Auger <cedric.auger@provenrun.com>
Reviewed-by: Jerome Forissier <jerome@forissier.org>
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
According to GP specification, passing a NULL pointer to
TEE_OpenPersistentObject() and TEE_CreatePersistentObject()
should panic the trusted application.
Current code is using a NULL pointer and expects success.
After creation (and opening) of the new object,
it should also be closed: we cannot expect to do anything on it.
Signed-off-by: Cedric Auger <cedric.auger@provenrun.com>
Reviewed-by: Jerome Forissier <jerome@forissier.org>
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
ta: remove 0ms timeouts in the tested TAs
According to GP specification, a 0ms timeout is likely to trigger
a TEE_ERROR_CANCEL error rather than the expected TEE_SUCCESS.
TEE_ERROR_CANCEL is returned when the operation has been queued
by the TEE but did not yet reached the TA.
Signed-off-by: Cedric Auger <cedric.auger@provenrun.com>
Reviewed-by: Jerome Forissier <jerome@forissier.org>
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
According to GP specification, a 0ms timeout is likely to trigger
a TEE_ERROR_CANCEL error rather than the expected TEE_SUCCESS.
TEE_ERROR_CANCEL is returned when the operation has been queued
by the TEE but did not yet reached the TA.
Signed-off-by: Cedric Auger <cedric.auger@provenrun.com>
Reviewed-by: Jerome Forissier <jerome@forissier.org>
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
regression 1021: fix wrong condition check
This commit enables the bottom half subtest execution for
CA to TA panic trigger, by fixing the expected counter condition.
It also applies some fixes that were hidden in the non-executed code.
Fixes: 15cecff0 ("regression: add tests for panic events handling")
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
Acked-by: Jerome Forissier <jerome@forissier.org>
Tested-by: Jerome Forissier <jerome@forissier.org> (QEMU)
Signed-off-by: Ovidiu Mihalachi <ovidiu_mihalachi@mentor.com>
This commit enables the bottom half subtest execution for
CA to TA panic trigger, by fixing the expected counter condition.
It also applies some fixes that were hidden in the non-executed code.
Fixes: 15cecff0 ("regression: add tests for panic events handling")
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
Acked-by: Jerome Forissier <jerome@forissier.org>
Tested-by: Jerome Forissier <jerome@forissier.org> (QEMU)
Signed-off-by: Ovidiu Mihalachi <ovidiu_mihalachi@mentor.com>
cmake: support OpenSSL in non-standard locations
When OpenSSL exists in a non-standard location, compilation
fails:
export OPENSSL_ROOT_DIR=/usr/local/openssl
cmake ...
make ...
| gcc -Ihost/xtest/. -Ihost/xtest/adbg/include -Ihost/xtest/xml/include \
-I<user-ta>/host_include -Ihost/xtest -Ita/include \
-Ita/aes_perf/include -Ita/concurrent/include \
-Ita/concurrent_large/include -Ita/create_fail_test/include \
-Ita/crypt/include -Ita/enc_fs/include -Ita/os_test/include \
-Ita/rpc_test/include -Ita/sdp_basic/include -Ita/sha_perf/include \
-Ita/sims/include -Ita/miss/include -Ita/sims_keepalive/include \
-Ita/socket/include -Ita/storage_benchmark/include ... \
-DOPENSSL_FOUND=1 ... \
-MD -MT host/xtest/CMakeFiles/xtest.dir/regression_8100.c.o \
-MF host/xtest/CMakeFiles/xtest.dir/regression_8100.c.o.d \
-o host/xtest/CMakeFiles/xtest.dir/regression_8100.c.o \
-c host/xtest/regression_8100.c
| host/xtest/regression_8100.c:17:10: fatal error: openssl/x509_vfy.h: No such file or directory
| #include <openssl/x509_vfy.h>
| ^~~~~~~~~~~~~~~~~~~~
| compilation terminated.
The reason is that while CMake will find OpenSSL using above export,
and also populate various variables to access the result, those
variables aren't being used in here.
In particular, CMake adds 'Imported Targets' variables that are
meant to be used, OpenSSL::Crypto in this case. They serve multiple
purposes:
* library (file names) are abstracted away
* specific include paths are added automatically to the compiler
command line where needed
So this here needs to switch over to using those.
Note that support for OpenSSL imported targets was added in CMake
v3.4 only and hence we also have to bump the minimum required
version to reflect that fact. Given v3.4 was releasd in 2015,
this is not deemed to be an issue.
Signed-off-by: André Draszik <andre.draszik@jci.com>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
When OpenSSL exists in a non-standard location, compilation
fails:
export OPENSSL_ROOT_DIR=/usr/local/openssl
cmake ...
make ...
| gcc -Ihost/xtest/. -Ihost/xtest/adbg/include -Ihost/xtest/xml/include \
-I<user-ta>/host_include -Ihost/xtest -Ita/include \
-Ita/aes_perf/include -Ita/concurrent/include \
-Ita/concurrent_large/include -Ita/create_fail_test/include \
-Ita/crypt/include -Ita/enc_fs/include -Ita/os_test/include \
-Ita/rpc_test/include -Ita/sdp_basic/include -Ita/sha_perf/include \
-Ita/sims/include -Ita/miss/include -Ita/sims_keepalive/include \
-Ita/socket/include -Ita/storage_benchmark/include ... \
-DOPENSSL_FOUND=1 ... \
-MD -MT host/xtest/CMakeFiles/xtest.dir/regression_8100.c.o \
-MF host/xtest/CMakeFiles/xtest.dir/regression_8100.c.o.d \
-o host/xtest/CMakeFiles/xtest.dir/regression_8100.c.o \
-c host/xtest/regression_8100.c
| host/xtest/regression_8100.c:17:10: fatal error: openssl/x509_vfy.h: No such file or directory
| #include <openssl/x509_vfy.h>
| ^~~~~~~~~~~~~~~~~~~~
| compilation terminated.
The reason is that while CMake will find OpenSSL using above export,
and also populate various variables to access the result, those
variables aren't being used in here.
In particular, CMake adds 'Imported Targets' variables that are
meant to be used, OpenSSL::Crypto in this case. They serve multiple
purposes:
* library (file names) are abstracted away
* specific include paths are added automatically to the compiler
command line where needed
So this here needs to switch over to using those.
Note that support for OpenSSL imported targets was added in CMake
v3.4 only and hence we also have to bump the minimum required
version to reflect that fact. Given v3.4 was releasd in 2015,
this is not deemed to be an issue.
Signed-off-by: André Draszik <andre.draszik@jci.com>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
Add regression 1022 to test dlopen()/dlsym()/dlclose()
Adds a new test case for the dynamic link API in libdl.
- A new shared library is added in ta/os_test_lib_dl.
- In xtest 1022, the dl API is used to load the test library and
retrieve pointers to functions.
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
Adds a new test case for the dynamic link API in libdl.
- A new shared library is added in ta/os_test_lib_dl.
- In xtest 1022, the dl API is used to load the test library and
retrieve pointers to functions.
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
ta/derive_key_taf: fix build warnings
Use correct type size when printing size_t content and remove unused err
label.
Signed-off-by: Ricardo Salveti <ricardo@foundries.io>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
Use correct type size when printing size_t content and remove unused err
label.
Signed-off-by: Ricardo Salveti <ricardo@foundries.io>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
regression_8100: use null terminated strings with file_to_c
GCC 9 is more strict with string manipulation, causing the build to
fail as the string data converted via file_to_c is not null terminated,
as described by the following build error:
regression_8100.c:100:29: error: '%*s' directive argument is not a
nul-terminated string [-Werror=format-overflow=]
tlen = myasprintf(&trust, "%*s", (int)sizeof(regression_8100_ca_crt),
^~~
regression_8100_ca_crt);
~~~~~~~~~~~~~~~~~~~~~~
Change file_to_c to terminate the string after conversion and update the
string size to remove the null terminated byte. Also update
regression_8100 to use the size variable defined via file_to_c instead
of manually calling sizeof.
Signed-off-by: Ricardo Salveti <ricardo@foundries.io>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
GCC 9 is more strict with string manipulation, causing the build to
fail as the string data converted via file_to_c is not null terminated,
as described by the following build error:
regression_8100.c:100:29: error: '%*s' directive argument is not a
nul-terminated string [-Werror=format-overflow=]
tlen = myasprintf(&trust, "%*s", (int)sizeof(regression_8100_ca_crt),
^~~
regression_8100_ca_crt);
~~~~~~~~~~~~~~~~~~~~~~
Change file_to_c to terminate the string after conversion and update the
string size to remove the null terminated byte. Also update
regression_8100 to use the size variable defined via file_to_c instead
of manually calling sizeof.
Signed-off-by: Ricardo Salveti <ricardo@foundries.io>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
regression: fix memory leakage in case 1010
In regression test case 1010 xtest_tee_test_invalid_mem_access2()
allocates shared memory, but doesn't free it. This can affect other test
cases run after this case.
The shared memory is freed when the context is finalized, but that can
be too late since it normally happens when xtest exits.
Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
In regression test case 1010 xtest_tee_test_invalid_mem_access2()
allocates shared memory, but doesn't free it. This can affect other test
cases run after this case.
The shared memory is freed when the context is finalized, but that can
be too late since it normally happens when xtest exits.
Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
regression 4013: add test for device and TA unique keys
Adds a test case that tests the system PTA that derives device and TA
unique keys.
Signed-off-by: Joakim Bech <joakim.bech@linaro.org>
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
Adds a test case that tests the system PTA that derives device and TA
unique keys.
Signed-off-by: Joakim Bech <joakim.bech@linaro.org>
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
ta/miss/Android.mk: fix typo
insert missing ".ta" at the end of filename
Fixes: 15cecff0 ("regression: add tests for panic events handling")
Signed-off-by: Victor Chong <victor.chong@linaro.org>
Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
insert missing ".ta" at the end of filename
Fixes: 15cecff0 ("regression: add tests for panic events handling")
Signed-off-by: Victor Chong <victor.chong@linaro.org>
Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
regression: add tests for panic events handling
Adds a new set of tests for checking the proper releasing of
the memory resources in case of a panic event. The tests are
covering use cases when connections to the panicked context are
established whether to non-secure sessions (CA) or
other secure sessions (TA).
Also are tested several scenarios which involve all supporter
instance types:
- Multiple Instance TAs
- Single Instance TAs
- Single Instance Keep Alive TAs
Signed-off-by: Ovidiu Mihalachi <ovidiu_mihalachi@mentor.com>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
Adds a new set of tests for checking the proper releasing of
the memory resources in case of a panic event. The tests are
covering use cases when connections to the panicked context are
established whether to non-secure sessions (CA) or
other secure sessions (TA).
Also are tested several scenarios which involve all supporter
instance types:
- Multiple Instance TAs
- Single Instance TAs
- Single Instance Keep Alive TAs
Signed-off-by: Ovidiu Mihalachi <ovidiu_mihalachi@mentor.com>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
regression 1012: gracefully close subtest case
Usually, all test subcases are marked by the pair
`Do_ADBG_BeginSubCase()` and `Do_ADBG_EndSubCase()` which
formats the output of each test execution.
This patch adds the missing ending routine to regression 1012 subset.
Signed-off-by: Ovidiu Mihalachi <ovidiu_mihalachi@mentor.com>
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
Usually, all test subcases are marked by the pair
`Do_ADBG_BeginSubCase()` and `Do_ADBG_EndSubCase()` which
formats the output of each test execution.
This patch adds the missing ending routine to regression 1012 subset.
Signed-off-by: Ovidiu Mihalachi <ovidiu_mihalachi@mentor.com>
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
ta/sims: open another TA session in SIMS
This commit adds the possibility to open another TA session from a TA,
scenario that is required in those tests that are checking
the resource releasing mechanism in case of a panic event.
Thus, this would make possible to check if the secure sessions are
properly removing any reference to the panicked context.
Signed-off-by: Ovidiu Mihalachi <ovidiu_mihalachi@mentor.com>
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
This commit adds the possibility to open another TA session from a TA,
scenario that is required in those tests that are checking
the resource releasing mechanism in case of a panic event.
Thus, this would make possible to check if the secure sessions are
properly removing any reference to the panicked context.
Signed-off-by: Ovidiu Mihalachi <ovidiu_mihalachi@mentor.com>
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
ta/sims: add operation for panic triggering
This operation is used for the next set of tests that are
checking the resource cleaning in case of a panic event.
Thus, it makes possible to reproduce those situations whenever
TA context is getting panicked and TEE core has to safely
clear all resources (e.g. sessions, memory) linked to that
specific panicked TA instance.
Signed-off-by: Ovidiu Mihalachi <ovidiu_mihalachi@mentor.com>
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
This operation is used for the next set of tests that are
checking the resource cleaning in case of a panic event.
Thus, it makes possible to reproduce those situations whenever
TA context is getting panicked and TEE core has to safely
clear all resources (e.g. sessions, memory) linked to that
specific panicked TA instance.
Signed-off-by: Ovidiu Mihalachi <ovidiu_mihalachi@mentor.com>
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
regression 41xx: prevent unsafe-loop-optimizations build error
Add -Wno-unsafe-loop-optimizations directive since regression_4100.c
fails to build on some recent toolchains as GCC 7.3.0 and 7.4.0 with
an error trace like below. Note building with GCC 8.2.1 does not
reproduce the build issue.
/path/to/optee_test/host/xtest/regression_4100.c: In function ‘convert_from_string’:
/path/to/optee_test/host/xtest/regression_4100.c:448:8: error: missed loop optimization, the loop counter may overflow [-Werror=unsafe-loop-optimizations]
while (spos) {
^
/path/to/optee_test/host/xtest/regression_4100.c:455:6: error: missed loop optimization, the loop counter may overflow [-Werror=unsafe-loop-optimizations]
if (!spos)
^
The GNU Makefile build sequence defines -Wno-unsafe-loop-optimizations
for the whole xtest sources while CMake build sequence defines it
specifically for regression_4100.c among xtest source files.
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
Add -Wno-unsafe-loop-optimizations directive since regression_4100.c
fails to build on some recent toolchains as GCC 7.3.0 and 7.4.0 with
an error trace like below. Note building with GCC 8.2.1 does not
reproduce the build issue.
/path/to/optee_test/host/xtest/regression_4100.c: In function ‘convert_from_string’:
/path/to/optee_test/host/xtest/regression_4100.c:448:8: error: missed loop optimization, the loop counter may overflow [-Werror=unsafe-loop-optimizations]
while (spos) {
^
/path/to/optee_test/host/xtest/regression_4100.c:455:6: error: missed loop optimization, the loop counter may overflow [-Werror=unsafe-loop-optimizations]
if (!spos)
^
The GNU Makefile build sequence defines -Wno-unsafe-loop-optimizations
for the whole xtest sources while CMake build sequence defines it
specifically for regression_4100.c among xtest source files.
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
4 years agoIncrease stack size for GP TTA_Arithmetical TA master ti2019.01 ti2019.01-rc3 ti2019.01-rc4 ti2019.01-rc5 ti2019.02 ti2019.02-rc1 ti2019.02-rc2 ti2019.02-rc3 ti2019.02-rc4 ti2019.03 ti2019.03-rc1 ti2019.03-rc2 ti2019.03-rc3 ti2019.03-rc4 ti2019.04 ti2019.04-rc1 ti2019.04-rc2 ti2019.04-rc3 ti2019.04-rc4 ti2019.04-rc5
Increase stack size for GP TTA_Arithmetical TA
On 64-bit platforms with 64-bit user TAs (QEMUv8, HiKey960), gp_8524
crashes with the following dump:
E/TC:0 0 User TA data-abort at address 0x40003fb0 (translation fault)
E/TC:0 0 esr 0x92000047 ttbr0 0x200000e19c000 ttbr1 0x00000000 cidr 0x0
E/TC:0 0 cpu #0 cpsr 0x20000100
E/TC:0 0 x0 0000000040004ce8 x1 0000000040004ce8
E/TC:0 0 x2 0000000040004d18 x3 0000000040004da0
E/TC:0 0 x4 0000000040004cd0 x5 0000000040004ef0
E/TC:0 0 x6 0000000000000100 x7 000000000e18da80
E/TC:0 0 x8 0000000000000021 x9 0000000000004c53
E/TC:0 0 x10 0000000000000041 x11 0000000000000052
E/TC:0 0 x12 00000000a71c5d59 x13 0000000040004f80
E/TC:0 0 x14 0000000000000000 x15 0000000000000000
E/TC:0 0 x16 000000000e138020 x17 0000000000000000
E/TC:0 0 x18 0000000000000000 x19 000000000e1a2fb0
E/TC:0 0 x20 0000000000000000 x21 000000000e17e4f0
E/TC:0 0 x22 00000000000005e0 x23 0000000000000000
E/TC:0 0 x24 0000000000000000 x25 0000000000000000
E/TC:0 0 x26 0000000000000000 x27 0000000000000000
E/TC:0 0 x28 0000000000000000 x29 0000000040004ca0
E/TC:0 0 x30 0000000040011708 elr 0000000040010100
E/TC:0 0 sp_el0 0000000040003fb0
E/TC:0 0 Status of TA 534d4152-5443-4c53-4152-4954484d4554 (0xe18da50) (active)
E/TC:0 0 arch: aarch64 load address: 0x0000000040005000 ctx-idr: 2
E/TC:0 0 stack: 0x0000000040004000 4096
E/TC:0 0 region 0: va 0x0000000040000000 pa 0x000000000e100000 size 0x002000 flags ---R-X
E/TC:0 0 region 1: va 0x0000000040002000 pa 0x000000000e190000 size 0x001000 flags ---RW-
E/TC:0 0 region 2: va 0x0000000040004000 pa 0x000000000e335000 size 0x001000 flags rw-RW-
E/TC:0 0 region 3: va 0x0000000040005000 pa 0x000000000e316000 size 0x014000 flags r-x--- [0] .ta_head .text .rodata .dynsym .rela.dyn .got .rela.got .dynamic .dynstr .hash
E/TC:0 0 region 4: va 0x0000000040019000 pa 0x000000000e32a000 size 0x00b000 flags rw---- [0] .data .bss
E/TC:0 0 region 5: va 0x0000000040025000 pa 0x0000000041102d80 size 0x001000 flags rw-RW-
E/TC:0 0 [0] 534d4152-5443-4c53-4152-4954484d4554 @ 0x0000000040005000 (optee_test/out/ta/GP_TTA_Arithmetical/534d4152-5443-4c53-4152-4954484d4554.elf)
E/TC:0 0 Call stack:
E/TC:0 0 0x0000000040010100 mbedtls_mpi_exp_mod at optee_os/lib/libmbedtls/mbedtls/library/bignum.c:1782
E/TC:0 0 0x0000000040011960 mbedtls_mpi_is_prime_ext at optee_os/lib/libmbedtls/mbedtls/library/bignum.c:2361
E/TC:0 0 0x0000000040011990 mbedtls_mpi_is_prime at optee_os/lib/libmbedtls/mbedtls/library/bignum.c:2380
E/TC:0 0 0x000000004000a4ec TEE_BigIntIsProbablePrime at optee_os/lib/libutee/tee_api_arith_mpi.c:771
E/TC:0 0 0x00000000400070dc CmdTEEBigIntIsProbablePrime at optee_test/ta/GP_TTA_Arithmetical/TTA_Arithmetical.c:1139
E/TC:0 0 0x0000000040007930 TA_InvokeCommandEntryPoint at optee_test/ta/GP_TTA_Arithmetical/TTA_Arithmetical.c:1425
E/TC:0 0 0x000000004000ac74 entry_invoke_command at optee_os/lib/libutee/arch/arm/user_ta_entry.c:191
E/TC:0 0 0x000000004000ad08 __utee_entry at optee_os/lib/libutee/arch/arm/user_ta_entry.c:219
E/TC:0 0 0x000000000e10d630 ???
The invalid address is just below the stack, which means the stack size is
insufficient. Let's increase it from 2 KiB to 3 KiB.
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Acked-by: Joakim Bech <joakim.bech@linaro.org>
On 64-bit platforms with 64-bit user TAs (QEMUv8, HiKey960), gp_8524
crashes with the following dump:
E/TC:0 0 User TA data-abort at address 0x40003fb0 (translation fault)
E/TC:0 0 esr 0x92000047 ttbr0 0x200000e19c000 ttbr1 0x00000000 cidr 0x0
E/TC:0 0 cpu #0 cpsr 0x20000100
E/TC:0 0 x0 0000000040004ce8 x1 0000000040004ce8
E/TC:0 0 x2 0000000040004d18 x3 0000000040004da0
E/TC:0 0 x4 0000000040004cd0 x5 0000000040004ef0
E/TC:0 0 x6 0000000000000100 x7 000000000e18da80
E/TC:0 0 x8 0000000000000021 x9 0000000000004c53
E/TC:0 0 x10 0000000000000041 x11 0000000000000052
E/TC:0 0 x12 00000000a71c5d59 x13 0000000040004f80
E/TC:0 0 x14 0000000000000000 x15 0000000000000000
E/TC:0 0 x16 000000000e138020 x17 0000000000000000
E/TC:0 0 x18 0000000000000000 x19 000000000e1a2fb0
E/TC:0 0 x20 0000000000000000 x21 000000000e17e4f0
E/TC:0 0 x22 00000000000005e0 x23 0000000000000000
E/TC:0 0 x24 0000000000000000 x25 0000000000000000
E/TC:0 0 x26 0000000000000000 x27 0000000000000000
E/TC:0 0 x28 0000000000000000 x29 0000000040004ca0
E/TC:0 0 x30 0000000040011708 elr 0000000040010100
E/TC:0 0 sp_el0 0000000040003fb0
E/TC:0 0 Status of TA 534d4152-5443-4c53-4152-4954484d4554 (0xe18da50) (active)
E/TC:0 0 arch: aarch64 load address: 0x0000000040005000 ctx-idr: 2
E/TC:0 0 stack: 0x0000000040004000 4096
E/TC:0 0 region 0: va 0x0000000040000000 pa 0x000000000e100000 size 0x002000 flags ---R-X
E/TC:0 0 region 1: va 0x0000000040002000 pa 0x000000000e190000 size 0x001000 flags ---RW-
E/TC:0 0 region 2: va 0x0000000040004000 pa 0x000000000e335000 size 0x001000 flags rw-RW-
E/TC:0 0 region 3: va 0x0000000040005000 pa 0x000000000e316000 size 0x014000 flags r-x--- [0] .ta_head .text .rodata .dynsym .rela.dyn .got .rela.got .dynamic .dynstr .hash
E/TC:0 0 region 4: va 0x0000000040019000 pa 0x000000000e32a000 size 0x00b000 flags rw---- [0] .data .bss
E/TC:0 0 region 5: va 0x0000000040025000 pa 0x0000000041102d80 size 0x001000 flags rw-RW-
E/TC:0 0 [0] 534d4152-5443-4c53-4152-4954484d4554 @ 0x0000000040005000 (optee_test/out/ta/GP_TTA_Arithmetical/534d4152-5443-4c53-4152-4954484d4554.elf)
E/TC:0 0 Call stack:
E/TC:0 0 0x0000000040010100 mbedtls_mpi_exp_mod at optee_os/lib/libmbedtls/mbedtls/library/bignum.c:1782
E/TC:0 0 0x0000000040011960 mbedtls_mpi_is_prime_ext at optee_os/lib/libmbedtls/mbedtls/library/bignum.c:2361
E/TC:0 0 0x0000000040011990 mbedtls_mpi_is_prime at optee_os/lib/libmbedtls/mbedtls/library/bignum.c:2380
E/TC:0 0 0x000000004000a4ec TEE_BigIntIsProbablePrime at optee_os/lib/libutee/tee_api_arith_mpi.c:771
E/TC:0 0 0x00000000400070dc CmdTEEBigIntIsProbablePrime at optee_test/ta/GP_TTA_Arithmetical/TTA_Arithmetical.c:1139
E/TC:0 0 0x0000000040007930 TA_InvokeCommandEntryPoint at optee_test/ta/GP_TTA_Arithmetical/TTA_Arithmetical.c:1425
E/TC:0 0 0x000000004000ac74 entry_invoke_command at optee_os/lib/libutee/arch/arm/user_ta_entry.c:191
E/TC:0 0 0x000000004000ad08 __utee_entry at optee_os/lib/libutee/arch/arm/user_ta_entry.c:219
E/TC:0 0 0x000000000e10d630 ???
The invalid address is just below the stack, which means the stack size is
insufficient. Let's increase it from 2 KiB to 3 KiB.
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Acked-by: Joakim Bech <joakim.bech@linaro.org>
GP: fix compile errors with calloc()
Fixes a few errors when xtest is compiled with GP tests enabled
(CFG_GP_PACKAGE_PATH pointing to the GP Initial Configuration Test
Suite files).
Fixes: e4ec9e4aca08 ("xtest: Explicitly initialize local variables")
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
Fixes a few errors when xtest is compiled with GP tests enabled
(CFG_GP_PACKAGE_PATH pointing to the GP Initial Configuration Test
Suite files).
Fixes: e4ec9e4aca08 ("xtest: Explicitly initialize local variables")
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
xtest: Explicitly initialize local variables
This change initializes all local variables to prevent build issues
(warnings and/or errors) in OP-TEE test package. This change uses
= { } for non-scalar variables and = 0 for scalar variables when there
is no obvious value. This change falls back to memset() only when
neither = { } nor = 0 is applicable, here pthread_t typed variable
and variable size arrays.
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
This change initializes all local variables to prevent build issues
(warnings and/or errors) in OP-TEE test package. This change uses
= { } for non-scalar variables and = 0 for scalar variables when there
is no obvious value. This change falls back to memset() only when
neither = { } nor = 0 is applicable, here pthread_t typed variable
and variable size arrays.
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
TAs: explicitly initialize local variables
This change initializes all local variables to prevent build issues
(warnings and/or errors) in OP-TEE test package. This change uses
= { } for non-scalar variables and = 0 for scalar variables.
This change also removes some useless header files inclusion.
This change also fixes few bad indentations.
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
This change initializes all local variables to prevent build issues
(warnings and/or errors) in OP-TEE test package. This change uses
= { } for non-scalar variables and = 0 for scalar variables.
This change also removes some useless header files inclusion.
This change also fixes few bad indentations.
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
regression 1008: adjust TA corruption test for CFG_ULIBS_SHARED=y
When TAs are linked against shared versions of libutee etc., the
size of the main binary is reduced significantly. This causes test
1008.4 to fail, because the size of the TA drops from ~121 KiB down
to ~9 KiB which is smaller than the offset supplied to
load_corrupt_ta(). Use a smaller offest to fix the issue.
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
When TAs are linked against shared versions of libutee etc., the
size of the main binary is reduced significantly. This causes test
1008.4 to fail, because the size of the TA drops from ~121 KiB down
to ~9 KiB which is smaller than the offset supplied to
load_corrupt_ta(). Use a smaller offest to fix the issue.
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
docs: Remove current docs and link to the new location
All current documentation has been transferred to a new git called
optee_docs [1]. The output from optee_docs will be rendered using Sphinx
and hosted at optee.readthedocs.io [2]. The new documentation git will
also be part of the regular OP-TEE releases. For completeness, it will
also be included in our manifests making up a full OP-TEE developer
setup.
[1] https://github.com/OP-TEE/optee_docs
[2] https://optee.readthedocs.io
Signed-off-by: Joakim Bech <joakim.bech@linaro.org>
Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
All current documentation has been transferred to a new git called
optee_docs [1]. The output from optee_docs will be rendered using Sphinx
and hosted at optee.readthedocs.io [2]. The new documentation git will
also be part of the regular OP-TEE releases. For completeness, it will
also be included in our manifests making up a full OP-TEE developer
setup.
[1] https://github.com/OP-TEE/optee_docs
[2] https://optee.readthedocs.io
Signed-off-by: Joakim Bech <joakim.bech@linaro.org>
Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
benchmark_1000: fix compilation against musl (uint)
Compiling against musl-libc fails with the following error:
| .../host/xtest/benchmark_1000.c: In function 'show_test_result':
| .../host/xtest/benchmark_1000.c:102:2: error: unknown type name 'uint'; did you mean 'int'?
| uint i;
| ^~~~
| int
| ...host/xtest/benchmark_1000.c:108:16: error: comparison of integer expressions of different signedness: 'int' and 'size_t' {aka 'unsigned int'} [-Werror=sign-compare]
| for (i = 0; i < size; i++) {
| ^
etc.
Convert to using more standard size_t
Signed-off-by: André Draszik <andre.draszik@jci.com>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
Compiling against musl-libc fails with the following error:
| .../host/xtest/benchmark_1000.c: In function 'show_test_result':
| .../host/xtest/benchmark_1000.c:102:2: error: unknown type name 'uint'; did you mean 'int'?
| uint i;
| ^~~~
| int
| ...host/xtest/benchmark_1000.c:108:16: error: comparison of integer expressions of different signedness: 'int' and 'size_t' {aka 'unsigned int'} [-Werror=sign-compare]
| for (i = 0; i < size; i++) {
| ^
etc.
Convert to using more standard size_t
Signed-off-by: André Draszik <andre.draszik@jci.com>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
build: ignore declaration-after-statement warnings
| Makefile:37: recipe for target 'xtest' failed
| make: *** [xtest] Error 2
| make: *** Waiting for unfinished jobs....
| arith_taf.c: In function 'get_handle':
| arith_taf.c:56:2: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
| int h = handle_get(&hdb, ptr);
| ^~~
| arith_taf.c: In function 'ta_entry_arith_new_var':
| arith_taf.c:82:2: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
| size_t len = TEE_BigIntSizeInU32(params[0].value.a);
| ^~~~~~
| arith_taf.c: In function 'ta_entry_arith_new_fmm_var':
| arith_taf.c:129:2: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
| size_t len = TEE_BigIntFMMSizeInU32(params[0].value.a);
| ^~~~~~
| arith_taf.c: In function 'ta_entry_arith_free_handle':
| arith_taf.c:150:2: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
| void *ptr = put_handle(params[0].value.a & ~HT_MASK);
| ^~~~
| arith_taf.c: In function 'ta_entry_arith_from_octet_string':
| arith_taf.c:165:2: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
| TEE_BigInt *big_int = lookup_handle(HT_BIGINT, params[0].value.a);
| ^~~~~~~~~~
| arith_taf.c: In function 'ta_entry_arith_from_s32':
| arith_taf.c:181:2: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
| TEE_BigInt *big_int = lookup_handle(HT_BIGINT, params[0].value.a);
| ^~~~~~~~~~
etc.
Signed-off-by: André Draszik <andre.draszik@jci.com>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
| Makefile:37: recipe for target 'xtest' failed
| make: *** [xtest] Error 2
| make: *** Waiting for unfinished jobs....
| arith_taf.c: In function 'get_handle':
| arith_taf.c:56:2: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
| int h = handle_get(&hdb, ptr);
| ^~~
| arith_taf.c: In function 'ta_entry_arith_new_var':
| arith_taf.c:82:2: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
| size_t len = TEE_BigIntSizeInU32(params[0].value.a);
| ^~~~~~
| arith_taf.c: In function 'ta_entry_arith_new_fmm_var':
| arith_taf.c:129:2: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
| size_t len = TEE_BigIntFMMSizeInU32(params[0].value.a);
| ^~~~~~
| arith_taf.c: In function 'ta_entry_arith_free_handle':
| arith_taf.c:150:2: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
| void *ptr = put_handle(params[0].value.a & ~HT_MASK);
| ^~~~
| arith_taf.c: In function 'ta_entry_arith_from_octet_string':
| arith_taf.c:165:2: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
| TEE_BigInt *big_int = lookup_handle(HT_BIGINT, params[0].value.a);
| ^~~~~~~~~~
| arith_taf.c: In function 'ta_entry_arith_from_s32':
| arith_taf.c:181:2: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
| TEE_BigInt *big_int = lookup_handle(HT_BIGINT, params[0].value.a);
| ^~~~~~~~~~
etc.
Signed-off-by: André Draszik <andre.draszik@jci.com>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
fix compilation against musl (inttypes)
Compiling against musl-libc fails with the following error:
| arith_taf.c: In function 'lookup_handle':
| arith_taf.c:38:29: error: expected ')' before 'PRIx32'
| EMSG("Invalid handle 0x%" PRIx32, handle);
| ^~~~~~
and similar for PRIx32 PRIu32 PRId32 etc.
Add the needed include to get the definition of those
macros.
Signed-off-by: André Draszik <andre.draszik@jci.com>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
Compiling against musl-libc fails with the following error:
| arith_taf.c: In function 'lookup_handle':
| arith_taf.c:38:29: error: expected ')' before 'PRIx32'
| EMSG("Invalid handle 0x%" PRIx32, handle);
| ^~~~~~
and similar for PRIx32 PRIu32 PRId32 etc.
Add the needed include to get the definition of those
macros.
Signed-off-by: André Draszik <andre.draszik@jci.com>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
sock_server: fix compilation against musl (sys/errno.h)
Compiling against musl-libc fails with the following error:
| In file included from .../host/xtest/sock_server.c:24:
| .../usr/include/sys/errno.h:1:2: error: #warning redirecting incorrect #include <sys/errno.h> to <errno.h> [-Werror=cpp]
| #warning redirecting incorrect #include <sys/errno.h> to <errno.h>
| ^~~~~~~
Just remove the needless include.
Signed-off-by: André Draszik <andre.draszik@jci.com>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
Compiling against musl-libc fails with the following error:
| In file included from .../host/xtest/sock_server.c:24:
| .../usr/include/sys/errno.h:1:2: error: #warning redirecting incorrect #include <sys/errno.h> to <errno.h> [-Werror=cpp]
| #warning redirecting incorrect #include <sys/errno.h> to <errno.h>
| ^~~~~~~
Just remove the needless include.
Signed-off-by: André Draszik <andre.draszik@jci.com>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
xtest: add --stats applet
Adds the --stats applet to interact with the pseudo TA "stats".
Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Adds the --stats applet to interact with the pseudo TA "stats".
Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
regression: 4002: run MAC tests in multiple increments
The .in_incr field of struct xtest_mac_case is currently used for
a single step, that is, update() is called to process in_incr byte,
then the rest of the input buffer is passed to final().
This commit allows to run the CBC MAC update() several times in chunks
of in_incr bytes, then the remaining bytes in the input buffer
(<= in_incr) are passed to final().
All MAC tests that have a non-zero increment (.in_incr) are now run
twice: first in two steps, then in multiple steps of in_incr size.
This is a test case for [1].
Link: [1] https://github.com/OP-TEE/optee_os/pull/2779
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
The .in_incr field of struct xtest_mac_case is currently used for
a single step, that is, update() is called to process in_incr byte,
then the rest of the input buffer is passed to final().
This commit allows to run the CBC MAC update() several times in chunks
of in_incr bytes, then the remaining bytes in the input buffer
(<= in_incr) are passed to final().
All MAC tests that have a non-zero increment (.in_incr) are now run
twice: first in two steps, then in multiple steps of in_incr size.
This is a test case for [1].
Link: [1] https://github.com/OP-TEE/optee_os/pull/2779
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
ta/cryp_taf: correct return value
ta_entry_copy_object_attributes() should faithfully returns
TEE_CopyObjectAttributes1()'s value instead of always overwriting it with
TEE_SUCCESS.
Signed-off-by: Oliver Chiang <rockerfeynman@gmail.com>
Reviewed-by: Joakim Bech <joakim.bech@linaro.org>
ta_entry_copy_object_attributes() should faithfully returns
TEE_CopyObjectAttributes1()'s value instead of always overwriting it with
TEE_SUCCESS.
Signed-off-by: Oliver Chiang <rockerfeynman@gmail.com>
Reviewed-by: Joakim Bech <joakim.bech@linaro.org>
cmake: locate files WRT to project home directory
Build system can't find file_to_c.py and certificate files, because
CMakeLists.txt have an assumption about those files locations. So,
when you try to use separate build directory, relative path in
CMakeLists.txt is not working as expected.
It is better to use CMAKE_CURRENT_SOURCE_DIR instead of assuming that
mentioned files can be reached from the build directory.
Signed-off-by: Volodymyr Babchuk <vlad.babchuk@gmail.com>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Joakim Bech <joakim.bech@linaro.org>
Build system can't find file_to_c.py and certificate files, because
CMakeLists.txt have an assumption about those files locations. So,
when you try to use separate build directory, relative path in
CMakeLists.txt is not working as expected.
It is better to use CMAKE_CURRENT_SOURCE_DIR instead of assuming that
mentioned files can be reached from the build directory.
Signed-off-by: Volodymyr Babchuk <vlad.babchuk@gmail.com>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Joakim Bech <joakim.bech@linaro.org>
regression 6000: fix uninitialized local variables
Reported by GCC 8.2.0 with traces like:
.../build/optee_test/host/xtest/regression_6000.c:495:8: error: ‘count’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
(void)ADBG_EXPECT_BUFFER(c, &data_00[5], 5, out, count);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.../build/optee_test/host/xtest/regression_6000.c:465:11: note: ‘count’ was declared here
uint32_t count;
^~~~~
.../build/optee_test/host/xtest/regression_6000.c:192:23: error: ‘obj’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
op.params[0].value.a = obj;
~~~~~~~~~~~~~~~~~~~~~^~~~~
.../build/optee_test/host/xtest/regression_6000.c:463:11: note: ‘obj’ was declared here
uint32_t obj;
^~~
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Joakim Bech <joakim.bech@linaro.org>
Reported by GCC 8.2.0 with traces like:
.../build/optee_test/host/xtest/regression_6000.c:495:8: error: ‘count’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
(void)ADBG_EXPECT_BUFFER(c, &data_00[5], 5, out, count);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.../build/optee_test/host/xtest/regression_6000.c:465:11: note: ‘count’ was declared here
uint32_t count;
^~~~~
.../build/optee_test/host/xtest/regression_6000.c:192:23: error: ‘obj’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
op.params[0].value.a = obj;
~~~~~~~~~~~~~~~~~~~~~^~~~~
.../build/optee_test/host/xtest/regression_6000.c:463:11: note: ‘obj’ was declared here
uint32_t obj;
^~~
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Joakim Bech <joakim.bech@linaro.org>
regression 4100: fix uninitialized local variable
Reported by GCC 8.2.0 with traces like:
.../build/optee_test/host/xtest/regression_4100.c:884:2: error: ‘cres’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
ADBG_EXPECT_COMPARE_SIGNED(c, cres, ==, cmp_res);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.../build/optee_test/host/xtest/regression_4100.c:869:10: note: ‘cres’ was declared here
int32_t cres;
^~~~
.../build/optee_test/host/xtest/regression_4100.c:857:2: error: ‘cres’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
ADBG_EXPECT_COMPARE_SIGNED(c, cres, ==, cmp_res);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.../build/optee_test/host/xtest/regression_4100.c:835:10: note: ‘cres’ was declared here
int32_t cres;
^~~~
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Joakim Bech <joakim.bech@linaro.org>
Reported by GCC 8.2.0 with traces like:
.../build/optee_test/host/xtest/regression_4100.c:884:2: error: ‘cres’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
ADBG_EXPECT_COMPARE_SIGNED(c, cres, ==, cmp_res);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.../build/optee_test/host/xtest/regression_4100.c:869:10: note: ‘cres’ was declared here
int32_t cres;
^~~~
.../build/optee_test/host/xtest/regression_4100.c:857:2: error: ‘cres’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
ADBG_EXPECT_COMPARE_SIGNED(c, cres, ==, cmp_res);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.../build/optee_test/host/xtest/regression_4100.c:835:10: note: ‘cres’ was declared here
int32_t cres;
^~~~
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Joakim Bech <joakim.bech@linaro.org>
regression 4000: fix uninitialized local variable
Reported by GCC 8.2.0 with trace:
.../build/optee_test/host/xtest/regression_4000.c:4090:24: error: ‘ptx_hash_size’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
if (!ADBG_EXPECT_TEEC_SUCCESS(c,
^~~~~~~~~~~~~
.../build/optee_test/host/xtest/regression_4000.c:3658:9: note: ‘ptx_hash_size’ was declared here
size_t ptx_hash_size;
^~~~~~~~~~~~~
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Joakim Bech <joakim.bech@linaro.org>
Reported by GCC 8.2.0 with trace:
.../build/optee_test/host/xtest/regression_4000.c:4090:24: error: ‘ptx_hash_size’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
if (!ADBG_EXPECT_TEEC_SUCCESS(c,
^~~~~~~~~~~~~
.../build/optee_test/host/xtest/regression_4000.c:3658:9: note: ‘ptx_hash_size’ was declared here
size_t ptx_hash_size;
^~~~~~~~~~~~~
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Joakim Bech <joakim.bech@linaro.org>
xtest --aes-perf: add -u option to process buffer in several steps
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Suggested-by: Tetsuya Yoshizaki <yoshizaki.tetsuya@socionext.com>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Suggested-by: Tetsuya Yoshizaki <yoshizaki.tetsuya@socionext.com>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
improve xtest summary message
"0 test cases were skipped" instead of "0 test case was skipped" after successful run
Signed-off-by: Markus S. Wamser <markus.wamser@mixed-mode.de>
Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
"0 test cases were skipped" instead of "0 test case was skipped" after successful run
Signed-off-by: Markus S. Wamser <markus.wamser@mixed-mode.de>
Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
regression: split 4007 into key types
Splits regression case 4007 into
- 4007_symmetric for symmetric keys
- 4007_rsa for RSA keys, which also is complemented with 3072 and 4096 keys
- 4007_dh for Diffie-Hellman keys
- 4007_ecc for ECC keys
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Splits regression case 4007 into
- 4007_symmetric for symmetric keys
- 4007_rsa for RSA keys, which also is complemented with 3072 and 4096 keys
- 4007_dh for Diffie-Hellman keys
- 4007_ecc for ECC keys
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
regression 4011: correct potential overflow
Fix issues reported by GCC 8.2.0.
build/optee_test/host/xtest/regression_4000.c: In function ‘xtest_tee_test_4011’:
build/optee_test/host/xtest/regression_4000.c:5029:3: error: ‘memmove’ pointer overflow between offset [0, 8] and size [4294967295, 2147483647] accessing array ‘tmp’ with type ‘uint8_t[1024]’ {aka ‘unsigned char[1024]’} [-Werror=array-bounds]
memmove(tmp + n + i, tmp + m, tmp_size - m);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
build/optee_test/host/xtest/regression_4000.c:4927:10: note: array ‘tmp’ declared here
uint8_t tmp[1024];
^~~
build/optee_test/host/xtest/regression_4000.c:5029:3: error: ‘memmove’ specified size 4294967295 exceeds maximum object size 2147483647 [-Werror=stringop-overflow=]
memmove(tmp + n + i, tmp + m, tmp_size - m);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
Reported-by: Simon Hughes <simon.hughes@arm.com>
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
Fix issues reported by GCC 8.2.0.
build/optee_test/host/xtest/regression_4000.c: In function ‘xtest_tee_test_4011’:
build/optee_test/host/xtest/regression_4000.c:5029:3: error: ‘memmove’ pointer overflow between offset [0, 8] and size [4294967295, 2147483647] accessing array ‘tmp’ with type ‘uint8_t[1024]’ {aka ‘unsigned char[1024]’} [-Werror=array-bounds]
memmove(tmp + n + i, tmp + m, tmp_size - m);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
build/optee_test/host/xtest/regression_4000.c:4927:10: note: array ‘tmp’ declared here
uint8_t tmp[1024];
^~~
build/optee_test/host/xtest/regression_4000.c:5029:3: error: ‘memmove’ specified size 4294967295 exceeds maximum object size 2147483647 [-Werror=stringop-overflow=]
memmove(tmp + n + i, tmp + m, tmp_size - m);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
Reported-by: Simon Hughes <simon.hughes@arm.com>
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
xtest: prevent unexpected build warning with strncpy
This change modifies adbg_run.c to prevent a false positive
warning reported by GCC 8.2 on usage of strncpy():
build/optee_test/host/xtest/adbg/src/adbg_run.c: In function ‘Do_ADBG_AppendToSuite’:
build/optee_test/host/xtest/adbg/src/adbg_run.c:103:3: error: ‘strncpy’ specified bound depends on the length of the source argument [-Werror=stringop-overflow=]
strncpy(p, Source_p->SuiteID_p, size);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
build/optee_test/host/xtest/adbg/src/adbg_run.c:88:9: note: length computed here
size = strlen(Source_p->SuiteID_p);
^~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
From [1]:
Using strncpy Safely
In general, it is not possible to avoid string truncation by strncpy
except by sizing the destination to be at least a byte larger than
the length of the source string. With that approach, however, using
strncpy becomes unnecessary and the function can be avoided in favor
of other APIs such as strcpy or (less preferably) memcpy. Much has
been written about the problems with strncpy and we recommend to
avoid it whenever possible. It is, however, worth keeping in mind
that unlike other standard string-handling functions, strncpy always
writes exactly as many characters as specified by the third argument;
if the source string is shorter, the function fills the remaining
bytes with NULs.
This change prefers using a snprintf() as used in the alternate
instruction block of the strncpy() call.
[1] https://developers.redhat.com/blog/2018/05/24/detecting-string-truncation-with-gcc-8/
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Signed-off-by: Simon Hughes <simon.hughes@arm.com>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
This change modifies adbg_run.c to prevent a false positive
warning reported by GCC 8.2 on usage of strncpy():
build/optee_test/host/xtest/adbg/src/adbg_run.c: In function ‘Do_ADBG_AppendToSuite’:
build/optee_test/host/xtest/adbg/src/adbg_run.c:103:3: error: ‘strncpy’ specified bound depends on the length of the source argument [-Werror=stringop-overflow=]
strncpy(p, Source_p->SuiteID_p, size);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
build/optee_test/host/xtest/adbg/src/adbg_run.c:88:9: note: length computed here
size = strlen(Source_p->SuiteID_p);
^~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
From [1]:
Using strncpy Safely
In general, it is not possible to avoid string truncation by strncpy
except by sizing the destination to be at least a byte larger than
the length of the source string. With that approach, however, using
strncpy becomes unnecessary and the function can be avoided in favor
of other APIs such as strcpy or (less preferably) memcpy. Much has
been written about the problems with strncpy and we recommend to
avoid it whenever possible. It is, however, worth keeping in mind
that unlike other standard string-handling functions, strncpy always
writes exactly as many characters as specified by the third argument;
if the source string is shorter, the function fills the remaining
bytes with NULs.
This change prefers using a snprintf() as used in the alternate
instruction block of the strncpy() call.
[1] https://developers.redhat.com/blog/2018/05/24/detecting-string-truncation-with-gcc-8/
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Signed-off-by: Simon Hughes <simon.hughes@arm.com>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
regression: 6010: add rename conflict case (with close)
Adds a test case for issue https://github.com/OP-TEE/optee_os/issues/2707.
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Reviewed-by: Joakim Bech <joakim.bech@linaro.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
Adds a test case for issue https://github.com/OP-TEE/optee_os/issues/2707.
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Reviewed-by: Joakim Bech <joakim.bech@linaro.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
ta/os_test: remove mpa testbench
Removes the MPA test suite "testbench" built into the os_test TA. The
test suite is made obsolete by the recently added 41xx cases.
Tested-by: Jens Wiklander <jens.wiklander@linaro.org> (Hikey)
Acked-by: Etienne Carriere <etienne.carriere@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Removes the MPA test suite "testbench" built into the os_test TA. The
test suite is made obsolete by the recently added 41xx cases.
Tested-by: Jens Wiklander <jens.wiklander@linaro.org> (Hikey)
Acked-by: Etienne Carriere <etienne.carriere@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
regression: add 41xx arithmetic tests
Adds a new 41xx series of for arithmetic tests. The test cases in
os_test TA in the tb_*.c and testframework.c files has been converted to
xtest format. The tests are now performed on TEE Internal API instead of
directly on the libmpa interace.
A few cases has been dropped, for instance random divisions. GCD and
FMM cases added.
Acked-by: Etienne Carriere <etienne.carriere@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Adds a new 41xx series of for arithmetic tests. The test cases in
os_test TA in the tb_*.c and testframework.c files has been converted to
xtest format. The tests are now performed on TEE Internal API instead of
directly on the libmpa interace.
A few cases has been dropped, for instance random divisions. GCD and
FMM cases added.
Acked-by: Etienne Carriere <etienne.carriere@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
ta/crypt: add arithmetic TAF wrappers
Adds TAF wrappers for GP TEE arithmetical API
Acked-by: Etienne Carriere <etienne.carriere@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Adds TAF wrappers for GP TEE arithmetical API
Acked-by: Etienne Carriere <etienne.carriere@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
regression: 4006: add test for RSASSA no ASN.1
This test checks the TEE_ALG_RSASSA_PKCS1_V1_5 extension, that allows to
sign data without including the hash OID in the signature. The test
vector data is copied from one of the already present vectors, with the
hash OID manually removed in the signature.
Link: <https://github.com/OP-TEE/optee_os/pull/2524>
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
Signed-off-by: Gabor Szekely <szvgabor@gmail.com>
This test checks the TEE_ALG_RSASSA_PKCS1_V1_5 extension, that allows to
sign data without including the hash OID in the signature. The test
vector data is copied from one of the already present vectors, with the
hash OID manually removed in the signature.
Link: <https://github.com/OP-TEE/optee_os/pull/2524>
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
Signed-off-by: Gabor Szekely <szvgabor@gmail.com>
cmake: component rely on C support
Without specifing optee_client source expects only C source file
support cmake may attempt to look for resources as g++. When
building with environments that do not provide such tools as when
building from native buildroot ofr a qemu target, optee_client
fails to build. This change ensure a minimal C support allows to
build optee_client with cmake.
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
Without specifing optee_client source expects only C source file
support cmake may attempt to look for resources as g++. When
building with environments that do not provide such tools as when
building from native buildroot ofr a qemu target, optee_client
fails to build. This change ensure a minimal C support allows to
build optee_client with cmake.
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
regression: add case 1020 (lockdep)
Test the "lockdep" algorithm. This simply triggers a special test
pseudo-TA.
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
Test the "lockdep" algorithm. This simply triggers a special test
pseudo-TA.
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
Android.mk: add required header files to LOCAL_ADDITIONAL_DEPENDENCIES
Using $(LOCAL_PATH)/host/xtest/regression_8100.c as a target is not
allowed by AOSP document "Build System Changes for Android.mk Writers" [1]
("2. The target is a real file, but it's outside the output directories").
Fixes the following build error:
external/optee_test/Android.mk:71: error: writing to readonly directory: "external/optee_test/host/xtest/regression_8100.c"
Link: [1] https://android.googlesource.com/platform/build/+/4c9399d9889e/Changes.md#phony_targets
Signed-off-by: Yongqin Liu <yongqin.liu@linaro.org>
Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
[jf: edit commit message]
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Using $(LOCAL_PATH)/host/xtest/regression_8100.c as a target is not
allowed by AOSP document "Build System Changes for Android.mk Writers" [1]
("2. The target is a real file, but it's outside the output directories").
Fixes the following build error:
external/optee_test/Android.mk:71: error: writing to readonly directory: "external/optee_test/host/xtest/regression_8100.c"
Link: [1] https://android.googlesource.com/platform/build/+/4c9399d9889e/Changes.md#phony_targets
Signed-off-by: Yongqin Liu <yongqin.liu@linaro.org>
Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
[jf: edit commit message]
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Android.mk : Fix compilation for build outside of source
Trying to specify Android build location outside of souce directory's
default 'out' using OUT_DIR_COMMON_BASE env variable, results in the
following error
"....
build/core/binary.mk:1480: error: external/optee_test/Android.mk:
xtest: C_INCLUDES must be under the source or output directories:
"
Fix the error by moving host_include/ from LOCAL_C_INCLUDES to LOCAL_CFLAGS
Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
Tested-by: Victor Chong <victor.chong@linaro.org> (hikey620)
Acked-by: Victor Chong <victor.chong@linaro.org>
[jf: wrap commit text]
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Trying to specify Android build location outside of souce directory's
default 'out' using OUT_DIR_COMMON_BASE env variable, results in the
following error
"....
build/core/binary.mk:1480: error: external/optee_test/Android.mk:
xtest: C_INCLUDES must be under the source or output directories:
"
Fix the error by moving host_include/ from LOCAL_C_INCLUDES to LOCAL_CFLAGS
Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
Tested-by: Victor Chong <victor.chong@linaro.org> (hikey620)
Acked-by: Victor Chong <victor.chong@linaro.org>
[jf: wrap commit text]
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
regression_*.c: move ADBG_CASE_DEFINE()
Moves all ADBG_CASE_DEFINE() to right after the function implementing
the test case.
Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Moves all ADBG_CASE_DEFINE() to right after the function implementing
the test case.
Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Android.mk: make xtest installed in the vendor partition
and use ta libs in the vendor partition,
so that we could make optee work with Treble enabled builds too
Acked-by: Victor Chong <victor.chong@linaro.org>
Signed-off-by: Yongqin Liu <yongqin.liu@linaro.org>
and use ta libs in the vendor partition,
so that we could make optee work with Treble enabled builds too
Acked-by: Victor Chong <victor.chong@linaro.org>
Signed-off-by: Yongqin Liu <yongqin.liu@linaro.org>
Replace 32-bit libcrypto.a with version compiled for Cortex-A9 (no udiv)
Re-build OpenSSL's libcrypto.a without hardware divide (udiv). Fixes the
following crash observed on Cortex-A9 platforms:
(gdb) r
Program terminated with signal SIGILL, Illegal instruction.
#0 0x00054c30 in lh_insert ()
(gdb) x/i 0x00054c30
0x54c30 <lh_insert+22>: udiv r3, r3, r2
Build commands:
git clone https://github.com/openssl/openssl.git
cd openssl
git checkout OpenSSL_1_0_2o
./Configure linux-generic32 -mcpu=cortex-a9 no-shared \
--cross-compile-prefix=arm-linux-gnueabihf-
make build_libcrypto
Reported-by: Andrew F. Davis <afd@ti.com>
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Tested-by: Andrew F. Davis <afd@ti.com>
Re-build OpenSSL's libcrypto.a without hardware divide (udiv). Fixes the
following crash observed on Cortex-A9 platforms:
(gdb) r
Program terminated with signal SIGILL, Illegal instruction.
#0 0x00054c30 in lh_insert ()
(gdb) x/i 0x00054c30
0x54c30 <lh_insert+22>: udiv r3, r3, r2
Build commands:
git clone https://github.com/openssl/openssl.git
cd openssl
git checkout OpenSSL_1_0_2o
./Configure linux-generic32 -mcpu=cortex-a9 no-shared \
--cross-compile-prefix=arm-linux-gnueabihf-
make build_libcrypto
Reported-by: Andrew F. Davis <afd@ti.com>
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Tested-by: Andrew F. Davis <afd@ti.com>
xest: OpenSSL may be provided by the system
Introduce build directive OPTEE_OPENSSL_EXPORT in GNU makefile
to get OpenSSL from the target rather than using the provided builds
of the library.
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
Introduce build directive OPTEE_OPENSSL_EXPORT in GNU makefile
to get OpenSSL from the target rather than using the provided builds
of the library.
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
xtest: Makefile: fix OpenSSL dependency on GP test suite support
CFG_GP_PACKAGE_PATH is not expected to store 'y' but a path, if
defined. This change corrects the test on CFG_GP_PACKAGE_PATH regarding
OpenSSL depedency.
Fixes: 43d58a5fce8f ("xtest: Makefile: link against OpenSSL if MBed TLS is enabled in TA")
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
CFG_GP_PACKAGE_PATH is not expected to store 'y' but a path, if
defined. This change corrects the test on CFG_GP_PACKAGE_PATH regarding
OpenSSL depedency.
Fixes: 43d58a5fce8f ("xtest: Makefile: link against OpenSSL if MBed TLS is enabled in TA")
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
regression: 4003: add AES CBC test
Test case for issue https://github.com/OP-TEE/optee_os/issues/2355.
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
Test case for issue https://github.com/OP-TEE/optee_os/issues/2355.
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
ta: os_test_lib: add aosp support
Signed-off-by: Victor Chong <victor.chong@linaro.org>
Signed-off-by: Yongqin Liu <yongqin.liu@linaro.org>
Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
Signed-off-by: Victor Chong <victor.chong@linaro.org>
Signed-off-by: Yongqin Liu <yongqin.liu@linaro.org>
Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
regression: 4003: use bigger plain text in AES CTR test
The AES CTR test added in the parent commit results in the accelerated
crypto code being called with 3 blocks of data (48 bytes), which revealed
a bug in the 32-bit version of ce_aes_ctr_encrypt() [1].
Add some more data to exercise a similar loop in the 64-bit version of
ce_aes_ctr_encrypt(). The loop deals with 4 blocks of data.
Link: [1] https://github.com/OP-TEE/optee_os/issues/2305
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Joakim Bech <joakim.bech@linaro.org>
The AES CTR test added in the parent commit results in the accelerated
crypto code being called with 3 blocks of data (48 bytes), which revealed
a bug in the 32-bit version of ce_aes_ctr_encrypt() [1].
Add some more data to exercise a similar loop in the 64-bit version of
ce_aes_ctr_encrypt(). The loop deals with 4 blocks of data.
Link: [1] https://github.com/OP-TEE/optee_os/issues/2305
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Joakim Bech <joakim.bech@linaro.org>
regression: 4003: add AES CTR test
Test case for issue https://github.com/OP-TEE/optee_os/issues/2305.
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Joakim Bech <joakim.bech@linaro.org>
Test case for issue https://github.com/OP-TEE/optee_os/issues/2305.
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Joakim Bech <joakim.bech@linaro.org>