Minos Galanakis 
							
						 
					 
					
						
						
							
						
						00bd8925a7 
					 
					
						
						
							
							bignum: Removed merge scaffolding.  
						
						... 
						
						
						
						Signed-off-by: Minos Galanakis <minos.galanakis@arm.com > 
						
						
					 
					
						2023-04-05 16:13:11 +01:00 
						 
				 
			
				
					
						
							
							
								Tom Cosgrove 
							
						 
					 
					
						
						
							
						
						6af26f3838 
					 
					
						
						
							
							Tidy up, remove MPI_CORE(), apply the naming convention, and use the new mbedtls_mpi_core_mul()  
						
						... 
						
						
						
						Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com >
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com > 
						
						
					 
					
						2023-03-31 16:16:00 +02:00 
						 
				 
			
				
					
						
							
							
								Hanno Becker 
							
						 
					 
					
						
						
							
						
						4ae890bbd0 
					 
					
						
						
							
							Extract MPI_CORE(mul) from the prototype  
						
						... 
						
						
						
						Signed-off-by: Hanno Becker <hanno.becker@arm.com >
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com > 
						
						
					 
					
						2023-03-31 16:10:34 +02:00 
						 
				 
			
				
					
						
							
							
								Gilles Peskine 
							
						 
					 
					
						
						
							
						
						449bd8303e 
					 
					
						
						
							
							Switch to the new code style  
						
						... 
						
						
						
						Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com > 
						
						
					 
					
						2023-01-11 14:50:10 +01:00 
						 
				 
			
				
					
						
							
							
								Gilles Peskine 
							
						 
					 
					
						
						
							
						
						e162b4725c 
					 
					
						
						
							
							Merge pull request  #6777  from tom-cosgrove-arm/issue-6292-mod_inv  
						
						... 
						
						
						
						Bignum: Implement high level fixed width modular inversion 
						
						
					 
					
						2022-12-17 13:26:02 +01:00 
						 
				 
			
				
					
						
							
							
								Manuel Pégourié-Gonnard 
							
						 
					 
					
						
						
							
						
						5bf8629b2c 
					 
					
						
						
							
							Merge pull request  #6303  from gilles-peskine-arm/bignum-core-random  
						
						... 
						
						
						
						Bignum: Implement mbedtls_mpi_core_random 
						
						
					 
					
						2022-12-16 09:58:07 +01:00 
						 
				 
			
				
					
						
							
							
								Tom Cosgrove 
							
						 
					 
					
						
						
							
						
						786848b5c5 
					 
					
						
						
							
							Add low-level Montgomery conversion functions to bignum_core  
						
						... 
						
						
						
						Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com > 
						
						
					 
					
						2022-12-15 16:56:36 +00:00 
						 
				 
			
				
					
						
							
							
								Tom Cosgrove 
							
						 
					 
					
						
						
							
						
						30f3b4d601 
					 
					
						
						
							
							Add mbedtls_mpi_core_check_zero_ct() and tests  
						
						... 
						
						
						
						Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com > 
						
						
					 
					
						2022-12-15 16:56:36 +00:00 
						 
				 
			
				
					
						
							
							
								Gilles Peskine 
							
						 
					 
					
						
						
							
						
						6b7ce968d2 
					 
					
						
						
							
							Clarify some comments  
						
						... 
						
						
						
						Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com > 
						
						
					 
					
						2022-12-15 15:04:33 +01:00 
						 
				 
			
				
					
						
							
							
								Manuel Pégourié-Gonnard 
							
						 
					 
					
						
						
							
						
						a9ac61203b 
					 
					
						
						
							
							Merge pull request  #6666  from daverodgman/fast_unaligned  
						
						... 
						
						
						
						Fast unaligned memory access macros 
						
						
					 
					
						2022-12-12 12:18:17 +01:00 
						 
				 
			
				
					
						
							
							
								Tom Cosgrove 
							
						 
					 
					
						
						
							
						
						0a0ddedfb7 
					 
					
						
						
							
							Have mbedtls_mpi_core_exp_mod() take a temporary instead of allocating memory  
						
						... 
						
						
						
						Last PR needed for #6293 
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com > 
						
						
					 
					
						2022-12-06 14:37:18 +00:00 
						 
				 
			
				
					
						
							
							
								Tom Cosgrove 
							
						 
					 
					
						
						
							
						
						ecda186893 
					 
					
						
						
							
							Require input to mbedtls_mpi_core_exp_mod() to already be in Montgomery form  
						
						... 
						
						
						
						Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com > 
						
						
					 
					
						2022-12-06 10:46:30 +00:00 
						 
				 
			
				
					
						
							
							
								Gilles Peskine 
							
						 
					 
					
						
						
							
						
						70375b2028 
					 
					
						
						
							
							Move mbedtls_mpi_core_random to the proper source file  
						
						... 
						
						
						
						Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com > 
						
						
					 
					
						2022-12-01 23:46:26 +01:00 
						 
				 
			
				
					
						
							
							
								Gilles Peskine 
							
						 
					 
					
						
						
							
						
						6f949ea67b 
					 
					
						
						
							
							New constant-flow function mbedtls_mpi_core_uint_le_mpi  
						
						... 
						
						
						
						Compare a single-limb MPI with a multi-limb MPI. This is rather ad hoc, but
