15 #define ARRAY_SIZE(arr) (sizeof(arr)/sizeof(arr[0]))
20 #define PSA_CONNECT(service) \
21 psa_handle_t ipc_handle; \
22 ipc_handle = psa_connect(service##_SID, service##_VERSION); \
23 if (!PSA_HANDLE_IS_VALID(ipc_handle)) { \
24 return PSA_ERROR_GENERIC_ERROR; \
27 #define PSA_CLOSE() psa_close(ipc_handle)
29 #define API_DISPATCH(sfn_name, sfn_id) \
30 psa_call(ipc_handle, PSA_IPC_CALL, \
31 in_vec, ARRAY_SIZE(in_vec), \
32 out_vec, ARRAY_SIZE(out_vec))
34 #define API_DISPATCH_NO_OUTVEC(sfn_name, sfn_id) \
35 psa_call(ipc_handle, PSA_IPC_CALL, \
36 in_vec, ARRAY_SIZE(in_vec), \
37 (psa_outvec *)NULL, 0)
39 #define API_DISPATCH(sfn_name, sfn_id) \
40 tfm_##sfn_name##_veneer( \
41 in_vec, ARRAY_SIZE(in_vec), \
42 out_vec, ARRAY_SIZE(out_vec))
44 #define API_DISPATCH_NO_OUTVEC(sfn_name, sfn_id) \
45 tfm_##sfn_name##_veneer( \
46 in_vec, ARRAY_SIZE(in_vec), \
50 __attribute__((section(
"SFN")))
59 __attribute__((section(
"SFN")))
64 #ifdef TFM_CRYPTO_KEY_MODULE_DISABLED
94 __attribute__((section(
"SFN")))
97 #ifdef TFM_CRYPTO_KEY_MODULE_DISABLED
103 .key_handle = handle,
114 TFM_CRYPTO_CLOSE_KEY);;
124 __attribute__((section(
"SFN")))
130 #ifdef TFM_CRYPTO_KEY_MODULE_DISABLED
140 {.base = data, .len = data_length}
151 TFM_CRYPTO_IMPORT_KEY);
160 __attribute__((section(
"SFN")))
163 #ifdef TFM_CRYPTO_KEY_MODULE_DISABLED
169 .key_handle = handle,
180 TFM_CRYPTO_DESTROY_KEY);
189 __attribute__((section(
"SFN")))
193 #ifdef TFM_CRYPTO_KEY_MODULE_DISABLED
199 .key_handle = handle,
213 TFM_CRYPTO_GET_KEY_ATTRIBUTES);
224 #ifdef TFM_CRYPTO_KEY_MODULE_DISABLED
246 TFM_CRYPTO_RESET_KEY_ATTRIBUTES);
255 __attribute__((section(
"SFN")))
261 #ifdef TFM_CRYPTO_KEY_MODULE_DISABLED
267 .key_handle = handle,
273 {.
base = data, .len = data_size}
281 TFM_CRYPTO_EXPORT_KEY);
283 *data_length = out_vec[0].
len;
293 __attribute__((section(
"SFN")))
299 #ifdef TFM_CRYPTO_KEY_MODULE_DISABLED
305 .key_handle = handle,
312 {.
base = data, .len = data_size}
320 TFM_CRYPTO_EXPORT_PUBLIC_KEY);
322 *data_length = out_vec[0].
len;
332 __attribute__((section(
"SFN")))
337 #ifdef TFM_CRYPTO_KEY_MODULE_DISABLED
343 .key_handle = source_handle,
360 TFM_CRYPTO_COPY_KEY);
369 __attribute__((section(
"SFN")))
375 #ifdef TFM_CRYPTO_CIPHER_MODULE_DISABLED
381 .op_handle = operation->handle,
388 {.
base = &(operation->handle), .len =
sizeof(uint32_t)},
389 {.base = iv, .len = iv_size},
397 TFM_CRYPTO_CIPHER_GENERATE_IV);
399 *iv_length = out_vec[1].
len;
409 __attribute__((section(
"SFN")))
411 const
unsigned char *iv,
414 #ifdef TFM_CRYPTO_CIPHER_MODULE_DISABLED
420 .op_handle = operation->handle,
425 {.base = iv, .len = iv_length},
428 {.
base = &(operation->handle), .len =
sizeof(uint32_t)},
436 TFM_CRYPTO_CIPHER_SET_IV);
445 __attribute__((section(
"SFN")))
450 #ifdef TFM_CRYPTO_CIPHER_MODULE_DISABLED
456 .key_handle = handle,
458 .op_handle = operation->handle,
465 {.
base = &(operation->handle), .len =
sizeof(uint32_t)},
473 TFM_CRYPTO_CIPHER_ENCRYPT_SETUP);
482 __attribute__((section(
"SFN")))
487 #ifdef TFM_CRYPTO_CIPHER_MODULE_DISABLED
493 .key_handle = handle,
495 .op_handle = operation->handle,
502 {.
base = &(operation->handle), .len =
sizeof(uint32_t)},
510 TFM_CRYPTO_CIPHER_DECRYPT_SETUP);
519 __attribute__((section(
"SFN")))
521 const uint8_t *input,
523 unsigned char *output,
525 size_t *output_length)
527 #ifdef TFM_CRYPTO_CIPHER_MODULE_DISABLED
533 .op_handle = operation->handle,
538 {.base = input, .len = input_length},
541 {.
base = &(operation->handle), .len =
sizeof(uint32_t)},
542 {.base = output, .len = output_size}
550 TFM_CRYPTO_CIPHER_UPDATE);
552 *output_length = out_vec[1].
len;
562 __attribute__((section(
"SFN")))
565 #ifdef TFM_CRYPTO_CIPHER_MODULE_DISABLED
571 .op_handle = operation->handle,
578 {.
base = &(operation->handle), .len =
sizeof(uint32_t)},
586 TFM_CRYPTO_CIPHER_ABORT);
595 __attribute__((section(
"SFN")))
599 size_t *output_length)
601 #ifdef TFM_CRYPTO_CIPHER_MODULE_DISABLED
607 .op_handle = operation->handle,
614 {.
base = &(operation->handle), .len =
sizeof(uint32_t)},
615 {.base = output, .len = output_size},
623 TFM_CRYPTO_CIPHER_FINISH);
625 *output_length = out_vec[1].
len;
635 __attribute__((section(
"SFN")))
639 #ifdef TFM_CRYPTO_HASH_MODULE_DISABLED
646 .op_handle = operation->handle,
653 {.
base = &(operation->handle), .len =
sizeof(uint32_t)},
661 TFM_CRYPTO_HASH_SETUP);
671 __attribute__((section(
"SFN")))
673 const uint8_t *input,
676 #ifdef TFM_CRYPTO_HASH_MODULE_DISABLED
682 .op_handle = operation->handle,
687 {.base = input, .len = input_length},
690 {.
base = &(operation->handle), .len =
sizeof(uint32_t)},
698 TFM_CRYPTO_HASH_UPDATE);
708 __attribute__((section(
"SFN")))
714 #ifdef TFM_CRYPTO_HASH_MODULE_DISABLED
720 .op_handle = operation->handle,
727 {.
base = &(operation->handle), .len =
sizeof(uint32_t)},
728 {.base = hash, .len = hash_size},
736 TFM_CRYPTO_HASH_FINISH);
738 *hash_length = out_vec[1].
len;
748 __attribute__((section(
"SFN")))
753 #ifdef TFM_CRYPTO_HASH_MODULE_DISABLED
759 .op_handle = operation->handle,
764 {.base = hash, .len = hash_length},
767 {.
base = &(operation->handle), .len =
sizeof(uint32_t)},
775 TFM_CRYPTO_HASH_VERIFY);
784 __attribute__((section(
"SFN")))
787 #ifdef TFM_CRYPTO_HASH_MODULE_DISABLED
793 .op_handle = operation->handle,
800 {.
base = &(operation->handle), .len =
sizeof(uint32_t)},
808 TFM_CRYPTO_HASH_ABORT);
817 __attribute__((section(
"SFN")))
821 #ifdef TFM_CRYPTO_HASH_MODULE_DISABLED
827 .op_handle = source_operation->handle,
837 if (target_operation && (target_operation->handle != 0)) {
846 TFM_CRYPTO_HASH_CLONE);
855 __attribute__((section(
"SFN")))
857 const uint8_t *input,
863 #if (TFM_CRYPTO_HASH_MODULE_DISABLED != 0)
874 {.base = input, .len = input_length},
878 {.
base = hash, .len = hash_size}
886 TFM_CRYPTO_HASH_COMPUTE);
888 *hash_length = out_vec[0].
len;
898 __attribute__((section(
"SFN")))
900 const uint8_t *input,
905 #if (TFM_CRYPTO_HASH_MODULE_DISABLED != 0)
916 {.base = input, .len = input_length},
917 {.base = hash, .len = hash_length},
925 TFM_CRYPTO_HASH_COMPARE);
935 __attribute__((section(
"SFN")))
940 #ifdef TFM_CRYPTO_MAC_MODULE_DISABLED
946 .key_handle = handle,
948 .op_handle = operation->handle,
955 {.
base = &(operation->handle), .len =
sizeof(uint32_t)},
963 TFM_CRYPTO_MAC_SIGN_SETUP);
972 __attribute__((section(
"SFN")))
977 #ifdef TFM_CRYPTO_MAC_MODULE_DISABLED
983 .key_handle = handle,
985 .op_handle = operation->handle,
992 {.
base = &(operation->handle), .len =
sizeof(uint32_t)},
1000 TFM_CRYPTO_MAC_VERIFY_SETUP);
1009 __attribute__((section(
"SFN")))
1011 const uint8_t *input,
1012 size_t input_length)
1014 #ifdef TFM_CRYPTO_MAC_MODULE_DISABLED
1020 .op_handle = operation->handle,
1025 {.base = input, .len = input_length},
1028 {.
base = &(operation->handle), .len =
sizeof(uint32_t)},
1036 TFM_CRYPTO_MAC_UPDATE);
1045 __attribute__((section(
"SFN")))
1051 #ifdef TFM_CRYPTO_MAC_MODULE_DISABLED
1057 .op_handle = operation->handle,
1064 {.
base = &(operation->handle), .len =
sizeof(uint32_t)},
1065 {.base = mac, .len = mac_size},
1073 TFM_CRYPTO_MAC_SIGN_FINISH);
1075 *mac_length = out_vec[1].
len;
1085 __attribute__((section(
"SFN")))
1090 #ifdef TFM_CRYPTO_MAC_MODULE_DISABLED
1096 .op_handle = operation->handle,
1101 {.base = mac, .len = mac_length},
1104 {.
base = &(operation->handle), .len =
sizeof(uint32_t)},
1112 TFM_CRYPTO_MAC_VERIFY_FINISH);
1122 __attribute__((section(
"SFN")))
1125 #ifdef TFM_CRYPTO_MAC_MODULE_DISABLED
1131 .op_handle = operation->handle,
1138 {.
base = &(operation->handle), .len =
sizeof(uint32_t)},
1146 TFM_CRYPTO_MAC_ABORT);
1155 __attribute__((section(
"SFN")))
1158 const uint8_t *nonce,
1159 size_t nonce_length,
1160 const uint8_t *additional_data,
1161 size_t additional_data_length,
1162 const uint8_t *plaintext,
1163 size_t plaintext_length,
1164 uint8_t *ciphertext,
1165 size_t ciphertext_size,
1166 size_t *ciphertext_length)
1168 #ifdef TFM_CRYPTO_AEAD_MODULE_DISABLED
1174 .key_handle = handle,
1176 .aead_in = {.nonce = {0}, .nonce_length = nonce_length}
1180 if ((additional_data == NULL) && (additional_data_length != 0)) {
1187 {.base = plaintext, .len = plaintext_length},
1188 {.base = additional_data, .len = additional_data_length},
1191 {.
base = ciphertext, .len = ciphertext_size},
1198 if (nonce != NULL) {
1199 for (idx = 0; idx < nonce_length; idx++) {
1210 if (additional_data == NULL) {
1217 TFM_CRYPTO_AEAD_ENCRYPT);
1220 *ciphertext_length = out_vec[0].
len;
1230 __attribute__((section(
"SFN")))
1233 const uint8_t *nonce,
1234 size_t nonce_length,
1235 const uint8_t *additional_data,
1236 size_t additional_data_length,
1237 const uint8_t *ciphertext,
1238 size_t ciphertext_length,
1240 size_t plaintext_size,
1241 size_t *plaintext_length)
1243 #ifdef TFM_CRYPTO_AEAD_MODULE_DISABLED
1249 .key_handle = handle,
1251 .aead_in = {.nonce = {0}, .nonce_length = nonce_length}
1255 if ((additional_data == NULL) && (additional_data_length != 0)) {
1262 {.base = ciphertext, .len = ciphertext_length},
1263 {.base = additional_data, .len = additional_data_length},
1266 {.
base = plaintext, .len = plaintext_size},
1273 if (nonce != NULL) {
1274 for (idx = 0; idx < nonce_length; idx++) {
1285 if (additional_data == NULL) {
1292 TFM_CRYPTO_AEAD_DECRYPT);
1295 *plaintext_length = out_vec[0].
len;
1305 __attribute__((section(
"SFN")))
1308 const uint8_t *hash,
1311 size_t signature_size,
1312 size_t *signature_length)
1314 return psa_sign_hash(handle, alg, hash, hash_length, signature, signature_size, signature_length);
1317 __attribute__((section(
"SFN")))
1320 const uint8_t *hash,
1323 size_t signature_size,
1324 size_t *signature_length)
1326 #ifdef TFM_CRYPTO_ASYMMETRIC_MODULE_DISABLED
1332 .key_handle = handle,
1338 {.base = hash, .len = hash_length},
1341 {.
base = signature, .len = signature_size},
1348 TFM_CRYPTO_SIGN_HASH);
1350 *signature_length = out_vec[0].
len;
1360 __attribute__((section(
"SFN")))
1363 const uint8_t *hash,
1365 const uint8_t *signature,
1366 size_t signature_length)
1368 return psa_verify_hash(handle, alg, hash, hash_length, signature, signature_length);
1371 __attribute__((section(
"SFN")))
1374 const uint8_t *hash,
1376 const uint8_t *signature,
1377 size_t signature_length)
1379 #ifdef TFM_CRYPTO_ASYMMETRIC_MODULE_DISABLED
1385 .key_handle = handle,
1391 {.base = hash, .len = hash_length},
1392 {.base = signature, .len = signature_length}
1400 TFM_CRYPTO_VERIFY_HASH);
1409 __attribute__((section(
"SFN")))
1412 const uint8_t *input,
1413 size_t input_length,
1414 const uint8_t *salt,
1418 size_t *output_length)
1420 #ifdef TFM_CRYPTO_ASYMMETRIC_MODULE_DISABLED
1426 .key_handle = handle,
1431 if ((salt == NULL) && (salt_length != 0)) {
1437 {.base = input, .len = input_length},
1438 {.base = salt, .len = salt_length}
1442 {.
base = output, .len = output_size},
1458 TFM_CRYPTO_ASYMMETRIC_ENCRYPT);
1461 *output_length = out_vec[0].
len;
1471 __attribute__((section(
"SFN")))
1474 const uint8_t *input,
1475 size_t input_length,
1476 const uint8_t *salt,
1480 size_t *output_length)
1482 #ifdef TFM_CRYPTO_ASYMMETRIC_MODULE_DISABLED
1488 .key_handle = handle,
1493 if ((salt == NULL) && (salt_length != 0)) {
1499 {.base = input, .len = input_length},
1500 {.base = salt, .len = salt_length}
1504 {.
base = output, .len = output_size},
1520 TFM_CRYPTO_ASYMMETRIC_DECRYPT);
1523 *output_length = out_vec[0].
len;
1533 __attribute__((section(
"SFN")))
1538 #ifdef TFM_CRYPTO_GENERATOR_MODULE_DISABLED
1544 .op_handle = operation->handle,
1560 TFM_CRYPTO_KEY_DERIVATION_GET_CAPACITY);
1569 __attribute__((section(
"SFN")))
1573 size_t output_length)
1575 #ifdef TFM_CRYPTO_GENERATOR_MODULE_DISABLED
1581 .op_handle = operation->handle,
1589 {.
base = output, .len = output_length},
1597 TFM_CRYPTO_KEY_DERIVATION_OUTPUT_BYTES);
1606 __attribute__((section(
"SFN")))
1612 #ifdef TFM_CRYPTO_GENERATOR_MODULE_DISABLED
1618 .key_handle = handle,
1620 .op_handle = operation->handle,
1632 TFM_CRYPTO_KEY_DERIVATION_INPUT_KEY);
1641 __attribute__((section(
"SFN")))
1644 #ifdef TFM_CRYPTO_GENERATOR_MODULE_DISABLED
1650 .op_handle = operation->handle,
1658 {.
base = &(operation->handle), .len =
sizeof(uint32_t)},
1666 TFM_CRYPTO_KEY_DERIVATION_ABORT);
1675 __attribute__((section(
"SFN")))
1680 const uint8_t *peer_key,
1681 size_t peer_key_length)
1683 #ifdef TFM_CRYPTO_GENERATOR_MODULE_DISABLED
1689 .key_handle = private_key,
1691 .op_handle = operation->handle,
1696 {.base = peer_key, .len = peer_key_length},
1700 {.
base = &(operation->handle), .len =
sizeof(uint32_t)},
1708 TFM_CRYPTO_KEY_DERIVATION_KEY_AGREEMENT);
1718 __attribute__((section(
"SFN")))
1722 #ifdef TFM_CRYPTO_GENERATOR_MODULE_DISABLED
1735 {.
base = output, .len = output_size},
1738 if (output_size == 0) {
1747 TFM_CRYPTO_GENERATE_RANDOM);
1757 __attribute__((section(
"SFN")))
1761 #ifdef TFM_CRYPTO_GENERATOR_MODULE_DISABLED
1783 TFM_CRYPTO_GENERATE_KEY);
1792 __attribute__((section(
"SFN")))
1795 const uint8_t *data,
1805 __attribute__((section(
"SFN")))
1810 size_t *data_length)
1819 __attribute__((section(
"SFN")))
1821 const uint8_t *input,
1822 size_t input_length)
1831 __attribute__((section(
"SFN")))
1833 uint8_t *ciphertext,
1834 size_t ciphertext_size,
1835 size_t *ciphertext_length,
1847 __attribute__((section(
"SFN")))
1850 size_t plaintext_size,
1851 size_t *plaintext_length,
1862 __attribute__((section(
"SFN")))
1872 __attribute__((section(
"SFN")))
1875 const uint8_t *input,
1876 size_t input_length,
1888 __attribute__((section(
"SFN")))
1891 const uint8_t *input,
1892 size_t input_length,
1894 const
size_t mac_length)
1903 __attribute__((section(
"SFN")))
1906 const uint8_t *input,
1907 size_t input_length,
1910 size_t *output_length)
1919 __attribute__((section(
"SFN")))
1922 const uint8_t *input,
1923 size_t input_length,
1926 size_t *output_length)
1935 __attribute__((section(
"SFN")))
1938 const uint8_t *peer_key,
1939 size_t peer_key_length,
1942 size_t *output_length)
1944 #ifdef TFM_CRYPTO_GENERATOR_MODULE_DISABLED
1951 .key_handle = private_key
1956 {.base = peer_key, .len = peer_key_length},
1960 {.
base = output, .len = output_size},
1967 TFM_CRYPTO_RAW_KEY_AGREEMENT);
1969 *output_length = out_vec[0].
len;
1979 __attribute__((section(
"SFN")))
1983 #ifdef TFM_CRYPTO_GENERATOR_MODULE_DISABLED
1990 .op_handle = operation->handle,
1997 {.
base = &(operation->handle), .len =
sizeof(uint32_t)},
2005 TFM_CRYPTO_KEY_DERIVATION_SETUP);
2014 __attribute__((section(
"SFN")))
2019 #ifdef TFM_CRYPTO_GENERATOR_MODULE_DISABLED
2026 .op_handle = operation->handle,
2038 TFM_CRYPTO_KEY_DERIVATION_SET_CAPACITY);
2047 __attribute__((section(
"SFN")))
2051 const uint8_t *data,
2054 #if (TFM_CRYPTO_GENERATOR_MODULE_DISABLED != 0)
2061 .op_handle = operation->handle,
2066 {.base = data, .len = data_length},
2074 TFM_CRYPTO_KEY_DERIVATION_INPUT_BYTES);
2083 __attribute__((section(
"SFN")))
2089 #if (TFM_CRYPTO_GENERATOR_MODULE_DISABLED != 0)
2095 .op_handle = operation->handle,
2112 TFM_CRYPTO_KEY_DERIVATION_OUTPUT_KEY);
2121 __attribute__((section(
"SFN")))
2133 __attribute__((section(
"SFN")))
2145 __attribute__((section(
"SFN")))
2149 size_t *nonce_length)
2158 __attribute__((section(
"SFN")))
2160 const uint8_t *nonce,
2161 size_t nonce_length)
2170 __attribute__((section(
"SFN")))
2173 size_t plaintext_length)
2182 __attribute__((section(
"SFN")))
2184 const uint8_t *input,
2185 size_t input_length,
2188 size_t *output_length)
psa_status_t psa_cipher_encrypt_setup(psa_cipher_operation_t *operation, psa_key_handle_t handle, psa_algorithm_t alg)
void psa_reset_key_attributes(psa_key_attributes_t *attributes)
psa_status_t tfm_crypto_aead_encrypt(psa_invec in_vec[], size_t in_len, psa_outvec out_vec[], size_t out_len)
#define TFM_CRYPTO_MAX_NONCE_LENGTH
This type is used to overcome a limitation in the number of maximum IOVECs that can be used especiall...
psa_status_t psa_generate_random(uint8_t *output, size_t output_size)
Generate random bytes.
psa_status_t psa_export_key(psa_key_handle_t handle, uint8_t *data, size_t data_size, size_t *data_length)
Export a key in binary format.
psa_status_t psa_mac_sign_finish(psa_mac_operation_t *operation, uint8_t *mac, size_t mac_size, size_t *mac_length)
psa_status_t psa_destroy_key(psa_key_handle_t handle)
Destroy a key.
psa_status_t tfm_crypto_import_key(psa_invec in_vec[], size_t in_len, psa_outvec out_vec[], size_t out_len)
Structure used to pack non-pointer types in a call.
psa_status_t psa_cipher_decrypt_setup(psa_cipher_operation_t *operation, psa_key_handle_t handle, psa_algorithm_t alg)
psa_status_t psa_sign_hash(psa_key_handle_t handle, psa_algorithm_t alg, const uint8_t *hash, size_t hash_length, uint8_t *signature, size_t signature_size, size_t *signature_length)
Sign a hash or short message with a private key.
psa_status_t tfm_crypto_hash_abort(psa_invec in_vec[], size_t in_len, psa_outvec out_vec[], size_t out_len)
psa_status_t psa_aead_encrypt_setup(psa_aead_operation_t *operation, psa_key_handle_t handle, psa_algorithm_t alg)
psa_status_t tfm_crypto_cipher_decrypt_setup(psa_invec in_vec[], size_t in_len, psa_outvec out_vec[], size_t out_len)
psa_status_t tfm_crypto_asymmetric_encrypt(psa_invec in_vec[], size_t in_len, psa_outvec out_vec[], size_t out_len)
psa_status_t psa_key_derivation_set_capacity(psa_key_derivation_operation_t *operation, size_t capacity)
psa_status_t tfm_crypto_cipher_update(psa_invec in_vec[], size_t in_len, psa_outvec out_vec[], size_t out_len)
psa_status_t psa_raw_key_agreement(psa_algorithm_t alg, psa_key_handle_t private_key, const uint8_t *peer_key, size_t peer_key_length, uint8_t *output, size_t output_size, size_t *output_length)
psa_status_t psa_close_key(psa_key_handle_t handle)
psa_status_t psa_key_derivation_abort(psa_key_derivation_operation_t *operation)
psa_status_t psa_cipher_decrypt(psa_key_handle_t handle, psa_algorithm_t alg, const uint8_t *input, size_t input_length, uint8_t *output, size_t output_size, size_t *output_length)
psa_status_t psa_mac_verify_finish(psa_mac_operation_t *operation, const uint8_t *mac, size_t mac_length)
psa_status_t psa_export_public_key(psa_key_handle_t handle, uint8_t *data, size_t data_size, size_t *data_length)
Export a public key or the public part of a key pair in binary format.
psa_status_t tfm_crypto_key_derivation_input_bytes(psa_invec in_vec[], size_t in_len, psa_outvec out_vec[], size_t out_len)
psa_status_t psa_cipher_generate_iv(psa_cipher_operation_t *operation, unsigned char *iv, size_t iv_size, size_t *iv_length)
psa_status_t tfm_crypto_export_public_key(psa_invec in_vec[], size_t in_len, psa_outvec out_vec[], size_t out_len)
psa_status_t tfm_crypto_mac_sign_finish(psa_invec in_vec[], size_t in_len, psa_outvec out_vec[], size_t out_len)
psa_status_t tfm_crypto_key_derivation_set_capacity(psa_invec in_vec[], size_t in_len, psa_outvec out_vec[], size_t out_len)
psa_status_t tfm_crypto_open_key(psa_invec in_vec[], size_t in_len, psa_outvec out_vec[], size_t out_len)
Platform Security Architecture cryptography module.
psa_status_t tfm_crypto_cipher_abort(psa_invec in_vec[], size_t in_len, psa_outvec out_vec[], size_t out_len)
psa_status_t tfm_crypto_hash_verify(psa_invec in_vec[], size_t in_len, psa_outvec out_vec[], size_t out_len)
psa_status_t psa_mac_abort(psa_mac_operation_t *operation)
uint16_t psa_key_derivation_step_t
Encoding of the step of a key derivation.
psa_status_t tfm_crypto_verify_hash(psa_invec in_vec[], size_t in_len, psa_outvec out_vec[], size_t out_len)
psa_status_t psa_get_key_domain_parameters(const psa_key_attributes_t *attributes, uint8_t *data, size_t data_size, size_t *data_length)
psa_status_t tfm_crypto_generate_random(psa_invec in_vec[], size_t in_len, psa_outvec out_vec[], size_t out_len)
psa_status_t psa_verify_hash(psa_key_handle_t handle, psa_algorithm_t alg, const uint8_t *hash, size_t hash_length, const uint8_t *signature, size_t signature_length)
Verify the signature a hash or short message using a public key.
psa_status_t tfm_crypto_cipher_finish(psa_invec in_vec[], size_t in_len, psa_outvec out_vec[], size_t out_len)
psa_status_t psa_hash_compute(psa_algorithm_t alg, const uint8_t *input, size_t input_length, uint8_t *hash, size_t hash_size, size_t *hash_length)
psa_status_t tfm_crypto_asymmetric_decrypt(psa_invec in_vec[], size_t in_len, psa_outvec out_vec[], size_t out_len)
psa_status_t tfm_crypto_hash_compute(psa_invec in_vec[], size_t in_len, psa_outvec out_vec[], size_t out_len)
psa_status_t psa_key_derivation_input_key(psa_key_derivation_operation_t *operation, psa_key_derivation_step_t step, psa_key_handle_t handle)
psa_status_t tfm_crypto_key_derivation_key_agreement(psa_invec in_vec[], size_t in_len, psa_outvec out_vec[], size_t out_len)
psa_status_t tfm_crypto_close_key(psa_invec in_vec[], size_t in_len, psa_outvec out_vec[], size_t out_len)
psa_status_t psa_hash_update(psa_hash_operation_t *operation, const uint8_t *input, size_t input_length)
psa_status_t tfm_crypto_mac_verify_setup(psa_invec in_vec[], size_t in_len, psa_outvec out_vec[], size_t out_len)
psa_status_t tfm_crypto_aead_decrypt(psa_invec in_vec[], size_t in_len, psa_outvec out_vec[], size_t out_len)
psa_status_t tfm_crypto_get_key_attributes(psa_invec in_vec[], size_t in_len, psa_outvec out_vec[], size_t out_len)
psa_status_t tfm_crypto_key_derivation_get_capacity(psa_invec in_vec[], size_t in_len, psa_outvec out_vec[], size_t out_len)
psa_status_t psa_aead_set_nonce(psa_aead_operation_t *operation, const uint8_t *nonce, size_t nonce_length)
psa_status_t psa_set_key_domain_parameters(psa_key_attributes_t *attributes, psa_key_type_t type, const uint8_t *data, size_t data_length)
psa_status_t psa_key_derivation_get_capacity(const psa_key_derivation_operation_t *operation, size_t *capacity)
psa_status_t psa_aead_finish(psa_aead_operation_t *operation, uint8_t *ciphertext, size_t ciphertext_size, size_t *ciphertext_length, uint8_t *tag, size_t tag_size, size_t *tag_length)
psa_status_t tfm_crypto_hash_finish(psa_invec in_vec[], size_t in_len, psa_outvec out_vec[], size_t out_len)
#define API_DISPATCH_NO_OUTVEC(sfn_name, sfn_id)
psa_status_t psa_asymmetric_encrypt(psa_key_handle_t handle, psa_algorithm_t alg, const uint8_t *input, size_t input_length, const uint8_t *salt, size_t salt_length, uint8_t *output, size_t output_size, size_t *output_length)
Encrypt a short message with a public key.
psa_status_t tfm_crypto_hash_update(psa_invec in_vec[], size_t in_len, psa_outvec out_vec[], size_t out_len)
psa_status_t tfm_crypto_mac_update(psa_invec in_vec[], size_t in_len, psa_outvec out_vec[], size_t out_len)
psa_status_t tfm_crypto_export_key(psa_invec in_vec[], size_t in_len, psa_outvec out_vec[], size_t out_len)
psa_status_t psa_mac_verify_setup(psa_mac_operation_t *operation, psa_key_handle_t handle, psa_algorithm_t alg)
psa_status_t psa_asymmetric_decrypt(psa_key_handle_t handle, psa_algorithm_t alg, const uint8_t *input, size_t input_length, const uint8_t *salt, size_t salt_length, uint8_t *output, size_t output_size, size_t *output_length)
Decrypt a short message with a private key.
psa_status_t tfm_crypto_mac_verify_finish(psa_invec in_vec[], size_t in_len, psa_outvec out_vec[], size_t out_len)
psa_status_t psa_cipher_finish(psa_cipher_operation_t *operation, uint8_t *output, size_t output_size, size_t *output_length)
psa_status_t tfm_crypto_destroy_key(psa_invec in_vec[], size_t in_len, psa_outvec out_vec[], size_t out_len)
psa_status_t tfm_crypto_key_derivation_abort(psa_invec in_vec[], size_t in_len, psa_outvec out_vec[], size_t out_len)
psa_status_t psa_aead_update_ad(psa_aead_operation_t *operation, const uint8_t *input, size_t input_length)
psa_status_t psa_import_key(const psa_key_attributes_t *attributes, const uint8_t *data, size_t data_length, psa_key_handle_t *handle)
Import a key in binary format.
psa_status_t tfm_crypto_cipher_encrypt_setup(psa_invec in_vec[], size_t in_len, psa_outvec out_vec[], size_t out_len)
psa_status_t psa_hash_verify(psa_hash_operation_t *operation, const uint8_t *hash, size_t hash_length)
psa_status_t psa_aead_set_lengths(psa_aead_operation_t *operation, size_t ad_length, size_t plaintext_length)
psa_status_t psa_aead_decrypt(psa_key_handle_t handle, psa_algorithm_t alg, const uint8_t *nonce, size_t nonce_length, const uint8_t *additional_data, size_t additional_data_length, const uint8_t *ciphertext, size_t ciphertext_length, uint8_t *plaintext, size_t plaintext_size, size_t *plaintext_length)
#define PSA_ERROR_INVALID_ARGUMENT
psa_status_t psa_asymmetric_verify(psa_key_handle_t handle, psa_algorithm_t alg, const uint8_t *hash, size_t hash_length, const uint8_t *signature, size_t signature_length)
psa_handle_t psa_connect(uint32_t sid, uint32_t version)
Connect to an RoT Service by its SID.
psa_status_t psa_mac_verify(psa_key_handle_t handle, psa_algorithm_t alg, const uint8_t *input, size_t input_length, const uint8_t *mac, const size_t mac_length)
#define PSA_HANDLE_IS_VALID(handle)
psa_status_t psa_hash_clone(const psa_hash_operation_t *source_operation, psa_hash_operation_t *target_operation)
psa_status_t psa_copy_key(psa_key_handle_t source_handle, const psa_key_attributes_t *attributes, psa_key_handle_t *target_handle)
psa_status_t tfm_crypto_mac_abort(psa_invec in_vec[], size_t in_len, psa_outvec out_vec[], size_t out_len)
uint32_t psa_algorithm_t
Encoding of a cryptographic algorithm.
psa_status_t tfm_crypto_sign_hash(psa_invec in_vec[], size_t in_len, psa_outvec out_vec[], size_t out_len)
struct psa_hash_operation_s psa_hash_operation_t
struct tfm_crypto_aead_pack_input aead_in
psa_status_t psa_aead_encrypt(psa_key_handle_t handle, psa_algorithm_t alg, const uint8_t *nonce, size_t nonce_length, const uint8_t *additional_data, size_t additional_data_length, const uint8_t *plaintext, size_t plaintext_length, uint8_t *ciphertext, size_t ciphertext_size, size_t *ciphertext_length)
psa_status_t tfm_crypto_hash_compare(psa_invec in_vec[], size_t in_len, psa_outvec out_vec[], size_t out_len)
#define TFM_CRYPTO_VERSION
psa_status_t psa_aead_generate_nonce(psa_aead_operation_t *operation, uint8_t *nonce, size_t nonce_size, size_t *nonce_length)
psa_status_t psa_hash_setup(psa_hash_operation_t *operation, psa_algorithm_t alg)
psa_status_t tfm_crypto_key_derivation_output_key(psa_invec in_vec[], size_t in_len, psa_outvec out_vec[], size_t out_len)
psa_status_t psa_aead_decrypt_setup(psa_aead_operation_t *operation, psa_key_handle_t handle, psa_algorithm_t alg)
psa_status_t psa_mac_sign_setup(psa_mac_operation_t *operation, psa_key_handle_t handle, psa_algorithm_t alg)
uint16_t psa_key_type_t
Encoding of a key type.
psa_status_t psa_get_key_attributes(psa_key_handle_t handle, psa_key_attributes_t *attributes)
psa_status_t psa_crypto_init(void)
Library initialization.
psa_status_t psa_key_derivation_output_bytes(psa_key_derivation_operation_t *operation, uint8_t *output, size_t output_length)
psa_status_t psa_key_derivation_input_bytes(psa_key_derivation_operation_t *operation, psa_key_derivation_step_t step, const uint8_t *data, size_t data_length)
psa_status_t psa_generate_key(const psa_key_attributes_t *attributes, psa_key_handle_t *handle)
Generate a key or key pair.
psa_status_t psa_aead_verify(psa_aead_operation_t *operation, uint8_t *plaintext, size_t plaintext_size, size_t *plaintext_length, const uint8_t *tag, size_t tag_length)
psa_status_t tfm_crypto_hash_clone(psa_invec in_vec[], size_t in_len, psa_outvec out_vec[], size_t out_len)
psa_status_t psa_key_derivation_key_agreement(psa_key_derivation_operation_t *operation, psa_key_derivation_step_t step, psa_key_handle_t private_key, const uint8_t *peer_key, size_t peer_key_length)
#define PSA_ERROR_NOT_SUPPORTED
psa_status_t psa_hash_abort(psa_hash_operation_t *operation)
psa_status_t tfm_crypto_key_derivation_input_key(psa_invec in_vec[], size_t in_len, psa_outvec out_vec[], size_t out_len)
psa_status_t psa_open_key(psa_key_id_t id, psa_key_handle_t *handle)
struct psa_client_key_attributes_s psa_key_attributes_t
psa_status_t psa_key_derivation_setup(psa_key_derivation_operation_t *operation, psa_algorithm_t alg)
psa_status_t psa_mac_compute(psa_key_handle_t handle, psa_algorithm_t alg, const uint8_t *input, size_t input_length, uint8_t *mac, size_t mac_size, size_t *mac_length)
psa_status_t psa_aead_abort(psa_aead_operation_t *operation)
psa_status_t tfm_crypto_cipher_generate_iv(psa_invec in_vec[], size_t in_len, psa_outvec out_vec[], size_t out_len)
psa_status_t tfm_crypto_key_derivation_setup(psa_invec in_vec[], size_t in_len, psa_outvec out_vec[], size_t out_len)
psa_status_t psa_aead_update(psa_aead_operation_t *operation, const uint8_t *input, size_t input_length, uint8_t *output, size_t output_size, size_t *output_length)
psa_status_t tfm_crypto_copy_key(psa_invec in_vec[], size_t in_len, psa_outvec out_vec[], size_t out_len)
#define PSA_CONNECT(service)
psa_status_t tfm_crypto_hash_setup(psa_invec in_vec[], size_t in_len, psa_outvec out_vec[], size_t out_len)
psa_status_t tfm_crypto_cipher_set_iv(psa_invec in_vec[], size_t in_len, psa_outvec out_vec[], size_t out_len)
#define API_DISPATCH(sfn_name, sfn_id)
#define PSA_ERROR_BAD_STATE
psa_status_t psa_asymmetric_sign(psa_key_handle_t handle, psa_algorithm_t alg, const uint8_t *hash, size_t hash_length, uint8_t *signature, size_t signature_size, size_t *signature_length)
psa_status_t tfm_crypto_key_derivation_output_bytes(psa_invec in_vec[], size_t in_len, psa_outvec out_vec[], size_t out_len)
int32_t psa_status_t
Function return status.
psa_status_t psa_mac_update(psa_mac_operation_t *operation, const uint8_t *input, size_t input_length)
psa_status_t psa_cipher_abort(psa_cipher_operation_t *operation)
psa_status_t tfm_crypto_mac_sign_setup(psa_invec in_vec[], size_t in_len, psa_outvec out_vec[], size_t out_len)
psa_status_t psa_hash_compare(psa_algorithm_t alg, const uint8_t *input, size_t input_length, const uint8_t *hash, size_t hash_length)
psa_status_t psa_key_derivation_output_key(const psa_key_attributes_t *attributes, psa_key_derivation_operation_t *operation, psa_key_handle_t *handle)
psa_status_t psa_call(psa_handle_t handle, int32_t type, const psa_invec *in_vec, size_t in_len, psa_outvec *out_vec, size_t out_len)
Call an RoT Service on an established connection.
psa_status_t psa_cipher_encrypt(psa_key_handle_t handle, psa_algorithm_t alg, const uint8_t *input, size_t input_length, uint8_t *output, size_t output_size, size_t *output_length)
psa_status_t tfm_crypto_generate_key(psa_invec in_vec[], size_t in_len, psa_outvec out_vec[], size_t out_len)
psa_status_t tfm_crypto_reset_key_attributes(psa_invec in_vec[], size_t in_len, psa_outvec out_vec[], size_t out_len)
psa_status_t tfm_crypto_raw_key_agreement(psa_invec in_vec[], size_t in_len, psa_outvec out_vec[], size_t out_len)
psa_status_t psa_cipher_set_iv(psa_cipher_operation_t *operation, const unsigned char *iv, size_t iv_length)
psa_status_t psa_hash_finish(psa_hash_operation_t *operation, uint8_t *hash, size_t hash_size, size_t *hash_length)
psa_status_t psa_cipher_update(psa_cipher_operation_t *operation, const uint8_t *input, size_t input_length, unsigned char *output, size_t output_size, size_t *output_length)