mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-08-08 17:42:09 +03:00
Refactor structures for pake driver support
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
This commit is contained in:
@@ -1826,14 +1826,7 @@ psa_status_t psa_pake_abort(psa_pake_operation_t *operation);
|
||||
/** Returns a suitable initializer for a PAKE operation object of type
|
||||
* psa_pake_operation_t.
|
||||
*/
|
||||
#if defined(MBEDTLS_PSA_BUILTIN_PAKE)
|
||||
#define PSA_PAKE_OPERATION_INIT { PSA_ALG_NONE, 0, 0, 0, 0, \
|
||||
NULL, 0, \
|
||||
PSA_PAKE_ROLE_NONE, { 0 }, 0, 0, \
|
||||
{ .dummy = 0 } }
|
||||
#else
|
||||
#define PSA_PAKE_OPERATION_INIT { PSA_ALG_NONE, 0, 0, { 0 } }
|
||||
#endif
|
||||
#define PSA_PAKE_OPERATION_INIT { 0, { .dummy = 0 } }
|
||||
|
||||
struct psa_pake_cipher_suite_s {
|
||||
psa_algorithm_t algorithm;
|
||||
@@ -1904,35 +1897,15 @@ static inline void psa_pake_cs_set_hash(psa_pake_cipher_suite_t *cipher_suite,
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_JPAKE)
|
||||
#include <mbedtls/ecjpake.h>
|
||||
/* Note: the format for mbedtls_ecjpake_read/write function has an extra
|
||||
* length byte for each step, plus an extra 3 bytes for ECParameters in the
|
||||
* server's 2nd round. */
|
||||
#define MBEDTLS_PSA_PAKE_BUFFER_SIZE ((3 + 1 + 65 + 1 + 65 + 1 + 32) * 2)
|
||||
#endif
|
||||
|
||||
struct psa_pake_operation_s {
|
||||
psa_algorithm_t MBEDTLS_PRIVATE(alg);
|
||||
unsigned int MBEDTLS_PRIVATE(state);
|
||||
unsigned int MBEDTLS_PRIVATE(sequence);
|
||||
#if defined(MBEDTLS_PSA_BUILTIN_PAKE)
|
||||
unsigned int MBEDTLS_PRIVATE(input_step);
|
||||
unsigned int MBEDTLS_PRIVATE(output_step);
|
||||
uint8_t *MBEDTLS_PRIVATE(password);
|
||||
size_t MBEDTLS_PRIVATE(password_len);
|
||||
psa_pake_role_t MBEDTLS_PRIVATE(role);
|
||||
uint8_t MBEDTLS_PRIVATE(buffer[MBEDTLS_PSA_PAKE_BUFFER_SIZE]);
|
||||
size_t MBEDTLS_PRIVATE(buffer_length);
|
||||
size_t MBEDTLS_PRIVATE(buffer_offset);
|
||||
#endif
|
||||
union {
|
||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_JPAKE)
|
||||
mbedtls_ecjpake_context ecjpake;
|
||||
#endif
|
||||
/* Make the union non-empty even with no supported algorithms. */
|
||||
uint8_t dummy;
|
||||
} MBEDTLS_PRIVATE(ctx);
|
||||
/** Unique ID indicating which driver got assigned to do the
|
||||
* operation. Since driver contexts are driver-specific, swapping
|
||||
* drivers halfway through the operation is not supported.
|
||||
* ID values are auto-generated in psa_crypto_driver_wrappers.h
|
||||
* ID value zero means the context is not valid or not assigned to
|
||||
* any driver (i.e. none of the driver contexts are active). */
|
||||
unsigned int MBEDTLS_PRIVATE(id);
|
||||
psa_driver_pake_context_t MBEDTLS_PRIVATE(ctx);
|
||||
};
|
||||
|
||||
static inline struct psa_pake_cipher_suite_s psa_pake_cipher_suite_init(void)
|
||||
|
Reference in New Issue
Block a user