David Horstmann 
							
						 
					 
					
						
						
							
						
						671f5f539e 
					 
					
						
						
							
							Change psa_crypto_copy_output error code  
						
						... 
						
						
						
						When we are copying output, it makes sense to return
PSA_ERROR_BUFFER_TOO_SMALL since the buffer we are copying to is a user
output buffer.
Signed-off-by: David Horstmann <david.horstmann@arm.com > 
						
						
					 
					
						2023-11-20 13:03:43 +00:00 
						 
				 
			
				
					
						
							
							
								Ryan Everett 
							
						 
					 
					
						
						
							
						
						975d411d92 
					 
					
						
						
							
							Only set slot to OCCUPIED on successful key loading  
						
						... 
						
						
						
						Signed-off-by: Ryan Everett <ryan.everett@arm.com > 
						
						
					 
					
						2023-11-16 13:37:51 +00:00 
						 
				 
			
				
					
						
							
							
								David Horstmann 
							
						 
					 
					
						
						
							
						
						c5cc1c3a92 
					 
					
						
						
							
							Remove redundant NULL check  
						
						... 
						
						
						
						A NULL buffer with a non-zero length is an internal error, so just
check the length.
Signed-off-by: David Horstmann <david.horstmann@arm.com > 
						
						
					 
					
						2023-11-15 18:11:26 +00:00 
						 
				 
			
				
					
						
							
							
								David Horstmann 
							
						 
					 
					
						
						
							
						
						777e74130f 
					 
					
						
						
							
							Skip call to memcpy if buffer length is zero  
						
						... 
						
						
						
						This allows the copy functions to work when passed a (NULL, 0) buffer.
Signed-off-by: David Horstmann <david.horstmann@arm.com > 
						
						
					 
					
						2023-11-15 17:38:46 +00:00 
						 
				 
			
				
					
						
							
							
								David Horstmann 
							
						 
					 
					
						
						
							
						
						1b7279a849 
					 
					
						
						
							
							Make copy functions static-testable  
						
						... 
						
						
						
						This allows greater compiler optimisation.
Signed-off-by: David Horstmann <david.horstmann@arm.com > 
						
						
					 
					
						2023-11-15 17:26:18 +00:00 
						 
				 
			
				
					
						
							
							
								David Horstmann 
							
						 
					 
					
						
						
							
						
						c335a4e186 
					 
					
						
						
							
							Fix unintentional direct use of memcpy()  
						
						... 
						
						
						
						Change psa_crypto_output_copy_free() to use psa_crypto_copy_output()
rather than calling memcpy directly as was erroneously done previously.
Signed-off-by: David Horstmann <david.horstmann@arm.com > 
						
						
					 
					
						2023-11-15 16:00:28 +00:00 
						 
				 
			
				
					
						
							
							
								David Horstmann 
							
						 
					 
					
						
						
							
						
						9467ea343b 
					 
					
						
						
							
							Add psa_crypto_output_copy_free() implementation  
						
						... 
						
						
						
						Signed-off-by: David Horstmann <david.horstmann@arm.com > 
						
						
					 
					
						2023-11-08 18:13:23 +00:00 
						 
				 
			
				
					
						
							
							
								David Horstmann 
							
						 
					 
					
						
						
							
						
						ba3c7d649c 
					 
					
						
						
							
							Add implementation of psa_crypto_output_alloc()  
						
						... 
						
						
						
						Signed-off-by: David Horstmann <david.horstmann@arm.com > 
						
						
					 
					
						2023-11-08 18:13:23 +00:00 
						 
				 
			
				
					
						
							
							
								David Horstmann 
							
						 
					 
					
						
						
							
						
						e6042ffc49 
					 
					
						
						
							
							Add implementation of psa_crypto_input_copy_free()  
						
						... 
						
						
						
						Signed-off-by: David Horstmann <david.horstmann@arm.com > 
						
						
					 
					
						2023-11-08 18:13:23 +00:00 
						 
				 
			
				
					
						
							
							
								David Horstmann 
							
						 
					 
					
						
						
							
						
						4ac788573b 
					 
					
						
						
							
							Add psa_crypto_input_copy_alloc() implementation  
						
						... 
						
						
						
						Signed-off-by: David Horstmann <david.horstmann@arm.com > 
						
						
					 
					
						2023-11-08 15:22:27 +00:00 
						 
				 
			
				
					
						
							
							
								Ryan Everett 
							
						 
					 
					
						
						
							
						
						5567e3a34b 
					 
					
						
						
							
							Make empty key slots explicit  
						
						... 
						
						
						
						Add new status field to key slots, and use it.
