blob: 1de26e6d67679febff5217f3abf69b388c991b0d [file] [log] [blame]
Gilles Peskine0cad07c2018-06-27 19:49:02 +02001/**
2 * \file psa/crypto_sizes.h
3 *
4 * \brief PSA cryptography module: Mbed TLS buffer size macros
5 *
6 * This file contains the definitions of macros that are useful to
7 * compute buffer sizes. The signatures and semantics of these macros
8 * are standardized, but the definitions are not, because they depend on
9 * the available algorithms and, in some cases, on permitted tolerances
10 * on buffer sizes.
11 */
12/*
13 * Copyright (C) 2018, ARM Limited, All Rights Reserved
14 * SPDX-License-Identifier: Apache-2.0
15 *
16 * Licensed under the Apache License, Version 2.0 (the "License"); you may
17 * not use this file except in compliance with the License.
18 * You may obtain a copy of the License at
19 *
20 * http://www.apache.org/licenses/LICENSE-2.0
21 *
22 * Unless required by applicable law or agreed to in writing, software
23 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
24 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
25 * See the License for the specific language governing permissions and
26 * limitations under the License.
27 *
28 * This file is part of mbed TLS (https://tls.mbed.org)
29 */
30
31#ifndef PSA_CRYPTO_SIZES_H
32#define PSA_CRYPTO_SIZES_H
33
34/* Include the Mbed TLS configuration file, the way Mbed TLS does it
35 * in each of its header files. */
36#if !defined(MBEDTLS_CONFIG_FILE)
37#include "../mbedtls/config.h"
38#else
39#include MBEDTLS_CONFIG_FILE
40#endif
41
42#if defined(MBEDTLS_SHA512_C)
43#define PSA_HASH_MAX_SIZE 64
44#define PSA_HMAC_MAX_HASH_BLOCK_SIZE 128
45#else
46#define PSA_HASH_MAX_SIZE 32
47#define PSA_HMAC_MAX_HASH_BLOCK_SIZE 64
48#endif
49
50#endif /* PSA_CRYPTO_SIZES_H */