will be useful for mbedtls_mpi_core_random.
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com > 
						
						
					 
					
						2022-12-01 23:06:43 +01:00 
						 
				 
			
				
					
						
							
							
								Gilles Peskine 
							
						 
					 
					
						
						
							
						
						edaa17b350 
					 
					
						
						
							
							Merge pull request  #6547  from yanesca/extract_mod_exp_from_prototype  
						
						... 
						
						
						
						Bignum: Extract mod exp from prototype 
						
						
					 
					
						2022-11-29 21:40:07 +01:00 
						 
				 
			
				
					
						
							
							
								Dave Rodgman 
							
						 
					 
					
						
						
							
						
						6d23ff60dd 
					 
					
						
						
							
							Make use of optimised bswap from bignum  
						
						... 
						
						
						
						Signed-off-by: Dave Rodgman <dave.rodgman@arm.com > 
						
						
					 
					
						2022-11-28 15:41:13 +00:00 
						 
				 
			
				
					
						
							
							
								Janos Follath 
							
						 
					 
					
						
						
							
						
						3321b5842c 
					 
					
						
						
							
							mpi_exp_mod: improve documentation  
						
						... 
						
						
						
						Signed-off-by: Janos Follath <janos.follath@arm.com > 
						
						
					 
					
						2022-11-22 21:22:54 +00:00 
						 
				 
			
				
					
						
							
							
								Gilles Peskine 
							
						 
					 
					
						
						
							
						
						7d89d351e6 
					 
					
						
						
							
							Zeroize sensitive data  
						
						... 
						
						
						
						Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com > 
						
						
					 
					
						2022-11-22 21:22:54 +00:00 
						 
				 
			
				
					
						
							
							
								Gilles Peskine 
							
						 
					 
					
						
						
							
						
						0b270a5603 
					 
					
						
						
							
							Explain a little more  
						
						... 
						
						
						
						Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com > 
						
						
					 
					
						2022-11-22 21:22:54 +00:00 
						 
				 
			
				
					
						
							
							
								Gilles Peskine 
							
						 
					 
					
						
						
							
						
						4380d7b7f3 
					 
					
						
						
							
							Simplify cleanup logic  
						
						... 
						
						
						
						Take advantage of the fact that there's a single point of failure.
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com > 
						
						
					 
					
						2022-11-22 21:22:54 +00:00 
						 
				 
			
				
					
						
							
							
								Gilles Peskine 
							
						 
					 
					
						
						
							
						
						3b63d09fea 
					 
					
						
						
							
							Make the main loop's logic clearer  
						
						... 
						
						
						
						The loop ends when there are no more bits to process, with one twist: when
