mirror of
				https://github.com/cuberite/polarssl.git
				synced 2025-10-30 19:20:40 -04:00 
			
		
		
		
	PSA: Adapt pk.c, pk_wrap.c, cipher.c to new key policy init API
This commit is contained in:
		
							parent
							
								
									e34f636f8d
								
							
						
					
					
						commit
						f99c2ec9d7
					
				| @ -322,7 +322,7 @@ int mbedtls_cipher_setkey( mbedtls_cipher_context_t *ctx, | |||||||
|          * mbedtls_cipher_free() needs to be called in any case. */ |          * mbedtls_cipher_free() needs to be called in any case. */ | ||||||
| 
 | 
 | ||||||
|         /* Setup policy for the new key slot. */ |         /* Setup policy for the new key slot. */ | ||||||
|         psa_key_policy_init( &key_policy ); |         key_policy = psa_key_policy_init(); | ||||||
| 
 | 
 | ||||||
|         /* Mbed TLS' cipher layer doesn't enforce the mode of operation
 |         /* Mbed TLS' cipher layer doesn't enforce the mode of operation
 | ||||||
|          * (encrypt vs. decrypt): it is possible to setup a key for encryption |          * (encrypt vs. decrypt): it is possible to setup a key for encryption | ||||||
|  | |||||||
| @ -580,7 +580,7 @@ int mbedtls_pk_wrap_as_opaque( mbedtls_pk_context *pk, | |||||||
|         return( MBEDTLS_ERR_PK_HW_ACCEL_FAILED ); |         return( MBEDTLS_ERR_PK_HW_ACCEL_FAILED ); | ||||||
| 
 | 
 | ||||||
|     /* set policy */ |     /* set policy */ | ||||||
|     psa_key_policy_init( &policy ); |     policy = psa_key_policy_init(); | ||||||
|     psa_key_policy_set_usage( &policy, PSA_KEY_USAGE_SIGN, |     psa_key_policy_set_usage( &policy, PSA_KEY_USAGE_SIGN, | ||||||
|                                        PSA_ALG_ECDSA(hash_alg) ); |                                        PSA_ALG_ECDSA(hash_alg) ); | ||||||
|     if( PSA_SUCCESS != psa_set_key_policy( key, &policy ) ) |     if( PSA_SUCCESS != psa_set_key_policy( key, &policy ) ) | ||||||
|  | |||||||
| @ -580,7 +580,7 @@ static int ecdsa_verify_wrap( void *ctx, mbedtls_md_type_t md_alg, | |||||||
|     if( ( ret = psa_allocate_key( &key_slot ) ) != PSA_SUCCESS ) |     if( ( ret = psa_allocate_key( &key_slot ) ) != PSA_SUCCESS ) | ||||||
|           return( mbedtls_psa_err_translate_pk( ret ) ); |           return( mbedtls_psa_err_translate_pk( ret ) ); | ||||||
| 
 | 
 | ||||||
|     psa_key_policy_init( &policy ); |     policy = psa_key_policy_init(); | ||||||
|     psa_key_policy_set_usage( &policy, PSA_KEY_USAGE_VERIFY, psa_sig_md ); |     psa_key_policy_set_usage( &policy, PSA_KEY_USAGE_VERIFY, psa_sig_md ); | ||||||
|     if( ( ret = psa_set_key_policy( key_slot, &policy ) ) != PSA_SUCCESS ) |     if( ( ret = psa_set_key_policy( key_slot, &policy ) ) != PSA_SUCCESS ) | ||||||
|     { |     { | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Hanno Becker
						Hanno Becker