blob: 9c95cc8f8c81abce72ab3981d448a6f9be32ae7a [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
Mateusz Starzyk2c09c9b2021-05-14 22:20:10 +020021#include <test/helpers.h>
22
Steven Cooreman37941cb2020-07-28 18:49:51 +020023#if defined(MBEDTLS_PSA_CRYPTO_DRIVERS) && defined(PSA_CRYPTO_DRIVER_TEST)
24#include "psa/crypto.h"
Ronald Cron8d310ad2020-12-15 15:17:20 +010025#include "psa_crypto_cipher.h"
Steven Cooremanacb5a102020-09-08 14:06:57 +020026#include "psa_crypto_core.h"
Steven Cooreman37941cb2020-07-28 18:49:51 +020027#include "mbedtls/cipher.h"
28
Steven Cooremanacb5a102020-09-08 14:06:57 +020029#include "test/drivers/cipher.h"
Steven Cooreman37941cb2020-07-28 18:49:51 +020030
31#include "test/random.h"
32
33#include <string.h>
34
Ronald Cron7f13fa22021-04-13 12:41:34 +020035mbedtls_test_driver_cipher_hooks_t mbedtls_test_driver_cipher_hooks =
36 MBEDTLS_TEST_DRIVER_CIPHER_INIT;
Steven Cooreman37941cb2020-07-28 18:49:51 +020037
Ronald Cron7f13fa22021-04-13 12:41:34 +020038static psa_status_t mbedtls_test_transparent_cipher_oneshot(
Steven Cooremanfe0ab552020-09-10 13:07:02 +020039 mbedtls_operation_t direction,
40 const psa_key_attributes_t *attributes,
41 const uint8_t *key, size_t key_length,
42 psa_algorithm_t alg,
43 const uint8_t *input, size_t input_length,
44 uint8_t *output, size_t output_size, size_t *output_length)
45{
Ronald Cron7f13fa22021-04-13 12:41:34 +020046 mbedtls_test_driver_cipher_hooks.hits++;
Steven Cooremanfe0ab552020-09-10 13:07:02 +020047
48 /* Test driver supports AES-CTR only, to verify operation calls. */
49 if( alg != PSA_ALG_CTR ||
50 psa_get_key_type( attributes ) != PSA_KEY_TYPE_AES )
51 return( PSA_ERROR_NOT_SUPPORTED );
52
53 /* If test driver response code is not SUCCESS, we can return early */
Ronald Cron7f13fa22021-04-13 12:41:34 +020054 if( mbedtls_test_driver_cipher_hooks.forced_status != PSA_SUCCESS )
55 return( mbedtls_test_driver_cipher_hooks.forced_status );
Steven Cooremanfe0ab552020-09-10 13:07:02 +020056
57 /* If test driver output is overridden, we don't need to do actual crypto */
Ronald Cron7f13fa22021-04-13 12:41:34 +020058 if( mbedtls_test_driver_cipher_hooks.forced_output != NULL )
Steven Cooremanfe0ab552020-09-10 13:07:02 +020059 {
Ronald Cron7f13fa22021-04-13 12:41:34 +020060 if( output_size < mbedtls_test_driver_cipher_hooks.forced_output_length )
Steven Cooremanfe0ab552020-09-10 13:07:02 +020061 return( PSA_ERROR_BUFFER_TOO_SMALL );
62
63 memcpy( output,
Ronald Cron7f13fa22021-04-13 12:41:34 +020064 mbedtls_test_driver_cipher_hooks.forced_output,
65 mbedtls_test_driver_cipher_hooks.forced_output_length );
66 *output_length = mbedtls_test_driver_cipher_hooks.forced_output_length;
Steven Cooremanfe0ab552020-09-10 13:07:02 +020067
Ronald Cron7f13fa22021-04-13 12:41:34 +020068 return( mbedtls_test_driver_cipher_hooks.forced_status );
Steven Cooremanfe0ab552020-09-10 13:07:02 +020069 }
70
71 /* Run AES-CTR using the cipher module */
72 {
73 mbedtls_test_rnd_pseudo_info rnd_info;
74 memset( &rnd_info, 0x5A, sizeof( mbedtls_test_rnd_pseudo_info ) );
75
76 const mbedtls_cipher_info_t *cipher_info =
77 mbedtls_cipher_info_from_values( MBEDTLS_CIPHER_ID_AES,
78 key_length * 8,
79 MBEDTLS_MODE_CTR );
80 mbedtls_cipher_context_t cipher;
81 int ret = 0;
82 uint8_t temp_output_buffer[16] = {0};
83 size_t temp_output_length = 0;
84
85 if( direction == MBEDTLS_ENCRYPT )
86 {
87 /* Oneshot encrypt needs to prepend the IV to the output */
88 if( output_size < ( input_length + 16 ) )
89 return( PSA_ERROR_BUFFER_TOO_SMALL );
90 }
91 else
92 {
93 /* Oneshot decrypt has the IV prepended to the input */
94 if( output_size < ( input_length - 16 ) )
95 return( PSA_ERROR_BUFFER_TOO_SMALL );
96 }
97
98 if( cipher_info == NULL )
99 return( PSA_ERROR_NOT_SUPPORTED );
100
101 mbedtls_cipher_init( &cipher );
102 ret = mbedtls_cipher_setup( &cipher, cipher_info );
103 if( ret != 0 )
104 goto exit;
105
106 ret = mbedtls_cipher_setkey( &cipher,
107 key,
108 key_length * 8, direction );
109 if( ret != 0 )
110 goto exit;
111
112 if( direction == MBEDTLS_ENCRYPT )
113 {
114 mbedtls_test_rnd_pseudo_info rnd_info;
115 memset( &rnd_info, 0x5A, sizeof( mbedtls_test_rnd_pseudo_info ) );
116
117 ret = mbedtls_test_rnd_pseudo_rand( &rnd_info,
118 temp_output_buffer,
119 16 );
120 if( ret != 0 )
121 goto exit;
122
123 ret = mbedtls_cipher_set_iv( &cipher, temp_output_buffer, 16 );
124 }
125 else
126 ret = mbedtls_cipher_set_iv( &cipher, input, 16 );
127
128 if( ret != 0 )
129 goto exit;
130
131 if( direction == MBEDTLS_ENCRYPT )
132 {
133 ret = mbedtls_cipher_update( &cipher,
134 input, input_length,
135 &output[16], output_length );
136 if( ret == 0 )
137 {
138 memcpy( output, temp_output_buffer, 16 );
139 *output_length += 16;
140 }
141 }
142 else
143 ret = mbedtls_cipher_update( &cipher,
144 &input[16], input_length - 16,
145 output, output_length );
146
147 if( ret != 0 )
148 goto exit;
149
150 ret = mbedtls_cipher_finish( &cipher,
151 temp_output_buffer,
152 &temp_output_length );
153
154exit:
155 if( ret != 0 )
156 {
157 *output_length = 0;
158 memset(output, 0, output_size);
159 }
160
161 mbedtls_cipher_free( &cipher );
162 return( mbedtls_to_psa_error( ret ) );
163 }
164}
165
Ronald Cron7f13fa22021-04-13 12:41:34 +0200166psa_status_t mbedtls_test_transparent_cipher_encrypt(
Steven Cooreman37941cb2020-07-28 18:49:51 +0200167 const psa_key_attributes_t *attributes,
168 const uint8_t *key, size_t key_length,
169 psa_algorithm_t alg,
170 const uint8_t *input, size_t input_length,
171 uint8_t *output, size_t output_size, size_t *output_length)
172{
Steven Cooremanfe0ab552020-09-10 13:07:02 +0200173 return (
Ronald Cron7f13fa22021-04-13 12:41:34 +0200174 mbedtls_test_transparent_cipher_oneshot(
Steven Cooremanfe0ab552020-09-10 13:07:02 +0200175 MBEDTLS_ENCRYPT,
176 attributes,
177 key, key_length,
178 alg,
179 input, input_length,
180 output, output_size, output_length) );
Steven Cooreman37941cb2020-07-28 18:49:51 +0200181}
182
Ronald Cron7f13fa22021-04-13 12:41:34 +0200183psa_status_t mbedtls_test_transparent_cipher_decrypt(
Steven Cooreman37941cb2020-07-28 18:49:51 +0200184 const psa_key_attributes_t *attributes,
185 const uint8_t *key, size_t key_length,
186 psa_algorithm_t alg,
187 const uint8_t *input, size_t input_length,
188 uint8_t *output, size_t output_size, size_t *output_length)
189{
Steven Cooremanfe0ab552020-09-10 13:07:02 +0200190 return (
Ronald Cron7f13fa22021-04-13 12:41:34 +0200191 mbedtls_test_transparent_cipher_oneshot(
Steven Cooremanfe0ab552020-09-10 13:07:02 +0200192 MBEDTLS_DECRYPT,
193 attributes,
194 key, key_length,
195 alg,
196 input, input_length,
197 output, output_size, output_length) );
Steven Cooreman37941cb2020-07-28 18:49:51 +0200198}
199
Ronald Cron7f13fa22021-04-13 12:41:34 +0200200psa_status_t mbedtls_test_transparent_cipher_encrypt_setup(
Ronald Cron7cb9c3d2021-03-10 12:21:48 +0100201 mbedtls_transparent_test_driver_cipher_operation_t *operation,
Steven Cooreman16afd3d2020-09-09 15:36:39 +0200202 const psa_key_attributes_t *attributes,
203 const uint8_t *key, size_t key_length,
204 psa_algorithm_t alg)
205{
Ronald Cron7f13fa22021-04-13 12:41:34 +0200206 mbedtls_test_driver_cipher_hooks.hits++;
Ronald Cron8d310ad2020-12-15 15:17:20 +0100207
208 /* Wiping the entire struct here, instead of member-by-member. This is
209 * useful for the test suite, since it gives a chance of catching memory
210 * corruption errors should the core not have allocated (enough) memory for
211 * our context struct. */
212 memset( operation, 0, sizeof( *operation ) );
213
Ronald Cron7f13fa22021-04-13 12:41:34 +0200214 if( mbedtls_test_driver_cipher_hooks.forced_status != PSA_SUCCESS )
215 return( mbedtls_test_driver_cipher_hooks.forced_status );
Ronald Cron8d310ad2020-12-15 15:17:20 +0100216
Ronald Cron3522e322021-03-12 11:08:49 +0100217 return ( mbedtls_transparent_test_driver_cipher_encrypt_setup(
218 operation, attributes, key, key_length, alg ) );
Steven Cooreman16afd3d2020-09-09 15:36:39 +0200219}
220
Ronald Cron7f13fa22021-04-13 12:41:34 +0200221psa_status_t mbedtls_test_transparent_cipher_decrypt_setup(
Ronald Cron7cb9c3d2021-03-10 12:21:48 +0100222 mbedtls_transparent_test_driver_cipher_operation_t *operation,
Steven Cooreman37941cb2020-07-28 18:49:51 +0200223 const psa_key_attributes_t *attributes,
224 const uint8_t *key, size_t key_length,
225 psa_algorithm_t alg)
226{
Ronald Cron7f13fa22021-04-13 12:41:34 +0200227 mbedtls_test_driver_cipher_hooks.hits++;
Ronald Cron8d310ad2020-12-15 15:17:20 +0100228
Ronald Cron7f13fa22021-04-13 12:41:34 +0200229 if( mbedtls_test_driver_cipher_hooks.forced_status != PSA_SUCCESS )
230 return( mbedtls_test_driver_cipher_hooks.forced_status );
Ronald Cron8d310ad2020-12-15 15:17:20 +0100231
Ronald Cron3522e322021-03-12 11:08:49 +0100232 return ( mbedtls_transparent_test_driver_cipher_decrypt_setup(
233 operation, attributes, key, key_length, alg ) );
Steven Cooreman37941cb2020-07-28 18:49:51 +0200234}
235
Ronald Cron7f13fa22021-04-13 12:41:34 +0200236psa_status_t mbedtls_test_transparent_cipher_abort(
Ronald Cron7cb9c3d2021-03-10 12:21:48 +0100237 mbedtls_transparent_test_driver_cipher_operation_t *operation)
Steven Cooreman37941cb2020-07-28 18:49:51 +0200238{
Ronald Cron7f13fa22021-04-13 12:41:34 +0200239 mbedtls_test_driver_cipher_hooks.hits++;
Steven Cooreman89e54f22020-09-10 18:07:57 +0200240
Steven Cooreman8b122252020-09-03 15:30:32 +0200241 if( operation->alg == 0 )
242 return( PSA_SUCCESS );
Steven Cooreman8b122252020-09-03 15:30:32 +0200243
Ronald Cron3522e322021-03-12 11:08:49 +0100244 mbedtls_transparent_test_driver_cipher_abort( operation );
Steven Cooreman8b122252020-09-03 15:30:32 +0200245
Ronald Cron8d310ad2020-12-15 15:17:20 +0100246 /* Wiping the entire struct here, instead of member-by-member. This is
247 * useful for the test suite, since it gives a chance of catching memory
248 * corruption errors should the core not have allocated (enough) memory for
249 * our context struct. */
Steven Cooreman5240e8b2020-09-09 11:51:45 +0200250 memset( operation, 0, sizeof( *operation ) );
Steven Cooreman37941cb2020-07-28 18:49:51 +0200251
Ronald Cron7f13fa22021-04-13 12:41:34 +0200252 return( mbedtls_test_driver_cipher_hooks.forced_status );
Steven Cooreman37941cb2020-07-28 18:49:51 +0200253}
254
Ronald Cron7f13fa22021-04-13 12:41:34 +0200255psa_status_t mbedtls_test_transparent_cipher_set_iv(
Ronald Cron7cb9c3d2021-03-10 12:21:48 +0100256 mbedtls_transparent_test_driver_cipher_operation_t *operation,
Steven Cooreman37941cb2020-07-28 18:49:51 +0200257 const uint8_t *iv,
258 size_t iv_length)
259{
Ronald Cron7f13fa22021-04-13 12:41:34 +0200260 mbedtls_test_driver_cipher_hooks.hits++;
Steven Cooreman8b122252020-09-03 15:30:32 +0200261
Ronald Cron7f13fa22021-04-13 12:41:34 +0200262 if( mbedtls_test_driver_cipher_hooks.forced_status != PSA_SUCCESS )
263 return( mbedtls_test_driver_cipher_hooks.forced_status );
Steven Cooreman89e54f22020-09-10 18:07:57 +0200264
Ronald Cron3522e322021-03-12 11:08:49 +0100265 return( mbedtls_transparent_test_driver_cipher_set_iv(
266 operation, iv, iv_length ) );
Steven Cooreman37941cb2020-07-28 18:49:51 +0200267}
268
Ronald Cron7f13fa22021-04-13 12:41:34 +0200269psa_status_t mbedtls_test_transparent_cipher_update(
Ronald Cron7cb9c3d2021-03-10 12:21:48 +0100270 mbedtls_transparent_test_driver_cipher_operation_t *operation,
Steven Cooreman37941cb2020-07-28 18:49:51 +0200271 const uint8_t *input,
272 size_t input_length,
273 uint8_t *output,
274 size_t output_size,
275 size_t *output_length)
276{
Ronald Cron7f13fa22021-04-13 12:41:34 +0200277 mbedtls_test_driver_cipher_hooks.hits++;
Steven Cooreman37941cb2020-07-28 18:49:51 +0200278
Ronald Cron7f13fa22021-04-13 12:41:34 +0200279 if( mbedtls_test_driver_cipher_hooks.forced_output != NULL )
Steven Cooreman8b122252020-09-03 15:30:32 +0200280 {
Ronald Cron7f13fa22021-04-13 12:41:34 +0200281 if( output_size < mbedtls_test_driver_cipher_hooks.forced_output_length )
Steven Cooreman8b122252020-09-03 15:30:32 +0200282 return PSA_ERROR_BUFFER_TOO_SMALL;
283
Steven Cooremanacb5a102020-09-08 14:06:57 +0200284 memcpy( output,
Ronald Cron7f13fa22021-04-13 12:41:34 +0200285 mbedtls_test_driver_cipher_hooks.forced_output,
286 mbedtls_test_driver_cipher_hooks.forced_output_length );
287 *output_length = mbedtls_test_driver_cipher_hooks.forced_output_length;
Ronald Cron8d310ad2020-12-15 15:17:20 +0100288
Ronald Cron7f13fa22021-04-13 12:41:34 +0200289 return( mbedtls_test_driver_cipher_hooks.forced_status );
Steven Cooreman8b122252020-09-03 15:30:32 +0200290 }
Steven Cooreman37941cb2020-07-28 18:49:51 +0200291
Ronald Cron7f13fa22021-04-13 12:41:34 +0200292 if( mbedtls_test_driver_cipher_hooks.forced_status != PSA_SUCCESS )
293 return( mbedtls_test_driver_cipher_hooks.forced_status );
Ronald Cron8d310ad2020-12-15 15:17:20 +0100294
Ronald Cron3522e322021-03-12 11:08:49 +0100295 return( mbedtls_transparent_test_driver_cipher_update(
296 operation, input, input_length,
297 output, output_size, output_length ) );
Steven Cooreman37941cb2020-07-28 18:49:51 +0200298}
299
Ronald Cron7f13fa22021-04-13 12:41:34 +0200300psa_status_t mbedtls_test_transparent_cipher_finish(
Ronald Cron7cb9c3d2021-03-10 12:21:48 +0100301 mbedtls_transparent_test_driver_cipher_operation_t *operation,
Steven Cooreman37941cb2020-07-28 18:49:51 +0200302 uint8_t *output,
303 size_t output_size,
304 size_t *output_length)
305{
Ronald Cron7f13fa22021-04-13 12:41:34 +0200306 mbedtls_test_driver_cipher_hooks.hits++;
Steven Cooreman37941cb2020-07-28 18:49:51 +0200307
Ronald Cron7f13fa22021-04-13 12:41:34 +0200308 if( mbedtls_test_driver_cipher_hooks.forced_output != NULL )
Steven Cooreman8b122252020-09-03 15:30:32 +0200309 {
Ronald Cron7f13fa22021-04-13 12:41:34 +0200310 if( output_size < mbedtls_test_driver_cipher_hooks.forced_output_length )
Steven Cooreman8b122252020-09-03 15:30:32 +0200311 return PSA_ERROR_BUFFER_TOO_SMALL;
312
Steven Cooremanacb5a102020-09-08 14:06:57 +0200313 memcpy( output,
Ronald Cron7f13fa22021-04-13 12:41:34 +0200314 mbedtls_test_driver_cipher_hooks.forced_output,
315 mbedtls_test_driver_cipher_hooks.forced_output_length );
316 *output_length = mbedtls_test_driver_cipher_hooks.forced_output_length;
Ronald Cron8d310ad2020-12-15 15:17:20 +0100317
Ronald Cron7f13fa22021-04-13 12:41:34 +0200318 return( mbedtls_test_driver_cipher_hooks.forced_status );
Steven Cooreman8b122252020-09-03 15:30:32 +0200319 }
Steven Cooreman37941cb2020-07-28 18:49:51 +0200320
Ronald Cron7f13fa22021-04-13 12:41:34 +0200321 if( mbedtls_test_driver_cipher_hooks.forced_status != PSA_SUCCESS )
322 return( mbedtls_test_driver_cipher_hooks.forced_status );
Ronald Cron8d310ad2020-12-15 15:17:20 +0100323
Ronald Cron3522e322021-03-12 11:08:49 +0100324 return( mbedtls_transparent_test_driver_cipher_finish(
325 operation, output, output_size, output_length ) );
Steven Cooreman37941cb2020-07-28 18:49:51 +0200326}
327
328/*
329 * opaque versions, to do
330 */
Ronald Cron7f13fa22021-04-13 12:41:34 +0200331psa_status_t mbedtls_test_opaque_cipher_encrypt(
Steven Cooreman37941cb2020-07-28 18:49:51 +0200332 const psa_key_attributes_t *attributes,
333 const uint8_t *key, size_t key_length,
334 psa_algorithm_t alg,
335 const uint8_t *input, size_t input_length,
336 uint8_t *output, size_t output_size, size_t *output_length)
337{
338 (void) attributes;
339 (void) key;
340 (void) key_length;
341 (void) alg;
342 (void) input;
343 (void) input_length;
344 (void) output;
345 (void) output_size;
346 (void) output_length;
Steven Cooremanacb5a102020-09-08 14:06:57 +0200347 return( PSA_ERROR_NOT_SUPPORTED );
Steven Cooreman37941cb2020-07-28 18:49:51 +0200348}
349
Ronald Cron7f13fa22021-04-13 12:41:34 +0200350psa_status_t mbedtls_test_opaque_cipher_decrypt(
Steven Cooreman37941cb2020-07-28 18:49:51 +0200351 const psa_key_attributes_t *attributes,
352 const uint8_t *key, size_t key_length,
353 psa_algorithm_t alg,
354 const uint8_t *input, size_t input_length,
355 uint8_t *output, size_t output_size, size_t *output_length)
356{
357 (void) attributes;
358 (void) key;
359 (void) key_length;
360 (void) alg;
361 (void) input;
362 (void) input_length;
363 (void) output;
364 (void) output_size;
365 (void) output_length;
Steven Cooremanacb5a102020-09-08 14:06:57 +0200366 return( PSA_ERROR_NOT_SUPPORTED );
Steven Cooreman37941cb2020-07-28 18:49:51 +0200367}
368
Ronald Cron7f13fa22021-04-13 12:41:34 +0200369psa_status_t mbedtls_test_opaque_cipher_encrypt_setup(
Ronald Cron7cb9c3d2021-03-10 12:21:48 +0100370 mbedtls_opaque_test_driver_cipher_operation_t *operation,
Steven Cooreman37941cb2020-07-28 18:49:51 +0200371 const psa_key_attributes_t *attributes,
372 const uint8_t *key, size_t key_length,
373 psa_algorithm_t alg)
374{
375 (void) operation;
376 (void) attributes;
377 (void) key;
378 (void) key_length;
379 (void) alg;
Steven Cooremanacb5a102020-09-08 14:06:57 +0200380 return( PSA_ERROR_NOT_SUPPORTED );
Steven Cooreman37941cb2020-07-28 18:49:51 +0200381}
382
Ronald Cron7f13fa22021-04-13 12:41:34 +0200383psa_status_t mbedtls_test_opaque_cipher_decrypt_setup(
Ronald Cron7cb9c3d2021-03-10 12:21:48 +0100384 mbedtls_opaque_test_driver_cipher_operation_t *operation,
Steven Cooreman37941cb2020-07-28 18:49:51 +0200385 const psa_key_attributes_t *attributes,
386 const uint8_t *key, size_t key_length,
387 psa_algorithm_t alg)
388{
389 (void) operation;
390 (void) attributes;
391 (void) key;
392 (void) key_length;
393 (void) alg;
Steven Cooremanacb5a102020-09-08 14:06:57 +0200394 return( PSA_ERROR_NOT_SUPPORTED );
Steven Cooreman37941cb2020-07-28 18:49:51 +0200395}
396
Ronald Cron7f13fa22021-04-13 12:41:34 +0200397psa_status_t mbedtls_test_opaque_cipher_abort(
Ronald Cron7cb9c3d2021-03-10 12:21:48 +0100398 mbedtls_opaque_test_driver_cipher_operation_t *operation )
Steven Cooreman37941cb2020-07-28 18:49:51 +0200399{
400 (void) operation;
Steven Cooremanacb5a102020-09-08 14:06:57 +0200401 return( PSA_ERROR_NOT_SUPPORTED );
Steven Cooreman37941cb2020-07-28 18:49:51 +0200402}
403
Ronald Cron7f13fa22021-04-13 12:41:34 +0200404psa_status_t mbedtls_test_opaque_cipher_set_iv(
Ronald Cron7cb9c3d2021-03-10 12:21:48 +0100405 mbedtls_opaque_test_driver_cipher_operation_t *operation,
Steven Cooreman37941cb2020-07-28 18:49:51 +0200406 const uint8_t *iv,
407 size_t iv_length)
408{
409 (void) operation;
410 (void) iv;
411 (void) iv_length;
Steven Cooremanacb5a102020-09-08 14:06:57 +0200412 return( PSA_ERROR_NOT_SUPPORTED );
Steven Cooreman37941cb2020-07-28 18:49:51 +0200413}
414
Ronald Cron7f13fa22021-04-13 12:41:34 +0200415psa_status_t mbedtls_test_opaque_cipher_update(
Ronald Cron7cb9c3d2021-03-10 12:21:48 +0100416 mbedtls_opaque_test_driver_cipher_operation_t *operation,
Steven Cooreman37941cb2020-07-28 18:49:51 +0200417 const uint8_t *input,
418 size_t input_length,
419 uint8_t *output,
420 size_t output_size,
421 size_t *output_length)
422{
423 (void) operation;
424 (void) input;
425 (void) input_length;
426 (void) output;
427 (void) output_size;
428 (void) output_length;
Steven Cooremanacb5a102020-09-08 14:06:57 +0200429 return( PSA_ERROR_NOT_SUPPORTED );
Steven Cooreman37941cb2020-07-28 18:49:51 +0200430}
431
Ronald Cron7f13fa22021-04-13 12:41:34 +0200432psa_status_t mbedtls_test_opaque_cipher_finish(
Ronald Cron7cb9c3d2021-03-10 12:21:48 +0100433 mbedtls_opaque_test_driver_cipher_operation_t *operation,
Steven Cooreman37941cb2020-07-28 18:49:51 +0200434 uint8_t *output,
435 size_t output_size,
436 size_t *output_length)
437{
438 (void) operation;
439 (void) output;
440 (void) output_size;
441 (void) output_length;
Steven Cooremanacb5a102020-09-08 14:06:57 +0200442 return( PSA_ERROR_NOT_SUPPORTED );
Steven Cooreman37941cb2020-07-28 18:49:51 +0200443}
444#endif /* MBEDTLS_PSA_CRYPTO_DRIVERS && PSA_CRYPTO_DRIVER_TEST */