Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add PSA interruptible key agreement APIs #9490

Merged
Merged
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
a2891a9
Add PSA interuptable key agreement APIs
waleed-elmelegy-arm Aug 6, 2024
a7fc0a6
Add PSA interruptible key agreement tests
waleed-elmelegy-arm Aug 20, 2024
96a5c01
Add changelog entry for interuptible psa key agreement APIs
waleed-elmelegy-arm Aug 20, 2024
4cef20d
Fix everest build issue
waleed-elmelegy-arm Aug 22, 2024
26136ec
Improve interruptible key agreement implementation
waleed-elmelegy-arm Sep 4, 2024
57fb2a6
Refactor interuptible key agreement testing helper function
waleed-elmelegy-arm Sep 4, 2024
93be7a1
Refactor PSA key agreement API implementation
waleed-elmelegy-arm Sep 24, 2024
3783aca
Improve key agreement iop basic testing
waleed-elmelegy-arm Sep 24, 2024
d610d18
Fix codestyle in psa iop key agreement driver wrapper APIs
waleed-elmelegy-arm Sep 24, 2024
fa4eb35
Improve psa iop key agreement changelog message
waleed-elmelegy-arm Sep 24, 2024
a98aeaf
Fix iop key agreement struct initilaization error on some platforms
waleed-elmelegy-arm Sep 24, 2024
8422138
Fix possible error in initalizing key agreement iop struct
waleed-elmelegy-arm Sep 25, 2024
86e518b
Remove interuptible key agreement driver interface
waleed-elmelegy-arm Oct 30, 2024
18df1c5
Refactor and improve interuptible key agreement builtin implementation
waleed-elmelegy-arm Oct 30, 2024
cd721b9
Add a common key agreement parameter validation function across iop a…
waleed-elmelegy-arm Oct 30, 2024
280e225
Add small fixes to iop key agreement APIs
waleed-elmelegy-arm Oct 30, 2024
f840b3a
Add compile time initilaizers to ECDH and bignum structs
waleed-elmelegy-arm Nov 1, 2024
e980fbe
Fix codestyle in ECDH compile time initilaizers
waleed-elmelegy-arm Nov 1, 2024
97041ed
Fix Documentation issue in mbedtls_psa_key_agreement_iop_setup()
waleed-elmelegy-arm Nov 1, 2024
a4d0fd1
Fix a typo and a mistake in ECDH conext compile time initalizer
waleed-elmelegy-arm Nov 4, 2024
7817da0
Improve and fix compile initializers for ECDH/ECP
waleed-elmelegy-arm Nov 6, 2024
947afa0
Remove designated initializers from ECDH compile time initializers
waleed-elmelegy-arm Nov 7, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix codestyle in ECDH compile time initilaizers
Signed-off-by: Waleed Elmelegy <waleed.elmelegy@arm.com>
waleed-elmelegy-arm committed Nov 6, 2024
commit e980fbe291d58be41c7fa1cf8e6030177c9fe501
36 changes: 22 additions & 14 deletions tf-psa-crypto/drivers/builtin/include/mbedtls/ecdh.h
Original file line number Diff line number Diff line change
@@ -96,11 +96,14 @@ typedef struct mbedtls_ecdh_context_mbed {
#endif

#if defined(MBEDTLS_ECP_RESTARTABLE)
#define MBEDTLS_ECDH_CTX_MBED_INIT {MBEDTLS_ECP_GROUP_INIT, MBEDTLS_MPI_INIT, MBEDTLS_ECP_POINT_INIT, \
MBEDTLS_ECP_POINT_INIT, MBEDTLS_MPI_INIT, MBEDTLS_ECP_RESTART_INIT}
#define MBEDTLS_ECDH_CTX_MBED_INIT { MBEDTLS_ECP_GROUP_INIT, MBEDTLS_MPI_INIT, \
MBEDTLS_ECP_POINT_INIT, \
MBEDTLS_ECP_POINT_INIT, MBEDTLS_MPI_INIT, \
MBEDTLS_ECP_RESTART_INIT }
#else
#define MBEDTLS_ECDH_CTX_MBED_INIT {MBEDTLS_ECP_GROUP_INIT, MBEDTLS_MPI_INIT, MBEDTLS_ECP_POINT_INIT, \
MBEDTLS_ECP_POINT_INIT, MBEDTLS_MPI_INIT}
#define MBEDTLS_ECDH_CTX_MBED_INIT { MBEDTLS_ECP_GROUP_INIT, MBEDTLS_MPI_INIT, \
MBEDTLS_ECP_POINT_INIT, \
MBEDTLS_ECP_POINT_INIT, MBEDTLS_MPI_INIT }
#endif

