db6b4db7a0
Renaming all MBEDTLS_HAVE for curves to MBEDTLS_ECP_HAVE
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no >
2023-09-25 17:39:41 +02:00
6d809cc969
lib/test: use new internal helpers in library's code and tests
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no >
2023-09-25 17:39:41 +02:00
5a3add2c67
Merge pull request #8234 from kouzhudong/development
...
Fix MSVC error C4703 about possibly uninitialized variable in pkwrite.c
2023-09-25 10:51:46 +01:00
8d276fbc23
Remove unused variable and unreachable return from mbedtls_pk_write_key_der()
...
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com >
2023-09-21 17:19:36 +01:00
a15b4851d4
Fix MSVC error C4703 about possibly uninitialized variable in pkwrite.c
...
Signed-off-by: correy <112426112@qq.com >
2023-09-21 20:18:52 +08:00
b9c7953442
pkwrite: Fix defined but not used warning
...
Fix defined but not used warning when
MBEDTLS_USE_PSA_CRYPTO, MBEDTLS_PK_HAVE_RFC8410_CURVES
and MBEDTLS_PK_HAVE_ECC_KEYS are defined but not
MBEDTLS_PEM_WRITE_C.
Signed-off-by: Ronald Cron <ronald.cron@arm.com >
2023-09-07 14:20:49 +02:00
e1d7c9dabd
pkwrite: fix internal buffer size in pk_write_ec_pubkey()
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no >
2023-08-10 07:40:18 +02:00
2be8c63af7
Create psa_util_internal.h
...
Most functions in psa_util.h are going to end up there (except those
that can be static in one file), but I wanted to have separate commits
for file creation and moving code around, so for now the new file's
pretty empty but that will change in the next few commits.
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com >
2023-07-06 12:42:33 +02:00
e1651360c0
pkwrite: fix wrong guard position for pk_get_opaque_ec_family()
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no >
2023-06-19 19:24:05 +02:00
81d75127ba
library: replace occurencies of ECP_LIGHT with PK_HAVE_ECC_KEYS
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no >
2023-06-19 19:24:05 +02:00
f9139e55ce
pk: minor code fixes
...
- removing duplicated code
- uninitialized variable usage
Signed-off-by: valerio <valerio.setti@nordicsemi.no >
2023-06-01 11:06:41 +02:00
c6e6fb320f
pk: fix guard position
...
Signed-off-by: valerio <valerio.setti@nordicsemi.no >
2023-06-01 11:06:41 +02:00
e279e50a76
pk: optimized/reshape code for writing private key PEM
...
Signed-off-by: valerio <valerio.setti@nordicsemi.no >
2023-06-01 11:06:41 +02:00
c0bac57ac9
pk: optimized/reshape code for writing private key DER
...
Signed-off-by: valerio <valerio.setti@nordicsemi.no >
2023-06-01 11:06:41 +02:00
52b675ffc3
pk: extend pk_write_ec_private to support opaque keys
...
Signed-off-by: valerio <valerio.setti@nordicsemi.no >
2023-06-01 11:06:41 +02:00
ba1fd32eda
pk: optimize/reshape public key writing
...
Signed-off-by: valerio <valerio.setti@nordicsemi.no >
2023-06-01 11:06:41 +02:00
9ea26173d6
pk: uniformmize public key writing functions
...
Signed-off-by: valerio <valerio.setti@nordicsemi.no >
2023-06-01 11:06:40 +02:00
b727314133
pk: add internal helpers for opaque keys
...
Signed-off-by: valerio <valerio.setti@nordicsemi.no >
2023-06-01 11:06:40 +02:00
449803abff
pkwrite: remove unnecessary code duplication
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no >
2023-05-25 09:37:05 +02:00
1194ffa82f
pk: minor code fixes/enhancements
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no >
2023-05-24 14:00:26 +02:00
00e8dd15d2
pk: manage parse and write for the new format
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no >
2023-05-23 15:12:07 +02:00
e0e6311b64
pk: change location of Montgomery helpers
...
This is to have them available only where they are really required.
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no >
2023-05-23 15:12:07 +02:00
4064dbbdb2
pk: update pkparse and pkwrite to use the new public key storing solution
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no >
2023-05-17 15:33:07 +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
fc90decb74
pkwrite: removing unused/duplicated variables
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no >
2023-05-05 12:30:40 +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
cb706ea308
Silence bad "maybe unitialized" warning for ec_grp_id
...
Signed-off-by: Jethro Beekman <jethro@fortanix.com >
2023-05-04 13:01:47 +02:00
cf4545e396
Fix unsued variable in mbedtls_pk_write_pubkey_der in certain configurations
...
Signed-off-by: Jethro Beekman <jethro@fortanix.com >
2023-05-04 13:01:47 +02:00
13d415c4ed
Only use mbedtls_ecc_group_of_psa if defined(MBEDTLS_ECP_LIGHT)
...
Signed-off-by: Jethro Beekman <jethro@fortanix.com >
2023-05-04 13:01:47 +02:00
8e59ebb2e4
Refactor EC SPKI serialization
...
Signed-off-by: Jethro Beekman <jethro@fortanix.com >
2023-05-04 13:01:47 +02:00
0167244be4
Read and write X25519 and X448 private keys
...
Signed-off-by: Jethro Beekman <jethro@fortanix.com >
Co-authored-by: Gijs Kwakkel <gijs.kwakkel@fortanix.com >
Signed-off-by: Gijs Kwakkel <gijs.kwakkel@fortanix.com >
2023-05-04 13:01:47 +02:00
6c496a1553
solve disparities for ECP_LIGHT between ref/accel
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no >
2023-04-11 11:33:50 +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
449bd8303e
Switch to the new code style
...
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com >
2023-01-11 14:50:10 +01:00
0fe6631486
Merge pull request #6291 from gilles-peskine-arm/platform.h-unconditional-3.2
...
Include platform.h unconditionally
2022-10-13 10:19:22 +02:00
945b23c46f
Include platform.h unconditionally: automatic part
...
We used to include platform.h only when MBEDTLS_PLATFORM_C was enabled, and
to define ad hoc replacements for mbedtls_xxx functions on a case-by-case
basis when MBEDTLS_PLATFORM_C was disabled. The only reason for this
complication was to allow building individual source modules without copying
platform.h. This is not something we support or recommend anymore, so get
rid of the complication: include platform.h unconditionally.
There should be no change in behavior since just including the header should
not change the behavior of a program.
This commit replaces most occurrences of conditional inclusion of
platform.h, using the following code:
```
perl -i -0777 -pe 's!#if.*\n#include "mbedtls/platform.h"\n(#else.*\n(#define (mbedtls|MBEDTLS)_.*\n|#include <(stdarg|stddef|stdio|stdlib|string|time)\.h>\n)*)?#endif.*!#include "mbedtls/platform.h"!mg' $(git grep -l '#include "mbedtls/platform.h"')
```
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com >
2022-09-15 20:33:07 +02:00
c388af63e4
Remove extra spacings
...
Signed-off-by: Tuvshinzaya Erdenekhuu <tuvshinzaya.erdenekhuu@arm.com >
2022-08-31 10:14:25 +01:00
088e936839
Remove NULL pointer validation in pkwrite.c
...
Signed-off-by: Tuvshinzaya Erdenekhuu <tuvshinzaya.erdenekhuu@arm.com >
2022-08-31 10:14:25 +01:00
295aeb17e6
Add support for RSA Opaque PK key in mbedtls_pk_write_pubkey_der()
...
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com >
2022-04-07 15:01:24 +02:00
e9ecd27890
Rename max sizes of RSA & EC DER keys defines
...
Rename to match the required pattern of defines:
'^(MBEDTLS|PSA)_[0-9A-Z_]*[0-9A-Z]$'
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com >
2022-03-01 10:03:21 +01:00
e0326a6acc
Move max sizes of RSA & EC DER keys into private pkwrite.h
...
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com >
2022-03-01 09:58:58 +01:00
03e01461ad
Make KEY_ID_ENCODES_OWNER compatible with USE_PSA_CRYPTO
...
Fix library references, tests and programs.
Testing is performed in the already present all.sh test.
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com >
2022-01-03 12:53:24 +01:00
d6c246f5bf
Merge branch 'development_3.0' into remove_depr_error_codes
2021-04-21 12:31:43 +02:00
b579ccd529
The still used deprecated error codes replaced with _PLATFORM_ ones
...
Signed-off-by: TRodziewicz <tomasz.rodziewicz@mobica.com >
2021-04-13 14:29:29 +02:00
73e3e2cb1a
Merge remote-tracking branch 'origin/development' into development_new
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com >
Conflicts:
include/mbedtls/check_config.h: nearby edits
library/entropy.c: nearby edits
programs/random/gen_random_havege.c: modification vs. removal
programs/ssl/ssl_test_lib.h: nearby edits
programs/test/cpp_dummy_build.cpp: nearby edits
visualc/VS2010/mbedTLS.vcxproj: automatically generated file,
regenerated with scripts/generate_visualc_files.pl
2021-04-07 16:31:09 +01:00
3292453402
Add missing const attribute to Public Key API
...
Signed-off-by: Mateusz Starzyk <mateusz.starzyk@mobica.com >
2021-02-05 12:06:01 +01:00
79fb5da632
adding parentheses to macro definitions, to avoid confusion and possible mistakes in usage.
...
Signed-off-by: Daniel Otte <d.otte@wut.de >
2021-02-01 14:26:08 +01:00
39f361466b
avoid errorneous computation of RSA_PRV_DER_MAX_BYTES if MBEDTLS_MPI_MAX_SIZE is odd.
...
if MBEDTLS_MPI_MAX_SIZE is odd then RSA_PRV_DER_MAX_BYTES will be two less than expected, since the macros are lacking parentheses.
Signed-off-by: Daniel Otte <d.otte@wut.de >
2021-02-01 14:23:30 +01:00
cf56a0a320
psa: Move from key handle to key identifier
...
Move all the PSA crypto APIs using key handles
to use key identifiers but psa_key_open() and
psa_key_close(). This is done without modifying
any test as key handles and key identifiers are
now the same.
Update the library modules using PSA crypto APIs
to get rid of key handles.
Programs and unit tests are updated to not use
key handles in subsequent commits, not in this
one.
Signed-off-by: Ronald Cron <ronald.cron@arm.com >
2020-11-10 16:00:41 +01:00