Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

examples/psa_crypto: Fix modules to run ECDSA on SEs #20461

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions examples/psa_crypto/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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 */
Expand Down Expand Up @@ -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));
Expand Down Expand Up @@ -122,15 +124,15 @@ 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));
if (status != PSA_SUCCESS) {
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);
Expand Down
Loading