44 Commits

Author SHA1 Message Date
Waleed Elmelegy
e25cb1bcda Fix formatting issue in psa_key_agreement() documentation
Signed-off-by: Waleed Elmelegy <waleed.elmelegy@arm.com>
2024-08-16 14:37:46 +01:00
Waleed Elmelegy
8faeee24ae Improve documentation of psa_key_agreement()
Signed-off-by: Waleed Elmelegy <waleed.elmelegy@arm.com>
2024-08-16 14:37:46 +01:00
Waleed Elmelegy
bdf2c98a27 Add psa_key_agreement() API
Add psa_key_agreement() API and basic testing.

Signed-off-by: Waleed Elmelegy <waleed.elmelegy@arm.com>
2024-08-16 14:36:47 +01:00
Janos Follath
9e088847ae Clarify IOP key generation restriction
Public keys can't be generated.

Co-authored-by: Gilles Peskine <gilles.peskine@arm.com>
Signed-off-by: Janos Follath <janos.follath@arm.com>
2024-08-15 13:51:05 +01:00
Janos Follath
9f48917b88 Improve IOP documentation
Signed-off-by: Janos Follath <janos.follath@arm.com>
2024-08-15 13:51:05 +01:00
Janos Follath
7311600fd5 Constrain interruptible key generation to key-pairs
Erroring on a symmetric-key type would actually be an extra line of
code.

In theory we could try to save that one line of code, but it is
premature optimisation at this point. Also, this is a predominantly
asymmetric crypto feature, it is less confusing/more user friendly if we
don't allow symmetric keys here.

Signed-off-by: Janos Follath <janos.follath@arm.com>
2024-08-15 13:51:05 +01:00
Paul Elliott
0c1aa4af38 Add psa_generate_key_iop_abort() documentation
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2024-08-15 13:51:04 +01:00
Paul Elliott
08afb00a9b Add psa_generate_key_iop_complete() documentation
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2024-08-15 13:51:04 +01:00
Paul Elliott
6044f3e444 Add psa_generate_key_iop_setup() documentation
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2024-08-15 13:51:04 +01:00
Paul Elliott
f712452a0e Add psa_generate_key_iop_get_num_ops() docs
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2024-08-15 13:51:04 +01:00
Paul Elliott
9e143a73ea Add psa_generate_key_iop_t structs and docs
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
Signed-off-by: Janos Follath <janos.follath@arm.com>
2024-08-15 13:50:52 +01:00
Janos Follath
1176e6f90e
Merge pull request #9410 from paul-elliott-arm/add_docs_iop_key_agreement
Add IOP Key agreement Documentation
2024-08-13 13:25:22 +00:00
Gilles Peskine
2ff81bf03b Add a test for the built-in key range
Restricting the built-in key range would be an API break since applications
can hard-code a built-in key value and expect that it won't clash with
anything else. Make it harder to accidentally break the API.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-08-07 12:39:05 +02:00
Gilles Peskine
b0b1b32914 Prevent mbedtls_psa_register_se_key with volatile keys
mbedtls_psa_register_se_key() is not usable with volatile keys, since there
is no way to return the implementation-chosen key identifier which would be
needed to use the key. Document this limitation. Reject an attempt to create
such an unusable key. Fixes #9253.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-08-07 12:39:05 +02:00
Gilles Peskine
3077f2f9c6 Remove experimental, superseded function psa_generate_key_ext
Remove the experimental functions psa_generate_key_ext() and
psa_key_derivation_output_key_ext(), which require a flexible array member
and therefore break C++ code that includes Mbed TLS headers. They have been
replaced by psa_generate_key_custom() and
psa_key_derivation_output_key_custom().

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-08-05 15:52:37 +02:00
Gilles Peskine
d5d69bb4a0 Match spacing in pointer types in documentation with the code style
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-08-05 15:52:37 +02:00
Gilles Peskine
6b2709bf06 Documentation improvements
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-08-05 15:52:37 +02:00
Gilles Peskine
ae1da9858c Remove some tests of psa_generate_key_ext
We know it's a thin wrapper around psa_generate_key_custom, so we just need
to check that it's passing the information through, we don't need coverage
of the parameter interpretation.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-08-05 15:49:22 +02:00
Gilles Peskine
8ae5028a1d Document the key_ext functions as deprecated
Don't formally deprecate them because we don't do that in a
long-time support branch. But do point readers away from them.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-08-05 15:49:22 +02:00
Gilles Peskine
e863f868ec Documentation: point to key_custom instead of key_ext
Replace references to the deprecated functions `psa_generate_key_ext()` and
`psa_key_derivation_output_key_ext()` by their replacements
Implement `psa_generate_key_custom()` and
`psa_key_derivation_output_key_custom()`.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-08-05 15:49:22 +02:00
Gilles Peskine
f9408282e8 Implement psa_generate_key_custom
Implement `psa_generate_key_custom()` and
`psa_key_derivation_output_key_custom()`. These functions replace
`psa_generate_key_ext()` and `psa_key_derivation_output_key_ext()`.
They have the same functionality, but a slightly different interface:
the `ext` functions use a structure with a flexible array member to pass
variable-length data, while the `custom` functions use a separate parameter.