Signed-off-by: Ryan Everett <ryan.everett@arm.com > 
						
						
					 
					
						2023-11-08 13:28:20 +00:00 
						 
				 
			
				
					
						
							
							
								David Horstmann 
							
						 
					 
					
						
						
							
						
						b3de69493c 
					 
					
						
						
							
							Remove psa_crypto_alloc_and_copy() API  
						
						... 
						
						
						
						This tied input and output buffers together in
awkward pairs, which made the API more difficult
to use.
Signed-off-by: David Horstmann <david.horstmann@arm.com > 
						
						
					 
					
						2023-11-06 17:45:09 +00:00 
						 
				 
			
				
					
						
							
							
								David Horstmann 
							
						 
					 
					
						
						
							
						
						49a7276c49 
					 
					
						
						
							
							Switch error code to more appropriate value  
						
						... 
						
						
						
						Since we are internal rather than user-facing,
PSA_ERROR_CORRUPTION_DETECTED makes more sense than
PSA_ERROR_BUFFER_TOO_SMALL. Whilst it really is a buffer that is too
small, this error code is intended to indicate that a user-supplied
buffer is too small, not an internal one.
Signed-off-by: David Horstmann <david.horstmann@arm.com > 
						
						
					 
					
						2023-11-03 19:51:40 +00:00 
						 
				 
			
				
					
						
							
							
								Dave Rodgman 
							
						 
					 
					
						
						
							
						
						16799db69a 
					 
					
						
						
							
							update headers  
						
						... 
						
						
						
						Signed-off-by: Dave Rodgman <dave.rodgman@arm.com > 
						
						
					 
					
						2023-11-02 19:47:20 +00:00 
						 
				 
			
				
					
						
							
							
								David Horstmann 
							
						 
					 
					
						
						
							
						
						72ab8ad44a 
					 
					
						
						
							
							Reject zero-lengths in psa_crypto_copy_and_free()  
						
						... 
						
						
						
						Zero-length buffers should be represented in the
psa_crypto_buffer_copy_t struct as NULL if it was created in
psa_crypto_alloc_and_copy(), so reject non-NULL zero-length buffers.
Signed-off-by: David Horstmann <david.horstmann@arm.com > 
						
						
					 
					
						2023-11-02 18:39:42 +00:00 
						 
				 
			
				
					
						
							
							
								David Horstmann 
							
						 
					 
					
						
						
							
						
						2b79cbaa17 
					 
					
						
						
							
							Reject NULL original_output with non-NULL output  
						
						... 
						
						
						
						If we have a copy buffer but no original to copy back to, there is not
much sensible we can do. The psa_crypto_buffer_copy_t state is invalid.
Signed-off-by: David Horstmann <david.horstmann@arm.com > 
						
						
					 
					
						2023-11-02 18:39:42 +00:00 
						 
				 
			
				
					
						
							
							
								David Horstmann 
							
						 
					 
					
						
						
							
						
						f4bbb632cd 
					 
					
						
						
							
							Add implementation of psa_crypto_copy_and_free()  
						
						... 
						
						
						
						Signed-off-by: David Horstmann <david.horstmann@arm.com > 
						
						
					 
					
						2023-11-02 18:39:42 +00:00 
						 
				 
			
				
					
						
							
							
								David Horstmann 
							
						 
					 
					
						
						
							
						
						0fee689e57 
					 
					
						
						
							
							Simplify zero-length buffers to always be NULL  
						
						... 
						
						
						
						Since it is implementation-dependent whether
