a7cb845705
pk: add checks for the returned ECC family
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no >
2023-05-22 18:39:43 +02:00
c1541cb3c7
pk: minor fixes (guards and a wrong assignment)
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no >
2023-05-17 19:23:02 +02:00
483738ed67
tests: fixes for using the new public key raw format
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no >
2023-05-17 15:38:39 +02:00
722f8f7472
pk: adding a new field to store the public key in raw format
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no >
2023-05-17 15:31:21 +02:00
3f00b84dd1
pk: fix build issues
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no >
2023-05-15 12:57:06 +02:00
77a75685ed
pk: align library and tests code to the new internal functions
...
Note = programs are not aligned to this change because:
- the original mbedtls_pk_ec is not ufficially deprecated
- that function is used in tests when ECP_C is defined, so
the legacy version of that function is available in that
case
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no >
2023-05-15 11:18:46 +02:00
4f387ef277
pk: use better naming for the new key ID field
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no >
2023-05-05 10:59:32 +02:00
048cd44f77
pk: fix library code for using the new opaque key solution
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no >
2023-05-05 10:59:32 +02:00
e00954d0ed
pk: store opaque key ID directly in the pk_context structure
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no >
2023-05-05 10:57:26 +02:00
33a3ccd899
Fix bug in mbedtls_pk_wrap_as_opaque
...
Signed-off-by: Jethro Beekman <jethro@fortanix.com >
2023-05-04 13:01:47 +02:00
2d81499026
pk: fix position for mbedtls_platform_zeroize
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no >
2023-05-02 15:45:39 +02:00
2c50526476
pk: fix: clear buffer holding raw EC private key on exit
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no >
2023-05-02 15:45:39 +02:00
38992cb833
pk: pass pk_context pointer to wrappers intead of void one
...
Signed-off-by: valerio <valerio.setti@nordicsemi.no >
2023-04-20 12:02:34 +02:00
0d2980f117
pk: adapt to new ECP_LIGHT symbol
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no >
2023-04-11 11:33:50 +02:00
8a045ce5e6
Unify PSA to Mbed TLS error translation
...
Move all error translation utilities to psa_util.c.
Introduce macros and functions to avoid having
a local copy of the error translating function in
each place.
Identify overlapping errors and introduce a
generic function.
Provide a single macro for all error translations
(unless one file needs a couple of different ones).
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com >
2023-03-03 05:23:44 -05:00
4a5c9ee7f2
Remove redundant SIZE_MAX guards
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com >
2023-02-10 16:03:44 +00:00
7ca1318256
pk: add new symbol for generic ECDSA capability
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no >
2023-02-07 08:02:23 +01:00
ab363d9fe1
pk/pk_wrap: replace ECDSA_C with generic ECDSA capabilities' defines
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no >
2023-02-07 08:02:23 +01:00
449bd8303e
Switch to the new code style
...
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com >
2023-01-11 14:50:10 +01:00
4dacf58d6d
Take advantage of now-public macro in pk.c
...
Used to be private, hence the duplication, but that's been fixed in the
meantime, I guess we just missed this occurrence.
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com >
2022-12-21 09:50:17 +01:00
6958355a51
Use PSA Crypto more often in pk_verify_ext()
...
See https://github.com/Mbed-TLS/mbedtls/issues/5277 - strategy 1.
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com >
2022-12-21 09:49:57 +01:00
c388af63e4
Remove extra spacings
...
Signed-off-by: Tuvshinzaya Erdenekhuu <tuvshinzaya.erdenekhuu@arm.com >
2022-08-31 10:14:25 +01:00
78c1d8c299
Re-introduce ENUM validation in pk.c
...
Signed-off-by: Tuvshinzaya Erdenekhuu <tuvshinzaya.erdenekhuu@arm.com >
2022-08-31 10:14:25 +01:00
26b39c6c6f
Remove NULL pointer validation in pk.c
...
Signed-off-by: Tuvshinzaya Erdenekhuu <tuvshinzaya.erdenekhuu@arm.com >
2022-08-31 10:14:25 +01:00
abac037a7b
Migrate from old inline to new actual function.
...
This is mostly:
sed -i 's/mbedtls_psa_translate_md/mbedtls_hash_info_psa_from_md/' \
library/*.c tests/suites/*.function
This should be good for code size as the old inline function was used
from 10 translation units inside the library, so we have 10 copies at
least.
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com >
2022-07-18 21:28:38 +02:00
4772884133
New internal module for managing hash information
...
Using static inline functions is bad for code size; the function from
md_internal.h was already used from 3 different C files, so already was
copied at least 3 times in the library, and this would only get worse
over time.
Use actual functions, and also share the actual data between them.
Provide a consistent set of operations. Conversion to/from
human-readable string was omitted for now but could be added later if
needed.
In the future, this can be used to replace other similar (inline)
functions that are currently scattered, including (but perhaps not
limited to):
- mbedtls_psa_translate_md() from psa_util.h
- mbedtls_md_info_from_psa() (indirectly) from psa_crypto_hash.h
- get_md_alg_from_psa() from psa_crypto_rsa.c
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com >
2022-07-18 21:28:38 +02:00
a370e06e30
Avoid dependency of PK on MD
...
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com >
2022-07-12 11:11:18 +02:00
81d391f773
Check when usage == 0 in mbedtls_pk_can_do_ext()
...
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com >
2022-05-20 09:26:16 +02:00
b80785f1a4
Comment typo fix in mbedtls_pk_can_do_ext()
...
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com >
2022-05-20 09:25:55 +02:00
084338d336
Change mbedtls_pk_can_do_ext() usage test logic for opaque keys
...
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com >
2022-05-19 16:22:40 +02:00
bbb8b75f20
Fixup comment of mbedtls_pk_can_do_ext()
...
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com >
2022-05-17 14:58:27 +02:00
408f6a60a3
Add usage parameter to mbedtls_pk_can_do_ext()
...
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com >
2022-05-17 14:23:20 +02:00
dab56ba2bd
Fix typo in mbedtls_pk_can_do_ext() code documentation
...
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com >
2022-05-17 11:56:55 +02:00
a88b15897d
Add implementation of mbedtls_pk_can_do_ext()
...
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com >
2022-05-12 11:53:02 +02:00
a1fc18fa55
Change mbedtls_pk_wrap_as_opaque() signature to specify alg, usage and key_enrollment_algorithm
...
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com >
2022-04-28 13:27:59 +02:00
13e76be02b
Reorganize & simplify mbedtls_pk_sign_ext() handling of wrapped RSA-PSS
...
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com >
2022-04-21 12:08:52 +02:00
62d452baac
Implement PK Opaque RSA PSS signature
...
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com >
2022-04-12 15:11:49 +02:00
7624a5ae5e
Allow RSA PK Opaque keys for RSA-PSS signing
...
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com >
2022-04-12 10:09:26 +02:00
56e71d4d1a
Update documentation of mbedtls_pk_setup_opaque()
...
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com >
2022-04-08 15:12:42 +02:00
eccf88fa48
Only accept RSA key pair in mbedtls_pk_setup_opaque()
...
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com >
2022-04-08 15:11:50 +02:00
c1152e4a0f
Handle and return translated PSA errors in mbedtls_pk_wrap_as_opaque()
...
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com >
2022-04-07 15:01:24 +02:00
7e1b4a45fa
Use PSA_BITS_TO_BYTES instead of open-coded calculation in mbedtls_pk_wrap_as_opaque()
...
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com >
2022-04-07 15:01:24 +02:00
ca5b55f0d1
Add support for RSA in mbedtls_pk_wrap_as_opaque()
...
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com >
2022-04-07 15:01:24 +02:00
eabbf9d907
Add support for RSA PK Opaque key
...
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com >
2022-04-07 14:51:47 +02:00
80325d00cf
Allow ECDSA PK Opaque keys for ECDH Derivation
...
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com >
2022-03-31 15:24:17 +02:00
fb0621d841
fix pk_sign_ext issues
...
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com >
2022-03-23 11:42:06 +08:00
89107d1bc2
fix ci fail without RSA_C
...
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com >
2022-03-22 15:14:53 +08:00
406cf27cb5
fix various issues
...
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com >
2022-03-22 15:14:53 +08:00
b02ee18e64
replace use_psa_crypto with psa_crypto_c
...
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com >
2022-03-22 15:13:35 +08:00
b6875bc17a
change rsa_pss salt type
...
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com >
2022-03-22 15:13:35 +08:00