Skip to content

Commit

Permalink
[nrf noup] attestation: Sign message instead of hash
Browse files Browse the repository at this point in the history
For attestation, sign the full token instead of the hash of the token.

Signed-off-by: Sigurd Hellesvik <[email protected]>
  • Loading branch information
hellesvik-nordic committed Nov 22, 2024
1 parent 2e12b98 commit 9c1a5ad
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions config/config_base.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ set(SYMMETRIC_INITIAL_ATTESTATION OFF CACHE BOOL "Use symmetr
set(ATTEST_INCLUDE_TEST_CODE OFF CACHE BOOL "Include minimal development tests in the initial attestation regression test suite")
set(ATTEST_KEY_BITS 256 CACHE STRING "The size of the initial attestation key in bits")
set(PSA_INITIAL_ATTEST_MAX_TOKEN_SIZE 0x250 CACHE STRING "The maximum possible size of a token")
set(ATTEST_SIGN_MESSAGE OFF CACHE BOOL "Sign message instead of hash")

set(TFM_PARTITION_PLATFORM OFF CACHE BOOL "Enable Platform partition")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,8 @@ device. System integrators might need to re-implement the following functions
if they want to use initial attestation service with a different cryptographic
library than Crypto service:

- ``t_cose_crypto_pub_key_sign()``: Calculates the signature over a hash value.
- ``t_cose_crypto_pub_key_sign_hash()``: Calculates the signature over a hash value.
- ``t_cose_crypto_pub_key_sign_message()``: Calculates the signature over a message.
- ``t_cose_crypto_get_ec_pub_key()``: Get the public key to create the key
identifier.
- ``t_cose_crypto_hash_start()``: Start a multipart hash operation.
Expand Down
8 changes: 8 additions & 0 deletions secure_fw/partitions/initial_attestation/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@ config ATTEST_KEY_BITS
help
The size of the initial attestation key in bits

config ATTEST_SIGN_MESSAGE
bool "Sign message instead of hash"
default n
help
By default attestation calculates a hash of the payload and signs that.
Use this to instead sign the payload/message directly.


config PSA_INITIAL_ATTEST_MAX_TOKEN_SIZE
hex "The maximum possible size of a token"
default 0x250
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,9 @@ attest_token_encode_start(struct attest_token_encode_ctx *me,
me->opt_flags = opt_flags;
me->key_select = key_select;

#ifdef ATTEST_SIGN_MESSAGE
t_cose_options |= T_COSE_OPT_SIGN_MESSAGE;
#endif

if (opt_flags & TOKEN_OPT_SHORT_CIRCUIT_SIGN) {
t_cose_options |= T_COSE_OPT_SHORT_CIRCUIT_SIG;
Expand Down

0 comments on commit 9c1a5ad

Please sign in to comment.