malloc(0) returns NULL or a pointer, explicitly
represent zero-length buffers as NULL in the
buffer-copy struct, so as to have a uniform
behaviour.
Signed-off-by: David Horstmann <david.horstmann@arm.com > 
						
						
					 
					
						2023-11-02 18:33:17 +00:00 
						 
				 
			
				
					
						
							
							
								David Horstmann 
							
						 
					 
					
						
						
							
						
						83eef383c7 
					 
					
						
						
							
							Add implementation of psa_crypto_alloc_and_copy()  
						
						... 
						
						
						
						Signed-off-by: David Horstmann <david.horstmann@arm.com > 
						
						
					 
					
						2023-11-02 18:33:17 +00:00 
						 
				 
			
				
					
						
							
							
								David Horstmann 
							
						 
					 
					
						
						
							
						
						8978f5c32a 
					 
					
						
						
							
							Add implementation of psa_crypto_copy_output()  
						
						... 
						
						
						
						Signed-off-by: David Horstmann <david.horstmann@arm.com > 
						
						
					 
					
						2023-11-02 17:16:36 +00:00 
						 
				 
			
				
					
						
							
							
								David Horstmann 
							
						 
					 
					
						
						
							
						
						fde97394a0 
					 
					
						
						
							
							Add implementation of psa_crypto_copy_input()  
						
						... 
						
						
						
						Signed-off-by: David Horstmann <david.horstmann@arm.com > 
						
						
					 
					
						2023-11-02 17:15:35 +00:00 
						 
				 
			
				
					
						
							
							
								Valerio Setti 
							
						 
					 
					
						
						
							
						
						02a634decd 
					 
					
						
						
							
							md: remove unnecessary inclusions of mbedtls/md.h  
						
						... 
						
						
						
						Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no > 
						
						
					 
					
						2023-10-11 13:15:58 +02:00 
						 
				 
			
				
					
						
							
							
								Dave Rodgman 
							
						 
					 
					
						
						
							
						
						0fc86b2ddf 
					 
					
						
						
							
							Merge pull request  #8075  from valeriosetti/issue8016  
						
						... 
						
						
						
						driver-only ECC: curve acceleration macros 
						
						
					 
					
						2023-09-27 14:39:02 +00:00 
						 
				 
			
				
					
						
							
							
								Xiaokang Qian 
							
						 
					 
					
						
						
							
						
						fe9666b8c0 
					 
					
						
						
							
							Change the extension type of the file psa_crypto_driver_wrapper  
						
						... 
						
						
						
						Signed-off-by: Xiaokang Qian <xiaokang.qian@arm.com > 
						
						
					 
					
						2023-09-26 09:09:20 +00:00 
						 
				 
			
				
					
						
							
							
								Xiaokang Qian 
							
						 
					 
					
						
						
							
						
						e9c39c42fd 
					 
					
						
						
							
							Enable build of non-static psa wrapper functions  
						
						... 
						
						
						
						Signed-off-by: Xiaokang Qian <xiaokang.qian@arm.com > 
						
						
					 
					
						2023-09-26 09:09:20 +00:00 
						 
				 
			
				
					
						
							
							
								Thomas Daubney 
							
						 
					 
					
						
						
							
						
						7046468a02 
					 
					
						
						
							
							Define the psa wrapper functions as static inline  
						
						... 
						
						
						
						This is a commit from Thomas Daubney.