that happens, we need to clear the window one last time. Since the window
does not start empty (E_limbs==0 is not supported), the loop always starts
with a non-empty window and some bits to process. So it's correct to move
the window clearing logic to the end of the loop. This lets us exit the loop
when the end of the exponent is reached.
It would be clearer not to do the final window clearing inside the loop, so
we wouldn't need to repeat the loop termination condition (end of exponent
reached) inside the loop. However, this requires duplicating the code to
clear the window. Empirically, this causes a significant code size increase,
even if the window clearing code is placed into a function.
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com > 
						
						
					 
					
						2022-11-22 21:22:54 +00:00 
						 
				 
			
				
					
						
							
							
								Gilles Peskine 
							
						 
					 
					
						
						
							
						
						c718a3ce94 
					 
					
						
						
							
							Simplify exponent bit selection  
						
						... 
						
						
						
						Use indices instead of mutating data to extract the bits of the exponent.
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com > 
						
						
					 
					
						2022-11-22 21:22:54 +00:00 
						 
				 
			
				
					
						
							
							
								Gilles Peskine 
							
						 
					 
					
						
						
							
						
						d83b5cb504 
					 
					
						
						
							
							Local readability improvements  
						
						... 
						
						
						
						Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com > 
						
						
					 
					
						2022-11-22 21:22:54 +00:00 
						 
				 
			
				
					
						
							
							
								Gilles Peskine 
							
						 
					 
					
						
						
							
						
						0de0a049f1 
					 
					
						
						
							
							Move window precomputation into an auxiliary function  
						
						... 
						
						
						
						Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com > 
						
						
					 
					
						2022-11-22 21:22:54 +00:00 
						 
				 
			
				
					
						
							
							
								Gilles Peskine 
							
						 
					 
					
						
						
							
						
						cf979b0fc1 
					 
					
						
						
							
							Define variables closer to their use  
						
						... 
						
						
						
						Make variables const where possible.
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com > 
						
						
					 
					
						2022-11-22 21:22:54 +00:00 
						 
				 
			
				
					
						
							
							
								Gilles Peskine 
							
						 
					 
					
						
						
							
						
						7af166b827 
					 
					
						
						
							
							Change E closer to where it's used  
						
						... 
						
						
						
						Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com > 
						
						
					 
					
						2022-11-22 21:22:54 +00:00 
						 
				 
			
				
					
						
							
							
								Gilles Peskine 
							
						 
					 
					
						
						
							
						
						07f2c69511 
					 
					
						
						
							
							More consistent variable names  
						
						... 
						
						
						
						Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com > 
						
						
					 
					
						2022-11-22 21:22:53 +00:00 
						 
				 
			
				
					
						
							
							
								Janos Follath 
							
						 
					 
					
						
						
							
						
						0ec6e3f394 
					 
					
						
						
							
							mpi_core_mod_exp: improve style and documentation  
						
						... 
						
						
						
						No intended change in behaviour.
Signed-off-by: Janos Follath <janos.follath@arm.com > 
						
						
					 
					
						2022-11-22 21:22:53 +00:00 
						 
				 
			
				
					
						
							
							
								Janos Follath 
							
						 
					 
					
						
						
							
						
						a77911e5c1 
					 
					
						
						
							
							core_exp_mod: improve window selection  
						
						... 
						
						
						
						We are looking at the exponent at limb granularity and therefore
exponent bits can't go below 32.
The `mpi_` prefix is also removed as it is better not to have prefix at
all than to have just a partial. (Full prefix would be overly long and
would hurt readability.)
Signed-off-by: Janos Follath <janos.follath@arm.com > 
						
						
					 
					
						2022-11-22 21:22:53 +00:00 
						 
				 
			
				
					
						
							
							
								Janos Follath 
							
						 
					 
					
						
						
							
						
						59cbd1be27 
					 
					
						
						
							
							Make mbedtls_mpi_core_ct_uint_table_lookup static  
						
						... 
						
						
						
						Now that we have a function that calls
mbedtls_mpi_core_ct_uint_table_lookup(), the compiler won't complain if
we make it static.
Signed-off-by: Janos Follath <janos.follath@arm.com > 
						
						
					 
					
						2022-11-22 21:22:53 +00:00 
						 
				 
			
				
					
						
							
							
								Janos Follath 
							
						 
					 
					
						
						
							
						
						bad42c4d0d 
					 
					
						
						
							
							mpi_core_exp_mod: fix local variable type  
						
						... 
						
						
						
						On platforms with size_t different from int, mismatch between size_t and
