1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

examples/psa_crypto: Fix modules to run ECDSA on SEs

This commit is contained in:
Lena Boeckmann 2024-03-12 14:43:56 +01:00
parent 03c05f7fe1
commit d8c003f6cc

View File

@ -27,7 +27,8 @@ extern psa_status_t example_cipher_aes_128(void);
#if IS_USED(MODULE_PSA_MAC)
extern psa_status_t example_hmac_sha256(void);
#endif
#if IS_USED(MODULE_PSA_ASYMMETRIC_ECC_P256R1)
#if IS_USED(MODULE_PSA_ASYMMETRIC_ECC_P256R1) || \
IS_USED(MODULE_PSA_SECURE_ELEMENT_ATECCX08A_ECC_P256)
extern psa_status_t example_ecdsa_p256(void);
#endif
#if IS_USED(MODULE_PSA_ASYMMETRIC_ECC_ED25519)
@ -43,7 +44,7 @@ extern psa_status_t example_cipher_aes_128_sec_se(void);
#if IS_USED(MODULE_PSA_MAC)
extern psa_status_t example_hmac_sha256_sec_se(void);
#endif /* MODULE_PSA_MAC */
#if IS_USED(MODULE_PSA_ASYMMETRIC_ECC_P256R1)
#if IS_USED(MODULE_PSA_SECURE_ELEMENT_ATECCX08A_ECC_P256)
extern psa_status_t example_ecdsa_p256_sec_se(void);
#endif /* MODULE_PSA_ASYMMETRIC_ECC_P256R1 */
#endif /* MULTIPLE_SE */
@ -81,7 +82,8 @@ int main(void)
}
#endif
#if IS_USED(MODULE_PSA_ASYMMETRIC_ECC_P256R1)
#if IS_USED(MODULE_PSA_ASYMMETRIC_ECC_P256R1) || \
IS_USED(MODULE_PSA_SECURE_ELEMENT_ATECCX08A_ECC_P256)
start = ztimer_now(ZTIMER_USEC);
status = example_ecdsa_p256();
printf("ECDSA took %d us\n", (int)(ztimer_now(ZTIMER_USEC) - start));
@ -122,7 +124,7 @@ int main(void)
}
#endif /* MODULE_PSA_CIPHER */
#if IS_USED(MODULE_PSA_ASYMMETRIC_ECC_P256R1)
#if IS_USED(MODULE_PSA_SECURE_ELEMENT_ATECCX08A_ECC_P256)
start = ztimer_now(ZTIMER_USEC);
status = example_ecdsa_p256_sec_se();
printf("ECDSA took %d us\n", (int)(ztimer_now(ZTIMER_USEC) - start));
@ -130,7 +132,7 @@ int main(void)
failed = true;
printf("ECDSA failed: %s\n", psa_status_to_humanly_readable(status));
}
#endif /* MODULE_PSA_ASYMMETRIC_ECC_P256R1 */
#endif /* MODULE_PSA_SECURE_ELEMENT_ATECCX08A_ECC_P256 */
#endif /* MULTIPLE_SE */
ztimer_release(ZTIMER_USEC);