blob: 30a8119aab26c368ee6e27e4ceefa18f9bc43eb7 [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
Ronald Cronb814bda2021-09-13 14:50:42 +020037#if defined(MBEDTLS_TEST_LIBTESTDRIVER1)
38#include "libtestdriver1/library/psa_crypto_cipher.h"
39#endif
40
Steven Cooreman37941cb2020-07-28 18:49:51 +020041#include <string.h>
42
Ronald Cronc4bc12e2021-04-13 12:41:34 +020043mbedtls_test_driver_cipher_hooks_t mbedtls_test_driver_cipher_hooks =
44 MBEDTLS_TEST_DRIVER_CIPHER_INIT;
Steven Cooreman37941cb2020-07-28 18:49:51 +020045
gabor-mezei-armfa990b52021-03-25 11:17:10 +010046psa_status_t mbedtls_test_transparent_cipher_encrypt(
Steven Cooremanfe0ab552020-09-10 13:07:02 +020047 const psa_key_attributes_t *attributes,
gabor-mezei-armfa990b52021-03-25 11:17:10 +010048 const uint8_t *key_buffer,
49 size_t key_buffer_size,
Steven Cooremanfe0ab552020-09-10 13:07:02 +020050 psa_algorithm_t alg,
Ronald Crona8331692021-07-09 09:19:35 +020051 const uint8_t *iv,
52 size_t iv_length,
gabor-mezei-armfa990b52021-03-25 11:17:10 +010053 const uint8_t *input,
54 size_t input_length,
55 uint8_t *output,
56 size_t output_size,
57 size_t *output_length )
Steven Cooremanfe0ab552020-09-10 13:07:02 +020058{
Ronald Cronc4bc12e2021-04-13 12:41:34 +020059 mbedtls_test_driver_cipher_hooks.hits++;
Steven Cooremanfe0ab552020-09-10 13:07:02 +020060
Ronald Cronc4bc12e2021-04-13 12:41:34 +020061 if( mbedtls_test_driver_cipher_hooks.forced_output != NULL )
Steven Cooremanfe0ab552020-09-10 13:07:02 +020062 {
Ronald Cronc4bc12e2021-04-13 12:41:34 +020063 if( output_size < mbedtls_test_driver_cipher_hooks.forced_output_length )
Steven Cooremanfe0ab552020-09-10 13:07:02 +020064 return( PSA_ERROR_BUFFER_TOO_SMALL );
65
66 memcpy( output,
Ronald Cronc4bc12e2021-04-13 12:41:34 +020067 mbedtls_test_driver_cipher_hooks.forced_output,
68 mbedtls_test_driver_cipher_hooks.forced_output_length );
69 *output_length = mbedtls_test_driver_cipher_hooks.forced_output_length;
Steven Cooremanfe0ab552020-09-10 13:07:02 +020070
Ronald Cronc4bc12e2021-04-13 12:41:34 +020071 return( mbedtls_test_driver_cipher_hooks.forced_status );
Steven Cooremanfe0ab552020-09-10 13:07:02 +020072 }
73
gabor-mezei-armfa990b52021-03-25 11:17:10 +010074 if( mbedtls_test_driver_cipher_hooks.forced_status != PSA_SUCCESS )
75 return( mbedtls_test_driver_cipher_hooks.forced_status );
Steven Cooremanfe0ab552020-09-10 13:07:02 +020076
Ronald Cronb814bda2021-09-13 14:50:42 +020077#if defined(MBEDTLS_TEST_LIBTESTDRIVER1) && \
78 defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_CIPHER)
Ronald Cron7b7854e2021-03-13 18:19:08 +010079 return( libtestdriver1_mbedtls_psa_cipher_encrypt(
Ronald Cronb814bda2021-09-13 14:50:42 +020080 (const libtestdriver1_psa_key_attributes_t *)attributes,
81 key_buffer, key_buffer_size,
Dave Rodgman08412e22021-12-14 12:52:51 +000082 alg, iv, iv_length, input, input_length,
gabor-mezei-armfa990b52021-03-25 11:17:10 +010083 output, output_size, output_length ) );
Ronald Cron2091eed2021-04-09 11:09:54 +020084#elif defined(MBEDTLS_PSA_BUILTIN_CIPHER)
85 return( mbedtls_psa_cipher_encrypt(
86 attributes, key_buffer, key_buffer_size,
Ronald Crona8331692021-07-09 09:19:35 +020087 alg, iv, iv_length, input, input_length,
Ronald Cron2091eed2021-04-09 11:09:54 +020088 output, output_size, output_length ) );
89#endif
90
91 return( PSA_ERROR_NOT_SUPPORTED );
Steven Cooreman37941cb2020-07-28 18:49:51 +020092}
93
Ronald Cronc4bc12e2021-04-13 12:41:34 +020094psa_status_t mbedtls_test_transparent_cipher_decrypt(
Steven Cooreman37941cb2020-07-28 18:49:51 +020095 const psa_key_attributes_t *attributes,
gabor-mezei-armfa990b52021-03-25 11:17:10 +010096 const uint8_t *key_buffer,
97 size_t key_buffer_size,
Steven Cooreman37941cb2020-07-28 18:49:51 +020098 psa_algorithm_t alg,
gabor-mezei-armfa990b52021-03-25 11:17:10 +010099 const uint8_t *input,
100 size_t input_length,
101 uint8_t *output,
102 size_t output_size,
103 size_t *output_length )
Steven Cooreman37941cb2020-07-28 18:49:51 +0200104{
gabor-mezei-armfa990b52021-03-25 11:17:10 +0100105 mbedtls_test_driver_cipher_hooks.hits++;
106
107 if( mbedtls_test_driver_cipher_hooks.forced_output != NULL )
108 {
109 if( output_size < mbedtls_test_driver_cipher_hooks.forced_output_length )
110 return( PSA_ERROR_BUFFER_TOO_SMALL );
111
112 memcpy( output,
113 mbedtls_test_driver_cipher_hooks.forced_output,
114 mbedtls_test_driver_cipher_hooks.forced_output_length );
115 *output_length = mbedtls_test_driver_cipher_hooks.forced_output_length;
116
117 return( mbedtls_test_driver_cipher_hooks.forced_status );
118 }
119
120 if( mbedtls_test_driver_cipher_hooks.forced_status != PSA_SUCCESS )
121 return( mbedtls_test_driver_cipher_hooks.forced_status );
122
Ronald Cronb814bda2021-09-13 14:50:42 +0200123#if defined(MBEDTLS_TEST_LIBTESTDRIVER1) && \
124 defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_CIPHER)
Ronald Cron7b7854e2021-03-13 18:19:08 +0100125 return( libtestdriver1_mbedtls_psa_cipher_decrypt(
Ronald Cronb814bda2021-09-13 14:50:42 +0200126 (const libtestdriver1_psa_key_attributes_t *)attributes,
127 key_buffer, key_buffer_size,
gabor-mezei-armfa990b52021-03-25 11:17:10 +0100128 alg, input, input_length,
129 output, output_size, output_length ) );
Ronald Cron2091eed2021-04-09 11:09:54 +0200130#elif defined(MBEDTLS_PSA_BUILTIN_CIPHER)
131 return( mbedtls_psa_cipher_decrypt(
132 attributes, key_buffer, key_buffer_size,
133 alg, input, input_length,
134 output, output_size, output_length ) );
135#endif
136
137 return( PSA_ERROR_NOT_SUPPORTED );
Steven Cooreman37941cb2020-07-28 18:49:51 +0200138}
139
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200140psa_status_t mbedtls_test_transparent_cipher_encrypt_setup(
Ronald Cron7cb9c3d2021-03-10 12:21:48 +0100141 mbedtls_transparent_test_driver_cipher_operation_t *operation,
Steven Cooreman16afd3d2020-09-09 15:36:39 +0200142 const psa_key_attributes_t *attributes,
143 const uint8_t *key, size_t key_length,
144 psa_algorithm_t alg)
145{
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200146 mbedtls_test_driver_cipher_hooks.hits++;
Ronald Cron8d310ad2020-12-15 15:17:20 +0100147
148 /* Wiping the entire struct here, instead of member-by-member. This is
149 * useful for the test suite, since it gives a chance of catching memory
150 * corruption errors should the core not have allocated (enough) memory for
151 * our context struct. */
152 memset( operation, 0, sizeof( *operation ) );
153
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200154 if( mbedtls_test_driver_cipher_hooks.forced_status != PSA_SUCCESS )
155 return( mbedtls_test_driver_cipher_hooks.forced_status );
Ronald Cron8d310ad2020-12-15 15:17:20 +0100156
Ronald Cronb814bda2021-09-13 14:50:42 +0200157#if defined(MBEDTLS_TEST_LIBTESTDRIVER1) && \
158 defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_CIPHER)
Ronald Cron7b7854e2021-03-13 18:19:08 +0100159 return( libtestdriver1_mbedtls_psa_cipher_encrypt_setup(
Ronald Cronb814bda2021-09-13 14:50:42 +0200160 operation,
161 (const libtestdriver1_psa_key_attributes_t *)attributes,
162 key, key_length, alg ) );
Ronald Cron2091eed2021-04-09 11:09:54 +0200163#elif defined(MBEDTLS_PSA_BUILTIN_CIPHER)
164 return( mbedtls_psa_cipher_encrypt_setup(
165 operation, attributes, key, key_length, alg ) );
166#endif
167
168 return( PSA_ERROR_NOT_SUPPORTED );
Steven Cooreman16afd3d2020-09-09 15:36:39 +0200169}
170
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200171psa_status_t mbedtls_test_transparent_cipher_decrypt_setup(
Ronald Cron7cb9c3d2021-03-10 12:21:48 +0100172 mbedtls_transparent_test_driver_cipher_operation_t *operation,
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{
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200177 mbedtls_test_driver_cipher_hooks.hits++;
Ronald Cron8d310ad2020-12-15 15:17:20 +0100178
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200179 if( mbedtls_test_driver_cipher_hooks.forced_status != PSA_SUCCESS )
180 return( mbedtls_test_driver_cipher_hooks.forced_status );
Ronald Cron8d310ad2020-12-15 15:17:20 +0100181
Ronald Cronb814bda2021-09-13 14:50:42 +0200182#if defined(MBEDTLS_TEST_LIBTESTDRIVER1) && \
183 defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_CIPHER)
Ronald Cron7b7854e2021-03-13 18:19:08 +0100184 return( libtestdriver1_mbedtls_psa_cipher_decrypt_setup(
Ronald Cronb814bda2021-09-13 14:50:42 +0200185 operation,
186 (const libtestdriver1_psa_key_attributes_t *)attributes,
187 key, key_length, alg ) );
Ronald Cron2091eed2021-04-09 11:09:54 +0200188#elif defined(MBEDTLS_PSA_BUILTIN_CIPHER)
189 return( mbedtls_psa_cipher_decrypt_setup(
190 operation, attributes, key, key_length, alg ) );
191#endif
192
193 return( PSA_ERROR_NOT_SUPPORTED );
Steven Cooreman37941cb2020-07-28 18:49:51 +0200194}
195
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200196psa_status_t mbedtls_test_transparent_cipher_abort(
Ronald Cron7cb9c3d2021-03-10 12:21:48 +0100197 mbedtls_transparent_test_driver_cipher_operation_t *operation)
Steven Cooreman37941cb2020-07-28 18:49:51 +0200198{
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200199 mbedtls_test_driver_cipher_hooks.hits++;
Steven Cooreman89e54f22020-09-10 18:07:57 +0200200
Steven Cooreman8b122252020-09-03 15:30:32 +0200201 if( operation->alg == 0 )
202 return( PSA_SUCCESS );
Steven Cooreman8b122252020-09-03 15:30:32 +0200203
Ronald Cronb814bda2021-09-13 14:50:42 +0200204#if defined(MBEDTLS_TEST_LIBTESTDRIVER1) && \
205 defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_CIPHER)
Ronald Cron7b7854e2021-03-13 18:19:08 +0100206 libtestdriver1_mbedtls_psa_cipher_abort( operation );
Ronald Cron2091eed2021-04-09 11:09:54 +0200207#elif defined(MBEDTLS_PSA_BUILTIN_CIPHER)
208 mbedtls_psa_cipher_abort( operation );
209#endif
Steven Cooreman8b122252020-09-03 15:30:32 +0200210
Ronald Cron8d310ad2020-12-15 15:17:20 +0100211 /* Wiping the entire struct here, instead of member-by-member. This is
212 * useful for the test suite, since it gives a chance of catching memory
213 * corruption errors should the core not have allocated (enough) memory for
214 * our context struct. */
Steven Cooreman5240e8b2020-09-09 11:51:45 +0200215 memset( operation, 0, sizeof( *operation ) );
Steven Cooreman37941cb2020-07-28 18:49:51 +0200216
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200217 return( mbedtls_test_driver_cipher_hooks.forced_status );
Steven Cooreman37941cb2020-07-28 18:49:51 +0200218}
219
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200220psa_status_t mbedtls_test_transparent_cipher_set_iv(
Ronald Cron7cb9c3d2021-03-10 12:21:48 +0100221 mbedtls_transparent_test_driver_cipher_operation_t *operation,
Steven Cooreman37941cb2020-07-28 18:49:51 +0200222 const uint8_t *iv,
223 size_t iv_length)
224{
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200225 mbedtls_test_driver_cipher_hooks.hits++;
Steven Cooreman8b122252020-09-03 15:30:32 +0200226
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200227 if( mbedtls_test_driver_cipher_hooks.forced_status != PSA_SUCCESS )
228 return( mbedtls_test_driver_cipher_hooks.forced_status );
Steven Cooreman89e54f22020-09-10 18:07:57 +0200229
Ronald Cronb814bda2021-09-13 14:50:42 +0200230#if defined(MBEDTLS_TEST_LIBTESTDRIVER1) && \
231 defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_CIPHER)
Ronald Cron7b7854e2021-03-13 18:19:08 +0100232 return( libtestdriver1_mbedtls_psa_cipher_set_iv(
Ronald Cron3522e322021-03-12 11:08:49 +0100233 operation, iv, iv_length ) );
Ronald Cron2091eed2021-04-09 11:09:54 +0200234#elif defined(MBEDTLS_PSA_BUILTIN_CIPHER)
235 return( mbedtls_psa_cipher_set_iv( operation, iv, iv_length ) );
236#endif
237
238 return( PSA_ERROR_NOT_SUPPORTED );
Steven Cooreman37941cb2020-07-28 18:49:51 +0200239}
240
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200241psa_status_t mbedtls_test_transparent_cipher_update(
Ronald Cron7cb9c3d2021-03-10 12:21:48 +0100242 mbedtls_transparent_test_driver_cipher_operation_t *operation,
Steven Cooreman37941cb2020-07-28 18:49:51 +0200243 const uint8_t *input,
244 size_t input_length,
245 uint8_t *output,
246 size_t output_size,
247 size_t *output_length)
248{
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200249 mbedtls_test_driver_cipher_hooks.hits++;
Steven Cooreman37941cb2020-07-28 18:49:51 +0200250
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200251 if( mbedtls_test_driver_cipher_hooks.forced_output != NULL )
Steven Cooreman8b122252020-09-03 15:30:32 +0200252 {
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200253 if( output_size < mbedtls_test_driver_cipher_hooks.forced_output_length )
Steven Cooreman8b122252020-09-03 15:30:32 +0200254 return PSA_ERROR_BUFFER_TOO_SMALL;
255
Steven Cooremanacb5a102020-09-08 14:06:57 +0200256 memcpy( output,
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200257 mbedtls_test_driver_cipher_hooks.forced_output,
258 mbedtls_test_driver_cipher_hooks.forced_output_length );
259 *output_length = mbedtls_test_driver_cipher_hooks.forced_output_length;
Ronald Cron8d310ad2020-12-15 15:17:20 +0100260
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200261 return( mbedtls_test_driver_cipher_hooks.forced_status );
Steven Cooreman8b122252020-09-03 15:30:32 +0200262 }
Steven Cooreman37941cb2020-07-28 18:49:51 +0200263
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200264 if( mbedtls_test_driver_cipher_hooks.forced_status != PSA_SUCCESS )
265 return( mbedtls_test_driver_cipher_hooks.forced_status );
Ronald Cron8d310ad2020-12-15 15:17:20 +0100266
Ronald Cronb814bda2021-09-13 14:50:42 +0200267#if defined(MBEDTLS_TEST_LIBTESTDRIVER1) && \
268 defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_CIPHER)
Ronald Cron7b7854e2021-03-13 18:19:08 +0100269 return( libtestdriver1_mbedtls_psa_cipher_update(
Ronald Cron3522e322021-03-12 11:08:49 +0100270 operation, input, input_length,
271 output, output_size, output_length ) );
Ronald Cron2091eed2021-04-09 11:09:54 +0200272#elif defined(MBEDTLS_PSA_BUILTIN_CIPHER)
273 return( mbedtls_psa_cipher_update(
274 operation, input, input_length,
275 output, output_size, output_length ) );
276#endif
277
278 return( PSA_ERROR_NOT_SUPPORTED );
Steven Cooreman37941cb2020-07-28 18:49:51 +0200279}
280
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200281psa_status_t mbedtls_test_transparent_cipher_finish(
Ronald Cron7cb9c3d2021-03-10 12:21:48 +0100282 mbedtls_transparent_test_driver_cipher_operation_t *operation,
Steven Cooreman37941cb2020-07-28 18:49:51 +0200283 uint8_t *output,
284 size_t output_size,
285 size_t *output_length)
286{
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200287 mbedtls_test_driver_cipher_hooks.hits++;
Steven Cooreman37941cb2020-07-28 18:49:51 +0200288
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200289 if( mbedtls_test_driver_cipher_hooks.forced_output != NULL )
Steven Cooreman8b122252020-09-03 15:30:32 +0200290 {
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200291 if( output_size < mbedtls_test_driver_cipher_hooks.forced_output_length )
Steven Cooreman8b122252020-09-03 15:30:32 +0200292 return PSA_ERROR_BUFFER_TOO_SMALL;
293
Steven Cooremanacb5a102020-09-08 14:06:57 +0200294 memcpy( output,
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200295 mbedtls_test_driver_cipher_hooks.forced_output,
296 mbedtls_test_driver_cipher_hooks.forced_output_length );
297 *output_length = mbedtls_test_driver_cipher_hooks.forced_output_length;
Ronald Cron8d310ad2020-12-15 15:17:20 +0100298
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200299 return( mbedtls_test_driver_cipher_hooks.forced_status );
Steven Cooreman8b122252020-09-03 15:30:32 +0200300 }
Steven Cooreman37941cb2020-07-28 18:49:51 +0200301
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200302 if( mbedtls_test_driver_cipher_hooks.forced_status != PSA_SUCCESS )
303 return( mbedtls_test_driver_cipher_hooks.forced_status );
Ronald Cron8d310ad2020-12-15 15:17:20 +0100304
Ronald Cronb814bda2021-09-13 14:50:42 +0200305#if defined(MBEDTLS_TEST_LIBTESTDRIVER1) && \
306 defined(LIBTESTDRIVER1_MBEDTLS_PSA_BUILTIN_CIPHER)
Ronald Cron7b7854e2021-03-13 18:19:08 +0100307 return( libtestdriver1_mbedtls_psa_cipher_finish(
Ronald Cron3522e322021-03-12 11:08:49 +0100308 operation, output, output_size, output_length ) );
Ronald Cron2091eed2021-04-09 11:09:54 +0200309#elif defined(MBEDTLS_PSA_BUILTIN_CIPHER)
310 return( mbedtls_psa_cipher_finish(
311 operation, output, output_size, output_length ) );
312#endif
313
314 return( PSA_ERROR_NOT_SUPPORTED );
Steven Cooreman37941cb2020-07-28 18:49:51 +0200315}
316
317/*
318 * opaque versions, to do
319 */
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200320psa_status_t mbedtls_test_opaque_cipher_encrypt(
Steven Cooreman37941cb2020-07-28 18:49:51 +0200321 const psa_key_attributes_t *attributes,
322 const uint8_t *key, size_t key_length,
323 psa_algorithm_t alg,
Ronald Crona8331692021-07-09 09:19:35 +0200324 const uint8_t *iv, size_t iv_length,
Steven Cooreman37941cb2020-07-28 18:49:51 +0200325 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;
Ronald Crona8331692021-07-09 09:19:35 +0200332 (void) iv;
333 (void) iv_length;
Steven Cooreman37941cb2020-07-28 18:49:51 +0200334 (void) input;
335 (void) input_length;
336 (void) output;
337 (void) output_size;
338 (void) output_length;
Steven Cooremanacb5a102020-09-08 14:06:57 +0200339 return( PSA_ERROR_NOT_SUPPORTED );
Steven Cooreman37941cb2020-07-28 18:49:51 +0200340}
341
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200342psa_status_t mbedtls_test_opaque_cipher_decrypt(
Steven Cooreman37941cb2020-07-28 18:49:51 +0200343 const psa_key_attributes_t *attributes,
344 const uint8_t *key, size_t key_length,
345 psa_algorithm_t alg,
346 const uint8_t *input, size_t input_length,
347 uint8_t *output, size_t output_size, size_t *output_length)
348{
349 (void) attributes;
350 (void) key;
351 (void) key_length;
352 (void) alg;
353 (void) input;
354 (void) input_length;
355 (void) output;
356 (void) output_size;
357 (void) output_length;
Steven Cooremanacb5a102020-09-08 14:06:57 +0200358 return( PSA_ERROR_NOT_SUPPORTED );
Steven Cooreman37941cb2020-07-28 18:49:51 +0200359}
360
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200361psa_status_t mbedtls_test_opaque_cipher_encrypt_setup(
Ronald Cron7cb9c3d2021-03-10 12:21:48 +0100362 mbedtls_opaque_test_driver_cipher_operation_t *operation,
Steven Cooreman37941cb2020-07-28 18:49:51 +0200363 const psa_key_attributes_t *attributes,
364 const uint8_t *key, size_t key_length,
365 psa_algorithm_t alg)
366{
367 (void) operation;
368 (void) attributes;
369 (void) key;
370 (void) key_length;
371 (void) alg;
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_decrypt_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 Cronc4bc12e2021-04-13 12:41:34 +0200389psa_status_t mbedtls_test_opaque_cipher_abort(
Ronald Cron7cb9c3d2021-03-10 12:21:48 +0100390 mbedtls_opaque_test_driver_cipher_operation_t *operation )
Steven Cooreman37941cb2020-07-28 18:49:51 +0200391{
392 (void) operation;
Steven Cooremanacb5a102020-09-08 14:06:57 +0200393 return( PSA_ERROR_NOT_SUPPORTED );
Steven Cooreman37941cb2020-07-28 18:49:51 +0200394}
395
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200396psa_status_t mbedtls_test_opaque_cipher_set_iv(
Ronald Cron7cb9c3d2021-03-10 12:21:48 +0100397 mbedtls_opaque_test_driver_cipher_operation_t *operation,
Steven Cooreman37941cb2020-07-28 18:49:51 +0200398 const uint8_t *iv,
399 size_t iv_length)
400{
401 (void) operation;
402 (void) iv;
403 (void) iv_length;
Steven Cooremanacb5a102020-09-08 14:06:57 +0200404 return( PSA_ERROR_NOT_SUPPORTED );
Steven Cooreman37941cb2020-07-28 18:49:51 +0200405}
406
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200407psa_status_t mbedtls_test_opaque_cipher_update(
Ronald Cron7cb9c3d2021-03-10 12:21:48 +0100408 mbedtls_opaque_test_driver_cipher_operation_t *operation,
Steven Cooreman37941cb2020-07-28 18:49:51 +0200409 const uint8_t *input,
410 size_t input_length,
411 uint8_t *output,
412 size_t output_size,
413 size_t *output_length)
414{
415 (void) operation;
416 (void) input;
417 (void) input_length;
418 (void) output;
419 (void) output_size;
420 (void) output_length;
Steven Cooremanacb5a102020-09-08 14:06:57 +0200421 return( PSA_ERROR_NOT_SUPPORTED );
Steven Cooreman37941cb2020-07-28 18:49:51 +0200422}
423
Ronald Cronc4bc12e2021-04-13 12:41:34 +0200424psa_status_t mbedtls_test_opaque_cipher_finish(
Ronald Cron7cb9c3d2021-03-10 12:21:48 +0100425 mbedtls_opaque_test_driver_cipher_operation_t *operation,
Steven Cooreman37941cb2020-07-28 18:49:51 +0200426 uint8_t *output,
427 size_t output_size,
428 size_t *output_length)
429{
430 (void) operation;
431 (void) output;
432 (void) output_size;
433 (void) output_length;
Steven Cooremanacb5a102020-09-08 14:06:57 +0200434 return( PSA_ERROR_NOT_SUPPORTED );
Steven Cooreman37941cb2020-07-28 18:49:51 +0200435}
436#endif /* MBEDTLS_PSA_CRYPTO_DRIVERS && PSA_CRYPTO_DRIVER_TEST */