mpi_uint can cause incorrect results or complaints from the compiler.
Signed-off-by: Janos Follath <janos.follath@arm.com >
mpi_core_exp_mod: Cast local variable explicitly
Signed-off-by: Janos Follath <janos.follath@arm.com > 
						
						
					 
					
						2022-11-22 21:22:53 +00:00 
						 
				 
			
				
					
						
							
							
								Janos Follath 
							
						 
					 
					
						
						
							
						
						b6673f0f19 
					 
					
						
						
							
							Add modular exponentiation to bignum core  
						
						... 
						
						
						
						Signed-off-by: Janos Follath <janos.follath@arm.com > 
						
						
					 
					
						2022-11-22 21:22:53 +00:00 
						 
				 
			
				
					
						
							
							
								Tom Cosgrove 
							
						 
					 
					
						
						
							
						
						f7ff4c9a11 
					 
					
						
						
							
							Tidy up, remove MPI_CORE(), and apply the naming convention  
						
						... 
						
						
						
						Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com > 
						
						
					 
					
						2022-11-22 14:58:15 +00:00 
						 
				 
			
				
					
						
							
							
								Hanno Becker 
							
						 
					 
					
						
						
							
						
						d9b2348d8f 
					 
					
						
						
							
							Extract MPI_CORE(sub_int) from the prototype  
						
						... 
						
						
						
						Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com > 
						
						
					 
					
						2022-11-22 14:58:15 +00:00 
						 
				 
			
				
					
						
							
							
								Janos Follath 
							
						 
					 
					
						
						
							
						
						2a8bcf8c6f 
					 
					
						
						
							
							Add bignum merge scaffolding  
						
						... 
						
						
						
						Signed-off-by: Janos Follath <janos.follath@arm.com > 
						
						
					 
					
						2022-11-02 17:25:48 +00:00 
						 
				 
			
				
					
						
							
							
								Gilles Peskine 
							
						 
					 
					
						
						
							
						
						22cdd0ccd3 
					 
					
						
						
							
							Update some internal comments  
						
						... 
						
						
						
						The refactoring of fill_random had left some obsolete bits in comments.
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com > 
						
						
					 
					
						2022-11-02 16:00:01 +01:00 
						 
				 
			
				
					
						
							
							
								Gilles Peskine 
							
						 
					 
					
						
						
							
						
						009d195a56 
					 
					
						
						
							
							Move mbedtls_mpi_core_fill_random to the proper .c file  
						
						... 
						
						
						
						Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com > 
						
						
					 
					
						2022-11-02 16:00:01 +01:00 
						 
				 
			
				
					
						
							
							
								Janos Follath 
							
						 
					 
					
						
						
							
						
						8904a2db29 
					 
					
						
						
							
							mpi_core_ct_uint_table_lookup: style and docs  
						
						... 
						
						
						
						Signed-off-by: Janos Follath <janos.follath@arm.com > 
						
						
					 
					
						2022-10-31 16:51:56 +00:00 
						 
				 
			
				
					
						
							
							
								Janos Follath 
							
						 
					 
					
						
						
							
						
						e50f2f1a8e 
					 
					
						
						
							
							Add mbedtls_mpi_core_ct_uint_table_lookup  
						
						... 
						
						
						
						This will be needed for extracting modular exponentiation from the
