blob: 03c160de868180a563f68bf3067b8e677dfbd149 [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
gabor-mezei-armfa990b52021-03-25 11:17:10 +010042psa_status_t mbedtls_test_transparent_cipher_encrypt(
Steven Cooremanfe0ab552020-09-10 13:07:02 +020043 const psa_key_attributes_t *attributes,
gabor-mezei-armfa990b52021-03-25 11:17:10 +010044 const uint8_t *key_buffer,
45 size_t key_buffer_size,
Steven Cooremanfe0ab552020-09-10 13:07:02 +020046 psa_algorithm_t alg,
gabor-mezei-armfa990b52021-03-25 11:17:10 +010047 const uint8_t *input,
48 size_t input_length,
49 uint8_t *output,
50 size_t output_size,
51 size_t *output_length )
Steven Cooremanfe0ab552020-09-10 13:07:02 +020052{
Ronald Cronc4bc12e2021-04-13 12:41:34 +020053 mbedtls_test_driver_cipher_hooks.hits++;
Steven Cooremanfe0ab552020-09-10 13:07:02 +020054
Ronald Cronc4bc12e2021-04-13 12:41:34 +020055 if( mbedtls_test_driver_cipher_hooks.forced_output != NULL )
Steven Cooremanfe0ab552020-09-10 13:07:02 +020056 {
Ronald Cronc4bc12e2021-04-13 12:41:34 +020057 if( output_size < mbedtls_test_driver_cipher_hooks.forced_output_length )
Steven Cooremanfe0ab552020-09-10 13:07:02 +020058 return( PSA_ERROR_BUFFER_TOO_SMALL );
59
60 memcpy( output,
Ronald Cronc4bc12e2021-04-13 12:41:34 +020061 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 Cooremanfe0ab552020-09-10 13:07:02 +020064
Ronald Cronc4bc12e2021-04-13 12:41:34 +020065 return( mbedtls_test_driver_cipher_hooks.forced_status );
Steven Cooremanfe0ab552020-09-10 13:07:02 +020066 }
67
gabor-mezei-armfa990b52021-03-25 11:17:10 +010068 if( mbedtls_test_driver_cipher_hooks.forced_status != PSA_SUCCESS )
69 return( mbedtls_test_driver_cipher_hooks.forced_status );
Steven Cooremanfe0ab552020-09-10 13:07:02 +020070
gabor-mezei-armfa990b52021-03-25 11:17:10 +010071 psa_generate_random( output, PSA_CIPHER_IV_LENGTH( attributes->core.type, alg ) );
Steven Cooremanfe0ab552020-09-10 13:07:02 +020072
Ronald Cron2091eed2021-04-09 11:09:54 +020073#if defined(MBEDTLS_PSA_CRYPTO_CONFIG)
gabor-mezei-armfa990b52021-03-25 11:17:10 +010074 return( mbedtls_transparent_test_driver_cipher_encrypt(
75 attributes, key_buffer, key_buffer_size,
76 alg, input, input_length,
77 output, output_size, output_length ) );
Ronald Cron2091eed2021-04-09 11:09:54 +020078#elif defined(MBEDTLS_PSA_BUILTIN_CIPHER)
79 return( mbedtls_psa_cipher_encrypt(
80 attributes, key_buffer, key_buffer_size,
81 alg, input, input_length,
82 output, output_size, output_length ) );
83#endif
84
85 return( PSA_ERROR_NOT_SUPPORTED );
Steven Cooreman37941cb2020-07-28 18:49:51 +020086}
87
Ronald Cronc4bc12e2021-04-13 12:41:34 +020088psa_status_t mbedtls_test_transparent_cipher_decrypt(
Steven Cooreman37941cb2020-07-28 18:49:51 +020089 const psa_key_attributes_t *attributes,
gabor-mezei-armfa990b52021-03-25 11:17:10 +010090 const uint8_t *key_buffer,
91 size_t key_buffer_size,
Steven Cooreman37941cb2020-07-28 18:49:51 +020092 psa_algorithm_t alg,
gabor-mezei-armfa990b52021-03-25 11:17:10 +010093 const uint8_t *input,
94 size_t input_length,
95 uint8_t *output,
96 size_t output_size,
97 size_t *output_length )
Steven Cooreman37941cb2020-07-28 18:49:51 +020098{
gabor-mezei-armfa990b52021-03-25 11:17:10 +010099 mbedtls_test_driver_cipher_hooks.hits++;
100
101 if( mbedtls_test_driver_cipher_hooks.forced_output != NULL )
102 {
103 if( output_size < mbedtls_test_driver_cipher_hooks.forced_output_length )
104 return( PSA_ERROR_BUFFER_TOO_SMALL );
105
106 memcpy( output,
107 mbedtls_test_driver_cipher_hooks.forced_output,
108 mbedtls_test_driver_cipher_hooks.forced_output_length );
109 *output_length = mbedtls_test_driver_cipher_hooks.forced_output_length;
110
111 return( mbedtls_test_driver_cipher_hooks.forced_status );
112 }
113
114 if( mbedtls_test_driver_cipher_hooks.forced_status != PSA_SUCCESS )
115 return( mbedtls_test_driver_cipher_hooks.forced_status );
116
Ronald Cron2091eed2021-04-09 11:09:54 +0200117#if defined(MBEDTLS_PSA_CRYPTO_CONFIG)
gabor-mezei-armfa990b52021-03-25 11:17:10 +0100118 return( mbedtls_transparent_test_driver_cipher_decrypt(
119 attributes, key_buffer, key_buffer_size,
120 alg, input, input_length,
121 output, output_size, output_length ) );
Ronald Cron2091eed2021-04-09 11:09:54 +0200122#elif defined(MBEDTLS_PSA_BUILTIN_CIPHER)
123 return( mbedtls_psa_cipher_decrypt(
124 attributes, key_buffer, key_buffer_size,
125 alg, input, input_length,
126 output, output_size, output_length ) );
127#endif
128
129 return( PSA_ERROR_NOT_SUPPORTED );
Steven Cooreman37941cb2020-07-28 18:49:51 +0200130}
131
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200132psa_status_t mbedtls_test_transparent_cipher_encrypt_setup(
Ronald Cron7cb9c3d2021-03-10 12:21:48 +0100133 mbedtls_transparent_test_driver_cipher_operation_t *operation,
Steven Cooreman16afd3d2020-09-09 15:36:39 +0200134 const psa_key_attributes_t *attributes,
135 const uint8_t *key, size_t key_length,
136 psa_algorithm_t alg)
137{
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200138 mbedtls_test_driver_cipher_hooks.hits++;
Ronald Cron8d310ad2020-12-15 15:17:20 +0100139
140 /* Wiping the entire struct here, instead of member-by-member. This is
141 * useful for the test suite, since it gives a chance of catching memory
142 * corruption errors should the core not have allocated (enough) memory for
143 * our context struct. */
144 memset( operation, 0, sizeof( *operation ) );
145
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200146 if( mbedtls_test_driver_cipher_hooks.forced_status != PSA_SUCCESS )
147 return( mbedtls_test_driver_cipher_hooks.forced_status );
Ronald Cron8d310ad2020-12-15 15:17:20 +0100148
Ronald Cron2091eed2021-04-09 11:09:54 +0200149#if defined(MBEDTLS_PSA_CRYPTO_CONFIG)
150 return( mbedtls_transparent_test_driver_cipher_encrypt_setup(
151 operation, attributes, key, key_length, alg ) );
152#elif defined(MBEDTLS_PSA_BUILTIN_CIPHER)
153 return( mbedtls_psa_cipher_encrypt_setup(
154 operation, attributes, key, key_length, alg ) );
155#endif
156
157 return( PSA_ERROR_NOT_SUPPORTED );
Steven Cooreman16afd3d2020-09-09 15:36:39 +0200158}
159
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200160psa_status_t mbedtls_test_transparent_cipher_decrypt_setup(
Ronald Cron7cb9c3d2021-03-10 12:21:48 +0100161 mbedtls_transparent_test_driver_cipher_operation_t *operation,
Steven Cooreman37941cb2020-07-28 18:49:51 +0200162 const psa_key_attributes_t *attributes,
163 const uint8_t *key, size_t key_length,
164 psa_algorithm_t alg)
165{
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200166 mbedtls_test_driver_cipher_hooks.hits++;
Ronald Cron8d310ad2020-12-15 15:17:20 +0100167
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200168 if( mbedtls_test_driver_cipher_hooks.forced_status != PSA_SUCCESS )
169 return( mbedtls_test_driver_cipher_hooks.forced_status );
Ronald Cron8d310ad2020-12-15 15:17:20 +0100170
Ronald Cron2091eed2021-04-09 11:09:54 +0200171#if defined(MBEDTLS_PSA_CRYPTO_CONFIG)
172 return( mbedtls_transparent_test_driver_cipher_decrypt_setup(
173 operation, attributes, key, key_length, alg ) );
174#elif defined(MBEDTLS_PSA_BUILTIN_CIPHER)
175 return( mbedtls_psa_cipher_decrypt_setup(
176 operation, attributes, key, key_length, alg ) );
177#endif
178
179 return( PSA_ERROR_NOT_SUPPORTED );
Steven Cooreman37941cb2020-07-28 18:49:51 +0200180}
181
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200182psa_status_t mbedtls_test_transparent_cipher_abort(
Ronald Cron7cb9c3d2021-03-10 12:21:48 +0100183 mbedtls_transparent_test_driver_cipher_operation_t *operation)
Steven Cooreman37941cb2020-07-28 18:49:51 +0200184{
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200185 mbedtls_test_driver_cipher_hooks.hits++;
Steven Cooreman89e54f22020-09-10 18:07:57 +0200186
Steven Cooreman8b122252020-09-03 15:30:32 +0200187 if( operation->alg == 0 )
188 return( PSA_SUCCESS );
Steven Cooreman8b122252020-09-03 15:30:32 +0200189
Ronald Cron2091eed2021-04-09 11:09:54 +0200190#if defined(MBEDTLS_PSA_CRYPTO_CONFIG)
Ronald Cron3522e322021-03-12 11:08:49 +0100191 mbedtls_transparent_test_driver_cipher_abort( operation );
Ronald Cron2091eed2021-04-09 11:09:54 +0200192#elif defined(MBEDTLS_PSA_BUILTIN_CIPHER)
193 mbedtls_psa_cipher_abort( operation );
194#endif
Steven Cooreman8b122252020-09-03 15:30:32 +0200195
Ronald Cron8d310ad2020-12-15 15:17:20 +0100196 /* Wiping the entire struct here, instead of member-by-member. This is
197 * useful for the test suite, since it gives a chance of catching memory
198 * corruption errors should the core not have allocated (enough) memory for
199 * our context struct. */
Steven Cooreman5240e8b2020-09-09 11:51:45 +0200200 memset( operation, 0, sizeof( *operation ) );
Steven Cooreman37941cb2020-07-28 18:49:51 +0200201
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200202 return( mbedtls_test_driver_cipher_hooks.forced_status );
Steven Cooreman37941cb2020-07-28 18:49:51 +0200203}
204
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200205psa_status_t mbedtls_test_transparent_cipher_set_iv(
Ronald Cron7cb9c3d2021-03-10 12:21:48 +0100206 mbedtls_transparent_test_driver_cipher_operation_t *operation,
Steven Cooreman37941cb2020-07-28 18:49:51 +0200207 const uint8_t *iv,
208 size_t iv_length)
209{
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200210 mbedtls_test_driver_cipher_hooks.hits++;
Steven Cooreman8b122252020-09-03 15:30:32 +0200211
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200212 if( mbedtls_test_driver_cipher_hooks.forced_status != PSA_SUCCESS )
213 return( mbedtls_test_driver_cipher_hooks.forced_status );
Steven Cooreman89e54f22020-09-10 18:07:57 +0200214
Ronald Cron2091eed2021-04-09 11:09:54 +0200215#if defined(MBEDTLS_PSA_CRYPTO_CONFIG)
Ronald Cron3522e322021-03-12 11:08:49 +0100216 return( mbedtls_transparent_test_driver_cipher_set_iv(
217 operation, iv, iv_length ) );
Ronald Cron2091eed2021-04-09 11:09:54 +0200218#elif defined(MBEDTLS_PSA_BUILTIN_CIPHER)
219 return( mbedtls_psa_cipher_set_iv( operation, iv, iv_length ) );
220#endif
221
222 return( PSA_ERROR_NOT_SUPPORTED );
Steven Cooreman37941cb2020-07-28 18:49:51 +0200223}
224
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200225psa_status_t mbedtls_test_transparent_cipher_update(
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 uint8_t *input,
228 size_t input_length,
229 uint8_t *output,
230 size_t output_size,
231 size_t *output_length)
232{
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200233 mbedtls_test_driver_cipher_hooks.hits++;
Steven Cooreman37941cb2020-07-28 18:49:51 +0200234
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200235 if( mbedtls_test_driver_cipher_hooks.forced_output != NULL )
Steven Cooreman8b122252020-09-03 15:30:32 +0200236 {
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200237 if( output_size < mbedtls_test_driver_cipher_hooks.forced_output_length )
Steven Cooreman8b122252020-09-03 15:30:32 +0200238 return PSA_ERROR_BUFFER_TOO_SMALL;
239
Steven Cooremanacb5a102020-09-08 14:06:57 +0200240 memcpy( output,
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200241 mbedtls_test_driver_cipher_hooks.forced_output,
242 mbedtls_test_driver_cipher_hooks.forced_output_length );
243 *output_length = mbedtls_test_driver_cipher_hooks.forced_output_length;
Ronald Cron8d310ad2020-12-15 15:17:20 +0100244
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200245 return( mbedtls_test_driver_cipher_hooks.forced_status );
Steven Cooreman8b122252020-09-03 15:30:32 +0200246 }
Steven Cooreman37941cb2020-07-28 18:49:51 +0200247
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200248 if( mbedtls_test_driver_cipher_hooks.forced_status != PSA_SUCCESS )
249 return( mbedtls_test_driver_cipher_hooks.forced_status );
Ronald Cron8d310ad2020-12-15 15:17:20 +0100250
Ronald Cron2091eed2021-04-09 11:09:54 +0200251#if defined(MBEDTLS_PSA_CRYPTO_CONFIG)
Ronald Cron3522e322021-03-12 11:08:49 +0100252 return( mbedtls_transparent_test_driver_cipher_update(
253 operation, input, input_length,
254 output, output_size, output_length ) );
Ronald Cron2091eed2021-04-09 11:09:54 +0200255#elif defined(MBEDTLS_PSA_BUILTIN_CIPHER)
256 return( mbedtls_psa_cipher_update(
257 operation, input, input_length,
258 output, output_size, output_length ) );
259#endif
260
261 return( PSA_ERROR_NOT_SUPPORTED );
Steven Cooreman37941cb2020-07-28 18:49:51 +0200262}
263
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200264psa_status_t mbedtls_test_transparent_cipher_finish(
Ronald Cron7cb9c3d2021-03-10 12:21:48 +0100265 mbedtls_transparent_test_driver_cipher_operation_t *operation,
Steven Cooreman37941cb2020-07-28 18:49:51 +0200266 uint8_t *output,
267 size_t output_size,
268 size_t *output_length)
269{
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200270 mbedtls_test_driver_cipher_hooks.hits++;
Steven Cooreman37941cb2020-07-28 18:49:51 +0200271
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200272 if( mbedtls_test_driver_cipher_hooks.forced_output != NULL )
Steven Cooreman8b122252020-09-03 15:30:32 +0200273 {
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200274 if( output_size < mbedtls_test_driver_cipher_hooks.forced_output_length )
Steven Cooreman8b122252020-09-03 15:30:32 +0200275 return PSA_ERROR_BUFFER_TOO_SMALL;
276
Steven Cooremanacb5a102020-09-08 14:06:57 +0200277 memcpy( output,
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200278 mbedtls_test_driver_cipher_hooks.forced_output,
279 mbedtls_test_driver_cipher_hooks.forced_output_length );
280 *output_length = mbedtls_test_driver_cipher_hooks.forced_output_length;
Ronald Cron8d310ad2020-12-15 15:17:20 +0100281
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200282 return( mbedtls_test_driver_cipher_hooks.forced_status );
Steven Cooreman8b122252020-09-03 15:30:32 +0200283 }
Steven Cooreman37941cb2020-07-28 18:49:51 +0200284
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200285 if( mbedtls_test_driver_cipher_hooks.forced_status != PSA_SUCCESS )
286 return( mbedtls_test_driver_cipher_hooks.forced_status );
Ronald Cron8d310ad2020-12-15 15:17:20 +0100287
Ronald Cron2091eed2021-04-09 11:09:54 +0200288#if defined(MBEDTLS_PSA_CRYPTO_CONFIG)
Ronald Cron3522e322021-03-12 11:08:49 +0100289 return( mbedtls_transparent_test_driver_cipher_finish(
290 operation, output, output_size, output_length ) );
Ronald Cron2091eed2021-04-09 11:09:54 +0200291#elif defined(MBEDTLS_PSA_BUILTIN_CIPHER)
292 return( mbedtls_psa_cipher_finish(
293 operation, output, output_size, output_length ) );
294#endif
295
296 return( PSA_ERROR_NOT_SUPPORTED );
Steven Cooreman37941cb2020-07-28 18:49:51 +0200297}
298
299/*
300 * opaque versions, to do
301 */
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200302psa_status_t mbedtls_test_opaque_cipher_encrypt(
Steven Cooreman37941cb2020-07-28 18:49:51 +0200303 const psa_key_attributes_t *attributes,
304 const uint8_t *key, size_t key_length,
305 psa_algorithm_t alg,
306 const uint8_t *input, size_t input_length,
307 uint8_t *output, size_t output_size, size_t *output_length)
308{
309 (void) attributes;
310 (void) key;
311 (void) key_length;
312 (void) alg;
313 (void) input;
314 (void) input_length;
315 (void) output;
316 (void) output_size;
317 (void) output_length;
Steven Cooremanacb5a102020-09-08 14:06:57 +0200318 return( PSA_ERROR_NOT_SUPPORTED );
Steven Cooreman37941cb2020-07-28 18:49:51 +0200319}
320
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200321psa_status_t mbedtls_test_opaque_cipher_decrypt(
Steven Cooreman37941cb2020-07-28 18:49:51 +0200322 const psa_key_attributes_t *attributes,
323 const uint8_t *key, size_t key_length,
324 psa_algorithm_t alg,
325 const uint8_t *input, size_t input_length,
326 uint8_t *output, size_t output_size, size_t *output_length)
327{
328 (void) attributes;
329 (void) key;
330 (void) key_length;
331 (void) alg;
332 (void) input;
333 (void) input_length;
334 (void) output;
335 (void) output_size;
336 (void) output_length;
Steven Cooremanacb5a102020-09-08 14:06:57 +0200337 return( PSA_ERROR_NOT_SUPPORTED );
Steven Cooreman37941cb2020-07-28 18:49:51 +0200338}
339
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200340psa_status_t mbedtls_test_opaque_cipher_encrypt_setup(
Ronald Cron7cb9c3d2021-03-10 12:21:48 +0100341 mbedtls_opaque_test_driver_cipher_operation_t *operation,
Steven Cooreman37941cb2020-07-28 18:49:51 +0200342 const psa_key_attributes_t *attributes,
343 const uint8_t *key, size_t key_length,
344 psa_algorithm_t alg)
345{
346 (void) operation;
347 (void) attributes;
348 (void) key;
349 (void) key_length;
350 (void) alg;
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_setup(
Ronald Cron7cb9c3d2021-03-10 12:21:48 +0100355 mbedtls_opaque_test_driver_cipher_operation_t *operation,
Steven Cooreman37941cb2020-07-28 18:49:51 +0200356 const psa_key_attributes_t *attributes,
357 const uint8_t *key, size_t key_length,
358 psa_algorithm_t alg)
359{
360 (void) operation;
361 (void) attributes;
362 (void) key;
363 (void) key_length;
364 (void) alg;
Steven Cooremanacb5a102020-09-08 14:06:57 +0200365 return( PSA_ERROR_NOT_SUPPORTED );
Steven Cooreman37941cb2020-07-28 18:49:51 +0200366}
367
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200368psa_status_t mbedtls_test_opaque_cipher_abort(
Ronald Cron7cb9c3d2021-03-10 12:21:48 +0100369 mbedtls_opaque_test_driver_cipher_operation_t *operation )
Steven Cooreman37941cb2020-07-28 18:49:51 +0200370{
371 (void) operation;
Steven Cooremanacb5a102020-09-08 14:06:57 +0200372 return( PSA_ERROR_NOT_SUPPORTED );
Steven Cooreman37941cb2020-07-28 18:49:51 +0200373}
374
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200375psa_status_t mbedtls_test_opaque_cipher_set_iv(
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 uint8_t *iv,
378 size_t iv_length)
379{
380 (void) operation;
381 (void) iv;
382 (void) iv_length;
Steven Cooremanacb5a102020-09-08 14:06:57 +0200383 return( PSA_ERROR_NOT_SUPPORTED );
Steven Cooreman37941cb2020-07-28 18:49:51 +0200384}
385
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200386psa_status_t mbedtls_test_opaque_cipher_update(
Ronald Cron7cb9c3d2021-03-10 12:21:48 +0100387 mbedtls_opaque_test_driver_cipher_operation_t *operation,
Steven Cooreman37941cb2020-07-28 18:49:51 +0200388 const uint8_t *input,
389 size_t input_length,
390 uint8_t *output,
391 size_t output_size,
392 size_t *output_length)
393{
394 (void) operation;
395 (void) input;
396 (void) input_length;
397 (void) output;
398 (void) output_size;
399 (void) output_length;
Steven Cooremanacb5a102020-09-08 14:06:57 +0200400 return( PSA_ERROR_NOT_SUPPORTED );
Steven Cooreman37941cb2020-07-28 18:49:51 +0200401}
402
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200403psa_status_t mbedtls_test_opaque_cipher_finish(
Ronald Cron7cb9c3d2021-03-10 12:21:48 +0100404 mbedtls_opaque_test_driver_cipher_operation_t *operation,
Steven Cooreman37941cb2020-07-28 18:49:51 +0200405 uint8_t *output,
406 size_t output_size,
407 size_t *output_length)
408{
409 (void) operation;
410 (void) output;
411 (void) output_size;
412 (void) output_length;
Steven Cooremanacb5a102020-09-08 14:06:57 +0200413 return( PSA_ERROR_NOT_SUPPORTED );
Steven Cooreman37941cb2020-07-28 18:49:51 +0200414}
415#endif /* MBEDTLS_PSA_CRYPTO_DRIVERS && PSA_CRYPTO_DRIVER_TEST */