From 7cb9c3d36087c244da5a245b8032476e2511d6a5 Mon Sep 17 00:00:00 2001 From: Ronald Cron Date: Wed, 10 Mar 2021 12:21:48 +0100 Subject: [PATCH] psa: cipher: Move to driver operation context application allocation Signed-off-by: Ronald Cron --- include/psa/crypto_builtin_cipher.h | 59 +++++++++ include/psa/crypto_driver_contexts.h | 13 ++ include/psa/crypto_struct.h | 22 +--- library/psa_crypto_driver_wrappers.c | 182 ++++++++------------------- tests/include/test/drivers/cipher.h | 70 ++++------- tests/src/drivers/cipher.c | 28 ++--- visualc/VS2010/mbedTLS.vcxproj | 1 + 7 files changed, 167 insertions(+), 208 deletions(-) create mode 100644 include/psa/crypto_builtin_cipher.h diff --git a/include/psa/crypto_builtin_cipher.h b/include/psa/crypto_builtin_cipher.h new file mode 100644 index 000000000..1c6e4c526 --- /dev/null +++ b/include/psa/crypto_builtin_cipher.h @@ -0,0 +1,59 @@ +/* + * Context structure declaration of the software-based driver which performs + * cipher operations through the PSA Crypto driver dispatch layer. + */ +/* + * Copyright The Mbed TLS Contributors + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PSA_CRYPTO_BUILTIN_CIPHER_H +#define PSA_CRYPTO_BUILTIN_CIPHER_H + +#include +#include "mbedtls/cipher.h" + +typedef struct { + /** Context structure for the Mbed TLS cipher implementation. */ + psa_algorithm_t alg; + uint8_t iv_size; + uint8_t block_size; + mbedtls_cipher_context_t cipher; +} mbedtls_psa_cipher_operation_t; + +#define MBEDTLS_PSA_CIPHER_OPERATION_INIT {0, 0, 0, {0}} + +/* + * BEYOND THIS POINT, TEST DRIVER DECLARATIONS ONLY. + */ +#if defined(PSA_CRYPTO_DRIVER_TEST) + +typedef mbedtls_psa_cipher_operation_t + mbedtls_transparent_test_driver_cipher_operation_t; + +typedef struct { + unsigned int initialised : 1; + mbedtls_transparent_test_driver_cipher_operation_t ctx; +} mbedtls_opaque_test_driver_cipher_operation_t; + +#define MBEDTLS_TRANSPARENT_TEST_DRIVER_CIPHER_OPERATION_INIT \ + MBEDTLS_PSA_CIPHER_OPERATION_INIT + +#define MBEDTLS_OPAQUE_TEST_DRIVER_CIPHER_OPERATION_INIT \ + { 0, MBEDTLS_TRANSPARENT_TEST_DRIVER_CIPHER_OPERATION_INIT } + +#endif /* PSA_CRYPTO_DRIVER_TEST */ + +#endif /* PSA_CRYPTO_BUILTIN_CIPHER_H */ diff --git a/include/psa/crypto_driver_contexts.h b/include/psa/crypto_driver_contexts.h index fdf178f94..f3f08b8eb 100644 --- a/include/psa/crypto_driver_contexts.h +++ b/include/psa/crypto_driver_contexts.h @@ -31,6 +31,7 @@ /* Include the context structure definitions for the Mbed TLS software drivers */ #include "psa/crypto_builtin_hash.h" +#include "psa/crypto_builtin_cipher.h" /* Define the context to be used for an operation that is executed through the * PSA Driver wrapper layer as the union of all possible driver's contexts. @@ -47,5 +48,17 @@ typedef union { #endif } psa_driver_hash_context_t; +typedef union { + unsigned dummy; /* Make sure this structure is always non-empty */ + mbedtls_psa_cipher_operation_t mbedtls_ctx; +#if defined(PSA_CRYPTO_DRIVER_TEST) + mbedtls_transparent_test_driver_cipher_operation_t + transparent_test_driver_ctx; + + mbedtls_opaque_test_driver_cipher_operation_t + opaque_test_driver_ctx; +#endif +} psa_driver_cipher_context_t; + #endif /* PSA_CRYPTO_DRIVER_CONTEXTS_H */ /* End of automatically generated file. */ diff --git a/include/psa/crypto_struct.h b/include/psa/crypto_struct.h index 52f4973c0..0ef885df8 100644 --- a/include/psa/crypto_struct.h +++ b/include/psa/crypto_struct.h @@ -65,18 +65,12 @@ extern "C" { #include MBEDTLS_CONFIG_FILE #endif -#include "mbedtls/cipher.h" #include "mbedtls/cmac.h" #include "mbedtls/gcm.h" /* Include the context definition for the compiled-in drivers */ #include "psa/crypto_driver_contexts.h" -typedef struct { - /** Context structure for the assigned driver, when id is not zero. */ - void* ctx; -} psa_operation_driver_context_t; - struct psa_hash_operation_s { /** Unique ID indicating which driver got assigned to do the @@ -136,14 +130,6 @@ static inline struct psa_mac_operation_s psa_mac_operation_init( void ) return( v ); } -typedef struct { - /** Context structure for the Mbed TLS cipher implementation. */ - psa_algorithm_t alg; - uint8_t iv_size; - uint8_t block_size; - mbedtls_cipher_context_t cipher; -} mbedtls_psa_cipher_operation_t; - struct psa_cipher_operation_s { /** Unique ID indicating which driver got assigned to do the @@ -156,12 +142,8 @@ struct psa_cipher_operation_s unsigned int iv_required : 1; unsigned int iv_set : 1; - union - { - unsigned dummy; /* Enable easier initializing of the union. */ - mbedtls_psa_cipher_operation_t mbedtls_ctx; - psa_operation_driver_context_t driver; - } ctx; + + psa_driver_cipher_context_t ctx; }; #define PSA_CIPHER_OPERATION_INIT {0, 0, 0, {0}} diff --git a/library/psa_crypto_driver_wrappers.c b/library/psa_crypto_driver_wrappers.c index af63fbf88..75ea6f58b 100644 --- a/library/psa_crypto_driver_wrappers.c +++ b/library/psa_crypto_driver_wrappers.c @@ -719,7 +719,6 @@ psa_status_t psa_driver_wrapper_cipher_encrypt_setup( psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; psa_key_location_t location = PSA_KEY_LIFETIME_GET_LOCATION( attributes->core.lifetime ); - void *driver_ctx = NULL; switch( location ) { @@ -728,28 +727,15 @@ psa_status_t psa_driver_wrapper_cipher_encrypt_setup( * cycle through all known transparent accelerators */ #if defined(PSA_CRYPTO_ACCELERATOR_DRIVER_PRESENT) #if defined(PSA_CRYPTO_DRIVER_TEST) - driver_ctx = mbedtls_calloc( 1, - sizeof( test_transparent_cipher_operation_t ) ); - if( driver_ctx == NULL ) - return PSA_ERROR_INSUFFICIENT_MEMORY; - - status = test_transparent_cipher_encrypt_setup( driver_ctx, - attributes, - key_buffer, - key_buffer_size, - alg ); + status = test_transparent_cipher_encrypt_setup( + &operation->ctx.transparent_test_driver_ctx, + attributes, + key_buffer, + key_buffer_size, + alg ); /* Declared with fallback == true */ if( status == PSA_SUCCESS ) - { operation->id = PSA_CRYPTO_TRANSPARENT_TEST_DRIVER_ID; - operation->ctx.driver.ctx = driver_ctx; - } - else - { - mbedtls_platform_zeroize( driver_ctx, - sizeof( test_transparent_cipher_operation_t ) ); - mbedtls_free( driver_ctx ); - } if( status != PSA_ERROR_NOT_SUPPORTED ) return( status ); @@ -770,27 +756,14 @@ psa_status_t psa_driver_wrapper_cipher_encrypt_setup( #if defined(PSA_CRYPTO_ACCELERATOR_DRIVER_PRESENT) #if defined(PSA_CRYPTO_DRIVER_TEST) case PSA_CRYPTO_TEST_DRIVER_LIFETIME: - driver_ctx = - mbedtls_calloc( 1, sizeof(test_opaque_cipher_operation_t) ); - if( driver_ctx == NULL ) - return( PSA_ERROR_INSUFFICIENT_MEMORY ); + status = test_opaque_cipher_encrypt_setup( + &operation->ctx.opaque_test_driver_ctx, + attributes, + key_buffer, key_buffer_size, + alg ); - status = test_opaque_cipher_encrypt_setup( driver_ctx, - attributes, - key_buffer, - key_buffer_size, - alg ); if( status == PSA_SUCCESS ) - { operation->id = PSA_CRYPTO_OPAQUE_TEST_DRIVER_ID; - operation->ctx.driver.ctx = driver_ctx; - } - else - { - mbedtls_platform_zeroize( - driver_ctx, sizeof( test_opaque_cipher_operation_t ) ); - mbedtls_free( driver_ctx ); - } return( status ); #endif /* PSA_CRYPTO_DRIVER_TEST */ @@ -798,7 +771,6 @@ psa_status_t psa_driver_wrapper_cipher_encrypt_setup( default: /* Key is declared with a lifetime not known to us */ (void)status; - (void)driver_ctx; return( PSA_ERROR_INVALID_ARGUMENT ); } } @@ -812,7 +784,6 @@ psa_status_t psa_driver_wrapper_cipher_decrypt_setup( psa_status_t status = PSA_ERROR_INVALID_ARGUMENT; psa_key_location_t location = PSA_KEY_LIFETIME_GET_LOCATION( attributes->core.lifetime ); - void *driver_ctx = NULL; switch( location ) { @@ -821,28 +792,15 @@ psa_status_t psa_driver_wrapper_cipher_decrypt_setup( * cycle through all known transparent accelerators */ #if defined(PSA_CRYPTO_ACCELERATOR_DRIVER_PRESENT) #if defined(PSA_CRYPTO_DRIVER_TEST) - driver_ctx = mbedtls_calloc( 1, - sizeof( test_transparent_cipher_operation_t ) ); - if( driver_ctx == NULL ) - return PSA_ERROR_INSUFFICIENT_MEMORY; - - status = test_transparent_cipher_decrypt_setup( driver_ctx, - attributes, - key_buffer, - key_buffer_size, - alg ); + status = test_transparent_cipher_decrypt_setup( + &operation->ctx.transparent_test_driver_ctx, + attributes, + key_buffer, + key_buffer_size, + alg ); /* Declared with fallback == true */ if( status == PSA_SUCCESS ) - { operation->id = PSA_CRYPTO_TRANSPARENT_TEST_DRIVER_ID; - operation->ctx.driver.ctx = driver_ctx; - } - else - { - mbedtls_platform_zeroize( driver_ctx, - sizeof( test_transparent_cipher_operation_t ) ); - mbedtls_free( driver_ctx ); - } if( status != PSA_ERROR_NOT_SUPPORTED ) return( status ); @@ -863,27 +821,14 @@ psa_status_t psa_driver_wrapper_cipher_decrypt_setup( #if defined(PSA_CRYPTO_ACCELERATOR_DRIVER_PRESENT) #if defined(PSA_CRYPTO_DRIVER_TEST) case PSA_CRYPTO_TEST_DRIVER_LIFETIME: - driver_ctx = - mbedtls_calloc( 1, sizeof(test_opaque_cipher_operation_t) ); - if( driver_ctx == NULL ) - return( PSA_ERROR_INSUFFICIENT_MEMORY ); + status = test_opaque_cipher_decrypt_setup( + &operation->ctx.opaque_test_driver_ctx, + attributes, + key_buffer, key_buffer_size, + alg ); - status = test_opaque_cipher_decrypt_setup( driver_ctx, - attributes, - key_buffer, - key_buffer_size, - alg ); if( status == PSA_SUCCESS ) - { operation->id = PSA_CRYPTO_OPAQUE_TEST_DRIVER_ID; - operation->ctx.driver.ctx = driver_ctx; - } - else - { - mbedtls_platform_zeroize( - driver_ctx, sizeof( test_opaque_cipher_operation_t ) ); - mbedtls_free( driver_ctx ); - } return( status ); #endif /* PSA_CRYPTO_DRIVER_TEST */ @@ -891,7 +836,6 @@ psa_status_t psa_driver_wrapper_cipher_decrypt_setup( default: /* Key is declared with a lifetime not known to us */ (void)status; - (void)driver_ctx; return( PSA_ERROR_INVALID_ARGUMENT ); } } @@ -913,14 +857,12 @@ psa_status_t psa_driver_wrapper_cipher_generate_iv( #if defined(PSA_CRYPTO_DRIVER_TEST) case PSA_CRYPTO_TRANSPARENT_TEST_DRIVER_ID: return( test_transparent_cipher_generate_iv( - operation->ctx.driver.ctx, - iv, - iv_size, - iv_length ) ); + &operation->ctx.transparent_test_driver_ctx, + iv, iv_size, iv_length ) ); case PSA_CRYPTO_OPAQUE_TEST_DRIVER_ID: return( test_opaque_cipher_generate_iv( - operation->ctx.driver.ctx, + &operation->ctx.opaque_test_driver_ctx, iv, iv_size, iv_length ) ); @@ -946,14 +888,14 @@ psa_status_t psa_driver_wrapper_cipher_set_iv( #if defined(PSA_CRYPTO_ACCELERATOR_DRIVER_PRESENT) #if defined(PSA_CRYPTO_DRIVER_TEST) case PSA_CRYPTO_TRANSPARENT_TEST_DRIVER_ID: - return( test_transparent_cipher_set_iv( operation->ctx.driver.ctx, - iv, - iv_length ) ); + return( test_transparent_cipher_set_iv( + &operation->ctx.transparent_test_driver_ctx, + iv, iv_length ) ); case PSA_CRYPTO_OPAQUE_TEST_DRIVER_ID: - return( test_opaque_cipher_set_iv( operation->ctx.driver.ctx, - iv, - iv_length ) ); + return( test_opaque_cipher_set_iv( + &operation->ctx.opaque_test_driver_ctx, + iv, iv_length ) ); #endif /* PSA_CRYPTO_DRIVER_TEST */ #endif /* PSA_CRYPTO_ACCELERATOR_DRIVER_PRESENT */ } @@ -981,19 +923,16 @@ psa_status_t psa_driver_wrapper_cipher_update( #if defined(PSA_CRYPTO_ACCELERATOR_DRIVER_PRESENT) #if defined(PSA_CRYPTO_DRIVER_TEST) case PSA_CRYPTO_TRANSPARENT_TEST_DRIVER_ID: - return( test_transparent_cipher_update( operation->ctx.driver.ctx, - input, - input_length, - output, - output_size, - output_length ) ); + return( test_transparent_cipher_update( + &operation->ctx.transparent_test_driver_ctx, + input, input_length, + output, output_size, output_length ) ); + case PSA_CRYPTO_OPAQUE_TEST_DRIVER_ID: - return( test_opaque_cipher_update( operation->ctx.driver.ctx, - input, - input_length, - output, - output_size, - output_length ) ); + return( test_opaque_cipher_update( + &operation->ctx.opaque_test_driver_ctx, + input, input_length, + output, output_size, output_length ) ); #endif /* PSA_CRYPTO_DRIVER_TEST */ #endif /* PSA_CRYPTO_ACCELERATOR_DRIVER_PRESENT */ } @@ -1019,16 +958,14 @@ psa_status_t psa_driver_wrapper_cipher_finish( #if defined(PSA_CRYPTO_ACCELERATOR_DRIVER_PRESENT) #if defined(PSA_CRYPTO_DRIVER_TEST) case PSA_CRYPTO_TRANSPARENT_TEST_DRIVER_ID: - return( test_transparent_cipher_finish( operation->ctx.driver.ctx, - output, - output_size, - output_length ) ); + return( test_transparent_cipher_finish( + &operation->ctx.transparent_test_driver_ctx, + output, output_size, output_length ) ); case PSA_CRYPTO_OPAQUE_TEST_DRIVER_ID: - return( test_opaque_cipher_finish( operation->ctx.driver.ctx, - output, - output_size, - output_length ) ); + return( test_opaque_cipher_finish( + &operation->ctx.opaque_test_driver_ctx, + output, output_size, output_length ) ); #endif /* PSA_CRYPTO_DRIVER_TEST */ #endif /* PSA_CRYPTO_ACCELERATOR_DRIVER_PRESENT */ } @@ -1040,13 +977,6 @@ psa_status_t psa_driver_wrapper_cipher_abort( psa_cipher_operation_t *operation ) { psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED; - psa_operation_driver_context_t *driver_context = &operation->ctx.driver; - - /* The object has (apparently) been initialized but it is not in use. It's - * ok to call abort on such an object, and there's nothing to do. */ - if( ( operation->id != PSA_CRYPTO_MBED_TLS_DRIVER_ID ) && - ( driver_context->ctx == NULL ) ) - return( PSA_SUCCESS ); switch( operation->id ) { @@ -1056,23 +986,19 @@ psa_status_t psa_driver_wrapper_cipher_abort( #if defined(PSA_CRYPTO_ACCELERATOR_DRIVER_PRESENT) #if defined(PSA_CRYPTO_DRIVER_TEST) case PSA_CRYPTO_TRANSPARENT_TEST_DRIVER_ID: - status = test_transparent_cipher_abort( driver_context->ctx ); + status = test_transparent_cipher_abort( + &operation->ctx.transparent_test_driver_ctx ); mbedtls_platform_zeroize( - driver_context->ctx, - sizeof( test_transparent_cipher_operation_t ) ); - mbedtls_free( driver_context->ctx ); - driver_context->ctx = NULL; - + &operation->ctx.transparent_test_driver_ctx, + sizeof( operation->ctx.transparent_test_driver_ctx ) ); return( status ); case PSA_CRYPTO_OPAQUE_TEST_DRIVER_ID: - status = test_opaque_cipher_abort( driver_context->ctx ); + status = test_opaque_cipher_abort( + &operation->ctx.opaque_test_driver_ctx ); mbedtls_platform_zeroize( - driver_context->ctx, - sizeof( test_opaque_cipher_operation_t ) ); - mbedtls_free( driver_context->ctx ); - driver_context->ctx = NULL; - + &operation->ctx.opaque_test_driver_ctx, + sizeof( operation->ctx.opaque_test_driver_ctx ) ); return( status ); #endif /* PSA_CRYPTO_DRIVER_TEST */ #endif /* PSA_CRYPTO_ACCELERATOR_DRIVER_PRESENT */ diff --git a/tests/include/test/drivers/cipher.h b/tests/include/test/drivers/cipher.h index a1eb51214..56b11591f 100644 --- a/tests/include/test/drivers/cipher.h +++ b/tests/include/test/drivers/cipher.h @@ -31,12 +31,6 @@ #include #include "mbedtls/cipher.h" -typedef mbedtls_psa_cipher_operation_t test_transparent_cipher_operation_t; - -typedef struct{ - unsigned int initialised : 1; - test_transparent_cipher_operation_t ctx; -} test_opaque_cipher_operation_t; typedef struct { /* If non-null, on success, copy this to the output. */ @@ -73,44 +67,36 @@ psa_status_t test_transparent_cipher_decrypt( uint8_t *output, size_t output_size, size_t *output_length); psa_status_t test_transparent_cipher_encrypt_setup( - test_transparent_cipher_operation_t *operation, + mbedtls_transparent_test_driver_cipher_operation_t *operation, const psa_key_attributes_t *attributes, const uint8_t *key, size_t key_length, psa_algorithm_t alg); psa_status_t test_transparent_cipher_decrypt_setup( - test_transparent_cipher_operation_t *operation, + mbedtls_transparent_test_driver_cipher_operation_t *operation, const psa_key_attributes_t *attributes, const uint8_t *key, size_t key_length, psa_algorithm_t alg); psa_status_t test_transparent_cipher_abort( - test_transparent_cipher_operation_t *operation); + mbedtls_transparent_test_driver_cipher_operation_t *operation ); psa_status_t test_transparent_cipher_generate_iv( - test_transparent_cipher_operation_t *operation, - uint8_t *iv, - size_t iv_size, - size_t *iv_length); + mbedtls_transparent_test_driver_cipher_operation_t *operation, + uint8_t *iv, size_t iv_size, size_t *iv_length); psa_status_t test_transparent_cipher_set_iv( - test_transparent_cipher_operation_t *operation, - const uint8_t *iv, - size_t iv_length); + mbedtls_transparent_test_driver_cipher_operation_t *operation, + const uint8_t *iv, size_t iv_length); psa_status_t test_transparent_cipher_update( - test_transparent_cipher_operation_t *operation, - const uint8_t *input, - size_t input_length, - uint8_t *output, - size_t output_size, - size_t *output_length); + mbedtls_transparent_test_driver_cipher_operation_t *operation, + const uint8_t *input, size_t input_length, + uint8_t *output, size_t output_size, size_t *output_length); psa_status_t test_transparent_cipher_finish( - test_transparent_cipher_operation_t *operation, - uint8_t *output, - size_t output_size, - size_t *output_length); + mbedtls_transparent_test_driver_cipher_operation_t *operation, + uint8_t *output, size_t output_size, size_t *output_length); /* * opaque versions @@ -130,44 +116,36 @@ psa_status_t test_opaque_cipher_decrypt( uint8_t *output, size_t output_size, size_t *output_length); psa_status_t test_opaque_cipher_encrypt_setup( - test_opaque_cipher_operation_t *operation, + mbedtls_opaque_test_driver_cipher_operation_t *operation, const psa_key_attributes_t *attributes, const uint8_t *key, size_t key_length, psa_algorithm_t alg); psa_status_t test_opaque_cipher_decrypt_setup( - test_opaque_cipher_operation_t *operation, + mbedtls_opaque_test_driver_cipher_operation_t *operation, const psa_key_attributes_t *attributes, const uint8_t *key, size_t key_length, psa_algorithm_t alg); psa_status_t test_opaque_cipher_abort( - test_opaque_cipher_operation_t *operation); + mbedtls_opaque_test_driver_cipher_operation_t *operation); psa_status_t test_opaque_cipher_generate_iv( - test_opaque_cipher_operation_t *operation, - uint8_t *iv, - size_t iv_size, - size_t *iv_length); + mbedtls_opaque_test_driver_cipher_operation_t *operation, + uint8_t *iv, size_t iv_size, size_t *iv_length); psa_status_t test_opaque_cipher_set_iv( - test_opaque_cipher_operation_t *operation, - const uint8_t *iv, - size_t iv_length); + mbedtls_opaque_test_driver_cipher_operation_t *operation, + const uint8_t *iv, size_t iv_length); psa_status_t test_opaque_cipher_update( - test_opaque_cipher_operation_t *operation, - const uint8_t *input, - size_t input_length, - uint8_t *output, - size_t output_size, - size_t *output_length); + mbedtls_opaque_test_driver_cipher_operation_t *operation, + const uint8_t *input, size_t input_length, + uint8_t *output, size_t output_size, size_t *output_length); psa_status_t test_opaque_cipher_finish( - test_opaque_cipher_operation_t *operation, - uint8_t *output, - size_t output_size, - size_t *output_length); + mbedtls_opaque_test_driver_cipher_operation_t *operation, + uint8_t *output, size_t output_size, size_t *output_length); #endif /* PSA_CRYPTO_DRIVER_TEST */ #endif /* PSA_CRYPTO_TEST_DRIVERS_CIPHER_H */ diff --git a/tests/src/drivers/cipher.c b/tests/src/drivers/cipher.c index 6a205b487..607cd949b 100644 --- a/tests/src/drivers/cipher.c +++ b/tests/src/drivers/cipher.c @@ -206,7 +206,7 @@ psa_status_t test_transparent_cipher_decrypt( } psa_status_t test_transparent_cipher_encrypt_setup( - test_transparent_cipher_operation_t *operation, + mbedtls_transparent_test_driver_cipher_operation_t *operation, const psa_key_attributes_t *attributes, const uint8_t *key, size_t key_length, psa_algorithm_t alg) @@ -230,7 +230,7 @@ psa_status_t test_transparent_cipher_encrypt_setup( } psa_status_t test_transparent_cipher_decrypt_setup( - test_transparent_cipher_operation_t *operation, + mbedtls_transparent_test_driver_cipher_operation_t *operation, const psa_key_attributes_t *attributes, const uint8_t *key, size_t key_length, psa_algorithm_t alg) @@ -248,7 +248,7 @@ psa_status_t test_transparent_cipher_decrypt_setup( } psa_status_t test_transparent_cipher_abort( - test_transparent_cipher_operation_t *operation) + mbedtls_transparent_test_driver_cipher_operation_t *operation) { test_driver_cipher_hooks.hits++; @@ -267,7 +267,7 @@ psa_status_t test_transparent_cipher_abort( } psa_status_t test_transparent_cipher_generate_iv( - test_transparent_cipher_operation_t *operation, + mbedtls_transparent_test_driver_cipher_operation_t *operation, uint8_t *iv, size_t iv_size, size_t *iv_length) @@ -284,7 +284,7 @@ psa_status_t test_transparent_cipher_generate_iv( } psa_status_t test_transparent_cipher_set_iv( - test_transparent_cipher_operation_t *operation, + mbedtls_transparent_test_driver_cipher_operation_t *operation, const uint8_t *iv, size_t iv_length) { @@ -299,7 +299,7 @@ psa_status_t test_transparent_cipher_set_iv( } psa_status_t test_transparent_cipher_update( - test_transparent_cipher_operation_t *operation, + mbedtls_transparent_test_driver_cipher_operation_t *operation, const uint8_t *input, size_t input_length, uint8_t *output, @@ -331,7 +331,7 @@ psa_status_t test_transparent_cipher_update( } psa_status_t test_transparent_cipher_finish( - test_transparent_cipher_operation_t *operation, + mbedtls_transparent_test_driver_cipher_operation_t *operation, uint8_t *output, size_t output_size, size_t *output_length) @@ -401,7 +401,7 @@ psa_status_t test_opaque_cipher_decrypt( } psa_status_t test_opaque_cipher_encrypt_setup( - test_opaque_cipher_operation_t *operation, + mbedtls_opaque_test_driver_cipher_operation_t *operation, const psa_key_attributes_t *attributes, const uint8_t *key, size_t key_length, psa_algorithm_t alg) @@ -415,7 +415,7 @@ psa_status_t test_opaque_cipher_encrypt_setup( } psa_status_t test_opaque_cipher_decrypt_setup( - test_opaque_cipher_operation_t *operation, + mbedtls_opaque_test_driver_cipher_operation_t *operation, const psa_key_attributes_t *attributes, const uint8_t *key, size_t key_length, psa_algorithm_t alg) @@ -429,14 +429,14 @@ psa_status_t test_opaque_cipher_decrypt_setup( } psa_status_t test_opaque_cipher_abort( - test_opaque_cipher_operation_t *operation) + mbedtls_opaque_test_driver_cipher_operation_t *operation ) { (void) operation; return( PSA_ERROR_NOT_SUPPORTED ); } psa_status_t test_opaque_cipher_generate_iv( - test_opaque_cipher_operation_t *operation, + mbedtls_opaque_test_driver_cipher_operation_t *operation, uint8_t *iv, size_t iv_size, size_t *iv_length) @@ -449,7 +449,7 @@ psa_status_t test_opaque_cipher_generate_iv( } psa_status_t test_opaque_cipher_set_iv( - test_opaque_cipher_operation_t *operation, + mbedtls_opaque_test_driver_cipher_operation_t *operation, const uint8_t *iv, size_t iv_length) { @@ -460,7 +460,7 @@ psa_status_t test_opaque_cipher_set_iv( } psa_status_t test_opaque_cipher_update( - test_opaque_cipher_operation_t *operation, + mbedtls_opaque_test_driver_cipher_operation_t *operation, const uint8_t *input, size_t input_length, uint8_t *output, @@ -477,7 +477,7 @@ psa_status_t test_opaque_cipher_update( } psa_status_t test_opaque_cipher_finish( - test_opaque_cipher_operation_t *operation, + mbedtls_opaque_test_driver_cipher_operation_t *operation, uint8_t *output, size_t output_size, size_t *output_length) diff --git a/visualc/VS2010/mbedTLS.vcxproj b/visualc/VS2010/mbedTLS.vcxproj index 0db6c4c7e..0fb1b5c7f 100644 --- a/visualc/VS2010/mbedTLS.vcxproj +++ b/visualc/VS2010/mbedTLS.vcxproj @@ -222,6 +222,7 @@ +