prototype. The function signature is kept aligned to the prototype, but
the implementation is new. (The implementation of this function in the
prototype has further optimisations which are out of scope for now.)
The function is not reused in the bignum counterpart as it will become
redundant soon.
This function is meant to be static, but doesn't have the qualifier as
it is not used yet and would cause compiler warnings. The
MBEDTLS_STATIC_TESTABLE macro will be added in a later commit.
Signed-off-by: Janos Follath <janos.follath@arm.com > 
						
						
					 
					
						2022-10-31 11:32:55 +00:00 
						 
				 
			
				
					
						
							
							
								Gilles Peskine 
							
						 
					 
					
						
						
							
						
						9603daddaa 
					 
					
						
						
							
							Merge pull request  #6230  from tom-cosgrove-arm/issue-6223-core-add  
						
						... 
						
						
						
						Bignum: extract core_add from the prototype 
						
						
					 
					
						2022-10-27 11:25:27 +02:00 
						 
				 
			
				
					
						
							
							
								Tom Cosgrove 
							
						 
					 
					
						
						
							
						
						af7d44b4d2 
					 
					
						
						
							
							Tidy up, remove MPI_CORE(), apply the naming convention, and use the new mbedtls_mpi_core_add()  
						
						... 
						
						
						
						Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com > 
						
						
					 
					
						2022-10-25 16:29:58 +01:00 
						 
				 
			
				
					
						
							
							
								Hanno Becker 
							
						 
					 
					
						
						
							
						
						c98871339d 
					 
					
						
						
							
							Extract MPI_CORE(add) from the prototype  
						
						... 
						
						
						
						Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com > 
						
						
					 
					
						2022-10-25 16:29:58 +01:00 
						 
				 
			
				
					
						
							
							
								Minos Galanakis 
							
						 
					 
					
						
						
							
						
						a081c51cd3 
					 
					
						
						
							
							Renamed mpi_core_get_mont_R2_unsafe_neg -> mpi_core_get_mont_r2_unsafe_neg  
						
						... 
						
						
						
						Signed-off-by: Minos Galanakis <minos.galanakis@arm.com > 
						
						
					 
					
						2022-10-25 15:12:38 +01:00 
						 
				 
			
				
					
						
							
							
								Minos Galanakis 
							
						 
					 
					
						
						
							
						
						51d638baf6 
					 
					
						
						
							
							bignum_core: Style update  
						
						... 
						
						
						
						'mbedtls_mpi_core_get_mont_R2_unsafe' aligns const
keyword to match the style of the rest of the module.
Documentation is also updated to remove
`MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED`.
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com > 
						
						
					 
					
						2022-10-25 15:12:38 +01:00 
						 
				 
			
				
					
						
							
							
								Minos Galanakis 
							
						 
					 
					
						
						
							
						
						ae4fb671b4 
					 
					
						
						
							
							mbedtls_mpi_core_get_mont_R2_unsafe: Removed NULL input checking  
						
						... 
						
						
						
						Signed-off-by: Minos Galanakis <minos.galanakis@arm.com > 
						
						
					 
					
						2022-10-25 15:12:38 +01:00 
						 
				 
			
				
					
						
							
							
								Minos Galanakis 
							
						 
					 
					
						
						
							
						
						4f43f61c6a 
					 
					
						
						
							
							Renamed mbedtls_mpi_get_montgomery_constant_unsafe to mpi_core_get_mont_R2_unsafe  
						
						... 
						
						
						
						Signed-off-by: Minos Galanakis <minos.galanakis@arm.com > 
						
						
					 
					
						2022-10-25 15:12:23 +01:00 
						 
				 
			
				
					
						
							
							
								Hanno Becker 
							
						 
					 
					
						
						
							
						
						ec440f2397 
					 
					
						
						
							
							bignum_mod_raw: Ported mbedtls_mpi_get_montgomery_constant_unsafe from prototype  
						
						... 
						
						
						
						Signed-off-by: Minos Galanakis <minos.galanakis@arm.com > 
						
						
					 
					
						2022-10-25 15:08:08 +01:00 
						 
				 
			
				
					
						
							
							
								Gilles Peskine 
							
						 
					 
					
						
						
							
						
						c279b2fa4a 
					 
					
						
						
							
							Move mbedtls_mpi_core_shift_r to the proper source file  
						
						... 
						
						
						
						Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com > 
						
						
					 
					
						2022-10-20 11:40:15 +02:00 
						 
				 
			
				
					
						
							
							
								Gilles Peskine 
							
						 
					 
					
						
						
							
						
						db2996357c 
					 
					
						
						
							
							Merge pull request  #6289  from gabor-mezei-arm/6237_Add_conditional_assign_and_swap_for_bignum  
						
						... 
						
						
						
						Bignum: Add safe conditional assign and swap for the new MPI types 
						
						
					 
					
						2022-10-19 15:51:19 +02:00 
						 
				 
			
				
					
						
							
							
								Gilles Peskine 
							
						 
					 
					
						
						
							
						
						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