blob: a415dd812b2f1e14f41f0157955be590913fb94f [file] [log] [blame]
Steven Cooreman37941cb2020-07-28 18:49:51 +02001/*
2 * Test driver for cipher functions.
3 * Currently only supports multi-part operations using AES-CTR.
4 */
Steven Cooreman3ec40182020-09-02 16:27:46 +02005/* Copyright The Mbed TLS Contributors
Steven Cooreman37941cb2020-07-28 18:49:51 +02006 * 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 Cooreman37941cb2020-07-28 18:49:51 +020019 */
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 Cron8d310ad2020-12-15 15:17:20 +010029#include "psa_crypto_cipher.h"
Steven Cooremanacb5a102020-09-08 14:06:57 +020030#include "psa_crypto_core.h"
Steven Cooreman37941cb2020-07-28 18:49:51 +020031#include "mbedtls/cipher.h"
32
Steven Cooremanacb5a102020-09-08 14:06:57 +020033#include "test/drivers/cipher.h"
Steven Cooreman37941cb2020-07-28 18:49:51 +020034
35#include "test/random.h"
36
37#include <string.h>
38
Ronald Cronc4bc12e2021-04-13 12:41:34 +020039mbedtls_test_driver_cipher_hooks_t mbedtls_test_driver_cipher_hooks =
40 MBEDTLS_TEST_DRIVER_CIPHER_INIT;
Steven Cooreman37941cb2020-07-28 18:49:51 +020041
Ronald Cronc4bc12e2021-04-13 12:41:34 +020042static psa_status_t mbedtls_test_transparent_cipher_oneshot(
Steven Cooremanfe0ab552020-09-10 13:07:02 +020043 mbedtls_operation_t direction,
44 const psa_key_attributes_t *attributes,
45 const uint8_t *key, size_t key_length,
46 psa_algorithm_t alg,
47 const uint8_t *input, size_t input_length,
48 uint8_t *output, size_t output_size, size_t *output_length)
49{
Ronald Cronc4bc12e2021-04-13 12:41:34 +020050 mbedtls_test_driver_cipher_hooks.hits++;
Steven Cooremanfe0ab552020-09-10 13:07:02 +020051
52 /* Test driver supports AES-CTR only, to verify operation calls. */
53 if( alg != PSA_ALG_CTR ||
54 psa_get_key_type( attributes ) != PSA_KEY_TYPE_AES )
55 return( PSA_ERROR_NOT_SUPPORTED );
56
57 /* If test driver response code is not SUCCESS, we can return early */
Ronald Cronc4bc12e2021-04-13 12:41:34 +020058 if( mbedtls_test_driver_cipher_hooks.forced_status != PSA_SUCCESS )
59 return( mbedtls_test_driver_cipher_hooks.forced_status );
Steven Cooremanfe0ab552020-09-10 13:07:02 +020060
61 /* If test driver output is overridden, we don't need to do actual crypto */
Ronald Cronc4bc12e2021-04-13 12:41:34 +020062 if( mbedtls_test_driver_cipher_hooks.forced_output != NULL )
Steven Cooremanfe0ab552020-09-10 13:07:02 +020063 {
Ronald Cronc4bc12e2021-04-13 12:41:34 +020064 if( output_size < mbedtls_test_driver_cipher_hooks.forced_output_length )
Steven Cooremanfe0ab552020-09-10 13:07:02 +020065 return( PSA_ERROR_BUFFER_TOO_SMALL );
66
67 memcpy( output,
Ronald Cronc4bc12e2021-04-13 12:41:34 +020068 mbedtls_test_driver_cipher_hooks.forced_output,
69 mbedtls_test_driver_cipher_hooks.forced_output_length );
70 *output_length = mbedtls_test_driver_cipher_hooks.forced_output_length;
Steven Cooremanfe0ab552020-09-10 13:07:02 +020071
Ronald Cronc4bc12e2021-04-13 12:41:34 +020072 return( mbedtls_test_driver_cipher_hooks.forced_status );
Steven Cooremanfe0ab552020-09-10 13:07:02 +020073 }
74
75 /* Run AES-CTR using the cipher module */
76 {
77 mbedtls_test_rnd_pseudo_info rnd_info;
78 memset( &rnd_info, 0x5A, sizeof( mbedtls_test_rnd_pseudo_info ) );
79
80 const mbedtls_cipher_info_t *cipher_info =
81 mbedtls_cipher_info_from_values( MBEDTLS_CIPHER_ID_AES,
82 key_length * 8,
83 MBEDTLS_MODE_CTR );
84 mbedtls_cipher_context_t cipher;
85 int ret = 0;
86 uint8_t temp_output_buffer[16] = {0};
87 size_t temp_output_length = 0;
88
89 if( direction == MBEDTLS_ENCRYPT )
90 {
91 /* Oneshot encrypt needs to prepend the IV to the output */
92 if( output_size < ( input_length + 16 ) )
93 return( PSA_ERROR_BUFFER_TOO_SMALL );
94 }
95 else
96 {
97 /* Oneshot decrypt has the IV prepended to the input */
98 if( output_size < ( input_length - 16 ) )
99 return( PSA_ERROR_BUFFER_TOO_SMALL );
100 }
101
102 if( cipher_info == NULL )
103 return( PSA_ERROR_NOT_SUPPORTED );
104
105 mbedtls_cipher_init( &cipher );
106 ret = mbedtls_cipher_setup( &cipher, cipher_info );
107 if( ret != 0 )
108 goto exit;
109
110 ret = mbedtls_cipher_setkey( &cipher,
111 key,
112 key_length * 8, direction );
113 if( ret != 0 )
114 goto exit;
115
116 if( direction == MBEDTLS_ENCRYPT )
117 {
118 mbedtls_test_rnd_pseudo_info rnd_info;
119 memset( &rnd_info, 0x5A, sizeof( mbedtls_test_rnd_pseudo_info ) );
120
121 ret = mbedtls_test_rnd_pseudo_rand( &rnd_info,
122 temp_output_buffer,
123 16 );
124 if( ret != 0 )
125 goto exit;
126
127 ret = mbedtls_cipher_set_iv( &cipher, temp_output_buffer, 16 );
128 }
129 else
130 ret = mbedtls_cipher_set_iv( &cipher, input, 16 );
131
132 if( ret != 0 )
133 goto exit;
134
135 if( direction == MBEDTLS_ENCRYPT )
136 {
137 ret = mbedtls_cipher_update( &cipher,
138 input, input_length,
139 &output[16], output_length );
140 if( ret == 0 )
141 {
142 memcpy( output, temp_output_buffer, 16 );
143 *output_length += 16;
144 }
145 }
146 else
147 ret = mbedtls_cipher_update( &cipher,
148 &input[16], input_length - 16,
149 output, output_length );
150
151 if( ret != 0 )
152 goto exit;
153
154 ret = mbedtls_cipher_finish( &cipher,
155 temp_output_buffer,
156 &temp_output_length );
157
158exit:
159 if( ret != 0 )
160 {
161 *output_length = 0;
162 memset(output, 0, output_size);
163 }
164
165 mbedtls_cipher_free( &cipher );
166 return( mbedtls_to_psa_error( ret ) );
167 }
168}
169
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200170psa_status_t mbedtls_test_transparent_cipher_encrypt(
Steven Cooreman37941cb2020-07-28 18:49:51 +0200171 const psa_key_attributes_t *attributes,
172 const uint8_t *key, size_t key_length,
173 psa_algorithm_t alg,
174 const uint8_t *input, size_t input_length,
175 uint8_t *output, size_t output_size, size_t *output_length)
176{
Steven Cooremanfe0ab552020-09-10 13:07:02 +0200177 return (
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200178 mbedtls_test_transparent_cipher_oneshot(
Steven Cooremanfe0ab552020-09-10 13:07:02 +0200179 MBEDTLS_ENCRYPT,
180 attributes,
181 key, key_length,
182 alg,
183 input, input_length,
184 output, output_size, output_length) );
Steven Cooreman37941cb2020-07-28 18:49:51 +0200185}
186
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200187psa_status_t mbedtls_test_transparent_cipher_decrypt(
Steven Cooreman37941cb2020-07-28 18:49:51 +0200188 const psa_key_attributes_t *attributes,
189 const uint8_t *key, size_t key_length,
190 psa_algorithm_t alg,
191 const uint8_t *input, size_t input_length,
192 uint8_t *output, size_t output_size, size_t *output_length)
193{
Steven Cooremanfe0ab552020-09-10 13:07:02 +0200194 return (
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200195 mbedtls_test_transparent_cipher_oneshot(
Steven Cooremanfe0ab552020-09-10 13:07:02 +0200196 MBEDTLS_DECRYPT,
197 attributes,
198 key, key_length,
199 alg,
200 input, input_length,
201 output, output_size, output_length) );
Steven Cooreman37941cb2020-07-28 18:49:51 +0200202}
203
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200204psa_status_t mbedtls_test_transparent_cipher_encrypt_setup(
Ronald Cron7cb9c3d2021-03-10 12:21:48 +0100205 mbedtls_transparent_test_driver_cipher_operation_t *operation,
Steven Cooreman16afd3d2020-09-09 15:36:39 +0200206 const psa_key_attributes_t *attributes,
207 const uint8_t *key, size_t key_length,
208 psa_algorithm_t alg)
209{
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200210 mbedtls_test_driver_cipher_hooks.hits++;
Ronald Cron8d310ad2020-12-15 15:17:20 +0100211
212 /* Wiping the entire struct here, instead of member-by-member. This is
213 * useful for the test suite, since it gives a chance of catching memory
214 * corruption errors should the core not have allocated (enough) memory for
215 * our context struct. */
216 memset( operation, 0, sizeof( *operation ) );
217
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200218 if( mbedtls_test_driver_cipher_hooks.forced_status != PSA_SUCCESS )
219 return( mbedtls_test_driver_cipher_hooks.forced_status );
Ronald Cron8d310ad2020-12-15 15:17:20 +0100220
Ronald Cron3522e322021-03-12 11:08:49 +0100221 return ( mbedtls_transparent_test_driver_cipher_encrypt_setup(
222 operation, attributes, key, key_length, alg ) );
Steven Cooreman16afd3d2020-09-09 15:36:39 +0200223}
224
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200225psa_status_t mbedtls_test_transparent_cipher_decrypt_setup(
Ronald Cron7cb9c3d2021-03-10 12:21:48 +0100226 mbedtls_transparent_test_driver_cipher_operation_t *operation,
Steven Cooreman37941cb2020-07-28 18:49:51 +0200227 const psa_key_attributes_t *attributes,
228 const uint8_t *key, size_t key_length,
229 psa_algorithm_t alg)
230{
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200231 mbedtls_test_driver_cipher_hooks.hits++;
Ronald Cron8d310ad2020-12-15 15:17:20 +0100232
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200233 if( mbedtls_test_driver_cipher_hooks.forced_status != PSA_SUCCESS )
234 return( mbedtls_test_driver_cipher_hooks.forced_status );
Ronald Cron8d310ad2020-12-15 15:17:20 +0100235
Ronald Cron3522e322021-03-12 11:08:49 +0100236 return ( mbedtls_transparent_test_driver_cipher_decrypt_setup(
237 operation, attributes, key, key_length, alg ) );
Steven Cooreman37941cb2020-07-28 18:49:51 +0200238}
239
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200240psa_status_t mbedtls_test_transparent_cipher_abort(
Ronald Cron7cb9c3d2021-03-10 12:21:48 +0100241 mbedtls_transparent_test_driver_cipher_operation_t *operation)
Steven Cooreman37941cb2020-07-28 18:49:51 +0200242{
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200243 mbedtls_test_driver_cipher_hooks.hits++;
Steven Cooreman89e54f22020-09-10 18:07:57 +0200244
Steven Cooreman8b122252020-09-03 15:30:32 +0200245 if( operation->alg == 0 )
246 return( PSA_SUCCESS );
Steven Cooreman8b122252020-09-03 15:30:32 +0200247
Ronald Cron3522e322021-03-12 11:08:49 +0100248 mbedtls_transparent_test_driver_cipher_abort( operation );
Steven Cooreman8b122252020-09-03 15:30:32 +0200249
Ronald Cron8d310ad2020-12-15 15:17:20 +0100250 /* Wiping the entire struct here, instead of member-by-member. This is
251 * useful for the test suite, since it gives a chance of catching memory
252 * corruption errors should the core not have allocated (enough) memory for
253 * our context struct. */
Steven Cooreman5240e8b2020-09-09 11:51:45 +0200254 memset( operation, 0, sizeof( *operation ) );
Steven Cooreman37941cb2020-07-28 18:49:51 +0200255
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200256 return( mbedtls_test_driver_cipher_hooks.forced_status );
Steven Cooreman37941cb2020-07-28 18:49:51 +0200257}
258
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200259psa_status_t mbedtls_test_transparent_cipher_set_iv(
Ronald Cron7cb9c3d2021-03-10 12:21:48 +0100260 mbedtls_transparent_test_driver_cipher_operation_t *operation,
Steven Cooreman37941cb2020-07-28 18:49:51 +0200261 const uint8_t *iv,
262 size_t iv_length)
263{
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200264 mbedtls_test_driver_cipher_hooks.hits++;
Steven Cooreman8b122252020-09-03 15:30:32 +0200265
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200266 if( mbedtls_test_driver_cipher_hooks.forced_status != PSA_SUCCESS )
267 return( mbedtls_test_driver_cipher_hooks.forced_status );
Steven Cooreman89e54f22020-09-10 18:07:57 +0200268
Ronald Cron3522e322021-03-12 11:08:49 +0100269 return( mbedtls_transparent_test_driver_cipher_set_iv(
270 operation, iv, iv_length ) );
Steven Cooreman37941cb2020-07-28 18:49:51 +0200271}
272
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200273psa_status_t mbedtls_test_transparent_cipher_update(
Ronald Cron7cb9c3d2021-03-10 12:21:48 +0100274 mbedtls_transparent_test_driver_cipher_operation_t *operation,
Steven Cooreman37941cb2020-07-28 18:49:51 +0200275 const uint8_t *input,
276 size_t input_length,
277 uint8_t *output,
278 size_t output_size,
279 size_t *output_length)
280{
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200281 mbedtls_test_driver_cipher_hooks.hits++;
Steven Cooreman37941cb2020-07-28 18:49:51 +0200282
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200283 if( mbedtls_test_driver_cipher_hooks.forced_output != NULL )
Steven Cooreman8b122252020-09-03 15:30:32 +0200284 {
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200285 if( output_size < mbedtls_test_driver_cipher_hooks.forced_output_length )
Steven Cooreman8b122252020-09-03 15:30:32 +0200286 return PSA_ERROR_BUFFER_TOO_SMALL;
287
Steven Cooremanacb5a102020-09-08 14:06:57 +0200288 memcpy( output,
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200289 mbedtls_test_driver_cipher_hooks.forced_output,
290 mbedtls_test_driver_cipher_hooks.forced_output_length );
291 *output_length = mbedtls_test_driver_cipher_hooks.forced_output_length;
Ronald Cron8d310ad2020-12-15 15:17:20 +0100292
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200293 return( mbedtls_test_driver_cipher_hooks.forced_status );
Steven Cooreman8b122252020-09-03 15:30:32 +0200294 }
Steven Cooreman37941cb2020-07-28 18:49:51 +0200295
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200296 if( mbedtls_test_driver_cipher_hooks.forced_status != PSA_SUCCESS )
297 return( mbedtls_test_driver_cipher_hooks.forced_status );
Ronald Cron8d310ad2020-12-15 15:17:20 +0100298
Ronald Cron3522e322021-03-12 11:08:49 +0100299 return( mbedtls_transparent_test_driver_cipher_update(
300 operation, input, input_length,
301 output, output_size, output_length ) );
Steven Cooreman37941cb2020-07-28 18:49:51 +0200302}
303
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200304psa_status_t mbedtls_test_transparent_cipher_finish(
Ronald Cron7cb9c3d2021-03-10 12:21:48 +0100305 mbedtls_transparent_test_driver_cipher_operation_t *operation,
Steven Cooreman37941cb2020-07-28 18:49:51 +0200306 uint8_t *output,
307 size_t output_size,
308 size_t *output_length)
309{
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200310 mbedtls_test_driver_cipher_hooks.hits++;
Steven Cooreman37941cb2020-07-28 18:49:51 +0200311
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200312 if( mbedtls_test_driver_cipher_hooks.forced_output != NULL )
Steven Cooreman8b122252020-09-03 15:30:32 +0200313 {
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200314 if( output_size < mbedtls_test_driver_cipher_hooks.forced_output_length )
Steven Cooreman8b122252020-09-03 15:30:32 +0200315 return PSA_ERROR_BUFFER_TOO_SMALL;
316
Steven Cooremanacb5a102020-09-08 14:06:57 +0200317 memcpy( output,
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200318 mbedtls_test_driver_cipher_hooks.forced_output,
319 mbedtls_test_driver_cipher_hooks.forced_output_length );
320 *output_length = mbedtls_test_driver_cipher_hooks.forced_output_length;
Ronald Cron8d310ad2020-12-15 15:17:20 +0100321
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200322 return( mbedtls_test_driver_cipher_hooks.forced_status );
Steven Cooreman8b122252020-09-03 15:30:32 +0200323 }
Steven Cooreman37941cb2020-07-28 18:49:51 +0200324
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200325 if( mbedtls_test_driver_cipher_hooks.forced_status != PSA_SUCCESS )
326 return( mbedtls_test_driver_cipher_hooks.forced_status );
Ronald Cron8d310ad2020-12-15 15:17:20 +0100327
Ronald Cron3522e322021-03-12 11:08:49 +0100328 return( mbedtls_transparent_test_driver_cipher_finish(
329 operation, output, output_size, output_length ) );
Steven Cooreman37941cb2020-07-28 18:49:51 +0200330}
331
332/*
333 * opaque versions, to do
334 */
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200335psa_status_t mbedtls_test_opaque_cipher_encrypt(
Steven Cooreman37941cb2020-07-28 18:49:51 +0200336 const psa_key_attributes_t *attributes,
337 const uint8_t *key, size_t key_length,
338 psa_algorithm_t alg,
339 const uint8_t *input, size_t input_length,
340 uint8_t *output, size_t output_size, size_t *output_length)
341{
342 (void) attributes;
343 (void) key;
344 (void) key_length;
345 (void) alg;
346 (void) input;
347 (void) input_length;
348 (void) output;
349 (void) output_size;
350 (void) output_length;
Steven Cooremanacb5a102020-09-08 14:06:57 +0200351 return( PSA_ERROR_NOT_SUPPORTED );
Steven Cooreman37941cb2020-07-28 18:49:51 +0200352}
353
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200354psa_status_t mbedtls_test_opaque_cipher_decrypt(
Steven Cooreman37941cb2020-07-28 18:49:51 +0200355 const psa_key_attributes_t *attributes,
356 const uint8_t *key, size_t key_length,
357 psa_algorithm_t alg,
358 const uint8_t *input, size_t input_length,
359 uint8_t *output, size_t output_size, size_t *output_length)
360{
361 (void) attributes;
362 (void) key;
363 (void) key_length;
364 (void) alg;
365 (void) input;
366 (void) input_length;
367 (void) output;
368 (void) output_size;
369 (void) output_length;
Steven Cooremanacb5a102020-09-08 14:06:57 +0200370 return( PSA_ERROR_NOT_SUPPORTED );
Steven Cooreman37941cb2020-07-28 18:49:51 +0200371}
372
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200373psa_status_t mbedtls_test_opaque_cipher_encrypt_setup(
Ronald Cron7cb9c3d2021-03-10 12:21:48 +0100374 mbedtls_opaque_test_driver_cipher_operation_t *operation,
Steven Cooreman37941cb2020-07-28 18:49:51 +0200375 const psa_key_attributes_t *attributes,
376 const uint8_t *key, size_t key_length,
377 psa_algorithm_t alg)
378{
379 (void) operation;
380 (void) attributes;
381 (void) key;
382 (void) key_length;
383 (void) alg;
Steven Cooremanacb5a102020-09-08 14:06:57 +0200384 return( PSA_ERROR_NOT_SUPPORTED );
Steven Cooreman37941cb2020-07-28 18:49:51 +0200385}
386
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200387psa_status_t mbedtls_test_opaque_cipher_decrypt_setup(
Ronald Cron7cb9c3d2021-03-10 12:21:48 +0100388 mbedtls_opaque_test_driver_cipher_operation_t *operation,
Steven Cooreman37941cb2020-07-28 18:49:51 +0200389 const psa_key_attributes_t *attributes,
390 const uint8_t *key, size_t key_length,
391 psa_algorithm_t alg)
392{
393 (void) operation;
394 (void) attributes;
395 (void) key;
396 (void) key_length;
397 (void) alg;
Steven Cooremanacb5a102020-09-08 14:06:57 +0200398 return( PSA_ERROR_NOT_SUPPORTED );
Steven Cooreman37941cb2020-07-28 18:49:51 +0200399}
400
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200401psa_status_t mbedtls_test_opaque_cipher_abort(
Ronald Cron7cb9c3d2021-03-10 12:21:48 +0100402 mbedtls_opaque_test_driver_cipher_operation_t *operation )
Steven Cooreman37941cb2020-07-28 18:49:51 +0200403{
404 (void) operation;
Steven Cooremanacb5a102020-09-08 14:06:57 +0200405 return( PSA_ERROR_NOT_SUPPORTED );
Steven Cooreman37941cb2020-07-28 18:49:51 +0200406}
407
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200408psa_status_t mbedtls_test_opaque_cipher_set_iv(
Ronald Cron7cb9c3d2021-03-10 12:21:48 +0100409 mbedtls_opaque_test_driver_cipher_operation_t *operation,
Steven Cooreman37941cb2020-07-28 18:49:51 +0200410 const uint8_t *iv,
411 size_t iv_length)
412{
413 (void) operation;
414 (void) iv;
415 (void) iv_length;
Steven Cooremanacb5a102020-09-08 14:06:57 +0200416 return( PSA_ERROR_NOT_SUPPORTED );
Steven Cooreman37941cb2020-07-28 18:49:51 +0200417}
418
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200419psa_status_t mbedtls_test_opaque_cipher_update(
Ronald Cron7cb9c3d2021-03-10 12:21:48 +0100420 mbedtls_opaque_test_driver_cipher_operation_t *operation,
Steven Cooreman37941cb2020-07-28 18:49:51 +0200421 const uint8_t *input,
422 size_t input_length,
423 uint8_t *output,
424 size_t output_size,
425 size_t *output_length)
426{
427 (void) operation;
428 (void) input;
429 (void) input_length;
430 (void) output;
431 (void) output_size;
432 (void) output_length;
Steven Cooremanacb5a102020-09-08 14:06:57 +0200433 return( PSA_ERROR_NOT_SUPPORTED );
Steven Cooreman37941cb2020-07-28 18:49:51 +0200434}
435
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200436psa_status_t mbedtls_test_opaque_cipher_finish(
Ronald Cron7cb9c3d2021-03-10 12:21:48 +0100437 mbedtls_opaque_test_driver_cipher_operation_t *operation,
Steven Cooreman37941cb2020-07-28 18:49:51 +0200438 uint8_t *output,
439 size_t output_size,
440 size_t *output_length)
441{
442 (void) operation;
443 (void) output;
444 (void) output_size;
445 (void) output_length;
Steven Cooremanacb5a102020-09-08 14:06:57 +0200446 return( PSA_ERROR_NOT_SUPPORTED );
Steven Cooreman37941cb2020-07-28 18:49:51 +0200447}
448#endif /* MBEDTLS_PSA_CRYPTO_DRIVERS && PSA_CRYPTO_DRIVER_TEST */