/**
@@ -151,26 +154,31 @@ mbedtls_ecdh_context;

#if defined(MBEDTLS_ECDH_LEGACY_CONTEXT)
#if defined(MBEDTLS_ECP_RESTARTABLE)
#define MBEDTLS_ECDH_CTX_INIT {MBEDTLS_ECP_GROUP_INIT, MBEDTLS_MPI_INIT, MBEDTLS_ECP_POINT_INIT, \
MBEDTLS_ECP_POINT_INIT, MBEDTLS_MPI_INIT, 0, MBEDTLS_ECP_POINT_INIT, \
MBEDTLS_ECP_POINT_INIT, MBEDTLS_MPI_INIT,0, MBEDTLS_ECP_RESTART_INIT}
#define MBEDTLS_ECDH_CTX_INIT { MBEDTLS_ECP_GROUP_INIT, MBEDTLS_MPI_INIT, MBEDTLS_ECP_POINT_INIT, \
MBEDTLS_ECP_POINT_INIT, MBEDTLS_MPI_INIT, 0, MBEDTLS_ECP_POINT_INIT, \
MBEDTLS_ECP_POINT_INIT, MBEDTLS_MPI_INIT, 0, \
MBEDTLS_ECP_RESTART_INIT }
#else
#define MBEDTLS_ECDH_CTX_INIT {MBEDTLS_ECP_GROUP_INIT, MBEDTLS_MPI_INIT, MBEDTLS_ECP_POINT_INIT, \
MBEDTLS_ECP_POINT_INIT, MBEDTLS_MPI_INIT, 0, MBEDTLS_ECP_POINT_INIT, \
MBEDTLS_ECP_POINT_INIT, MBEDTLS_MPI_INIT}
#define MBEDTLS_ECDH_CTX_INIT { MBEDTLS_ECP_GROUP_INIT, MBEDTLS_MPI_INIT, MBEDTLS_ECP_POINT_INIT, \
MBEDTLS_ECP_POINT_INIT, MBEDTLS_MPI_INIT, 0, MBEDTLS_ECP_POINT_INIT, \
MBEDTLS_ECP_POINT_INIT, MBEDTLS_MPI_INIT }
#endif /* MBEDTLS_ECP_RESTARTABLE */
#else
#if !defined(MBEDTLS_ECDH_VARIANT_EVEREST_ENABLED)
gilles-peskine-arm marked this conversation as resolved.
Show resolved Hide resolved
#if defined(MBEDTLS_ECP_RESTARTABLE)
#define MBEDTLS_ECDH_CTX_INIT {0, MBEDTLS_ECP_DP_NONE, MBEDTLS_ECDH_VARIANT_NONE, MBEDTLS_ECDH_CTX_MBED_INIT, MBEDTLS_ECDH_CTX_MBED_INIT, 0}
#define MBEDTLS_ECDH_CTX_INIT { 0, MBEDTLS_ECP_DP_NONE, MBEDTLS_ECDH_VARIANT_NONE, \
MBEDTLS_ECDH_CTX_MBED_INIT, MBEDTLS_ECDH_CTX_MBED_INIT, 0 }
#else
#define MBEDTLS_ECDH_CTX_INIT {0, MBEDTLS_ECP_DP_NONE, MBEDTLS_ECDH_VARIANT_NONE, MBEDTLS_ECDH_CTX_MBED_INIT, MBEDTLS_ECDH_CTX_MBED_INIT}
#define MBEDTLS_ECDH_CTX_INIT { 0, MBEDTLS_ECP_DP_NONE, MBEDTLS_ECDH_VARIANT_NONE, \
MBEDTLS_ECDH_CTX_MBED_INIT, MBEDTLS_ECDH_CTX_MBED_INIT }
#endif /* MBEDTLS_ECP_RESTARTABLE */
#else
#if defined(MBEDTLS_ECP_RESTARTABLE)
#define MBEDTLS_ECDH_CTX_INIT {0, MBEDTLS_ECP_DP_NONE, MBEDTLS_ECDH_VARIANT_NONE, MBEDTLS_ECDH_CTX_EVEREST_INIT, MBEDTLS_ECDH_CTX_MBED_INIT, 0}
#define MBEDTLS_ECDH_CTX_INIT { 0, MBEDTLS_ECP_DP_NONE, MBEDTLS_ECDH_VARIANT_NONE, \
MBEDTLS_ECDH_CTX_EVEREST_INIT, MBEDTLS_ECDH_CTX_MBED_INIT, 0 }
#else
#define MBEDTLS_ECDH_CTX_INIT {0, MBEDTLS_ECP_DP_NONE, MBEDTLS_ECDH_VARIANT_NONE, MBEDTLS_ECDH_CTX_EVEREST_INIT, MBEDTLS_ECDH_CTX_MBED_INIT}
#define MBEDTLS_ECDH_CTX_INIT { 0, MBEDTLS_ECP_DP_NONE, MBEDTLS_ECDH_VARIANT_NONE, \
MBEDTLS_ECDH_CTX_EVEREST_INIT, MBEDTLS_ECDH_CTX_MBED_INIT }
#endif /* MBEDTLS_ECP_RESTARTABLE */
#endif /* !MBEDTLS_ECDH_VARIANT_EVEREST_ENABLED */
#endif /* MBEDTLS_ECDH_LEGACY_CONTEXT */
2 changes: 1 addition & 1 deletion tf-psa-crypto/drivers/builtin/include/mbedtls/ecp.h
Original file line number Diff line number Diff line change
@@ -373,7 +373,7 @@ typedef struct {
mbedtls_ecp_restart_muladd_ctx *MBEDTLS_PRIVATE(ma); /*!< ecp_muladd() sub-context */
} mbedtls_ecp_restart_ctx;

#define MBEDTLS_ECP_RESTART_INIT {0, 0, NULL, NULL}
#define MBEDTLS_ECP_RESTART_INIT { 0, 0, NULL, NULL }

/*
* Operation counts for restartable functions
3 changes: 2 additions & 1 deletion tf-psa-crypto/include/psa/crypto_struct.h
Original file line number Diff line number Diff line change
@@ -518,7 +518,8 @@ struct psa_key_agreement_iop_s {
#if defined(MBEDTLS_PSA_CRYPTO_CLIENT) && !defined(MBEDTLS_PSA_CRYPTO_C)
#define PSA_KEY_AGREEMENT_IOP_INIT { 0 }
#else
#define PSA_KEY_AGREEMENT_IOP_INIT { 0, MBEDTLS_PSA_KEY_AGREEMENT_IOP_INIT, 0, PSA_KEY_ATTRIBUTES_INIT, 0 }
#define PSA_KEY_AGREEMENT_IOP_INIT { 0, MBEDTLS_PSA_KEY_AGREEMENT_IOP_INIT, 0, \
PSA_KEY_ATTRIBUTES_INIT, 0 }
#endif

static inline struct psa_key_agreement_iop_s