blob: 45c770c811aa1168599c77b77a11a1d9125392fb [file] [log] [blame]
Steven Cooremanf7638102021-03-04 15:14:36 +01001/*
2 * Test driver for hash functions
3 */
4/* Copyright The Mbed TLS Contributors
5 * SPDX-License-Identifier: Apache-2.0
6 *
7 * Licensed under the Apache License, Version 2.0 (the "License"); you may
8 * not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 */
19
20#ifndef PSA_CRYPTO_TEST_DRIVERS_HASH_H
21#define PSA_CRYPTO_TEST_DRIVERS_HASH_H
22
23#if !defined(MBEDTLS_CONFIG_FILE)
24#include "mbedtls/config.h"
25#else
26#include MBEDTLS_CONFIG_FILE
27#endif
28
29#if defined(PSA_CRYPTO_DRIVER_TEST)
30/* Include path is relative to the tests/include folder, which is the base
31 * include path for including this (hash.h) test driver header. */
32#include "../../library/psa_crypto_hash.h"
33
34typedef struct {
35 mbedtls_psa_hash_operation_t operation;
36} test_transparent_hash_operation_t;
37
38psa_status_t test_transparent_hash_compute(
39 psa_algorithm_t alg,
40 const uint8_t *input,
41 size_t input_length,
42 uint8_t *hash,
43 size_t hash_size,
44 size_t *hash_length);
45
46psa_status_t test_transparent_hash_setup(
47 test_transparent_hash_operation_t *operation,
48 psa_algorithm_t alg );
49
50psa_status_t test_transparent_hash_clone(
51 const test_transparent_hash_operation_t *source_operation,
52 test_transparent_hash_operation_t *target_operation );
53
54psa_status_t test_transparent_hash_update(
55 test_transparent_hash_operation_t *operation,
56 const uint8_t *input,
57 size_t input_length );
58
59psa_status_t test_transparent_hash_finish(
60 test_transparent_hash_operation_t *operation,
61 uint8_t *hash,
62 size_t hash_size,
63 size_t *hash_length );
64
65psa_status_t test_transparent_hash_abort(
66 test_transparent_hash_operation_t *operation );
67
68#endif /* PSA_CRYPTO_DRIVER_TEST */
69#endif /* PSA_CRYPTO_TEST_DRIVERS_HASH_H */