blob: 4827946b0744e133fd04cf7a61028511e3a747c0 [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
Mateusz Starzyk2c09c9b2021-05-14 22:20:10 +020027#include <test/helpers.h>
28
Steven Cooreman37941cb2020-07-28 18:49:51 +020029#if defined(MBEDTLS_PSA_CRYPTO_DRIVERS) && defined(PSA_CRYPTO_DRIVER_TEST)
30#include "psa/crypto.h"
Ronald Cron8d310ad2020-12-15 15:17:20 +010031#include "psa_crypto_cipher.h"
Steven Cooremanacb5a102020-09-08 14:06:57 +020032#include "psa_crypto_core.h"
Steven Cooreman37941cb2020-07-28 18:49:51 +020033#include "mbedtls/cipher.h"
34
Steven Cooremanacb5a102020-09-08 14:06:57 +020035#include "test/drivers/cipher.h"
Steven Cooreman37941cb2020-07-28 18:49:51 +020036
37#include "test/random.h"
38
39#include <string.h>
40
Ronald Cron7f13fa22021-04-13 12:41:34 +020041mbedtls_test_driver_cipher_hooks_t mbedtls_test_driver_cipher_hooks =
42 MBEDTLS_TEST_DRIVER_CIPHER_INIT;
Steven Cooreman37941cb2020-07-28 18:49:51 +020043
Ronald Cron7f13fa22021-04-13 12:41:34 +020044static psa_status_t mbedtls_test_transparent_cipher_oneshot(
Steven Cooremanfe0ab552020-09-10 13:07:02 +020045 mbedtls_operation_t direction,
46 const psa_key_attributes_t *attributes,
47 const uint8_t *key, size_t key_length,
48 psa_algorithm_t alg,
49 const uint8_t *input, size_t input_length,
50 uint8_t *output, size_t output_size, size_t *output_length)
51{
Ronald Cron7f13fa22021-04-13 12:41:34 +020052 mbedtls_test_driver_cipher_hooks.hits++;
Steven Cooremanfe0ab552020-09-10 13:07:02 +020053
54 /* Test driver supports AES-CTR only, to verify operation calls. */
55 if( alg != PSA_ALG_CTR ||
56 psa_get_key_type( attributes ) != PSA_KEY_TYPE_AES )
57 return( PSA_ERROR_NOT_SUPPORTED );
58
59 /* If test driver response code is not SUCCESS, we can return early */
Ronald Cron7f13fa22021-04-13 12:41:34 +020060 if( mbedtls_test_driver_cipher_hooks.forced_status != PSA_SUCCESS )
61 return( mbedtls_test_driver_cipher_hooks.forced_status );
Steven Cooremanfe0ab552020-09-10 13:07:02 +020062
63 /* If test driver output is overridden, we don't need to do actual crypto */
Ronald Cron7f13fa22021-04-13 12:41:34 +020064 if( mbedtls_test_driver_cipher_hooks.forced_output != NULL )
Steven Cooremanfe0ab552020-09-10 13:07:02 +020065 {
Ronald Cron7f13fa22021-04-13 12:41:34 +020066 if( output_size < mbedtls_test_driver_cipher_hooks.forced_output_length )
Steven Cooremanfe0ab552020-09-10 13:07:02 +020067 return( PSA_ERROR_BUFFER_TOO_SMALL );
68
69 memcpy( output,
Ronald Cron7f13fa22021-04-13 12:41:34 +020070 mbedtls_test_driver_cipher_hooks.forced_output,
71 mbedtls_test_driver_cipher_hooks.forced_output_length );
72 *output_length = mbedtls_test_driver_cipher_hooks.forced_output_length;
Steven Cooremanfe0ab552020-09-10 13:07:02 +020073
Ronald Cron7f13fa22021-04-13 12:41:34 +020074 return( mbedtls_test_driver_cipher_hooks.forced_status );
Steven Cooremanfe0ab552020-09-10 13:07:02 +020075 }
76
77 /* Run AES-CTR using the cipher module */
78 {
79 mbedtls_test_rnd_pseudo_info rnd_info;
80 memset( &rnd_info, 0x5A, sizeof( mbedtls_test_rnd_pseudo_info ) );
81
82 const mbedtls_cipher_info_t *cipher_info =
83 mbedtls_cipher_info_from_values( MBEDTLS_CIPHER_ID_AES,
84 key_length * 8,
85 MBEDTLS_MODE_CTR );
86 mbedtls_cipher_context_t cipher;
87 int ret = 0;
88 uint8_t temp_output_buffer[16] = {0};
89 size_t temp_output_length = 0;
90
91 if( direction == MBEDTLS_ENCRYPT )
92 {
93 /* Oneshot encrypt needs to prepend the IV to the output */
94 if( output_size < ( input_length + 16 ) )
95 return( PSA_ERROR_BUFFER_TOO_SMALL );
96 }
97 else
98 {
99 /* Oneshot decrypt has the IV prepended to the input */
100 if( output_size < ( input_length - 16 ) )
101 return( PSA_ERROR_BUFFER_TOO_SMALL );
102 }
103
104 if( cipher_info == NULL )
105 return( PSA_ERROR_NOT_SUPPORTED );
106
107 mbedtls_cipher_init( &cipher );
108 ret = mbedtls_cipher_setup( &cipher, cipher_info );
109 if( ret != 0 )
110 goto exit;
111
112 ret = mbedtls_cipher_setkey( &cipher,
113 key,
114 key_length * 8, direction );
115 if( ret != 0 )
116 goto exit;
117
118 if( direction == MBEDTLS_ENCRYPT )
119 {
120 mbedtls_test_rnd_pseudo_info rnd_info;
121 memset( &rnd_info, 0x5A, sizeof( mbedtls_test_rnd_pseudo_info ) );
122
123 ret = mbedtls_test_rnd_pseudo_rand( &rnd_info,
124 temp_output_buffer,
125 16 );
126 if( ret != 0 )
127 goto exit;
128
129 ret = mbedtls_cipher_set_iv( &cipher, temp_output_buffer, 16 );
130 }
131 else
132 ret = mbedtls_cipher_set_iv( &cipher, input, 16 );
133
134 if( ret != 0 )
135 goto exit;
136
137 if( direction == MBEDTLS_ENCRYPT )
138 {
139 ret = mbedtls_cipher_update( &cipher,
140 input, input_length,
141 &output[16], output_length );
142 if( ret == 0 )
143 {
144 memcpy( output, temp_output_buffer, 16 );
145 *output_length += 16;
146 }
147 }
148 else
149 ret = mbedtls_cipher_update( &cipher,
150 &input[16], input_length - 16,
151 output, output_length );
152
153 if( ret != 0 )
154 goto exit;
155
156 ret = mbedtls_cipher_finish( &cipher,
157 temp_output_buffer,
158 &temp_output_length );
159
160exit:
161 if( ret != 0 )
162 {
163 *output_length = 0;
164 memset(output, 0, output_size);
165 }
166
167 mbedtls_cipher_free( &cipher );
168 return( mbedtls_to_psa_error( ret ) );
169 }
170}
171
Ronald Cron7f13fa22021-04-13 12:41:34 +0200172psa_status_t mbedtls_test_transparent_cipher_encrypt(
Steven Cooreman37941cb2020-07-28 18:49:51 +0200173 const psa_key_attributes_t *attributes,
174 const uint8_t *key, size_t key_length,
175 psa_algorithm_t alg,
176 const uint8_t *input, size_t input_length,
177 uint8_t *output, size_t output_size, size_t *output_length)
178{
Steven Cooremanfe0ab552020-09-10 13:07:02 +0200179 return (
Ronald Cron7f13fa22021-04-13 12:41:34 +0200180 mbedtls_test_transparent_cipher_oneshot(
Steven Cooremanfe0ab552020-09-10 13:07:02 +0200181 MBEDTLS_ENCRYPT,
182 attributes,
183 key, key_length,
184 alg,
185 input, input_length,
186 output, output_size, output_length) );
Steven Cooreman37941cb2020-07-28 18:49:51 +0200187}
188
Ronald Cron7f13fa22021-04-13 12:41:34 +0200189psa_status_t mbedtls_test_transparent_cipher_decrypt(
Steven Cooreman37941cb2020-07-28 18:49:51 +0200190 const psa_key_attributes_t *attributes,
191 const uint8_t *key, size_t key_length,
192 psa_algorithm_t alg,
193 const uint8_t *input, size_t input_length,
194 uint8_t *output, size_t output_size, size_t *output_length)
195{
Steven Cooremanfe0ab552020-09-10 13:07:02 +0200196 return (
Ronald Cron7f13fa22021-04-13 12:41:34 +0200197 mbedtls_test_transparent_cipher_oneshot(
Steven Cooremanfe0ab552020-09-10 13:07:02 +0200198 MBEDTLS_DECRYPT,
199 attributes,
200 key, key_length,
201 alg,
202 input, input_length,
203 output, output_size, output_length) );
Steven Cooreman37941cb2020-07-28 18:49:51 +0200204}
205
Ronald Cron7f13fa22021-04-13 12:41:34 +0200206psa_status_t mbedtls_test_transparent_cipher_encrypt_setup(
Ronald Cron7cb9c3d2021-03-10 12:21:48 +0100207 mbedtls_transparent_test_driver_cipher_operation_t *operation,
Steven Cooreman16afd3d2020-09-09 15:36:39 +0200208 const psa_key_attributes_t *attributes,
209 const uint8_t *key, size_t key_length,
210 psa_algorithm_t alg)
211{
Ronald Cron7f13fa22021-04-13 12:41:34 +0200212 mbedtls_test_driver_cipher_hooks.hits++;
Ronald Cron8d310ad2020-12-15 15:17:20 +0100213
214 /* Wiping the entire struct here, instead of member-by-member. This is
215 * useful for the test suite, since it gives a chance of catching memory
216 * corruption errors should the core not have allocated (enough) memory for
217 * our context struct. */
218 memset( operation, 0, sizeof( *operation ) );
219
Ronald Cron7f13fa22021-04-13 12:41:34 +0200220 if( mbedtls_test_driver_cipher_hooks.forced_status != PSA_SUCCESS )
221 return( mbedtls_test_driver_cipher_hooks.forced_status );
Ronald Cron8d310ad2020-12-15 15:17:20 +0100222
Ronald Cron3522e322021-03-12 11:08:49 +0100223 return ( mbedtls_transparent_test_driver_cipher_encrypt_setup(
224 operation, attributes, key, key_length, alg ) );
Steven Cooreman16afd3d2020-09-09 15:36:39 +0200225}
226
Ronald Cron7f13fa22021-04-13 12:41:34 +0200227psa_status_t mbedtls_test_transparent_cipher_decrypt_setup(
Ronald Cron7cb9c3d2021-03-10 12:21:48 +0100228 mbedtls_transparent_test_driver_cipher_operation_t *operation,
Steven Cooreman37941cb2020-07-28 18:49:51 +0200229 const psa_key_attributes_t *attributes,
230 const uint8_t *key, size_t key_length,
231 psa_algorithm_t alg)
232{
Ronald Cron7f13fa22021-04-13 12:41:34 +0200233 mbedtls_test_driver_cipher_hooks.hits++;
Ronald Cron8d310ad2020-12-15 15:17:20 +0100234
Ronald Cron7f13fa22021-04-13 12:41:34 +0200235 if( mbedtls_test_driver_cipher_hooks.forced_status != PSA_SUCCESS )
236 return( mbedtls_test_driver_cipher_hooks.forced_status );
Ronald Cron8d310ad2020-12-15 15:17:20 +0100237
Ronald Cron3522e322021-03-12 11:08:49 +0100238 return ( mbedtls_transparent_test_driver_cipher_decrypt_setup(
239 operation, attributes, key, key_length, alg ) );
Steven Cooreman37941cb2020-07-28 18:49:51 +0200240}
241
Ronald Cron7f13fa22021-04-13 12:41:34 +0200242psa_status_t mbedtls_test_transparent_cipher_abort(
Ronald Cron7cb9c3d2021-03-10 12:21:48 +0100243 mbedtls_transparent_test_driver_cipher_operation_t *operation)
Steven Cooreman37941cb2020-07-28 18:49:51 +0200244{
Ronald Cron7f13fa22021-04-13 12:41:34 +0200245 mbedtls_test_driver_cipher_hooks.hits++;
Steven Cooreman89e54f22020-09-10 18:07:57 +0200246
Steven Cooreman8b122252020-09-03 15:30:32 +0200247 if( operation->alg == 0 )
248 return( PSA_SUCCESS );
Steven Cooreman8b122252020-09-03 15:30:32 +0200249
Ronald Cron3522e322021-03-12 11:08:49 +0100250 mbedtls_transparent_test_driver_cipher_abort( operation );
Steven Cooreman8b122252020-09-03 15:30:32 +0200251
Ronald Cron8d310ad2020-12-15 15:17:20 +0100252 /* Wiping the entire struct here, instead of member-by-member. This is
253 * useful for the test suite, since it gives a chance of catching memory
254 * corruption errors should the core not have allocated (enough) memory for
255 * our context struct. */
Steven Cooreman5240e8b2020-09-09 11:51:45 +0200256 memset( operation, 0, sizeof( *operation ) );
Steven Cooreman37941cb2020-07-28 18:49:51 +0200257
Ronald Cron7f13fa22021-04-13 12:41:34 +0200258 return( mbedtls_test_driver_cipher_hooks.forced_status );
Steven Cooreman37941cb2020-07-28 18:49:51 +0200259}
260
Ronald Cron7f13fa22021-04-13 12:41:34 +0200261psa_status_t mbedtls_test_transparent_cipher_set_iv(
Ronald Cron7cb9c3d2021-03-10 12:21:48 +0100262 mbedtls_transparent_test_driver_cipher_operation_t *operation,
Steven Cooreman37941cb2020-07-28 18:49:51 +0200263 const uint8_t *iv,
264 size_t iv_length)
265{
Ronald Cron7f13fa22021-04-13 12:41:34 +0200266 mbedtls_test_driver_cipher_hooks.hits++;
Steven Cooreman8b122252020-09-03 15:30:32 +0200267
Ronald Cron7f13fa22021-04-13 12:41:34 +0200268 if( mbedtls_test_driver_cipher_hooks.forced_status != PSA_SUCCESS )
269 return( mbedtls_test_driver_cipher_hooks.forced_status );
Steven Cooreman89e54f22020-09-10 18:07:57 +0200270
Ronald Cron3522e322021-03-12 11:08:49 +0100271 return( mbedtls_transparent_test_driver_cipher_set_iv(
272 operation, iv, iv_length ) );
Steven Cooreman37941cb2020-07-28 18:49:51 +0200273}
274
Ronald Cron7f13fa22021-04-13 12:41:34 +0200275psa_status_t mbedtls_test_transparent_cipher_update(
Ronald Cron7cb9c3d2021-03-10 12:21:48 +0100276 mbedtls_transparent_test_driver_cipher_operation_t *operation,
Steven Cooreman37941cb2020-07-28 18:49:51 +0200277 const uint8_t *input,
278 size_t input_length,
279 uint8_t *output,
280 size_t output_size,
281 size_t *output_length)
282{
Ronald Cron7f13fa22021-04-13 12:41:34 +0200283 mbedtls_test_driver_cipher_hooks.hits++;
Steven Cooreman37941cb2020-07-28 18:49:51 +0200284
Ronald Cron7f13fa22021-04-13 12:41:34 +0200285 if( mbedtls_test_driver_cipher_hooks.forced_output != NULL )
Steven Cooreman8b122252020-09-03 15:30:32 +0200286 {
Ronald Cron7f13fa22021-04-13 12:41:34 +0200287 if( output_size < mbedtls_test_driver_cipher_hooks.forced_output_length )
Steven Cooreman8b122252020-09-03 15:30:32 +0200288 return PSA_ERROR_BUFFER_TOO_SMALL;
289
Steven Cooremanacb5a102020-09-08 14:06:57 +0200290 memcpy( output,
Ronald Cron7f13fa22021-04-13 12:41:34 +0200291 mbedtls_test_driver_cipher_hooks.forced_output,
292 mbedtls_test_driver_cipher_hooks.forced_output_length );
293 *output_length = mbedtls_test_driver_cipher_hooks.forced_output_length;
Ronald Cron8d310ad2020-12-15 15:17:20 +0100294
Ronald Cron7f13fa22021-04-13 12:41:34 +0200295 return( mbedtls_test_driver_cipher_hooks.forced_status );
Steven Cooreman8b122252020-09-03 15:30:32 +0200296 }
Steven Cooreman37941cb2020-07-28 18:49:51 +0200297
Ronald Cron7f13fa22021-04-13 12:41:34 +0200298 if( mbedtls_test_driver_cipher_hooks.forced_status != PSA_SUCCESS )
299 return( mbedtls_test_driver_cipher_hooks.forced_status );
Ronald Cron8d310ad2020-12-15 15:17:20 +0100300
Ronald Cron3522e322021-03-12 11:08:49 +0100301 return( mbedtls_transparent_test_driver_cipher_update(
302 operation, input, input_length,
303 output, output_size, output_length ) );
Steven Cooreman37941cb2020-07-28 18:49:51 +0200304}
305
Ronald Cron7f13fa22021-04-13 12:41:34 +0200306psa_status_t mbedtls_test_transparent_cipher_finish(
Ronald Cron7cb9c3d2021-03-10 12:21:48 +0100307 mbedtls_transparent_test_driver_cipher_operation_t *operation,
Steven Cooreman37941cb2020-07-28 18:49:51 +0200308 uint8_t *output,
309 size_t output_size,
310 size_t *output_length)
311{
Ronald Cron7f13fa22021-04-13 12:41:34 +0200312 mbedtls_test_driver_cipher_hooks.hits++;
Steven Cooreman37941cb2020-07-28 18:49:51 +0200313
Ronald Cron7f13fa22021-04-13 12:41:34 +0200314 if( mbedtls_test_driver_cipher_hooks.forced_output != NULL )
Steven Cooreman8b122252020-09-03 15:30:32 +0200315 {
Ronald Cron7f13fa22021-04-13 12:41:34 +0200316 if( output_size < mbedtls_test_driver_cipher_hooks.forced_output_length )
Steven Cooreman8b122252020-09-03 15:30:32 +0200317 return PSA_ERROR_BUFFER_TOO_SMALL;
318
Steven Cooremanacb5a102020-09-08 14:06:57 +0200319 memcpy( output,
Ronald Cron7f13fa22021-04-13 12:41:34 +0200320 mbedtls_test_driver_cipher_hooks.forced_output,
321 mbedtls_test_driver_cipher_hooks.forced_output_length );
322 *output_length = mbedtls_test_driver_cipher_hooks.forced_output_length;
Ronald Cron8d310ad2020-12-15 15:17:20 +0100323
Ronald Cron7f13fa22021-04-13 12:41:34 +0200324 return( mbedtls_test_driver_cipher_hooks.forced_status );
Steven Cooreman8b122252020-09-03 15:30:32 +0200325 }
Steven Cooreman37941cb2020-07-28 18:49:51 +0200326
Ronald Cron7f13fa22021-04-13 12:41:34 +0200327 if( mbedtls_test_driver_cipher_hooks.forced_status != PSA_SUCCESS )
328 return( mbedtls_test_driver_cipher_hooks.forced_status );
Ronald Cron8d310ad2020-12-15 15:17:20 +0100329
Ronald Cron3522e322021-03-12 11:08:49 +0100330 return( mbedtls_transparent_test_driver_cipher_finish(
331 operation, output, output_size, output_length ) );
Steven Cooreman37941cb2020-07-28 18:49:51 +0200332}
333
334/*
335 * opaque versions, to do
336 */
Ronald Cron7f13fa22021-04-13 12:41:34 +0200337psa_status_t mbedtls_test_opaque_cipher_encrypt(
Steven Cooreman37941cb2020-07-28 18:49:51 +0200338 const psa_key_attributes_t *attributes,
339 const uint8_t *key, size_t key_length,
340 psa_algorithm_t alg,
341 const uint8_t *input, size_t input_length,
342 uint8_t *output, size_t output_size, size_t *output_length)
343{
344 (void) attributes;
345 (void) key;
346 (void) key_length;
347 (void) alg;
348 (void) input;
349 (void) input_length;
350 (void) output;
351 (void) output_size;
352 (void) output_length;
Steven Cooremanacb5a102020-09-08 14:06:57 +0200353 return( PSA_ERROR_NOT_SUPPORTED );
Steven Cooreman37941cb2020-07-28 18:49:51 +0200354}
355
Ronald Cron7f13fa22021-04-13 12:41:34 +0200356psa_status_t mbedtls_test_opaque_cipher_decrypt(
Steven Cooreman37941cb2020-07-28 18:49:51 +0200357 const psa_key_attributes_t *attributes,
358 const uint8_t *key, size_t key_length,
359 psa_algorithm_t alg,
360 const uint8_t *input, size_t input_length,
361 uint8_t *output, size_t output_size, size_t *output_length)
362{
363 (void) attributes;
364 (void) key;
365 (void) key_length;
366 (void) alg;
367 (void) input;
368 (void) input_length;
369 (void) output;
370 (void) output_size;
371 (void) output_length;
Steven Cooremanacb5a102020-09-08 14:06:57 +0200372 return( PSA_ERROR_NOT_SUPPORTED );
Steven Cooreman37941cb2020-07-28 18:49:51 +0200373}
374
Ronald Cron7f13fa22021-04-13 12:41:34 +0200375psa_status_t mbedtls_test_opaque_cipher_encrypt_setup(
Ronald Cron7cb9c3d2021-03-10 12:21:48 +0100376 mbedtls_opaque_test_driver_cipher_operation_t *operation,
Steven Cooreman37941cb2020-07-28 18:49:51 +0200377 const psa_key_attributes_t *attributes,
378 const uint8_t *key, size_t key_length,
379 psa_algorithm_t alg)
380{
381 (void) operation;
382 (void) attributes;
383 (void) key;
384 (void) key_length;
385 (void) alg;
Steven Cooremanacb5a102020-09-08 14:06:57 +0200386 return( PSA_ERROR_NOT_SUPPORTED );
Steven Cooreman37941cb2020-07-28 18:49:51 +0200387}
388
Ronald Cron7f13fa22021-04-13 12:41:34 +0200389psa_status_t mbedtls_test_opaque_cipher_decrypt_setup(
Ronald Cron7cb9c3d2021-03-10 12:21:48 +0100390 mbedtls_opaque_test_driver_cipher_operation_t *operation,
Steven Cooreman37941cb2020-07-28 18:49:51 +0200391 const psa_key_attributes_t *attributes,
392 const uint8_t *key, size_t key_length,
393 psa_algorithm_t alg)
394{
395 (void) operation;
396 (void) attributes;
397 (void) key;
398 (void) key_length;
399 (void) alg;
Steven Cooremanacb5a102020-09-08 14:06:57 +0200400 return( PSA_ERROR_NOT_SUPPORTED );
Steven Cooreman37941cb2020-07-28 18:49:51 +0200401}
402
Ronald Cron7f13fa22021-04-13 12:41:34 +0200403psa_status_t mbedtls_test_opaque_cipher_abort(
Ronald Cron7cb9c3d2021-03-10 12:21:48 +0100404 mbedtls_opaque_test_driver_cipher_operation_t *operation )
Steven Cooreman37941cb2020-07-28 18:49:51 +0200405{
406 (void) operation;
Steven Cooremanacb5a102020-09-08 14:06:57 +0200407 return( PSA_ERROR_NOT_SUPPORTED );
Steven Cooreman37941cb2020-07-28 18:49:51 +0200408}
409
Ronald Cron7f13fa22021-04-13 12:41:34 +0200410psa_status_t mbedtls_test_opaque_cipher_set_iv(
Ronald Cron7cb9c3d2021-03-10 12:21:48 +0100411 mbedtls_opaque_test_driver_cipher_operation_t *operation,
Steven Cooreman37941cb2020-07-28 18:49:51 +0200412 const uint8_t *iv,
413 size_t iv_length)
414{
415 (void) operation;
416 (void) iv;
417 (void) iv_length;
Steven Cooremanacb5a102020-09-08 14:06:57 +0200418 return( PSA_ERROR_NOT_SUPPORTED );
Steven Cooreman37941cb2020-07-28 18:49:51 +0200419}
420
Ronald Cron7f13fa22021-04-13 12:41:34 +0200421psa_status_t mbedtls_test_opaque_cipher_update(
Ronald Cron7cb9c3d2021-03-10 12:21:48 +0100422 mbedtls_opaque_test_driver_cipher_operation_t *operation,
Steven Cooreman37941cb2020-07-28 18:49:51 +0200423 const uint8_t *input,
424 size_t input_length,
425 uint8_t *output,
426 size_t output_size,
427 size_t *output_length)
428{
429 (void) operation;
430 (void) input;
431 (void) input_length;
432 (void) output;
433 (void) output_size;
434 (void) output_length;
Steven Cooremanacb5a102020-09-08 14:06:57 +0200435 return( PSA_ERROR_NOT_SUPPORTED );
Steven Cooreman37941cb2020-07-28 18:49:51 +0200436}
437
Ronald Cron7f13fa22021-04-13 12:41:34 +0200438psa_status_t mbedtls_test_opaque_cipher_finish(
Ronald Cron7cb9c3d2021-03-10 12:21:48 +0100439 mbedtls_opaque_test_driver_cipher_operation_t *operation,
Steven Cooreman37941cb2020-07-28 18:49:51 +0200440 uint8_t *output,
441 size_t output_size,
442 size_t *output_length)
443{
444 (void) operation;
445 (void) output;
446 (void) output_size;
447 (void) output_length;
Steven Cooremanacb5a102020-09-08 14:06:57 +0200448 return( PSA_ERROR_NOT_SUPPORTED );
Steven Cooreman37941cb2020-07-28 18:49:51 +0200449}
450#endif /* MBEDTLS_PSA_CRYPTO_DRIVERS && PSA_CRYPTO_DRIVER_TEST */