Signed-off-by: Thomas Daubney <thomas.daubney@arm.com >
Signed-off-by: Xiaokang Qian <xiaokang.qian@arm.com > 
						
						
					 
					
						2023-09-26 09:09:06 +00:00 
						 
				 
			
				
					
						
							
							
								Valerio Setti 
							
						 
					 
					
						
						
							
						
						c437faeaa1 
					 
					
						
						
							
							psa_crypto: fix guards in mbedtls_ecc_group_to_psa()  
						
						... 
						
						
						
						Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no > 
						
						
					 
					
						2023-09-25 17:39:41 +02:00 
						 
				 
			
				
					
						
							
							
								Gilles Peskine 
							
						 
					 
					
						
						
							
						
						67c86e626b 
					 
					
						
						
							
							Merge pull request  #7961  from gilles-peskine-arm/psa_crypto_config-in-full  
						
						... 
						
						
						
						Enable MBEDTLS_PSA_CRYPTO_CONFIG in the full config 
						
						
					 
					
						2023-09-18 08:13:12 +00:00 
						 
				 
			
				
					
						
							
							
								Gilles Peskine 
							
						 
					 
					
						
						
							
						
						0ddffb6de2 
					 
					
						
						
							
							Merge pull request  #7210  from sergio-nsk/patch-2  
						
						... 
						
						
						
						Fix llvm error: variable 'default_iv_length' and other may be used uninitialized 
						
						
					 
					
						2023-09-13 16:38:55 +02:00 
						 
				 
			
				
					
						
							
							
								Dave Rodgman 
							
						 
					 
					
						
						
							
						
						1dab445804 
					 
					
						
						
							
							Update guard for ecp  
						
						... 
						
						
						
						Signed-off-by: Dave Rodgman <dave.rodgman@arm.com > 
						
						
					 
					
						2023-09-02 10:56:44 +01:00 
						 
				 
			
				
					
						
							
							
								Dave Rodgman 
							
						 
					 
					
						
						
							
						
						4f47f3dac8 
					 
					
						
						
							
							Covert PSA guards to MBEDTLS  
						
						... 
						
						
						
						Signed-off-by: Dave Rodgman <dave.rodgman@arm.com > 
						
						
					 
					
						2023-08-31 12:10:00 +01:00 
						 
				 
			
				
					
						
							
							
								Dave Rodgman 
							
						 
					 
					
						
						
							
						
						a9a53a05f0 
					 
					
						
						
							
							Merge remote-tracking branch 'origin/development' into misc-code-size  
						
						
						
						
					 
					
						2023-08-31 11:53:46 +01:00 
						 
				 
			
				
					
						
							
							
								Dave Rodgman 
							
						 
					 
					
						
						
							
						
						dea266f3f5 
					 
					
						
						
							
							Use MBEDTLS_MD_LIGHT instead of MBEDTLS_MD_C  
						
						... 
						
						
						
						Signed-off-by: Dave Rodgman <dave.rodgman@arm.com > 
						
						
					 
					
						2023-08-31 11:52:43 +01:00 
						 
				 
			
				
					
						
							
							
								Dave Rodgman 
							
						 
					 
					
						
						
							
						
						8d706f6b59 
					 
					
						
						
							
							Simplify camellia error conversion macros  
						
						... 
						
						
						
						Signed-off-by: Dave Rodgman <dave.rodgman@arm.com > 
						
						
					 
					
						2023-08-31 11:48:44 +01:00 
						 
				 
			
				
					
						
							
							
								Dave Rodgman 
							
						 
					 
					
						
						
							
						
						09a9e589c1 
					 
					
						
						
							
							Add missing error conversion case  
						
						... 
						
						
						
						Signed-off-by: Dave Rodgman <dave.rodgman@arm.com > 
						
						
					 
					
						2023-08-31 11:05:22 +01:00 
						 
				 
			
				
					
						
							
							
								Dave Rodgman 
							
						 
					 
					
						
						
							
						
						787011542b 
					 
					
						
						
							
							Fully replace mbedtls_psa_safer_memcmp  
						
						... 
						
						
						
						Signed-off-by: Dave Rodgman <dave.rodgman@arm.com > 
						
						
					 
					
						2023-08-29 14:20:18 +01:00 
						 
				 
			
				
					
						
							
							
								Gilles Peskine 
							
						 
					 
					
						
						
							
						
						ead1766b5f 
					 
					
						
						
							
							Fix PBKDF2 with empty salt segment on platforms where malloc(0)=NULL  
						
						... 
						
						
						
						"Fix PBKDF2 with empty salt on platforms where malloc(0)=NULL" took care of
making an empty salt work. But it didn't fix the case of an empty salt
segment followed by a non-empty salt segment, which still invoked memcpy
with a potentially null pointer as the source. This commit fixes that case,
and also simplifies the logic in the function a little.
Test data obtained with:
```
pip3 install cryptodome
python3 -c 'import sys; from Crypto.Hash import SHA256; from Crypto.Protocol.KDF import PBKDF2; cost = int(sys.argv[1], 0); salt = bytes.fromhex(sys.argv[2]); password = bytes.fromhex(sys.argv[3]); n = int(sys.argv[4], 0); print(PBKDF2(password=password, salt=salt, dkLen=n, count=cost, hmac_hash_module=SHA256).hex())' 1 "" "706173737764" 64
```
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com > 
						
						
					 
					
						2023-08-20 22:05:16 +02:00 
						 
				 
			
				
					
						
							
							
								Gilles Peskine 
							
						 
					 
					
						
						
							
						
						73936868b8 
					 
					
						
						
							
							Merge remote-tracking branch 'development' into psa_crypto_config-in-full  
						
						... 
						
						
						
						Conflicts:
