blob: ed65c9168f84253b700ccde96e9f6fa8ca47bb8c [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
gabor-mezei-arma9449a02021-03-25 11:17:10 +010038psa_status_t mbedtls_test_transparent_cipher_encrypt(
Steven Cooremanfe0ab552020-09-10 13:07:02 +020039 const psa_key_attributes_t *attributes,
gabor-mezei-arma9449a02021-03-25 11:17:10 +010040 const uint8_t *key_buffer,
41 size_t key_buffer_size,
Steven Cooremanfe0ab552020-09-10 13:07:02 +020042 psa_algorithm_t alg,
gabor-mezei-arma9449a02021-03-25 11:17:10 +010043 const uint8_t *input,
44 size_t input_length,
45 uint8_t *output,
46 size_t output_size,
47 size_t *output_length )
Steven Cooremanfe0ab552020-09-10 13:07:02 +020048{
Ronald Cron7f13fa22021-04-13 12:41:34 +020049 mbedtls_test_driver_cipher_hooks.hits++;
Steven Cooremanfe0ab552020-09-10 13:07:02 +020050
Ronald Cron7f13fa22021-04-13 12:41:34 +020051 if( mbedtls_test_driver_cipher_hooks.forced_output != NULL )
Steven Cooremanfe0ab552020-09-10 13:07:02 +020052 {
Ronald Cron7f13fa22021-04-13 12:41:34 +020053 if( output_size < mbedtls_test_driver_cipher_hooks.forced_output_length )
Steven Cooremanfe0ab552020-09-10 13:07:02 +020054 return( PSA_ERROR_BUFFER_TOO_SMALL );
55
56 memcpy( output,
Ronald Cron7f13fa22021-04-13 12:41:34 +020057 mbedtls_test_driver_cipher_hooks.forced_output,
58 mbedtls_test_driver_cipher_hooks.forced_output_length );
59 *output_length = mbedtls_test_driver_cipher_hooks.forced_output_length;
Steven Cooremanfe0ab552020-09-10 13:07:02 +020060
Ronald Cron7f13fa22021-04-13 12:41:34 +020061 return( mbedtls_test_driver_cipher_hooks.forced_status );
Steven Cooremanfe0ab552020-09-10 13:07:02 +020062 }
63
gabor-mezei-arma9449a02021-03-25 11:17:10 +010064 if( mbedtls_test_driver_cipher_hooks.forced_status != PSA_SUCCESS )
65 return( mbedtls_test_driver_cipher_hooks.forced_status );
Steven Cooremanfe0ab552020-09-10 13:07:02 +020066
gabor-mezei-arma9449a02021-03-25 11:17:10 +010067 psa_generate_random( output, PSA_CIPHER_IV_LENGTH( attributes->core.type, alg ) );
Steven Cooremanfe0ab552020-09-10 13:07:02 +020068
Ronald Cron73c9d9e2021-04-09 11:09:54 +020069#if defined(MBEDTLS_PSA_CRYPTO_CONFIG)
gabor-mezei-arma9449a02021-03-25 11:17:10 +010070 return( mbedtls_transparent_test_driver_cipher_encrypt(
71 attributes, key_buffer, key_buffer_size,
72 alg, input, input_length,
73 output, output_size, output_length ) );
Ronald Cron73c9d9e2021-04-09 11:09:54 +020074#elif defined(MBEDTLS_PSA_BUILTIN_CIPHER)
75 return( mbedtls_psa_cipher_encrypt(
76 attributes, key_buffer, key_buffer_size,
77 alg, input, input_length,
78 output, output_size, output_length ) );
79#endif
80
81 return( PSA_ERROR_NOT_SUPPORTED );
Steven Cooreman37941cb2020-07-28 18:49:51 +020082}
83
Ronald Cron7f13fa22021-04-13 12:41:34 +020084psa_status_t mbedtls_test_transparent_cipher_decrypt(
Steven Cooreman37941cb2020-07-28 18:49:51 +020085 const psa_key_attributes_t *attributes,
gabor-mezei-arma9449a02021-03-25 11:17:10 +010086 const uint8_t *key_buffer,
87 size_t key_buffer_size,
Steven Cooreman37941cb2020-07-28 18:49:51 +020088 psa_algorithm_t alg,
gabor-mezei-arma9449a02021-03-25 11:17:10 +010089 const uint8_t *input,
90 size_t input_length,
91 uint8_t *output,
92 size_t output_size,
93 size_t *output_length )
Steven Cooreman37941cb2020-07-28 18:49:51 +020094{
gabor-mezei-arma9449a02021-03-25 11:17:10 +010095 mbedtls_test_driver_cipher_hooks.hits++;
96
97 if( mbedtls_test_driver_cipher_hooks.forced_output != NULL )
98 {
99 if( output_size < mbedtls_test_driver_cipher_hooks.forced_output_length )
100 return( PSA_ERROR_BUFFER_TOO_SMALL );
101
102 memcpy( output,
103 mbedtls_test_driver_cipher_hooks.forced_output,
104 mbedtls_test_driver_cipher_hooks.forced_output_length );
105 *output_length = mbedtls_test_driver_cipher_hooks.forced_output_length;
106
107 return( mbedtls_test_driver_cipher_hooks.forced_status );
108 }
109
110 if( mbedtls_test_driver_cipher_hooks.forced_status != PSA_SUCCESS )
111 return( mbedtls_test_driver_cipher_hooks.forced_status );
112
Ronald Cron73c9d9e2021-04-09 11:09:54 +0200113#if defined(MBEDTLS_PSA_CRYPTO_CONFIG)
gabor-mezei-arma9449a02021-03-25 11:17:10 +0100114 return( mbedtls_transparent_test_driver_cipher_decrypt(
115 attributes, key_buffer, key_buffer_size,
116 alg, input, input_length,
117 output, output_size, output_length ) );
Ronald Cron73c9d9e2021-04-09 11:09:54 +0200118#elif defined(MBEDTLS_PSA_BUILTIN_CIPHER)
119 return( mbedtls_psa_cipher_decrypt(
120 attributes, key_buffer, key_buffer_size,
121 alg, input, input_length,
122 output, output_size, output_length ) );
123#endif
124
125 return( PSA_ERROR_NOT_SUPPORTED );
Steven Cooreman37941cb2020-07-28 18:49:51 +0200126}
127
Ronald Cron7f13fa22021-04-13 12:41:34 +0200128psa_status_t mbedtls_test_transparent_cipher_encrypt_setup(
Ronald Cron7cb9c3d2021-03-10 12:21:48 +0100129 mbedtls_transparent_test_driver_cipher_operation_t *operation,
Steven Cooreman16afd3d2020-09-09 15:36:39 +0200130 const psa_key_attributes_t *attributes,
131 const uint8_t *key, size_t key_length,
132 psa_algorithm_t alg)
133{
Ronald Cron7f13fa22021-04-13 12:41:34 +0200134 mbedtls_test_driver_cipher_hooks.hits++;
Ronald Cron8d310ad2020-12-15 15:17:20 +0100135
136 /* Wiping the entire struct here, instead of member-by-member. This is
137 * useful for the test suite, since it gives a chance of catching memory
138 * corruption errors should the core not have allocated (enough) memory for
139 * our context struct. */
140 memset( operation, 0, sizeof( *operation ) );
141
Ronald Cron7f13fa22021-04-13 12:41:34 +0200142 if( mbedtls_test_driver_cipher_hooks.forced_status != PSA_SUCCESS )
143 return( mbedtls_test_driver_cipher_hooks.forced_status );
Ronald Cron8d310ad2020-12-15 15:17:20 +0100144
Ronald Cron73c9d9e2021-04-09 11:09:54 +0200145#if defined(MBEDTLS_PSA_CRYPTO_CONFIG)
146 return( mbedtls_transparent_test_driver_cipher_encrypt_setup(
147 operation, attributes, key, key_length, alg ) );
148#elif defined(MBEDTLS_PSA_BUILTIN_CIPHER)
149 return( mbedtls_psa_cipher_encrypt_setup(
150 operation, attributes, key, key_length, alg ) );
151#endif
152
153 return( PSA_ERROR_NOT_SUPPORTED );
Steven Cooreman16afd3d2020-09-09 15:36:39 +0200154}
155
Ronald Cron7f13fa22021-04-13 12:41:34 +0200156psa_status_t mbedtls_test_transparent_cipher_decrypt_setup(
Ronald Cron7cb9c3d2021-03-10 12:21:48 +0100157 mbedtls_transparent_test_driver_cipher_operation_t *operation,
Steven Cooreman37941cb2020-07-28 18:49:51 +0200158 const psa_key_attributes_t *attributes,
159 const uint8_t *key, size_t key_length,
160 psa_algorithm_t alg)
161{
Ronald Cron7f13fa22021-04-13 12:41:34 +0200162 mbedtls_test_driver_cipher_hooks.hits++;
Ronald Cron8d310ad2020-12-15 15:17:20 +0100163
Ronald Cron7f13fa22021-04-13 12:41:34 +0200164 if( mbedtls_test_driver_cipher_hooks.forced_status != PSA_SUCCESS )
165 return( mbedtls_test_driver_cipher_hooks.forced_status );
Ronald Cron8d310ad2020-12-15 15:17:20 +0100166
Ronald Cron73c9d9e2021-04-09 11:09:54 +0200167#if defined(MBEDTLS_PSA_CRYPTO_CONFIG)
168 return( mbedtls_transparent_test_driver_cipher_decrypt_setup(
169 operation, attributes, key, key_length, alg ) );
170#elif defined(MBEDTLS_PSA_BUILTIN_CIPHER)
171 return( mbedtls_psa_cipher_decrypt_setup(
172 operation, attributes, key, key_length, alg ) );
173#endif
174
175 return( PSA_ERROR_NOT_SUPPORTED );
Steven Cooreman37941cb2020-07-28 18:49:51 +0200176}
177
Ronald Cron7f13fa22021-04-13 12:41:34 +0200178psa_status_t mbedtls_test_transparent_cipher_abort(
Ronald Cron7cb9c3d2021-03-10 12:21:48 +0100179 mbedtls_transparent_test_driver_cipher_operation_t *operation)
Steven Cooreman37941cb2020-07-28 18:49:51 +0200180{
Ronald Cron7f13fa22021-04-13 12:41:34 +0200181 mbedtls_test_driver_cipher_hooks.hits++;
Steven Cooreman89e54f22020-09-10 18:07:57 +0200182
Ronald Cron73c9d9e2021-04-09 11:09:54 +0200183#if defined(MBEDTLS_PSA_CRYPTO_CONFIG)
Ronald Cron3522e322021-03-12 11:08:49 +0100184 mbedtls_transparent_test_driver_cipher_abort( operation );
Ronald Cron73c9d9e2021-04-09 11:09:54 +0200185#elif defined(MBEDTLS_PSA_BUILTIN_CIPHER)
186 mbedtls_psa_cipher_abort( operation );
187#endif
Steven Cooreman8b122252020-09-03 15:30:32 +0200188
Ronald Cron8d310ad2020-12-15 15:17:20 +0100189 /* Wiping the entire struct here, instead of member-by-member. This is
190 * useful for the test suite, since it gives a chance of catching memory
191 * corruption errors should the core not have allocated (enough) memory for
192 * our context struct. */
Steven Cooreman5240e8b2020-09-09 11:51:45 +0200193 memset( operation, 0, sizeof( *operation ) );
Steven Cooreman37941cb2020-07-28 18:49:51 +0200194
Ronald Cron7f13fa22021-04-13 12:41:34 +0200195 return( mbedtls_test_driver_cipher_hooks.forced_status );
Steven Cooreman37941cb2020-07-28 18:49:51 +0200196}
197
Ronald Cron7f13fa22021-04-13 12:41:34 +0200198psa_status_t mbedtls_test_transparent_cipher_set_iv(
Ronald Cron7cb9c3d2021-03-10 12:21:48 +0100199 mbedtls_transparent_test_driver_cipher_operation_t *operation,
Steven Cooreman37941cb2020-07-28 18:49:51 +0200200 const uint8_t *iv,
201 size_t iv_length)
202{
Ronald Cron7f13fa22021-04-13 12:41:34 +0200203 mbedtls_test_driver_cipher_hooks.hits++;
Steven Cooreman8b122252020-09-03 15:30:32 +0200204
Ronald Cron7f13fa22021-04-13 12:41:34 +0200205 if( mbedtls_test_driver_cipher_hooks.forced_status != PSA_SUCCESS )
206 return( mbedtls_test_driver_cipher_hooks.forced_status );
Steven Cooreman89e54f22020-09-10 18:07:57 +0200207
Ronald Cron73c9d9e2021-04-09 11:09:54 +0200208#if defined(MBEDTLS_PSA_CRYPTO_CONFIG)
Ronald Cron3522e322021-03-12 11:08:49 +0100209 return( mbedtls_transparent_test_driver_cipher_set_iv(
210 operation, iv, iv_length ) );
Ronald Cron73c9d9e2021-04-09 11:09:54 +0200211#elif defined(MBEDTLS_PSA_BUILTIN_CIPHER)
212 return( mbedtls_psa_cipher_set_iv( operation, iv, iv_length ) );
213#endif
214
215 return( PSA_ERROR_NOT_SUPPORTED );
Steven Cooreman37941cb2020-07-28 18:49:51 +0200216}
217
Ronald Cron7f13fa22021-04-13 12:41:34 +0200218psa_status_t mbedtls_test_transparent_cipher_update(
Ronald Cron7cb9c3d2021-03-10 12:21:48 +0100219 mbedtls_transparent_test_driver_cipher_operation_t *operation,
Steven Cooreman37941cb2020-07-28 18:49:51 +0200220 const uint8_t *input,
221 size_t input_length,
222 uint8_t *output,
223 size_t output_size,
224 size_t *output_length)
225{
Ronald Cron7f13fa22021-04-13 12:41:34 +0200226 mbedtls_test_driver_cipher_hooks.hits++;
Steven Cooreman37941cb2020-07-28 18:49:51 +0200227
Ronald Cron7f13fa22021-04-13 12:41:34 +0200228 if( mbedtls_test_driver_cipher_hooks.forced_output != NULL )
Steven Cooreman8b122252020-09-03 15:30:32 +0200229 {
Ronald Cron7f13fa22021-04-13 12:41:34 +0200230 if( output_size < mbedtls_test_driver_cipher_hooks.forced_output_length )
Steven Cooreman8b122252020-09-03 15:30:32 +0200231 return PSA_ERROR_BUFFER_TOO_SMALL;
232
Steven Cooremanacb5a102020-09-08 14:06:57 +0200233 memcpy( output,
Ronald Cron7f13fa22021-04-13 12:41:34 +0200234 mbedtls_test_driver_cipher_hooks.forced_output,
235 mbedtls_test_driver_cipher_hooks.forced_output_length );
236 *output_length = mbedtls_test_driver_cipher_hooks.forced_output_length;
Ronald Cron8d310ad2020-12-15 15:17:20 +0100237
Ronald Cron7f13fa22021-04-13 12:41:34 +0200238 return( mbedtls_test_driver_cipher_hooks.forced_status );
Steven Cooreman8b122252020-09-03 15:30:32 +0200239 }
Steven Cooreman37941cb2020-07-28 18:49:51 +0200240
Ronald Cron7f13fa22021-04-13 12:41:34 +0200241 if( mbedtls_test_driver_cipher_hooks.forced_status != PSA_SUCCESS )
242 return( mbedtls_test_driver_cipher_hooks.forced_status );
Ronald Cron8d310ad2020-12-15 15:17:20 +0100243
Ronald Cron73c9d9e2021-04-09 11:09:54 +0200244#if defined(MBEDTLS_PSA_CRYPTO_CONFIG)
Ronald Cron3522e322021-03-12 11:08:49 +0100245 return( mbedtls_transparent_test_driver_cipher_update(
246 operation, input, input_length,
247 output, output_size, output_length ) );
Ronald Cron73c9d9e2021-04-09 11:09:54 +0200248#elif defined(MBEDTLS_PSA_BUILTIN_CIPHER)
249 return( mbedtls_psa_cipher_update(
250 operation, input, input_length,
251 output, output_size, output_length ) );
252#endif
253
254 return( PSA_ERROR_NOT_SUPPORTED );
Steven Cooreman37941cb2020-07-28 18:49:51 +0200255}
256
Ronald Cron7f13fa22021-04-13 12:41:34 +0200257psa_status_t mbedtls_test_transparent_cipher_finish(
Ronald Cron7cb9c3d2021-03-10 12:21:48 +0100258 mbedtls_transparent_test_driver_cipher_operation_t *operation,
Steven Cooreman37941cb2020-07-28 18:49:51 +0200259 uint8_t *output,
260 size_t output_size,
261 size_t *output_length)
262{
Ronald Cron7f13fa22021-04-13 12:41:34 +0200263 mbedtls_test_driver_cipher_hooks.hits++;
Steven Cooreman37941cb2020-07-28 18:49:51 +0200264
Ronald Cron7f13fa22021-04-13 12:41:34 +0200265 if( mbedtls_test_driver_cipher_hooks.forced_output != NULL )
Steven Cooreman8b122252020-09-03 15:30:32 +0200266 {
Ronald Cron7f13fa22021-04-13 12:41:34 +0200267 if( output_size < mbedtls_test_driver_cipher_hooks.forced_output_length )
Steven Cooreman8b122252020-09-03 15:30:32 +0200268 return PSA_ERROR_BUFFER_TOO_SMALL;
269
Steven Cooremanacb5a102020-09-08 14:06:57 +0200270 memcpy( output,
Ronald Cron7f13fa22021-04-13 12:41:34 +0200271 mbedtls_test_driver_cipher_hooks.forced_output,
272 mbedtls_test_driver_cipher_hooks.forced_output_length );
273 *output_length = mbedtls_test_driver_cipher_hooks.forced_output_length;
Ronald Cron8d310ad2020-12-15 15:17:20 +0100274
Ronald Cron7f13fa22021-04-13 12:41:34 +0200275 return( mbedtls_test_driver_cipher_hooks.forced_status );
Steven Cooreman8b122252020-09-03 15:30:32 +0200276 }
Steven Cooreman37941cb2020-07-28 18:49:51 +0200277
Ronald Cron7f13fa22021-04-13 12:41:34 +0200278 if( mbedtls_test_driver_cipher_hooks.forced_status != PSA_SUCCESS )
279 return( mbedtls_test_driver_cipher_hooks.forced_status );
Ronald Cron8d310ad2020-12-15 15:17:20 +0100280
Ronald Cron73c9d9e2021-04-09 11:09:54 +0200281#if defined(MBEDTLS_PSA_CRYPTO_CONFIG)
Ronald Cron3522e322021-03-12 11:08:49 +0100282 return( mbedtls_transparent_test_driver_cipher_finish(
283 operation, output, output_size, output_length ) );
Ronald Cron73c9d9e2021-04-09 11:09:54 +0200284#elif defined(MBEDTLS_PSA_BUILTIN_CIPHER)
285 return( mbedtls_psa_cipher_finish(
286 operation, output, output_size, output_length ) );
287#endif
288
289 return( PSA_ERROR_NOT_SUPPORTED );
Steven Cooreman37941cb2020-07-28 18:49:51 +0200290}
291
292/*
293 * opaque versions, to do
294 */
Ronald Cron7f13fa22021-04-13 12:41:34 +0200295psa_status_t mbedtls_test_opaque_cipher_encrypt(
Steven Cooreman37941cb2020-07-28 18:49:51 +0200296 const psa_key_attributes_t *attributes,
297 const uint8_t *key, size_t key_length,
298 psa_algorithm_t alg,
299 const uint8_t *input, size_t input_length,
300 uint8_t *output, size_t output_size, size_t *output_length)
301{
302 (void) attributes;
303 (void) key;
304 (void) key_length;
305 (void) alg;
306 (void) input;
307 (void) input_length;
308 (void) output;
309 (void) output_size;
310 (void) output_length;
Steven Cooremanacb5a102020-09-08 14:06:57 +0200311 return( PSA_ERROR_NOT_SUPPORTED );
Steven Cooreman37941cb2020-07-28 18:49:51 +0200312}
313
Ronald Cron7f13fa22021-04-13 12:41:34 +0200314psa_status_t mbedtls_test_opaque_cipher_decrypt(
Steven Cooreman37941cb2020-07-28 18:49:51 +0200315 const psa_key_attributes_t *attributes,
316 const uint8_t *key, size_t key_length,
317 psa_algorithm_t alg,
318 const uint8_t *input, size_t input_length,
319 uint8_t *output, size_t output_size, size_t *output_length)
320{
321 (void) attributes;
322 (void) key;
323 (void) key_length;
324 (void) alg;
325 (void) input;
326 (void) input_length;
327 (void) output;
328 (void) output_size;
329 (void) output_length;
Steven Cooremanacb5a102020-09-08 14:06:57 +0200330 return( PSA_ERROR_NOT_SUPPORTED );
Steven Cooreman37941cb2020-07-28 18:49:51 +0200331}
332
Ronald Cron7f13fa22021-04-13 12:41:34 +0200333psa_status_t mbedtls_test_opaque_cipher_encrypt_setup(
Ronald Cron7cb9c3d2021-03-10 12:21:48 +0100334 mbedtls_opaque_test_driver_cipher_operation_t *operation,
Steven Cooreman37941cb2020-07-28 18:49:51 +0200335 const psa_key_attributes_t *attributes,
336 const uint8_t *key, size_t key_length,
337 psa_algorithm_t alg)
338{
339 (void) operation;
340 (void) attributes;
341 (void) key;
342 (void) key_length;
343 (void) alg;
Steven Cooremanacb5a102020-09-08 14:06:57 +0200344 return( PSA_ERROR_NOT_SUPPORTED );
Steven Cooreman37941cb2020-07-28 18:49:51 +0200345}
346
Ronald Cron7f13fa22021-04-13 12:41:34 +0200347psa_status_t mbedtls_test_opaque_cipher_decrypt_setup(
Ronald Cron7cb9c3d2021-03-10 12:21:48 +0100348 mbedtls_opaque_test_driver_cipher_operation_t *operation,
Steven Cooreman37941cb2020-07-28 18:49:51 +0200349 const psa_key_attributes_t *attributes,
350 const uint8_t *key, size_t key_length,
351 psa_algorithm_t alg)
352{
353 (void) operation;
354 (void) attributes;
355 (void) key;
356 (void) key_length;
357 (void) alg;
Steven Cooremanacb5a102020-09-08 14:06:57 +0200358 return( PSA_ERROR_NOT_SUPPORTED );
Steven Cooreman37941cb2020-07-28 18:49:51 +0200359}
360
Ronald Cron7f13fa22021-04-13 12:41:34 +0200361psa_status_t mbedtls_test_opaque_cipher_abort(
Ronald Cron7cb9c3d2021-03-10 12:21:48 +0100362 mbedtls_opaque_test_driver_cipher_operation_t *operation )
Steven Cooreman37941cb2020-07-28 18:49:51 +0200363{
364 (void) operation;
Steven Cooremanacb5a102020-09-08 14:06:57 +0200365 return( PSA_ERROR_NOT_SUPPORTED );
Steven Cooreman37941cb2020-07-28 18:49:51 +0200366}
367
Ronald Cron7f13fa22021-04-13 12:41:34 +0200368psa_status_t mbedtls_test_opaque_cipher_set_iv(
Ronald Cron7cb9c3d2021-03-10 12:21:48 +0100369 mbedtls_opaque_test_driver_cipher_operation_t *operation,
Steven Cooreman37941cb2020-07-28 18:49:51 +0200370 const uint8_t *iv,
371 size_t iv_length)
372{
373 (void) operation;
374 (void) iv;
375 (void) iv_length;
Steven Cooremanacb5a102020-09-08 14:06:57 +0200376 return( PSA_ERROR_NOT_SUPPORTED );
Steven Cooreman37941cb2020-07-28 18:49:51 +0200377}
378
Ronald Cron7f13fa22021-04-13 12:41:34 +0200379psa_status_t mbedtls_test_opaque_cipher_update(
Ronald Cron7cb9c3d2021-03-10 12:21:48 +0100380 mbedtls_opaque_test_driver_cipher_operation_t *operation,
Steven Cooreman37941cb2020-07-28 18:49:51 +0200381 const uint8_t *input,
382 size_t input_length,
383 uint8_t *output,
384 size_t output_size,
385 size_t *output_length)
386{
387 (void) operation;
388 (void) input;
389 (void) input_length;
390 (void) output;
391 (void) output_size;
392 (void) output_length;
Steven Cooremanacb5a102020-09-08 14:06:57 +0200393 return( PSA_ERROR_NOT_SUPPORTED );
Steven Cooreman37941cb2020-07-28 18:49:51 +0200394}
395
Ronald Cron7f13fa22021-04-13 12:41:34 +0200396psa_status_t mbedtls_test_opaque_cipher_finish(
Ronald Cron7cb9c3d2021-03-10 12:21:48 +0100397 mbedtls_opaque_test_driver_cipher_operation_t *operation,
Steven Cooreman37941cb2020-07-28 18:49:51 +0200398 uint8_t *output,
399 size_t output_size,
400 size_t *output_length)
401{
402 (void) operation;
403 (void) output;
404 (void) output_size;
405 (void) output_length;
Steven Cooremanacb5a102020-09-08 14:06:57 +0200406 return( PSA_ERROR_NOT_SUPPORTED );
Steven Cooreman37941cb2020-07-28 18:49:51 +0200407}
408#endif /* MBEDTLS_PSA_CRYPTO_DRIVERS && PSA_CRYPTO_DRIVER_TEST */