Skip to content

Commit 46dc477

Browse files
Merge pull request #10444 from gilles-peskine-arm/jpake-persistent-key-compat-3.6.5
Backport 3.6: PSA JPAKE: add storage test case and document limitations
2 parents 42ae2ac + 84a9b26 commit 46dc477

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

include/psa/crypto_extra.h

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -760,6 +760,17 @@ int psa_can_do_cipher(psa_key_type_t key_type, psa_algorithm_t cipher_alg);
760760
* To make the authentication explicit there are various methods, see Section 5
761761
* of RFC 8236 for two examples.
762762
*
763+
* \note The JPAKE implementation has the following limitations:
764+
* - The only supported primitive is ECC on the curve secp256r1, i.e.
765+
* `PSA_PAKE_PRIMITIVE(PSA_PAKE_PRIMITIVE_TYPE_ECC,
766+
* PSA_ECC_FAMILY_SECP_R1, 256)`.
767+
* - The only supported hash algorithm is SHA-256, i.e.
768+
* `PSA_ALG_SHA_256`.
769+
* - When using the built-in implementation, the user ID and the peer ID
770+
* must be `"client"` (6-byte string) and `"server"` (6-byte string),
771+
* or the other way round.
772+
* Third-party drivers may or may not have this limitation.
773+
*
763774
*/
764775
#define PSA_ALG_JPAKE ((psa_algorithm_t) 0x0a000100)
765776

@@ -1196,6 +1207,8 @@ static psa_algorithm_t psa_pake_cs_get_algorithm(
11961207
* This function overwrites any PAKE algorithm
11971208
* previously set in \p cipher_suite.
11981209
*
1210+
* \note For #PSA_ALG_JPAKE, the only supported hash algorithm is SHA-256.
1211+
*
11991212
* \param[out] cipher_suite The cipher suite structure to write to.
12001213
* \param algorithm The PAKE algorithm to write.
12011214
* (`PSA_ALG_XXX` values of type ::psa_algorithm_t
@@ -1219,6 +1232,10 @@ static psa_pake_primitive_t psa_pake_cs_get_primitive(
12191232
*
12201233
* This function overwrites any primitive previously set in \p cipher_suite.
12211234
*
1235+
* \note For #PSA_ALG_JPAKE, the only supported primitive is ECC on the curve
1236+
* secp256r1, i.e. `PSA_PAKE_PRIMITIVE(PSA_PAKE_PRIMITIVE_TYPE_ECC,
1237+
* PSA_ECC_FAMILY_SECP_R1, 256)`.
1238+
*
12221239
* \param[out] cipher_suite The cipher suite structure to write to.
12231240
* \param primitive The primitive to write. If this is 0, the
12241241
* primitive type in \p cipher_suite becomes
@@ -1555,6 +1572,10 @@ psa_status_t psa_pake_set_password_key(psa_pake_operation_t *operation,
15551572
* values of type ::psa_algorithm_t such that #PSA_ALG_IS_PAKE(\c alg) is true)
15561573
* for more information.
15571574
*
1575+
* \note When using the built-in implementation of #PSA_ALG_JPAKE, the user ID
1576+
* must be `"client"` (6-byte string) or `"server"` (6-byte string).
1577+
* Third-party drivers may or may not have this limitation.
1578+
*
15581579
* \param[in,out] operation The operation object to set the user ID for. It
15591580
* must have been set up by psa_pake_setup() and
15601581
* not yet in use (neither psa_pake_output() nor
@@ -1596,6 +1617,10 @@ psa_status_t psa_pake_set_user(psa_pake_operation_t *operation,
15961617
* values of type ::psa_algorithm_t such that #PSA_ALG_IS_PAKE(\c alg) is true)
15971618
* for more information.
15981619
*
1620+
* \note When using the built-in implementation of #PSA_ALG_JPAKE, the peer ID
1621+
* must be `"client"` (6-byte string) or `"server"` (6-byte string).
1622+
* Third-party drivers may or may not have this limitation.
1623+
*
15991624
* \param[in,out] operation The operation object to set the peer ID for. It
16001625
* must have been set up by psa_pake_setup() and
16011626
* not yet in use (neither psa_pake_output() nor

tests/suites/test_suite_psa_crypto_storage_format.misc.data

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,14 @@ PSA storage save: AES-GCM+CTR
1010
depends_on:PSA_WANT_KEY_TYPE_AES
1111
key_storage_save:PSA_KEY_LIFETIME_PERSISTENT:PSA_KEY_TYPE_AES:128:PSA_KEY_USAGE_EXPORT | PSA_KEY_USAGE_ENCRYPT:PSA_ALG_GCM:PSA_ALG_CTR:"404142434445464748494a4b4c4d4e4f":"505341004b45590000000000010000000024800001010000000250050010c00410000000404142434445464748494a4b4c4d4e4f"
1212

13+
PSA storage read: PASSWORD-JPAKE
14+
depends_on:PSA_WANT_ALG_JPAKE:PSA_WANT_ALG_SHA_256:PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_IMPORT:PSA_WANT_ECC_SECP_R1_256
15+
key_storage_read:0x0001:PSA_KEY_TYPE_PASSWORD:8:PSA_KEY_USAGE_DERIVE | PSA_KEY_USAGE_EXPORT:PSA_ALG_JPAKE:PSA_ALG_NONE:"4c":"505341004b455900000000000100000003120800014000000001000a00000000010000004c":0
16+
17+
PSA storage save: PASSWORD-JPAKE
18+
depends_on:PSA_WANT_ALG_JPAKE:PSA_WANT_ALG_SHA_256:PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_IMPORT:PSA_WANT_ECC_SECP_R1_256
19+
key_storage_save:0x0001:PSA_KEY_TYPE_PASSWORD:8:PSA_KEY_USAGE_DERIVE | PSA_KEY_USAGE_EXPORT:PSA_ALG_JPAKE:PSA_ALG_NONE:"4c":"505341004b455900000000000100000003120800014000000001000a00000000010000004c"
20+
1321
# Create a persistent key which is larger than MBEDTLS_PSA_STATIC_KEY_SLOT_BUFFER_SIZE
1422
# so that when psa_get_key_attributes() tries to load it from the storage it will fail.
1523
PSA storage read: key larger than MBEDTLS_PSA_STATIC_KEY_SLOT_BUFFER_SIZE

0 commit comments

Comments
 (0)