Keep the `ext` functions for backward compatibility with Mbed TLS 3.6.0.
But make them a thin wrapper around the new `custom` functions.

Duplicate the test code and data. The test cases have to be duplicated
anyway, and the test functions are individually more readable this way.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-08-05 15:49:22 +02:00
Janos Follath
26561b7122 Fix typos
Signed-off-by: Janos Follath <janos.follath@arm.com>
2024-08-05 11:22:12 +01:00
Paul Elliott
e50edc0d95 Add warning about not using keys directly
Keys that are the result of key agreement have biases and really should
not be used directly. Warning taken in part from psa_raw_key_agreement()

Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2024-08-01 18:28:07 +01:00
Paul Elliott
327da4774b Clarify key type support
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2024-08-01 18:27:54 +01:00
Paul Elliott
623c09a1eb Change over to psa_raw_key_agreement
psa_key_agreement exists, but only in the PSA spec, we have not
implemented it, so refer to the one we actually implemented.

Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2024-08-01 18:16:35 +01:00
Paul Elliott
5238475ac6 Update key attribute documentation inline with PSA
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2024-08-01 17:52:51 +01:00
Paul Elliott
459448b8cf Neaten 'Please call next function' docs.
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2024-08-01 11:50:16 +01:00
Paul Elliott
4b0b35e1d7 Clarify PSA_ERROR_NOT_SUPPORTED error reasons
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2024-08-01 11:37:17 +01:00
Paul Elliott
8e412871c1 Clarify ops used reset logic
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2024-08-01 11:34:07 +01:00
Paul Elliott
9bcfd8981e improve return codes and logic description
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2024-08-01 10:29:24 +01:00
Paul Elliott
867815d89d Minor formatting fixes
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2024-07-31 18:56:36 +01:00
Paul Elliott
cae2bed689 Remove unneccessary 'Implementation' references
These were copied from the PSA docs when they should not have been.

Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2024-07-31 18:48:34 +01:00
Elena Uziunaite
665eda7031 Introduce crypto_adjust_config_derived.h
Signed-off-by: Elena Uziunaite <elena.uziunaite@arm.com>
2024-07-29 12:15:22 +01:00
Paul Elliott
088fd7ec85 Add psa_key_agreement_iop_abort() documentation
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2024-07-19 18:27:53 +01:00
Paul Elliott
b06727e463 Add psa_key_agreement_iop_complete() documentation
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2024-07-19 18:25:24 +01:00
Paul Elliott
2dc58fe717 Add psa_key_agreement_iop_setup() documentation
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2024-07-19 18:22:23 +01:00
Paul Elliott
d791062fee Add psa_key_agreement_iop_get_num_ops() docs
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2024-07-19 18:17:20 +01:00
Paul Elliott
03d62b1958 Add psa_key_agreement_iop_t structs and docs
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2024-07-19 17:29:57 +01:00
Gilles Peskine
5f616e9601
Merge pull request #9308 from valeriosetti/fix-psa_key_derivation_verify_bytes
psa: fix parameters' names of psa_key_derivation_verify_bytes()
2024-07-15 11:01:08 +00:00
Ronald Cron
05ba9124b7 Adapt libraries installation
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-07-01 14:59:35 +02:00
Valerio Setti
fc37c10e0b psa: fix parameters' names of psa_key_derivation_verify_bytes()
PSA buffers and their length should follow a pattern for which
the latter is named after the former as <buffer_name>_length,
but this was not the case for psa_key_derivation_verify_bytes().

This makes life of crypto.h parsers (for automatic code generation)
harder. This commit aims at solving this problem.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-06-24 15:27:51 +02:00
Ronald Cron
1451a76958 Adapt libtestdriver1 build
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-06-13 09:02:30 +02:00
Ronald Cron
2581d91fda Adapt libraries installation
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-06-13 09:02:30 +02:00
Ronald Cron
d80134b56d Move PSA headers
Move PSA headers to tf-psa-crypto
directory.

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-06-12 15:22:26 +02:00