blob: ca91eaa36539f95d6f2fe3e25a8ed0227c3f05a0 [file] [log] [blame]
Ronald Cron0ff57952021-03-08 16:46:35 +01001/*
2 * PSA cipher driver entry points
3 */
4/*
5 * Copyright The Mbed TLS Contributors
6 * 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.
19 */
20
21#include "common.h"
22
23#if defined(MBEDTLS_PSA_CRYPTO_C)
24
25#include <psa_crypto_cipher.h>
Ronald Crond6d28882020-12-14 14:56:02 +010026#include "psa_crypto_core.h"
Ronald Cron6d051732020-10-01 14:10:20 +020027#include "psa_crypto_random_impl.h"
28
Ronald Crond6d28882020-12-14 14:56:02 +010029#include "mbedtls/cipher.h"
Ronald Cron6d051732020-10-01 14:10:20 +020030#include "mbedtls/error.h"
Ronald Cron0ff57952021-03-08 16:46:35 +010031
Ronald Crond6d28882020-12-14 14:56:02 +010032#include <string.h>
33
Ronald Cron5d9b00d2021-03-10 14:43:20 +010034#if ( defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_DES) || \
35 ( defined(PSA_CRYPTO_DRIVER_TEST) && \
36 defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_DES) ) )
37#define BUILTIN_KEY_TYPE_DES 1
38#endif
39
40#if ( defined(MBEDTLS_PSA_BUILTIN_ALG_CBC_NO_PADDING) || \
41 ( defined(PSA_CRYPTO_DRIVER_TEST) && \
42 defined(MBEDTLS_PSA_ACCEL_ALG_CBC_NO_PADDING) ) )
43#define BUILTIN_ALG_CBC_NO_PADDING 1
44#endif
45
46#if ( defined(MBEDTLS_PSA_BUILTIN_ALG_CBC_PKCS7) || \
47 ( defined(PSA_CRYPTO_DRIVER_TEST) && \
48 defined(MBEDTLS_PSA_ACCEL_ALG_CBC_PKCS7) ) )
49#define BUILTIN_ALG_CBC_PKCS7 1
50#endif
51
52#if ( defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_CHACHA20) || \
53 ( defined(PSA_CRYPTO_DRIVER_TEST) && \
54 defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_CHACHA20) ) )
55#define BUILTIN_KEY_TYPE_CHACHA20 1
56#endif
57
58#if defined(MBEDTLS_PSA_BUILTIN_CIPHER) || defined(PSA_CRYPTO_DRIVER_TEST)
59
Ronald Crond6d28882020-12-14 14:56:02 +010060static psa_status_t cipher_setup(
Ronald Cron6e412a72021-03-10 09:58:47 +010061 mbedtls_psa_cipher_operation_t *operation,
Ronald Crond6d28882020-12-14 14:56:02 +010062 const psa_key_attributes_t *attributes,
63 const uint8_t *key_buffer, size_t key_buffer_size,
64 psa_algorithm_t alg,
65 mbedtls_operation_t cipher_operation )
66{
67 int ret = 0;
68 size_t key_bits;
69 const mbedtls_cipher_info_t *cipher_info = NULL;
70 psa_key_type_t key_type = attributes->core.type;
71
72 (void)key_buffer_size;
73
74 /* Proceed with initializing an mbed TLS cipher context if no driver is
75 * available for the given algorithm & key. */
Ronald Cron6e412a72021-03-10 09:58:47 +010076 mbedtls_cipher_init( &operation->cipher );
Ronald Crond6d28882020-12-14 14:56:02 +010077
Ronald Cron6e412a72021-03-10 09:58:47 +010078 operation->alg = alg;
Ronald Crond6d28882020-12-14 14:56:02 +010079 key_bits = attributes->core.bits;
80 cipher_info = mbedtls_cipher_info_from_psa( alg, key_type,
81 key_bits, NULL );
82 if( cipher_info == NULL )
83 return( PSA_ERROR_NOT_SUPPORTED );
84
Ronald Cron6e412a72021-03-10 09:58:47 +010085 ret = mbedtls_cipher_setup( &operation->cipher, cipher_info );
Ronald Crond6d28882020-12-14 14:56:02 +010086 if( ret != 0 )
87 goto exit;
88
Ronald Cron5d9b00d2021-03-10 14:43:20 +010089#if defined(BUILTIN_KEY_TYPE_DES)
Ronald Crond6d28882020-12-14 14:56:02 +010090 if( key_type == PSA_KEY_TYPE_DES && key_bits == 128 )
91 {
92 /* Two-key Triple-DES is 3-key Triple-DES with K1=K3 */
93 uint8_t keys[24];
94 memcpy( keys, key_buffer, 16 );
95 memcpy( keys + 16, key_buffer, 8 );
Ronald Cron6e412a72021-03-10 09:58:47 +010096 ret = mbedtls_cipher_setkey( &operation->cipher,
Ronald Crond6d28882020-12-14 14:56:02 +010097 keys,
98 192, cipher_operation );
99 }
100 else
101#endif
102 {
Ronald Cron6e412a72021-03-10 09:58:47 +0100103 ret = mbedtls_cipher_setkey( &operation->cipher, key_buffer,
Ronald Crond6d28882020-12-14 14:56:02 +0100104 (int) key_bits, cipher_operation );
105 }
106 if( ret != 0 )
107 goto exit;
108
Ronald Cron5d9b00d2021-03-10 14:43:20 +0100109#if defined(BUILTIN_ALG_CBC_NO_PADDING) || \
110 defined(BUILTIN_ALG_CBC_PKCS7)
Ronald Crond6d28882020-12-14 14:56:02 +0100111 switch( alg )
112 {
113 case PSA_ALG_CBC_NO_PADDING:
Ronald Cron6e412a72021-03-10 09:58:47 +0100114 ret = mbedtls_cipher_set_padding_mode( &operation->cipher,
Ronald Crond6d28882020-12-14 14:56:02 +0100115 MBEDTLS_PADDING_NONE );
116 break;
117 case PSA_ALG_CBC_PKCS7:
Ronald Cron6e412a72021-03-10 09:58:47 +0100118 ret = mbedtls_cipher_set_padding_mode( &operation->cipher,
Ronald Crond6d28882020-12-14 14:56:02 +0100119 MBEDTLS_PADDING_PKCS7 );
120 break;
121 default:
122 /* The algorithm doesn't involve padding. */
123 ret = 0;
124 break;
125 }
126 if( ret != 0 )
127 goto exit;
Ronald Cron5d9b00d2021-03-10 14:43:20 +0100128#endif /* BUILTIN_ALG_CBC_NO_PADDING || BUILTIN_ALG_CBC_PKCS7 */
Ronald Crond6d28882020-12-14 14:56:02 +0100129
Ronald Cron6e412a72021-03-10 09:58:47 +0100130 operation->block_size = ( PSA_ALG_IS_STREAM_CIPHER( alg ) ? 1 :
Ronald Crond6d28882020-12-14 14:56:02 +0100131 PSA_BLOCK_CIPHER_BLOCK_LENGTH( key_type ) );
132 if( ( alg & PSA_ALG_CIPHER_FROM_BLOCK_FLAG ) != 0 &&
133 alg != PSA_ALG_ECB_NO_PADDING )
134 {
Ronald Cron6e412a72021-03-10 09:58:47 +0100135 operation->iv_size = PSA_BLOCK_CIPHER_BLOCK_LENGTH( key_type );
Ronald Crond6d28882020-12-14 14:56:02 +0100136 }
Ronald Cron5d9b00d2021-03-10 14:43:20 +0100137#if defined(BUILTIN_KEY_TYPE_CHACHA20)
Ronald Crond6d28882020-12-14 14:56:02 +0100138 else
139 if( ( alg == PSA_ALG_STREAM_CIPHER ) &&
140 ( key_type == PSA_KEY_TYPE_CHACHA20 ) )
Ronald Cron6e412a72021-03-10 09:58:47 +0100141 operation->iv_size = 12;
Ronald Crond6d28882020-12-14 14:56:02 +0100142#endif
143
144exit:
145 return( mbedtls_to_psa_error( ret ) );
146}
147
Ronald Cron8287e6b2021-03-12 10:35:18 +0100148static psa_status_t cipher_encrypt_setup(
Ronald Cron6e412a72021-03-10 09:58:47 +0100149 mbedtls_psa_cipher_operation_t *operation,
Ronald Crond6d28882020-12-14 14:56:02 +0100150 const psa_key_attributes_t *attributes,
151 const uint8_t *key_buffer, size_t key_buffer_size,
152 psa_algorithm_t alg )
153{
154 return( cipher_setup( operation, attributes,
155 key_buffer, key_buffer_size,
156 alg, MBEDTLS_ENCRYPT ) );
157}
158
Ronald Cron8287e6b2021-03-12 10:35:18 +0100159static psa_status_t cipher_decrypt_setup(
Ronald Cron6e412a72021-03-10 09:58:47 +0100160 mbedtls_psa_cipher_operation_t *operation,
Ronald Crond6d28882020-12-14 14:56:02 +0100161 const psa_key_attributes_t *attributes,
162 const uint8_t *key_buffer, size_t key_buffer_size,
163 psa_algorithm_t alg )
164{
165 return( cipher_setup( operation, attributes,
166 key_buffer, key_buffer_size,
167 alg, MBEDTLS_DECRYPT ) );
168}
Ronald Cron6d051732020-10-01 14:10:20 +0200169
Ronald Cron8287e6b2021-03-12 10:35:18 +0100170static psa_status_t cipher_set_iv( mbedtls_psa_cipher_operation_t *operation,
171 const uint8_t *iv, size_t iv_length )
172{
173 if( iv_length != operation->iv_size )
174 return( PSA_ERROR_INVALID_ARGUMENT );
175
176 return( mbedtls_to_psa_error(
177 mbedtls_cipher_set_iv( &operation->cipher,
178 iv, iv_length ) ) );
179}
180
181static psa_status_t cipher_generate_iv(
Ronald Cron6e412a72021-03-10 09:58:47 +0100182 mbedtls_psa_cipher_operation_t *operation,
Ronald Cron6d051732020-10-01 14:10:20 +0200183 uint8_t *iv, size_t iv_size, size_t *iv_length )
184{
185 int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
186
Ronald Cron6e412a72021-03-10 09:58:47 +0100187 if( iv_size < operation->iv_size )
Ronald Cron6d051732020-10-01 14:10:20 +0200188 return( PSA_ERROR_BUFFER_TOO_SMALL );
189
190 ret = mbedtls_psa_get_random( MBEDTLS_PSA_RANDOM_STATE,
Ronald Cron6e412a72021-03-10 09:58:47 +0100191 iv, operation->iv_size );
Ronald Cron6d051732020-10-01 14:10:20 +0200192 if( ret != 0 )
193 return( mbedtls_to_psa_error( ret ) );
194
Ronald Cron6e412a72021-03-10 09:58:47 +0100195 *iv_length = operation->iv_size;
Ronald Cron6d051732020-10-01 14:10:20 +0200196
Ronald Cron8287e6b2021-03-12 10:35:18 +0100197 return( cipher_set_iv( operation, iv, *iv_length ) );
Ronald Cron6d051732020-10-01 14:10:20 +0200198}
199
200/* Process input for which the algorithm is set to ECB mode. This requires
201 * manual processing, since the PSA API is defined as being able to process
202 * arbitrary-length calls to psa_cipher_update() with ECB mode, but the
203 * underlying mbedtls_cipher_update only takes full blocks. */
204static psa_status_t psa_cipher_update_ecb(
205 mbedtls_cipher_context_t *ctx,
206 const uint8_t *input,
207 size_t input_length,
208 uint8_t *output,
209 size_t output_size,
210 size_t *output_length )
211{
212 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
213 size_t block_size = ctx->cipher_info->block_size;
214 size_t internal_output_length = 0;
215 *output_length = 0;
216
217 if( input_length == 0 )
218 {
219 status = PSA_SUCCESS;
220 goto exit;
221 }
222
223 if( ctx->unprocessed_len > 0 )
224 {
225 /* Fill up to block size, and run the block if there's a full one. */
226 size_t bytes_to_copy = block_size - ctx->unprocessed_len;
227
228 if( input_length < bytes_to_copy )
229 bytes_to_copy = input_length;
230
231 memcpy( &( ctx->unprocessed_data[ctx->unprocessed_len] ),
232 input, bytes_to_copy );
233 input_length -= bytes_to_copy;
234 input += bytes_to_copy;
235 ctx->unprocessed_len += bytes_to_copy;
236
237 if( ctx->unprocessed_len == block_size )
238 {
239 status = mbedtls_to_psa_error(
240 mbedtls_cipher_update( ctx,
241 ctx->unprocessed_data,
242 block_size,
243 output, &internal_output_length ) );
244
245 if( status != PSA_SUCCESS )
246 goto exit;
247
248 output += internal_output_length;
249 output_size -= internal_output_length;
250 *output_length += internal_output_length;
251 ctx->unprocessed_len = 0;
252 }
253 }
254
255 while( input_length >= block_size )
256 {
257 /* Run all full blocks we have, one by one */
258 status = mbedtls_to_psa_error(
259 mbedtls_cipher_update( ctx, input,
260 block_size,
261 output, &internal_output_length ) );
262
263 if( status != PSA_SUCCESS )
264 goto exit;
265
266 input_length -= block_size;
267 input += block_size;
268
269 output += internal_output_length;
270 output_size -= internal_output_length;
271 *output_length += internal_output_length;
272 }
273
274 if( input_length > 0 )
275 {
276 /* Save unprocessed bytes for later processing */
277 memcpy( &( ctx->unprocessed_data[ctx->unprocessed_len] ),
278 input, input_length );
279 ctx->unprocessed_len += input_length;
280 }
281
282 status = PSA_SUCCESS;
283
284exit:
285 return( status );
286}
287
Ronald Cron8287e6b2021-03-12 10:35:18 +0100288static psa_status_t cipher_update( mbedtls_psa_cipher_operation_t *operation,
289 const uint8_t *input,
290 size_t input_length,
291 uint8_t *output,
292 size_t output_size,
293 size_t *output_length )
Ronald Cron6d051732020-10-01 14:10:20 +0200294{
295 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
296 size_t expected_output_size;
297
Ronald Cron6e412a72021-03-10 09:58:47 +0100298 if( ! PSA_ALG_IS_STREAM_CIPHER( operation->alg ) )
Ronald Cron6d051732020-10-01 14:10:20 +0200299 {
300 /* Take the unprocessed partial block left over from previous
301 * update calls, if any, plus the input to this call. Remove
302 * the last partial block, if any. You get the data that will be
303 * output in this call. */
304 expected_output_size =
Ronald Cron6e412a72021-03-10 09:58:47 +0100305 ( operation->cipher.unprocessed_len + input_length )
306 / operation->block_size * operation->block_size;
Ronald Cron6d051732020-10-01 14:10:20 +0200307 }
308 else
309 {
310 expected_output_size = input_length;
311 }
312
313 if( output_size < expected_output_size )
314 return( PSA_ERROR_BUFFER_TOO_SMALL );
315
Ronald Cron6e412a72021-03-10 09:58:47 +0100316 if( operation->alg == PSA_ALG_ECB_NO_PADDING )
Ronald Cron6d051732020-10-01 14:10:20 +0200317 {
318 /* mbedtls_cipher_update has an API inconsistency: it will only
319 * process a single block at a time in ECB mode. Abstract away that
320 * inconsistency here to match the PSA API behaviour. */
Ronald Cron6e412a72021-03-10 09:58:47 +0100321 status = psa_cipher_update_ecb( &operation->cipher,
Ronald Cron6d051732020-10-01 14:10:20 +0200322 input,
323 input_length,
324 output,
325 output_size,
326 output_length );
327 }
328 else
329 {
330 status = mbedtls_to_psa_error(
Ronald Cron6e412a72021-03-10 09:58:47 +0100331 mbedtls_cipher_update( &operation->cipher, input,
Ronald Cron6d051732020-10-01 14:10:20 +0200332 input_length, output, output_length ) );
333 }
334
335 return( status );
336}
337
Ronald Cron8287e6b2021-03-12 10:35:18 +0100338static psa_status_t cipher_finish( mbedtls_psa_cipher_operation_t *operation,
339 uint8_t *output,
340 size_t output_size,
341 size_t *output_length )
Ronald Cron6d051732020-10-01 14:10:20 +0200342{
343 psa_status_t status = PSA_ERROR_GENERIC_ERROR;
344 uint8_t temp_output_buffer[MBEDTLS_MAX_BLOCK_LENGTH];
345
Ronald Cron6e412a72021-03-10 09:58:47 +0100346 if( operation->cipher.unprocessed_len != 0 )
Ronald Cron6d051732020-10-01 14:10:20 +0200347 {
Ronald Cron6e412a72021-03-10 09:58:47 +0100348 if( operation->alg == PSA_ALG_ECB_NO_PADDING ||
349 operation->alg == PSA_ALG_CBC_NO_PADDING )
Ronald Cron6d051732020-10-01 14:10:20 +0200350 {
351 status = PSA_ERROR_INVALID_ARGUMENT;
352 goto exit;
353 }
354 }
355
356 status = mbedtls_to_psa_error(
Ronald Cron6e412a72021-03-10 09:58:47 +0100357 mbedtls_cipher_finish( &operation->cipher,
Ronald Cron6d051732020-10-01 14:10:20 +0200358 temp_output_buffer,
359 output_length ) );
360 if( status != PSA_SUCCESS )
361 goto exit;
362
363 if( *output_length == 0 )
364 ; /* Nothing to copy. Note that output may be NULL in this case. */
365 else if( output_size >= *output_length )
366 memcpy( output, temp_output_buffer, *output_length );
367 else
368 status = PSA_ERROR_BUFFER_TOO_SMALL;
369
370exit:
371 mbedtls_platform_zeroize( temp_output_buffer,
372 sizeof( temp_output_buffer ) );
373
374 return( status );
375}
376
Ronald Cron8287e6b2021-03-12 10:35:18 +0100377static psa_status_t cipher_abort( mbedtls_psa_cipher_operation_t *operation )
Ronald Cron6d051732020-10-01 14:10:20 +0200378{
Ronald Cron937dfee2021-03-10 09:17:32 +0100379 /* Sanity check (shouldn't happen: operation->alg should
380 * always have been initialized to a valid value). */
Ronald Cron6e412a72021-03-10 09:58:47 +0100381 if( ! PSA_ALG_IS_CIPHER( operation->alg ) )
Ronald Cron937dfee2021-03-10 09:17:32 +0100382 return( PSA_ERROR_BAD_STATE );
383
Ronald Cron6e412a72021-03-10 09:58:47 +0100384 mbedtls_cipher_free( &operation->cipher );
Ronald Cron6d051732020-10-01 14:10:20 +0200385
386 return( PSA_SUCCESS );
387}
Ronald Cron5d9b00d2021-03-10 14:43:20 +0100388#endif /* MBEDTLS_PSA_BUILTIN_CIPHER || PSA_CRYPTO_DRIVER_TEST */
Ronald Cron6d051732020-10-01 14:10:20 +0200389
Ronald Cron5d9b00d2021-03-10 14:43:20 +0100390#if defined(MBEDTLS_PSA_BUILTIN_CIPHER)
Ronald Cron8287e6b2021-03-12 10:35:18 +0100391psa_status_t mbedtls_psa_cipher_encrypt_setup(
392 mbedtls_psa_cipher_operation_t *operation,
393 const psa_key_attributes_t *attributes,
394 const uint8_t *key_buffer, size_t key_buffer_size,
395 psa_algorithm_t alg )
396{
397 return( cipher_encrypt_setup(
398 operation, attributes, key_buffer, key_buffer_size, alg ) );
399}
400
401psa_status_t mbedtls_psa_cipher_decrypt_setup(
402 mbedtls_psa_cipher_operation_t *operation,
403 const psa_key_attributes_t *attributes,
404 const uint8_t *key_buffer, size_t key_buffer_size,
405 psa_algorithm_t alg )
406{
407 return( cipher_decrypt_setup(
408 operation, attributes, key_buffer, key_buffer_size, alg ) );
409}
410
411psa_status_t mbedtls_psa_cipher_generate_iv(
412 mbedtls_psa_cipher_operation_t *operation,
413 uint8_t *iv, size_t iv_size, size_t *iv_length )
414{
415 return( cipher_generate_iv( operation, iv, iv_size, iv_length ) );
416}
417
418psa_status_t mbedtls_psa_cipher_set_iv( mbedtls_psa_cipher_operation_t *operation,
419 const uint8_t *iv,
420 size_t iv_length )
421{
422 return( cipher_set_iv( operation, iv, iv_length ) );
423}
424
425psa_status_t mbedtls_psa_cipher_update( mbedtls_psa_cipher_operation_t *operation,
426 const uint8_t *input,
427 size_t input_length,
428 uint8_t *output,
429 size_t output_size,
430 size_t *output_length )
431{
432 return( cipher_update( operation, input, input_length,
433 output, output_size, output_length ) );
434}
435
436psa_status_t mbedtls_psa_cipher_finish( mbedtls_psa_cipher_operation_t *operation,
437 uint8_t *output,
438 size_t output_size,
439 size_t *output_length )
440{
441 return( cipher_finish( operation, output, output_size, output_length ) );
442}
443
444psa_status_t mbedtls_psa_cipher_abort( mbedtls_psa_cipher_operation_t *operation )
445{
446 return( cipher_abort( operation ) );
447}
Ronald Cron5d9b00d2021-03-10 14:43:20 +0100448#endif /* MBEDTLS_PSA_BUILTIN_CIPHER */
Ronald Cron8287e6b2021-03-12 10:35:18 +0100449
Ronald Cron3522e322021-03-12 11:08:49 +0100450/*
451 * BEYOND THIS POINT, TEST DRIVER ENTRY POINTS ONLY.
452 */
453
454#if defined(PSA_CRYPTO_DRIVER_TEST)
455psa_status_t mbedtls_transparent_test_driver_cipher_encrypt_setup(
456 mbedtls_psa_cipher_operation_t *operation,
457 const psa_key_attributes_t *attributes,
458 const uint8_t *key_buffer, size_t key_buffer_size,
459 psa_algorithm_t alg )
460{
461 return( cipher_encrypt_setup(
462 operation, attributes, key_buffer, key_buffer_size, alg ) );
463}
464
465psa_status_t mbedtls_transparent_test_driver_cipher_decrypt_setup(
466 mbedtls_psa_cipher_operation_t *operation,
467 const psa_key_attributes_t *attributes,
468 const uint8_t *key_buffer, size_t key_buffer_size,
469 psa_algorithm_t alg )
470{
471 return( cipher_decrypt_setup(
472 operation, attributes, key_buffer, key_buffer_size, alg ) );
473}
474
475psa_status_t mbedtls_transparent_test_driver_cipher_generate_iv(
476 mbedtls_psa_cipher_operation_t *operation,
477 uint8_t *iv, size_t iv_size, size_t *iv_length )
478{
479 return( cipher_generate_iv( operation, iv, iv_size, iv_length ) );
480}
481
482psa_status_t mbedtls_transparent_test_driver_cipher_set_iv(
483 mbedtls_psa_cipher_operation_t *operation,
484 const uint8_t *iv, size_t iv_length )
485{
486 return( cipher_set_iv( operation, iv, iv_length ) );
487}
488
489psa_status_t mbedtls_transparent_test_driver_cipher_update(
490 mbedtls_psa_cipher_operation_t *operation,
491 const uint8_t *input, size_t input_length,
492 uint8_t *output, size_t output_size, size_t *output_length )
493{
494 return( cipher_update( operation, input, input_length,
495 output, output_size, output_length ) );
496}
497
498psa_status_t mbedtls_transparent_test_driver_cipher_finish(
499 mbedtls_psa_cipher_operation_t *operation,
500 uint8_t *output, size_t output_size, size_t *output_length )
501{
502 return( cipher_finish( operation, output, output_size, output_length ) );
503}
504
505psa_status_t mbedtls_transparent_test_driver_cipher_abort(
506 mbedtls_psa_cipher_operation_t *operation )
507{
508 return( cipher_abort( operation ) );
509}
510#endif /* PSA_CRYPTO_DRIVER_TEST */
511
Ronald Cron0ff57952021-03-08 16:46:35 +0100512#endif /* MBEDTLS_PSA_CRYPTO_C */