* tests/scripts/all.sh: component_test_crypto_full_no_cipher was removed
  in the development branch. 
						
						
					 
					
						2023-08-17 19:46:34 +02:00 
						 
				 
			
				
					
						
							
							
								Gilles Peskine 
							
						 
					 
					
						
						
							
						
						294be94922 
					 
					
						
						
							
							Merge pull request  #7818  from silabs-Kusumit/PBKDF2_cmac_implementation  
						
						... 
						
						
						
						PBKDF2 CMAC implementation 
						
						
					 
					
						2023-08-17 11:15:16 +00:00 
						 
				 
			
				
					
						
							
							
								Dave Rodgman 
							
						 
					 
					
						
						
							
						
						509b567911 
					 
					
						
						
							
							add ifdefs to reduce size of mbedtls_to_psa_error  
						
						... 
						
						
						
						Signed-off-by: Dave Rodgman <dave.rodgman@arm.com > 
						
						
					 
					
						2023-08-16 22:37:29 +01:00 
						 
				 
			
				
					
						
							
							
								Dave Rodgman 
							
						 
					 
					
						
						
							
						
						6f6820345a 
					 
					
						
						
							
							add #ifdefs to reduce switch size  
						
						... 
						
						
						
						Signed-off-by: Dave Rodgman <dave.rodgman@arm.com > 
						
						
					 
					
						2023-08-16 18:44:32 +01:00 
						 
				 
			
				
					
						
							
							
								Dave Rodgman 
							
						 
					 
					
						
						
							
						
						864f594acc 
					 
					
						
						
							
							Adjust layout of some stucts  
						
						... 
						
						
						
						Signed-off-by: Dave Rodgman <dave.rodgman@arm.com > 
						
						
					 
					
						2023-08-16 18:04:44 +01:00 
						 
				 
			
				
					
						
							
							
								Dave Rodgman 
							
						 
					 
					
						
						
							
						
						6f80ac4979 
					 
					
						
						
							
							Merge pull request  #7864  from waleed-elmelegy-arm/enforce-min-RSA-key-size  
						
						... 
						
						
						
						Enforce minimum key size when generating RSA key size 
						
						
					 
					
						2023-08-03 12:57:52 +00:00 
						 
				 
			
				
					
						
							
							
								Dave Rodgman 
							
						 
					 
					
						
						
							
						
						1d4d944e19 
					 
					
						
						
							
							Merge pull request  #7933  from tom-cosgrove-arm/add-mbedtls_zeroize_and_free  
						
						... 
						
						
						
						Provide and use internal function mbedtls_zeroize_and_free() 
						
						
					 
					
						2023-08-03 12:56:21 +00:00 
						 
				 
			
				
					
						
							
							
								Gilles Peskine 
							
						 
					 
					
						
						
							
						
						267bee9be8 
					 
					
						
						
							
							Merge pull request  #7903  from valeriosetti/issue7773  
						
						... 
						
						
						
						Define PSA_WANT_xxx_KEY_PAIR_yyy step 2/DH 
						
						
					 
					
						2023-08-02 10:16:44 +00:00 
						 
				 
			
				
					
						
							
							
								Tom Cosgrove 
							
						 
					 
					
						
						
							
						
						52f7e18042 
					 
					
						
						
							
							Use mbedtls_zeroize_and_free() in psa_remove_key_data_from_memory()  
						
						... 
						
						
						
						Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com > 
						
						
					 
					
						2023-08-01 09:08:48 +01:00 
						 
				 
			
				
					
						
							
							
								Manuel Pégourié-Gonnard 
							
						 
					 
					
						
						
							
						
						43cef57e51 
					 
					
						
						
							
							Merge pull request  #7811  from mpg/md-info  
						
						... 
						
						
						
						Optimize strings in MD 
						
						
					 
					
						2023-07-28 08:34:09 +00:00 
						 
				 
			
				
					
						
							
							
								Kusumit Ghoderao 
							
						 
					 
					
						
						
							
						
						f3e696dc1b 
					 
					
						
						
							
							Add ifdef for hmac and cmac set password  
						
						... 
						
						
						
						Signed-off-by: Kusumit Ghoderao <Kusumit.Ghoderao@silabs.com > 
						
						
					 
					
						2023-07-28 13:30:50 +05:30 
						 
				 
			
				
					
						
							
							
								Kusumit Ghoderao 
							
						 
					 
					
						
						
							
						
						5f3345ae44 
					 
					
						
						
							
							Add issue link instead of issue number  
						
						... 
						
						
						
						Signed-off-by: Kusumit Ghoderao <Kusumit.Ghoderao@silabs.com > 
						
						
					 
					
						2023-07-27 21:21:38 +05:30 
						 
				 
			
				
					
						
							
							
								Kusumit Ghoderao 
							
						 
					 
					
						
						
							
						
						0bca4c5fc4 
					 
					
						
						
							
							Add ifdef for hmac and cmac specific functions  
						
						... 
						
						
						
						Signed-off-by: Kusumit Ghoderao <Kusumit.Ghoderao@silabs.com > 
						
						
					 
					
						2023-07-27 21:20:14 +05:30