Steven Cooreman | 37941cb | 2020-07-28 18:49:51 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Test driver for cipher functions. |
| 3 | * Currently only supports multi-part operations using AES-CTR. |
| 4 | */ |
Steven Cooreman | 3ec4018 | 2020-09-02 16:27:46 +0200 | [diff] [blame] | 5 | /* Copyright The Mbed TLS Contributors |
Steven Cooreman | 37941cb | 2020-07-28 18:49:51 +0200 | [diff] [blame] | 6 | * SPDX-License-Identifier: Apache-2.0 |
| 7 | * |
| 8 | * Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 9 | * not use this file except in compliance with the License. |
| 10 | * You may obtain a copy of the License at |
| 11 | * |
| 12 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 13 | * |
| 14 | * Unless required by applicable law or agreed to in writing, software |
| 15 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 16 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 17 | * See the License for the specific language governing permissions and |
| 18 | * limitations under the License. |
Steven Cooreman | 37941cb | 2020-07-28 18:49:51 +0200 | [diff] [blame] | 19 | */ |
| 20 | |
| 21 | #if !defined(MBEDTLS_CONFIG_FILE) |
| 22 | #include "mbedtls/config.h" |
| 23 | #else |
| 24 | #include MBEDTLS_CONFIG_FILE |
| 25 | #endif |
| 26 | |
| 27 | #if defined(MBEDTLS_PSA_CRYPTO_DRIVERS) && defined(PSA_CRYPTO_DRIVER_TEST) |
| 28 | #include "psa/crypto.h" |
Ronald Cron | 8d310ad | 2020-12-15 15:17:20 +0100 | [diff] [blame] | 29 | #include "psa_crypto_cipher.h" |
Steven Cooreman | acb5a10 | 2020-09-08 14:06:57 +0200 | [diff] [blame] | 30 | #include "psa_crypto_core.h" |
Steven Cooreman | 37941cb | 2020-07-28 18:49:51 +0200 | [diff] [blame] | 31 | #include "mbedtls/cipher.h" |
| 32 | |
Steven Cooreman | acb5a10 | 2020-09-08 14:06:57 +0200 | [diff] [blame] | 33 | #include "test/drivers/cipher.h" |
Steven Cooreman | 37941cb | 2020-07-28 18:49:51 +0200 | [diff] [blame] | 34 | |
| 35 | #include "test/random.h" |
| 36 | |
| 37 | #include <string.h> |
| 38 | |
Ronald Cron | c4bc12e | 2021-04-13 12:41:34 +0200 | [diff] [blame] | 39 | mbedtls_test_driver_cipher_hooks_t mbedtls_test_driver_cipher_hooks = |
| 40 | MBEDTLS_TEST_DRIVER_CIPHER_INIT; |
Steven Cooreman | 37941cb | 2020-07-28 18:49:51 +0200 | [diff] [blame] | 41 | |
gabor-mezei-arm | fa990b5 | 2021-03-25 11:17:10 +0100 | [diff] [blame] | 42 | psa_status_t mbedtls_test_transparent_cipher_encrypt( |
Steven Cooreman | fe0ab55 | 2020-09-10 13:07:02 +0200 | [diff] [blame] | 43 | const psa_key_attributes_t *attributes, |
gabor-mezei-arm | fa990b5 | 2021-03-25 11:17:10 +0100 | [diff] [blame] | 44 | const uint8_t *key_buffer, |
| 45 | size_t key_buffer_size, |
Steven Cooreman | fe0ab55 | 2020-09-10 13:07:02 +0200 | [diff] [blame] | 46 | psa_algorithm_t alg, |
gabor-mezei-arm | fa990b5 | 2021-03-25 11:17:10 +0100 | [diff] [blame] | 47 | const uint8_t *input, |
| 48 | size_t input_length, |
| 49 | uint8_t *output, |
| 50 | size_t output_size, |
| 51 | size_t *output_length ) |
Steven Cooreman | fe0ab55 | 2020-09-10 13:07:02 +0200 | [diff] [blame] | 52 | { |
Ronald Cron | c4bc12e | 2021-04-13 12:41:34 +0200 | [diff] [blame] | 53 | mbedtls_test_driver_cipher_hooks.hits++; |
Steven Cooreman | fe0ab55 | 2020-09-10 13:07:02 +0200 | [diff] [blame] | 54 | |
Ronald Cron | c4bc12e | 2021-04-13 12:41:34 +0200 | [diff] [blame] | 55 | if( mbedtls_test_driver_cipher_hooks.forced_output != NULL ) |
Steven Cooreman | fe0ab55 | 2020-09-10 13:07:02 +0200 | [diff] [blame] | 56 | { |
Ronald Cron | c4bc12e | 2021-04-13 12:41:34 +0200 | [diff] [blame] | 57 | if( output_size < mbedtls_test_driver_cipher_hooks.forced_output_length ) |
Steven Cooreman | fe0ab55 | 2020-09-10 13:07:02 +0200 | [diff] [blame] | 58 | return( PSA_ERROR_BUFFER_TOO_SMALL ); |
| 59 | |
| 60 | memcpy( output, |
Ronald Cron | c4bc12e | 2021-04-13 12:41:34 +0200 | [diff] [blame] | 61 | mbedtls_test_driver_cipher_hooks.forced_output, |
| 62 | mbedtls_test_driver_cipher_hooks.forced_output_length ); |
| 63 | *output_length = mbedtls_test_driver_cipher_hooks.forced_output_length; |
Steven Cooreman | fe0ab55 | 2020-09-10 13:07:02 +0200 | [diff] [blame] | 64 | |
Ronald Cron | c4bc12e | 2021-04-13 12:41:34 +0200 | [diff] [blame] | 65 | return( mbedtls_test_driver_cipher_hooks.forced_status ); |
Steven Cooreman | fe0ab55 | 2020-09-10 13:07:02 +0200 | [diff] [blame] | 66 | } |
| 67 | |
gabor-mezei-arm | fa990b5 | 2021-03-25 11:17:10 +0100 | [diff] [blame] | 68 | if( mbedtls_test_driver_cipher_hooks.forced_status != PSA_SUCCESS ) |
| 69 | return( mbedtls_test_driver_cipher_hooks.forced_status ); |
Steven Cooreman | fe0ab55 | 2020-09-10 13:07:02 +0200 | [diff] [blame] | 70 | |
gabor-mezei-arm | fa990b5 | 2021-03-25 11:17:10 +0100 | [diff] [blame] | 71 | return( mbedtls_transparent_test_driver_cipher_encrypt( |
| 72 | attributes, key_buffer, key_buffer_size, |
| 73 | alg, input, input_length, |
| 74 | output, output_size, output_length ) ); |
Steven Cooreman | 37941cb | 2020-07-28 18:49:51 +0200 | [diff] [blame] | 75 | } |
| 76 | |
Ronald Cron | c4bc12e | 2021-04-13 12:41:34 +0200 | [diff] [blame] | 77 | psa_status_t mbedtls_test_transparent_cipher_decrypt( |
Steven Cooreman | 37941cb | 2020-07-28 18:49:51 +0200 | [diff] [blame] | 78 | const psa_key_attributes_t *attributes, |
gabor-mezei-arm | fa990b5 | 2021-03-25 11:17:10 +0100 | [diff] [blame] | 79 | const uint8_t *key_buffer, |
| 80 | size_t key_buffer_size, |
Steven Cooreman | 37941cb | 2020-07-28 18:49:51 +0200 | [diff] [blame] | 81 | psa_algorithm_t alg, |
gabor-mezei-arm | fa990b5 | 2021-03-25 11:17:10 +0100 | [diff] [blame] | 82 | const uint8_t *input, |
| 83 | size_t input_length, |
| 84 | uint8_t *output, |
| 85 | size_t output_size, |
| 86 | size_t *output_length ) |
Steven Cooreman | 37941cb | 2020-07-28 18:49:51 +0200 | [diff] [blame] | 87 | { |
gabor-mezei-arm | fa990b5 | 2021-03-25 11:17:10 +0100 | [diff] [blame] | 88 | mbedtls_test_driver_cipher_hooks.hits++; |
| 89 | |
| 90 | if( mbedtls_test_driver_cipher_hooks.forced_output != NULL ) |
| 91 | { |
| 92 | if( output_size < mbedtls_test_driver_cipher_hooks.forced_output_length ) |
| 93 | return( PSA_ERROR_BUFFER_TOO_SMALL ); |
| 94 | |
| 95 | memcpy( output, |
| 96 | mbedtls_test_driver_cipher_hooks.forced_output, |
| 97 | mbedtls_test_driver_cipher_hooks.forced_output_length ); |
| 98 | *output_length = mbedtls_test_driver_cipher_hooks.forced_output_length; |
| 99 | |
| 100 | return( mbedtls_test_driver_cipher_hooks.forced_status ); |
| 101 | } |
| 102 | |
| 103 | if( mbedtls_test_driver_cipher_hooks.forced_status != PSA_SUCCESS ) |
| 104 | return( mbedtls_test_driver_cipher_hooks.forced_status ); |
| 105 | |
| 106 | return( mbedtls_transparent_test_driver_cipher_decrypt( |
| 107 | attributes, key_buffer, key_buffer_size, |
| 108 | alg, input, input_length, |
| 109 | output, output_size, output_length ) ); |
Steven Cooreman | 37941cb | 2020-07-28 18:49:51 +0200 | [diff] [blame] | 110 | } |
| 111 | |
Ronald Cron | c4bc12e | 2021-04-13 12:41:34 +0200 | [diff] [blame] | 112 | psa_status_t mbedtls_test_transparent_cipher_encrypt_setup( |
Ronald Cron | 7cb9c3d | 2021-03-10 12:21:48 +0100 | [diff] [blame] | 113 | mbedtls_transparent_test_driver_cipher_operation_t *operation, |
Steven Cooreman | 16afd3d | 2020-09-09 15:36:39 +0200 | [diff] [blame] | 114 | const psa_key_attributes_t *attributes, |
| 115 | const uint8_t *key, size_t key_length, |
| 116 | psa_algorithm_t alg) |
| 117 | { |
Ronald Cron | c4bc12e | 2021-04-13 12:41:34 +0200 | [diff] [blame] | 118 | mbedtls_test_driver_cipher_hooks.hits++; |
Ronald Cron | 8d310ad | 2020-12-15 15:17:20 +0100 | [diff] [blame] | 119 | |
| 120 | /* Wiping the entire struct here, instead of member-by-member. This is |
| 121 | * useful for the test suite, since it gives a chance of catching memory |
| 122 | * corruption errors should the core not have allocated (enough) memory for |
| 123 | * our context struct. */ |
| 124 | memset( operation, 0, sizeof( *operation ) ); |
| 125 | |
Ronald Cron | c4bc12e | 2021-04-13 12:41:34 +0200 | [diff] [blame] | 126 | if( mbedtls_test_driver_cipher_hooks.forced_status != PSA_SUCCESS ) |
| 127 | return( mbedtls_test_driver_cipher_hooks.forced_status ); |
Ronald Cron | 8d310ad | 2020-12-15 15:17:20 +0100 | [diff] [blame] | 128 | |
Ronald Cron | 3522e32 | 2021-03-12 11:08:49 +0100 | [diff] [blame] | 129 | return ( mbedtls_transparent_test_driver_cipher_encrypt_setup( |
| 130 | operation, attributes, key, key_length, alg ) ); |
Steven Cooreman | 16afd3d | 2020-09-09 15:36:39 +0200 | [diff] [blame] | 131 | } |
| 132 | |
Ronald Cron | c4bc12e | 2021-04-13 12:41:34 +0200 | [diff] [blame] | 133 | psa_status_t mbedtls_test_transparent_cipher_decrypt_setup( |
Ronald Cron | 7cb9c3d | 2021-03-10 12:21:48 +0100 | [diff] [blame] | 134 | mbedtls_transparent_test_driver_cipher_operation_t *operation, |
Steven Cooreman | 37941cb | 2020-07-28 18:49:51 +0200 | [diff] [blame] | 135 | const psa_key_attributes_t *attributes, |
| 136 | const uint8_t *key, size_t key_length, |
| 137 | psa_algorithm_t alg) |
| 138 | { |
Ronald Cron | c4bc12e | 2021-04-13 12:41:34 +0200 | [diff] [blame] | 139 | mbedtls_test_driver_cipher_hooks.hits++; |
Ronald Cron | 8d310ad | 2020-12-15 15:17:20 +0100 | [diff] [blame] | 140 | |
Ronald Cron | c4bc12e | 2021-04-13 12:41:34 +0200 | [diff] [blame] | 141 | if( mbedtls_test_driver_cipher_hooks.forced_status != PSA_SUCCESS ) |
| 142 | return( mbedtls_test_driver_cipher_hooks.forced_status ); |
Ronald Cron | 8d310ad | 2020-12-15 15:17:20 +0100 | [diff] [blame] | 143 | |
Ronald Cron | 3522e32 | 2021-03-12 11:08:49 +0100 | [diff] [blame] | 144 | return ( mbedtls_transparent_test_driver_cipher_decrypt_setup( |
| 145 | operation, attributes, key, key_length, alg ) ); |
Steven Cooreman | 37941cb | 2020-07-28 18:49:51 +0200 | [diff] [blame] | 146 | } |
| 147 | |
Ronald Cron | c4bc12e | 2021-04-13 12:41:34 +0200 | [diff] [blame] | 148 | psa_status_t mbedtls_test_transparent_cipher_abort( |
Ronald Cron | 7cb9c3d | 2021-03-10 12:21:48 +0100 | [diff] [blame] | 149 | mbedtls_transparent_test_driver_cipher_operation_t *operation) |
Steven Cooreman | 37941cb | 2020-07-28 18:49:51 +0200 | [diff] [blame] | 150 | { |
Ronald Cron | c4bc12e | 2021-04-13 12:41:34 +0200 | [diff] [blame] | 151 | mbedtls_test_driver_cipher_hooks.hits++; |
Steven Cooreman | 89e54f2 | 2020-09-10 18:07:57 +0200 | [diff] [blame] | 152 | |
Steven Cooreman | 8b12225 | 2020-09-03 15:30:32 +0200 | [diff] [blame] | 153 | if( operation->alg == 0 ) |
| 154 | return( PSA_SUCCESS ); |
Steven Cooreman | 8b12225 | 2020-09-03 15:30:32 +0200 | [diff] [blame] | 155 | |
Ronald Cron | 3522e32 | 2021-03-12 11:08:49 +0100 | [diff] [blame] | 156 | mbedtls_transparent_test_driver_cipher_abort( operation ); |
Steven Cooreman | 8b12225 | 2020-09-03 15:30:32 +0200 | [diff] [blame] | 157 | |
Ronald Cron | 8d310ad | 2020-12-15 15:17:20 +0100 | [diff] [blame] | 158 | /* Wiping the entire struct here, instead of member-by-member. This is |
| 159 | * useful for the test suite, since it gives a chance of catching memory |
| 160 | * corruption errors should the core not have allocated (enough) memory for |
| 161 | * our context struct. */ |
Steven Cooreman | 5240e8b | 2020-09-09 11:51:45 +0200 | [diff] [blame] | 162 | memset( operation, 0, sizeof( *operation ) ); |
Steven Cooreman | 37941cb | 2020-07-28 18:49:51 +0200 | [diff] [blame] | 163 | |
Ronald Cron | c4bc12e | 2021-04-13 12:41:34 +0200 | [diff] [blame] | 164 | return( mbedtls_test_driver_cipher_hooks.forced_status ); |
Steven Cooreman | 37941cb | 2020-07-28 18:49:51 +0200 | [diff] [blame] | 165 | } |
| 166 | |
Ronald Cron | c4bc12e | 2021-04-13 12:41:34 +0200 | [diff] [blame] | 167 | psa_status_t mbedtls_test_transparent_cipher_set_iv( |
Ronald Cron | 7cb9c3d | 2021-03-10 12:21:48 +0100 | [diff] [blame] | 168 | mbedtls_transparent_test_driver_cipher_operation_t *operation, |
Steven Cooreman | 37941cb | 2020-07-28 18:49:51 +0200 | [diff] [blame] | 169 | const uint8_t *iv, |
| 170 | size_t iv_length) |
| 171 | { |
Ronald Cron | c4bc12e | 2021-04-13 12:41:34 +0200 | [diff] [blame] | 172 | mbedtls_test_driver_cipher_hooks.hits++; |
Steven Cooreman | 8b12225 | 2020-09-03 15:30:32 +0200 | [diff] [blame] | 173 | |
Ronald Cron | c4bc12e | 2021-04-13 12:41:34 +0200 | [diff] [blame] | 174 | if( mbedtls_test_driver_cipher_hooks.forced_status != PSA_SUCCESS ) |
| 175 | return( mbedtls_test_driver_cipher_hooks.forced_status ); |
Steven Cooreman | 89e54f2 | 2020-09-10 18:07:57 +0200 | [diff] [blame] | 176 | |
Ronald Cron | 3522e32 | 2021-03-12 11:08:49 +0100 | [diff] [blame] | 177 | return( mbedtls_transparent_test_driver_cipher_set_iv( |
| 178 | operation, iv, iv_length ) ); |
Steven Cooreman | 37941cb | 2020-07-28 18:49:51 +0200 | [diff] [blame] | 179 | } |
| 180 | |
Ronald Cron | c4bc12e | 2021-04-13 12:41:34 +0200 | [diff] [blame] | 181 | psa_status_t mbedtls_test_transparent_cipher_update( |
Ronald Cron | 7cb9c3d | 2021-03-10 12:21:48 +0100 | [diff] [blame] | 182 | mbedtls_transparent_test_driver_cipher_operation_t *operation, |
Steven Cooreman | 37941cb | 2020-07-28 18:49:51 +0200 | [diff] [blame] | 183 | const uint8_t *input, |
| 184 | size_t input_length, |
| 185 | uint8_t *output, |
| 186 | size_t output_size, |
| 187 | size_t *output_length) |
| 188 | { |
Ronald Cron | c4bc12e | 2021-04-13 12:41:34 +0200 | [diff] [blame] | 189 | mbedtls_test_driver_cipher_hooks.hits++; |
Steven Cooreman | 37941cb | 2020-07-28 18:49:51 +0200 | [diff] [blame] | 190 | |
Ronald Cron | c4bc12e | 2021-04-13 12:41:34 +0200 | [diff] [blame] | 191 | if( mbedtls_test_driver_cipher_hooks.forced_output != NULL ) |
Steven Cooreman | 8b12225 | 2020-09-03 15:30:32 +0200 | [diff] [blame] | 192 | { |
Ronald Cron | c4bc12e | 2021-04-13 12:41:34 +0200 | [diff] [blame] | 193 | if( output_size < mbedtls_test_driver_cipher_hooks.forced_output_length ) |
Steven Cooreman | 8b12225 | 2020-09-03 15:30:32 +0200 | [diff] [blame] | 194 | return PSA_ERROR_BUFFER_TOO_SMALL; |
| 195 | |
Steven Cooreman | acb5a10 | 2020-09-08 14:06:57 +0200 | [diff] [blame] | 196 | memcpy( output, |
Ronald Cron | c4bc12e | 2021-04-13 12:41:34 +0200 | [diff] [blame] | 197 | mbedtls_test_driver_cipher_hooks.forced_output, |
| 198 | mbedtls_test_driver_cipher_hooks.forced_output_length ); |
| 199 | *output_length = mbedtls_test_driver_cipher_hooks.forced_output_length; |
Ronald Cron | 8d310ad | 2020-12-15 15:17:20 +0100 | [diff] [blame] | 200 | |
Ronald Cron | c4bc12e | 2021-04-13 12:41:34 +0200 | [diff] [blame] | 201 | return( mbedtls_test_driver_cipher_hooks.forced_status ); |
Steven Cooreman | 8b12225 | 2020-09-03 15:30:32 +0200 | [diff] [blame] | 202 | } |
Steven Cooreman | 37941cb | 2020-07-28 18:49:51 +0200 | [diff] [blame] | 203 | |
Ronald Cron | c4bc12e | 2021-04-13 12:41:34 +0200 | [diff] [blame] | 204 | if( mbedtls_test_driver_cipher_hooks.forced_status != PSA_SUCCESS ) |
| 205 | return( mbedtls_test_driver_cipher_hooks.forced_status ); |
Ronald Cron | 8d310ad | 2020-12-15 15:17:20 +0100 | [diff] [blame] | 206 | |
Ronald Cron | 3522e32 | 2021-03-12 11:08:49 +0100 | [diff] [blame] | 207 | return( mbedtls_transparent_test_driver_cipher_update( |
| 208 | operation, input, input_length, |
| 209 | output, output_size, output_length ) ); |
Steven Cooreman | 37941cb | 2020-07-28 18:49:51 +0200 | [diff] [blame] | 210 | } |
| 211 | |
Ronald Cron | c4bc12e | 2021-04-13 12:41:34 +0200 | [diff] [blame] | 212 | psa_status_t mbedtls_test_transparent_cipher_finish( |
Ronald Cron | 7cb9c3d | 2021-03-10 12:21:48 +0100 | [diff] [blame] | 213 | mbedtls_transparent_test_driver_cipher_operation_t *operation, |
Steven Cooreman | 37941cb | 2020-07-28 18:49:51 +0200 | [diff] [blame] | 214 | uint8_t *output, |
| 215 | size_t output_size, |
| 216 | size_t *output_length) |
| 217 | { |
Ronald Cron | c4bc12e | 2021-04-13 12:41:34 +0200 | [diff] [blame] | 218 | mbedtls_test_driver_cipher_hooks.hits++; |
Steven Cooreman | 37941cb | 2020-07-28 18:49:51 +0200 | [diff] [blame] | 219 | |
Ronald Cron | c4bc12e | 2021-04-13 12:41:34 +0200 | [diff] [blame] | 220 | if( mbedtls_test_driver_cipher_hooks.forced_output != NULL ) |
Steven Cooreman | 8b12225 | 2020-09-03 15:30:32 +0200 | [diff] [blame] | 221 | { |
Ronald Cron | c4bc12e | 2021-04-13 12:41:34 +0200 | [diff] [blame] | 222 | if( output_size < mbedtls_test_driver_cipher_hooks.forced_output_length ) |
Steven Cooreman | 8b12225 | 2020-09-03 15:30:32 +0200 | [diff] [blame] | 223 | return PSA_ERROR_BUFFER_TOO_SMALL; |
| 224 | |
Steven Cooreman | acb5a10 | 2020-09-08 14:06:57 +0200 | [diff] [blame] | 225 | memcpy( output, |
Ronald Cron | c4bc12e | 2021-04-13 12:41:34 +0200 | [diff] [blame] | 226 | mbedtls_test_driver_cipher_hooks.forced_output, |
| 227 | mbedtls_test_driver_cipher_hooks.forced_output_length ); |
| 228 | *output_length = mbedtls_test_driver_cipher_hooks.forced_output_length; |
Ronald Cron | 8d310ad | 2020-12-15 15:17:20 +0100 | [diff] [blame] | 229 | |
Ronald Cron | c4bc12e | 2021-04-13 12:41:34 +0200 | [diff] [blame] | 230 | return( mbedtls_test_driver_cipher_hooks.forced_status ); |
Steven Cooreman | 8b12225 | 2020-09-03 15:30:32 +0200 | [diff] [blame] | 231 | } |
Steven Cooreman | 37941cb | 2020-07-28 18:49:51 +0200 | [diff] [blame] | 232 | |
Ronald Cron | c4bc12e | 2021-04-13 12:41:34 +0200 | [diff] [blame] | 233 | if( mbedtls_test_driver_cipher_hooks.forced_status != PSA_SUCCESS ) |
| 234 | return( mbedtls_test_driver_cipher_hooks.forced_status ); |
Ronald Cron | 8d310ad | 2020-12-15 15:17:20 +0100 | [diff] [blame] | 235 | |
Ronald Cron | 3522e32 | 2021-03-12 11:08:49 +0100 | [diff] [blame] | 236 | return( mbedtls_transparent_test_driver_cipher_finish( |
| 237 | operation, output, output_size, output_length ) ); |
Steven Cooreman | 37941cb | 2020-07-28 18:49:51 +0200 | [diff] [blame] | 238 | } |
| 239 | |
| 240 | /* |
| 241 | * opaque versions, to do |
| 242 | */ |
Ronald Cron | c4bc12e | 2021-04-13 12:41:34 +0200 | [diff] [blame] | 243 | psa_status_t mbedtls_test_opaque_cipher_encrypt( |
Steven Cooreman | 37941cb | 2020-07-28 18:49:51 +0200 | [diff] [blame] | 244 | const psa_key_attributes_t *attributes, |
| 245 | const uint8_t *key, size_t key_length, |
| 246 | psa_algorithm_t alg, |
| 247 | const uint8_t *input, size_t input_length, |
| 248 | uint8_t *output, size_t output_size, size_t *output_length) |
| 249 | { |
| 250 | (void) attributes; |
| 251 | (void) key; |
| 252 | (void) key_length; |
| 253 | (void) alg; |
| 254 | (void) input; |
| 255 | (void) input_length; |
| 256 | (void) output; |
| 257 | (void) output_size; |
| 258 | (void) output_length; |
Steven Cooreman | acb5a10 | 2020-09-08 14:06:57 +0200 | [diff] [blame] | 259 | return( PSA_ERROR_NOT_SUPPORTED ); |
Steven Cooreman | 37941cb | 2020-07-28 18:49:51 +0200 | [diff] [blame] | 260 | } |
| 261 | |
Ronald Cron | c4bc12e | 2021-04-13 12:41:34 +0200 | [diff] [blame] | 262 | psa_status_t mbedtls_test_opaque_cipher_decrypt( |
Steven Cooreman | 37941cb | 2020-07-28 18:49:51 +0200 | [diff] [blame] | 263 | const psa_key_attributes_t *attributes, |
| 264 | const uint8_t *key, size_t key_length, |
| 265 | psa_algorithm_t alg, |
| 266 | const uint8_t *input, size_t input_length, |
| 267 | uint8_t *output, size_t output_size, size_t *output_length) |
| 268 | { |
| 269 | (void) attributes; |
| 270 | (void) key; |
| 271 | (void) key_length; |
| 272 | (void) alg; |
| 273 | (void) input; |
| 274 | (void) input_length; |
| 275 | (void) output; |
| 276 | (void) output_size; |
| 277 | (void) output_length; |
Steven Cooreman | acb5a10 | 2020-09-08 14:06:57 +0200 | [diff] [blame] | 278 | return( PSA_ERROR_NOT_SUPPORTED ); |
Steven Cooreman | 37941cb | 2020-07-28 18:49:51 +0200 | [diff] [blame] | 279 | } |
| 280 | |
Ronald Cron | c4bc12e | 2021-04-13 12:41:34 +0200 | [diff] [blame] | 281 | psa_status_t mbedtls_test_opaque_cipher_encrypt_setup( |
Ronald Cron | 7cb9c3d | 2021-03-10 12:21:48 +0100 | [diff] [blame] | 282 | mbedtls_opaque_test_driver_cipher_operation_t *operation, |
Steven Cooreman | 37941cb | 2020-07-28 18:49:51 +0200 | [diff] [blame] | 283 | const psa_key_attributes_t *attributes, |
| 284 | const uint8_t *key, size_t key_length, |
| 285 | psa_algorithm_t alg) |
| 286 | { |
| 287 | (void) operation; |
| 288 | (void) attributes; |
| 289 | (void) key; |
| 290 | (void) key_length; |
| 291 | (void) alg; |
Steven Cooreman | acb5a10 | 2020-09-08 14:06:57 +0200 | [diff] [blame] | 292 | return( PSA_ERROR_NOT_SUPPORTED ); |
Steven Cooreman | 37941cb | 2020-07-28 18:49:51 +0200 | [diff] [blame] | 293 | } |
| 294 | |
Ronald Cron | c4bc12e | 2021-04-13 12:41:34 +0200 | [diff] [blame] | 295 | psa_status_t mbedtls_test_opaque_cipher_decrypt_setup( |
Ronald Cron | 7cb9c3d | 2021-03-10 12:21:48 +0100 | [diff] [blame] | 296 | mbedtls_opaque_test_driver_cipher_operation_t *operation, |
Steven Cooreman | 37941cb | 2020-07-28 18:49:51 +0200 | [diff] [blame] | 297 | const psa_key_attributes_t *attributes, |
| 298 | const uint8_t *key, size_t key_length, |
| 299 | psa_algorithm_t alg) |
| 300 | { |
| 301 | (void) operation; |
| 302 | (void) attributes; |
| 303 | (void) key; |
| 304 | (void) key_length; |
| 305 | (void) alg; |
Steven Cooreman | acb5a10 | 2020-09-08 14:06:57 +0200 | [diff] [blame] | 306 | return( PSA_ERROR_NOT_SUPPORTED ); |
Steven Cooreman | 37941cb | 2020-07-28 18:49:51 +0200 | [diff] [blame] | 307 | } |
| 308 | |
Ronald Cron | c4bc12e | 2021-04-13 12:41:34 +0200 | [diff] [blame] | 309 | psa_status_t mbedtls_test_opaque_cipher_abort( |
Ronald Cron | 7cb9c3d | 2021-03-10 12:21:48 +0100 | [diff] [blame] | 310 | mbedtls_opaque_test_driver_cipher_operation_t *operation ) |
Steven Cooreman | 37941cb | 2020-07-28 18:49:51 +0200 | [diff] [blame] | 311 | { |
| 312 | (void) operation; |
Steven Cooreman | acb5a10 | 2020-09-08 14:06:57 +0200 | [diff] [blame] | 313 | return( PSA_ERROR_NOT_SUPPORTED ); |
Steven Cooreman | 37941cb | 2020-07-28 18:49:51 +0200 | [diff] [blame] | 314 | } |
| 315 | |
Ronald Cron | c4bc12e | 2021-04-13 12:41:34 +0200 | [diff] [blame] | 316 | psa_status_t mbedtls_test_opaque_cipher_set_iv( |
Ronald Cron | 7cb9c3d | 2021-03-10 12:21:48 +0100 | [diff] [blame] | 317 | mbedtls_opaque_test_driver_cipher_operation_t *operation, |
Steven Cooreman | 37941cb | 2020-07-28 18:49:51 +0200 | [diff] [blame] | 318 | const uint8_t *iv, |
| 319 | size_t iv_length) |
| 320 | { |
| 321 | (void) operation; |
| 322 | (void) iv; |
| 323 | (void) iv_length; |
Steven Cooreman | acb5a10 | 2020-09-08 14:06:57 +0200 | [diff] [blame] | 324 | return( PSA_ERROR_NOT_SUPPORTED ); |
Steven Cooreman | 37941cb | 2020-07-28 18:49:51 +0200 | [diff] [blame] | 325 | } |
| 326 | |
Ronald Cron | c4bc12e | 2021-04-13 12:41:34 +0200 | [diff] [blame] | 327 | psa_status_t mbedtls_test_opaque_cipher_update( |
Ronald Cron | 7cb9c3d | 2021-03-10 12:21:48 +0100 | [diff] [blame] | 328 | mbedtls_opaque_test_driver_cipher_operation_t *operation, |
Steven Cooreman | 37941cb | 2020-07-28 18:49:51 +0200 | [diff] [blame] | 329 | const uint8_t *input, |
| 330 | size_t input_length, |
| 331 | uint8_t *output, |
| 332 | size_t output_size, |
| 333 | size_t *output_length) |
| 334 | { |
| 335 | (void) operation; |
| 336 | (void) input; |
| 337 | (void) input_length; |
| 338 | (void) output; |
| 339 | (void) output_size; |
| 340 | (void) output_length; |
Steven Cooreman | acb5a10 | 2020-09-08 14:06:57 +0200 | [diff] [blame] | 341 | return( PSA_ERROR_NOT_SUPPORTED ); |
Steven Cooreman | 37941cb | 2020-07-28 18:49:51 +0200 | [diff] [blame] | 342 | } |
| 343 | |
Ronald Cron | c4bc12e | 2021-04-13 12:41:34 +0200 | [diff] [blame] | 344 | psa_status_t mbedtls_test_opaque_cipher_finish( |
Ronald Cron | 7cb9c3d | 2021-03-10 12:21:48 +0100 | [diff] [blame] | 345 | mbedtls_opaque_test_driver_cipher_operation_t *operation, |
Steven Cooreman | 37941cb | 2020-07-28 18:49:51 +0200 | [diff] [blame] | 346 | uint8_t *output, |
| 347 | size_t output_size, |
| 348 | size_t *output_length) |
| 349 | { |
| 350 | (void) operation; |
| 351 | (void) output; |
| 352 | (void) output_size; |
| 353 | (void) output_length; |
Steven Cooreman | acb5a10 | 2020-09-08 14:06:57 +0200 | [diff] [blame] | 354 | return( PSA_ERROR_NOT_SUPPORTED ); |
Steven Cooreman | 37941cb | 2020-07-28 18:49:51 +0200 | [diff] [blame] | 355 | } |
| 356 | #endif /* MBEDTLS_PSA_CRYPTO_DRIVERS && PSA_CRYPTO_DRIVER_TEST */ |