Tom Cosgrove
c8de362202
Merge pull request #8665 from ivq/reduce_static_mem
...
Reduce many unnecessary static memory consumption
2024-02-07 23:26:27 +00:00
Chien Wong
4e9683e818
Reduce many unnecessary static memory consumption
...
.data section of ssl_client1 becomes 320 bytes smaller on AMD64.
Signed-off-by: Chien Wong <m@xv97.com>
2024-02-06 17:50:44 +08:00
Valerio Setti
a45a399a6b
lib: remove NULL pointer checks performed with MBEDTLS_INTERNAL_VALIDATE[_RET]
...
Symbols defined starting from MBEDTLS_INTERNAL_VALIDATE[_RET]
are removed as well.
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-01-29 12:00:15 +01:00
Dave Rodgman
16799db69a
update headers
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-11-02 19:47:20 +00:00
Janos Follath
c25567af23
Move variant test to ecp_curves
...
We would like to de-duplicate ecp.c, but ecp_curves.c remains duplicated
and we still want to test for the active variant.
Signed-off-by: Janos Follath <janos.follath@arm.com>
2023-08-02 10:32:21 +01:00
Xiaokang Qian
59159abcce
Fix fast quasi-reduction modulo value of p192K1 in comments
...
Signed-off-by: Xiaokang Qian <xiaokang.qian@arm.com>
2023-07-31 06:46:28 +00:00
Xiaokang Qian
796500e751
Fix the type cast(size_t to unsigned short) warning
...
Signed-off-by: Xiaokang Qian <xiaokang.qian@arm.com>
2023-07-31 06:46:28 +00:00
Xiaokang Qian
02a3e0318f
Declare mbedtls_ecp_fix_negative() always static to fix check_name failures
...
Signed-off-by: Xiaokang Qian <xiaokang.qian@arm.com>
2023-07-31 06:46:28 +00:00
Xiaokang Qian
a8d30ac7e5
Use new ECP_LIGHT symbol in ecp_curves.c
...
Signed-off-by: Xiaokang Qian <xiaokang.qian@arm.com>
2023-07-31 06:46:28 +00:00
Xiaokang Qian
be4d6b62ab
Fix use of sizeof without brackets in ecp_curves.c
...
Signed-off-by: Xiaokang Qian <xiaokang.qian@arm.com>
2023-07-31 06:46:28 +00:00
Xiaokang Qian
748a362fd0
Revert ecp_curves.c to commit 449bd83
to save code size
...
Signed-off-by: Xiaokang Qian <xiaokang.qian@arm.com>
2023-07-31 06:46:28 +00:00
Xiaokang Qian
73d98405b8
Rework the clone of ecp_curves.c
...
Change macro guard
rebase ecp_curves_new.c to the latest ecp_curves.c
Signed-off-by: Xiaokang Qian <xiaokang.qian@arm.com>
2023-07-21 08:22:12 +00:00
Xiaokang Qian
dc2ea2705b
Clone the ecp_curve.c file as ecp_curve_new.c
...
Use macro guard MBEDTLS_ECP_WITH_MPI_UINT/STRUCT to enable
either c file
Signed-off-by: Xiaokang Qian <xiaokang.qian@arm.com>
2023-07-21 08:22:11 +00:00
Dave Rodgman
8e8e6b9be3
Merge pull request #7934 from AgathiyanB/move-declarations-to-top
...
Move declarations to top of functions
2023-07-19 15:25:27 +01:00
Dave Rodgman
b8f18850c6
Align ECP_MPI_INIT parameter order with mbedtls_mpi struct order
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-07-18 13:53:07 +02:00
Agathiyan Bragadeesh
ec4c91ecc1
Move declaration in ecp_mod_koblitz to top
...
Signed-off-by: Agathiyan Bragadeesh <agathiyan.bragadeesh2@arm.com>
2023-07-17 12:21:06 +01:00
Dave Rodgman
84eaefa43e
Use designated initializers for mbedtls_mpi
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-07-11 16:02:46 +01:00
Gilles Peskine
053022fe24
Reduce the size of mbedtls_mpi
...
Reduce the size of mbedtls_mpi from 3 words to 2 on most architectures.
This also reduces the code size significantly in bignum.o and ecp_curves.o,
with negligible variations in other modules.
This removes the ability to set MBEDTLS_MPI_MAX_LIMBS to a value >=65536,
but we don't support customizing this value anyway (it's always 10000).
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-06-29 19:33:44 +02:00
Minos Galanakis
c4e4958326
ecp_curves: Adjusted expected_width inputs to use BITS_TO_LIMBS
macro.
...
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2023-06-27 14:07:07 +01:00
Minos Galanakis
25d998b3b9
ecp_curves: Fixed modp pointers on mbedtls_ecp_modulus_setup
.
...
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2023-06-25 21:08:58 +01:00
Paul Elliott
3048c8c906
Merge pull request #7725 from minosgalanakis/ecp/7268_add_optimised_reduction_setup_3
...
[Bignum] Add optimised reduction setup
2023-06-22 16:30:39 +01:00
Minos Galanakis
2a03fd3b7b
bignum_mod: Added a typedef for OPT_RED function pointer.
...
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2023-06-22 09:14:28 +01:00
Paul Elliott
215ed131cf
Fix 32 bit unreachable code build failure
...
Given the size of ciL is set dependant on MBEDTLS_HAVE_INT32 /
MBEDTLS_HAVE_INT64, clang rightfully reports this as unreachable code in
32 bit builds. Fix this by using #define guards instead.
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-06-20 17:55:15 +01:00
Minos Galanakis
de87461c23
ecp_curves: Updated the optimised reduction function pointer.
...
This patch modifies the `mbedtls_mpi_opt_red_struct` to use an
mpi_uint * pointer and size_t limps arguments.
The methods interacting with this pointer have been updated
accordingly:
- mbedtls_mpi_mod_optred_modulus_setup
- mbedtls_ecp_modulus_setup
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2023-06-16 13:48:47 +01:00
Minos Galanakis
65210952ec
ecp_curves: Updated mbedtls_ecp_modulus_setup
to use optimised reduction.
...
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2023-06-16 13:48:47 +01:00
Minos Galanakis
1d3e332986
ecp_curves: Updated input argument for mbedtls_ecp_modulus_setup
.
...
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2023-06-16 13:48:47 +01:00
Minos Galanakis
88e16dfa2a
bignum_mod: Refactored mbedtls_mpi_mod_modulus_setup()
...
This patch removes the `int_rep` input parameter for modular
setup, aiming to align it with the optred variant.
Test and test-suite helper functions have been updated
accordingly.
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2023-06-16 13:48:47 +01:00
Paul Elliott
a2e48f751b
Split out mbedtls_ecp_mod_p448_raw()
...
Switch testing over to using the generic raw functions.
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-06-15 17:16:38 +01:00
Paul Elliott
b4df176610
Merge pull request #7637 from paul-elliott-arm/fixed_ecp_mod_p448
...
[Bignum] Fixed width for ecp mod p448
2023-06-15 17:12:02 +01:00
Paul Elliott
bed9ac7b2d
Optimise final 2 rounds
...
Final two rounds logic could be significantly simplified.
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-06-14 19:20:33 +01:00
Paul Elliott
b8f7305b02
Replace sizeof(mbedtls_mpi_uint) with ciL define
...
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-06-14 17:52:42 +01:00
Paul Elliott
3646dc78bc
Fix coding style issue
...
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-06-14 08:51:08 +01:00
Paul Elliott
436f2ad37c
Three round solution
...
Attempt to fix failing test by dealing with overflow with three rounds,
instead of previous subtract modulus solution. Also optimise out shifts
by using memcpy / memmove instead. Remove final sub to return canonical
result, as this is not required here.
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-06-13 17:39:44 +01:00
Xiaokang Qian
fcdd0477b3
Replace loop zeroise with memset
...
Signed-off-by: Xiaokang Qian <xiaokang.qian@arm.com>
2023-06-08 10:03:53 +00:00
Janos Follath
035e5fc885
Add comments to 448 optimised reduction
...
Signed-off-by: Janos Follath <janos.follath@arm.com>
2023-06-08 09:44:30 +00:00
Paul Elliott
805a0a2d06
Merge pull request #7591 from minosgalanakis/ecp/6028_xtract_fast_reduction_curve25519
...
[Bignum] Implement fast reduction curve25519
2023-06-01 17:43:35 +01:00
Paul Elliott
edc97680d5
Fix output width of mbedtls_ecp_mod_p448() to 448 bits
...
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-05-25 17:37:58 +01:00
Paul Elliott
981d8b6fc7
Merge pull request #7566 from paul-elliott-arm/core_ecp_mod_p448
...
[Bignum] Convert ecp_mod_p448 over to using core functions
2023-05-25 17:11:57 +01:00
Paul Elliott
7050662a48
Correct comment header block
...
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-05-24 17:31:57 +01:00
Minos Galanakis
e72bf2da3d
ecp_curves: Adjusted the expected limb size for ecp_mod_p255()
.
...
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2023-05-24 15:13:42 +01:00
Paul Elliott
3b6bf105d1
Fix missed renames from N to X
...
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-05-23 17:51:52 +01:00
Minos Galanakis
ec00b500b5
ecp_curves: Adjusted input checking for ecp_mod_p255
.
...
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2023-05-23 17:31:01 +01:00
Minos Galanakis
d6beda7af9
ecp_curves: Extended documentation for CURVE25519.
...
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2023-05-23 09:57:09 +01:00
Minos Galanakis
47249fd9ec
ecp_curves: Added documentation for mbedtls_ecp_mod_p255_raw
...
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2023-05-23 09:57:09 +01:00
Minos Galanakis
31f0b452c7
ecp_curves: Reintroduced input checking for
...
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2023-05-23 09:57:09 +01:00
Minos Galanakis
65c386ee3d
ecp_curves: Switched to dynamic memory for
...
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2023-05-23 09:57:09 +01:00
Minos Galanakis
2daa374ea8
ecp_curves: Minor refactoring of mbedtls_ecp_mod_p255_raw()
...
* Fixed whitespace issues.
* Renamed variables to align with bignum conventions.
* Updated alignment on test input data.
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2023-05-23 09:57:09 +01:00
Minos Galanakis
d0292c2aca
ecp_curves: Refactored mbedtls_ecp_mod_p255
.
...
This patch introduces following methods, as implemented in the
design prototype, and updates them to utilise the _core methods
available for multiplication and addition.
* `mbedtls_ecp_mod_p255()`
* `mbedtls_ecp_mod_p255_raw()`
An entry has been exposed in the `ecp_invasive.h` header
to facilitate testing.
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2023-05-22 22:22:32 +01:00
Gabor Mezei
d56e6e008b
Add input parameter length check for the Koblitz reduction
...
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2023-05-17 17:51:19 +02:00
Paul Elliott
c05f51ded9
Convert comments over to X rather than N
...
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-05-17 14:29:44 +01:00