b45b8ce474
Disable MBEDTLS_PSA_CRYPTO_SE_C is hash psa builds
...
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com >
2023-02-22 11:30:32 +01:00
6d77830c6a
Remove redundant code
...
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com >
2023-02-22 11:30:32 +01:00
dff21d3429
Move jpake role check to psa_pake_complete_inputs()
...
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com >
2023-02-22 11:30:32 +01:00
4fcc61eec0
Optimize psa_pake_ecjpake_setup()
...
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com >
2023-02-22 11:30:32 +01:00
849c35f8b4
Remove pake abort on failure from driver (handled by core)
...
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com >
2023-02-22 11:30:32 +01:00
e1d51bf3c9
Optimieze psa_pake_complete_inputs()
...
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com >
2023-02-22 11:30:32 +01:00
3e784d8981
PSA crypto pake: call abort on each failure
...
Adapt driver hook counters in pake driver test.
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com >
2023-02-22 11:30:32 +01:00
a48cf500d7
mbedtls_test_transparent_pake_abort: call driver/build-in impl even when status is forced
...
This is done to solve the problem with memory leak when pake abort status is forced. In this case the driver/build-in abort function was not executed.
After failure core clears the operation object and no successive abort call is possible.
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com >
2023-02-22 11:30:32 +01:00
d69dca9fc4
Rework psa_pake_abort
...
- Fix potential issue with freeing password
- Clean operation object even if psa_driver_wrapper_pake_abort fails
- Remove redundant code
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com >
2023-02-22 11:30:32 +01:00
f62b3bb087
Optimization of pake core functions
...
Adapt pake test (passing NULL buffers is not allowed).
Passing the null buffer to psa_pake_output results in a hard fault.
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com >
2023-02-22 11:30:32 +01:00
ac067d779e
Fix PSA_PAKE_OPERATION_INIT macro
...
Needs to be adapted for the clang -Wall -Wextra.
Requirea to explicitly initialize all the members of the struct that is the first member in the union.
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com >
2023-02-22 11:30:32 +01:00
9dd2440c95
Change pake input: key_lifetime -> key attributes
...
In the future key attributes will be available for opaque driver via psa_crypto_driver_pake_get_password_key().
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com >
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com >
2023-02-22 11:30:32 +01:00
d5d28a217f
Use operation alg for locking key slot
...
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com >
2023-02-22 11:30:32 +01:00
1c3cfb4fb0
Introduce PSA_PAKE_OPERATION_STAGE_SETUP to optimize out alg checks
...
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com >
2023-02-22 11:30:32 +01:00
ff01bc496c
Remove j-pake specific checks from psa_pake_setup
...
mbedtls_psa_pake_setup has already check for PSA_PAKE_PRIMITIVE_TYPE_ECC primitive.
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com >
2023-02-22 11:30:32 +01:00
dde6a910bb
Optimize out psa_pake_computation_stage_t
...
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com >
2023-02-22 11:30:32 +01:00
27cd488088
Update the documentation (v.3)
...
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com >
2023-02-22 11:30:32 +01:00
38b4e1761d
Remove typedef for enum
...
Workaround for CI error:
Parsing source code...
Compiling...
=============
All symbols in header: PASS
Naming patterns of public_macros: PASS
Naming patterns of internal_macros: PASS
Naming patterns of enum_consts: FAIL
> include/psa/crypto_extra.h:1857: 'return' does not match the required
pattern '^(MBEDTLS|PSA)_[0-9A-Z_]*[0-9A-Z]$'.
|
1857 | return cipher_suite->algorithm;
| ^^^^^^
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com >
2023-02-22 11:30:32 +01:00
33ea63d766
Minor updates of the documentation
...
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com >
2023-02-22 11:30:32 +01:00
5cbca790f7
Make usage of pake input getters
...
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com >
2023-02-22 11:30:32 +01:00
18620a3b1c
Make copy of inputs on stack before passing to psa_driver_wrapper_pake_setup
...
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com >
2023-02-22 11:30:32 +01:00
ca8d2b2589
Add get-data functions for inputs + tests
...
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com >
2023-02-22 11:30:32 +01:00
0f50f689b7
Remove redundant dummy fields inside unions
...
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com >
2023-02-22 11:30:32 +01:00
7b730175b3
Simplify psa_pake_computation_stage_s structure
...
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com >
2023-02-22 11:30:32 +01:00
b09c487546
Combine core pake computation stage(step,sequence,state) into single driver step
...
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com >
2023-02-22 11:30:31 +01:00
8c8ab26b2a
Update documentation (handling inputs, function names)
...
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com >
2023-02-22 11:30:31 +01:00
d67a5b6320
Update PAKE driver documentation (v.2)
...
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com >
2023-02-22 11:30:31 +01:00
5798003b99
Add enum that presents computation stage as single value
...
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com >
2023-02-22 11:30:31 +01:00
d6eb11007f
Add draft documentation for the PAKE driver dispatch logic
...
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com >
2023-02-22 11:30:31 +01:00
9a5b812aa8
Cleanup the code
...
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com >
2023-02-22 11:30:31 +01:00
fcd70e250f
Adapt pake driver wrapper tests for the new design
...
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com >
2023-02-22 11:30:31 +01:00
2797d37424
Split handling of memory allocation for password between core and driver
...
Driver is now responsible for creating its own copy of the password in the setup function.
After calling pake setup driver entry point core frees memory for password.
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com >
2023-02-22 11:30:31 +01:00
e12ed36a6c
Move JPAKE state machine logic from driver to core
...
- Add `alg` and `computation_stage` to `psa_pake_operation_s`.
Now when logic is moved to core information about `alg` is required.
`computation_stage` is a structure that provides a union of computation stages for pake algorithms.
- Move the jpake operation logic from driver to core. This requires changing driver entry points for `psa_pake_output`/`psa_pake_input` functions and adding a `computation_stage` parameter. I'm not sure if this solution is correct. Now the driver can check the current computation stage and perform some action. For jpake drivers `step` parameter is now not used, but I think it needs to stay as it might be needed for other pake algorithms.
- Removed test that seems to be redundant as we can't be sure that operation is aborted after failure.
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com >
2023-02-22 11:30:31 +01:00
be5e27b5ad
Remove redundant code
...
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com >
2023-02-22 11:30:31 +01:00
3f9dbac83f
Adapt ake driver tests to the new design
...
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com >
2023-02-22 11:30:31 +01:00
95629ab4ae
Add forced status for pake setup
...
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com >
2023-02-22 11:30:31 +01:00
c6b954686b
Adapt test_suite_psa_crypto_pake test for the new design
...
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com >
2023-02-22 11:30:31 +01:00
ca67483b15
psa_crypto_pake.h: adapt function descriptions
...
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com >
2023-02-22 11:30:31 +01:00
96ae8b939d
Move pake definitions to headers for composite algorithms
...
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com >
2023-02-22 11:30:31 +01:00
51eac53b93
Divide pake operation into two phases collecting inputs and computation.
...
Functions that only set inputs do not have driver entry points.
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com >
2023-02-22 11:25:30 +01:00
e5e41eb14c
Remove redundant line (fix rebase error)
...
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com >
2023-02-22 11:25:30 +01:00
061f6949fd
Make psa_get_and_lock_key_slot_with_policy() static function
...
psa_get_and_lock_key_slot_with_policy() becomes public temporarily as part of:
https://github.com/Mbed-TLS/mbedtls/pull/6608
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com >
2023-02-22 11:25:30 +01:00
0c78180ee5
mbedtls_psa_pake_get_implicit_key: move psa_key_derivation_input_bytes call to upper layer
...
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com >
2023-02-22 11:25:30 +01:00
4f0035be29
Add guards for buildin pake set_password function
...
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com >
2023-02-22 11:25:30 +01:00
7658a0768b
Add pake driver wrapper tests
...
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com >
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com >
2023-02-22 11:25:30 +01:00
061a016c65
Add ALG_TLS12_PRF, TLS12_PSK_TO_MS, LG_TLS12_ECJPAKE_TO_PMS support to test driver extensions
...
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com >
2023-02-22 11:25:30 +01:00
6a9785f061
Add pake.h to test driver header
...
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com >
2023-02-22 11:25:30 +01:00
6c7644150a
Adapt pake impl for driver dispatch
...
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com >
2023-02-22 11:25:30 +01:00
d91bcb7673
Refactor structures for pake driver support
...
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com >
2023-02-22 11:25:30 +01:00
03790029a6
Add test components to test accelerated pake and fallback
...
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com >
2023-02-22 11:25:30 +01:00