blob: cd539b54be32d45d01672734c349e18858821fdd [file] [log] [blame]
Jens Wiklander817466c2018-05-22 13:49:31 +02001/**
Jens Wiklander32b31802023-10-06 16:59:46 +02002 * \file md_wrap.h
Jens Wiklander817466c2018-05-22 13:49:31 +02003 *
4 * \brief Message digest wrappers.
5 *
6 * \warning This in an internal header. Do not include directly.
7 *
8 * \author Adriaan de Jong <dejong@fox-it.com>
Jens Wiklander3d3b0592019-03-20 15:30:29 +01009 */
10/*
Jerome Forissier79013242021-07-28 10:24:04 +020011 * Copyright The Mbed TLS Contributors
12 * SPDX-License-Identifier: Apache-2.0
Jens Wiklander817466c2018-05-22 13:49:31 +020013 *
14 * Licensed under the Apache License, Version 2.0 (the "License"); you may
15 * not use this file except in compliance with the License.
16 * You may obtain a copy of the License at
17 *
18 * http://www.apache.org/licenses/LICENSE-2.0
19 *
20 * Unless required by applicable law or agreed to in writing, software
21 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
22 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23 * See the License for the specific language governing permissions and
24 * limitations under the License.
Jens Wiklander817466c2018-05-22 13:49:31 +020025 */
26#ifndef MBEDTLS_MD_WRAP_H
27#define MBEDTLS_MD_WRAP_H
28
Jens Wiklander32b31802023-10-06 16:59:46 +020029#include "mbedtls/build_info.h"
Jens Wiklander817466c2018-05-22 13:49:31 +020030
Jerome Forissier11fa71b2020-04-20 17:17:56 +020031#include "mbedtls/md.h"
Jens Wiklander817466c2018-05-22 13:49:31 +020032
33#ifdef __cplusplus
34extern "C" {
35#endif
36
37/**
38 * Message digest information.
39 * Allows message digest functions to be called in a generic way.
40 */
Jens Wiklander32b31802023-10-06 16:59:46 +020041struct mbedtls_md_info_t {
Jens Wiklander817466c2018-05-22 13:49:31 +020042 /** Name of the message digest */
Jens Wiklander32b31802023-10-06 16:59:46 +020043 const char *name;
Jens Wiklander817466c2018-05-22 13:49:31 +020044
Jerome Forissier11fa71b2020-04-20 17:17:56 +020045 /** Digest identifier */
46 mbedtls_md_type_t type;
47
Jens Wiklander817466c2018-05-22 13:49:31 +020048 /** Output length of the digest function in bytes */
Jerome Forissier11fa71b2020-04-20 17:17:56 +020049 unsigned char size;
Jens Wiklander817466c2018-05-22 13:49:31 +020050
51 /** Block length of the digest function in bytes */
Jerome Forissier11fa71b2020-04-20 17:17:56 +020052 unsigned char block_size;
Jens Wiklander817466c2018-05-22 13:49:31 +020053};
54
Jens Wiklander817466c2018-05-22 13:49:31 +020055#if defined(MBEDTLS_MD5_C)
56extern const mbedtls_md_info_t mbedtls_md5_info;
57#endif
58#if defined(MBEDTLS_RIPEMD160_C)
59extern const mbedtls_md_info_t mbedtls_ripemd160_info;
60#endif
61#if defined(MBEDTLS_SHA1_C)
62extern const mbedtls_md_info_t mbedtls_sha1_info;
63#endif
Jens Wiklander32b31802023-10-06 16:59:46 +020064#if defined(MBEDTLS_SHA224_C)
Jens Wiklander817466c2018-05-22 13:49:31 +020065extern const mbedtls_md_info_t mbedtls_sha224_info;
Jens Wiklander32b31802023-10-06 16:59:46 +020066#endif
67#if defined(MBEDTLS_SHA256_C)
Jens Wiklander817466c2018-05-22 13:49:31 +020068extern const mbedtls_md_info_t mbedtls_sha256_info;
69#endif
Jens Wiklander32b31802023-10-06 16:59:46 +020070#if defined(MBEDTLS_SHA384_C)
Jens Wiklander817466c2018-05-22 13:49:31 +020071extern const mbedtls_md_info_t mbedtls_sha384_info;
Jerome Forissier11fa71b2020-04-20 17:17:56 +020072#endif
Jens Wiklander32b31802023-10-06 16:59:46 +020073#if defined(MBEDTLS_SHA512_C)
Jens Wiklander817466c2018-05-22 13:49:31 +020074extern const mbedtls_md_info_t mbedtls_sha512_info;
75#endif
76
77#ifdef __cplusplus
78}
79#endif
80
81#endif /* MBEDTLS_MD_WRAP_H */