diff --git a/sw/device/lib/crypto/impl/ecc/ecdh_p256.h b/sw/device/lib/crypto/impl/ecc/ecdh_p256.h index 3287fa9b9cd2e..de219cd296378 100644 --- a/sw/device/lib/crypto/impl/ecc/ecdh_p256.h +++ b/sw/device/lib/crypto/impl/ecc/ecdh_p256.h @@ -33,6 +33,7 @@ typedef struct ecdh_p256_shared_key { * * @return Result of the operation (OK or error). */ +OT_WARN_UNUSED_RESULT status_t ecdh_p256_keypair_start(void); /** @@ -44,6 +45,7 @@ status_t ecdh_p256_keypair_start(void); * @param[out] public_key Generated public key. * @return Result of the operation (OK or error). */ +OT_WARN_UNUSED_RESULT status_t ecdh_p256_keypair_finalize(p256_masked_scalar_t *private_key, p256_point_t *public_key); @@ -56,6 +58,7 @@ status_t ecdh_p256_keypair_finalize(p256_masked_scalar_t *private_key, * @param public_key Public key (Q). * @return Result of the operation (OK or error). */ +OT_WARN_UNUSED_RESULT status_t ecdh_p256_shared_key_start(const p256_masked_scalar_t *private_key, const p256_point_t *public_key); @@ -69,6 +72,7 @@ status_t ecdh_p256_shared_key_start(const p256_masked_scalar_t *private_key, * @param[out] shared_key Shared secret key (x-coordinate of d*Q). * @return Result of the operation (OK or error). */ +OT_WARN_UNUSED_RESULT status_t ecdh_p256_shared_key_finalize(ecdh_p256_shared_key_t *shared_key); /** @@ -81,6 +85,7 @@ status_t ecdh_p256_shared_key_finalize(ecdh_p256_shared_key_t *shared_key); * * @return Result of the operation (OK or error). */ +OT_WARN_UNUSED_RESULT status_t ecdh_p256_sideload_keypair_start(void); /** @@ -91,6 +96,7 @@ status_t ecdh_p256_sideload_keypair_start(void); * @param[out] public_key Generated public key. * @return Result of the operation (OK or error). */ +OT_WARN_UNUSED_RESULT status_t ecdh_p256_sideload_keypair_finalize(p256_point_t *public_key); /** @@ -104,6 +110,7 @@ status_t ecdh_p256_sideload_keypair_finalize(p256_point_t *public_key); * @param public_key Public key (Q). * @return Result of the operation (OK or error). */ +OT_WARN_UNUSED_RESULT status_t ecdh_p256_sideload_shared_key_start(const p256_point_t *public_key); #ifdef __cplusplus diff --git a/sw/device/lib/crypto/impl/ecc/ecdsa_p256.h b/sw/device/lib/crypto/impl/ecc/ecdsa_p256.h index b359a2330fd76..35b78fe62b255 100644 --- a/sw/device/lib/crypto/impl/ecc/ecdsa_p256.h +++ b/sw/device/lib/crypto/impl/ecc/ecdsa_p256.h @@ -33,6 +33,7 @@ typedef struct ecdsa_p256_signature_t { * * @return Result of the operation (OK or error). */ +OT_WARN_UNUSED_RESULT status_t ecdsa_p256_keygen_start(void); /** @@ -43,6 +44,7 @@ status_t ecdsa_p256_keygen_start(void); * * @return Result of the operation (OK or error). */ +OT_WARN_UNUSED_RESULT status_t ecdsa_p256_sideload_keygen_start(void); /** @@ -54,6 +56,7 @@ status_t ecdsa_p256_sideload_keygen_start(void); * @param[out] public_key Generated public key. * @return Result of the operation (OK or error). */ +OT_WARN_UNUSED_RESULT status_t ecdsa_p256_keygen_finalize(p256_masked_scalar_t *private_key, p256_point_t *public_key); @@ -66,6 +69,7 @@ status_t ecdsa_p256_keygen_finalize(p256_masked_scalar_t *private_key, * @param[out] public_key Public key. * @return Result of the operation (OK or error). */ +OT_WARN_UNUSED_RESULT status_t ecdsa_p256_sideload_keygen_finalize(p256_point_t *public_key); /** @@ -77,6 +81,7 @@ status_t ecdsa_p256_sideload_keygen_finalize(p256_point_t *public_key); * @param private_key Secret key to sign the message with. * @return Result of the operation (OK or error). */ +OT_WARN_UNUSED_RESULT status_t ecdsa_p256_sign_start(const uint32_t digest[kP256ScalarWords], const p256_masked_scalar_t *private_key); @@ -89,6 +94,7 @@ status_t ecdsa_p256_sign_start(const uint32_t digest[kP256ScalarWords], * @param digest Digest of the message to sign. * @return Result of the operation (OK or error). */ +OT_WARN_UNUSED_RESULT status_t ecdsa_p256_sideload_sign_start( const uint32_t digest[kP256ScalarWords]); @@ -102,6 +108,7 @@ status_t ecdsa_p256_sideload_sign_start( * @param[out] result Buffer in which to store the generated signature. * @return Result of the operation (OK or error). */ +OT_WARN_UNUSED_RESULT status_t ecdsa_p256_sign_finalize(ecdsa_p256_signature_t *result); /** @@ -116,6 +123,7 @@ status_t ecdsa_p256_sign_finalize(ecdsa_p256_signature_t *result); * @param public_key Key to check the signature against. * @return Result of the operation (OK or error). */ +OT_WARN_UNUSED_RESULT status_t ecdsa_p256_verify_start(const ecdsa_p256_signature_t *signature, const uint32_t digest[kP256ScalarWords], const p256_point_t *public_key); @@ -140,6 +148,7 @@ status_t ecdsa_p256_verify_start(const ecdsa_p256_signature_t *signature, * otherwise) * @return Result of the operation (OK or error). */ +OT_WARN_UNUSED_RESULT status_t ecdsa_p256_verify_finalize(const ecdsa_p256_signature_t *signature, hardened_bool_t *result); diff --git a/sw/device/lib/crypto/impl/ecc/p256_common.h b/sw/device/lib/crypto/impl/ecc/p256_common.h index bc0e7ca36dcce..154dfc4802eb0 100644 --- a/sw/device/lib/crypto/impl/ecc/p256_common.h +++ b/sw/device/lib/crypto/impl/ecc/p256_common.h @@ -101,6 +101,7 @@ typedef struct p256_point { * @param share1_addr DMEM address of the second share. * @return Result of the operation. */ +OT_WARN_UNUSED_RESULT status_t p256_masked_scalar_write(const p256_masked_scalar_t *src, const otbn_addr_t share0_addr, const otbn_addr_t share1_addr);