blob: 51655f9408fc3115b4c3d5af71e317253f857b1d [file] [log] [blame]
Paul Bakker17373852011-01-06 14:20:01 +00001/**
Chris Jonesdaacb592021-03-09 17:03:29 +00002 * \file md_wrap.h
Paul Bakker9af723c2014-05-01 13:03:14 +02003 *
Paul Bakker17373852011-01-06 14:20:01 +00004 * \brief Message digest wrappers.
5 *
Manuel Pégourié-Gonnardca878db2015-03-24 12:13:30 +01006 * \warning This in an internal header. Do not include directly.
7 *
Paul Bakker17373852011-01-06 14:20:01 +00008 * \author Adriaan de Jong <dejong@fox-it.com>
Darryl Greena40a1012018-01-05 15:33:17 +00009 */
10/*
Bence Szépkúti1e148272020-08-07 13:07:28 +020011 * Copyright The Mbed TLS Contributors
Manuel Pégourié-Gonnard37ff1402015-09-04 14:21:07 +020012 * SPDX-License-Identifier: Apache-2.0
13 *
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.
Paul Bakker17373852011-01-06 14:20:01 +000025 */
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020026#ifndef MBEDTLS_MD_WRAP_H
27#define MBEDTLS_MD_WRAP_H
Paul Bakker17373852011-01-06 14:20:01 +000028
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020029#if !defined(MBEDTLS_CONFIG_FILE)
Jaeden Ameroc49fbbf2019-07-04 20:01:14 +010030#include "mbedtls/config.h"
Manuel Pégourié-Gonnardcef4ad22014-04-29 12:39:06 +020031#else
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020032#include MBEDTLS_CONFIG_FILE
Manuel Pégourié-Gonnardcef4ad22014-04-29 12:39:06 +020033#endif
Manuel Pégourié-Gonnard6c5abfa2015-02-13 14:12:07 +000034
Jaeden Ameroc49fbbf2019-07-04 20:01:14 +010035#include "mbedtls/md.h"
Paul Bakker17373852011-01-06 14:20:01 +000036
Paul Bakker17373852011-01-06 14:20:01 +000037#ifdef __cplusplus
38extern "C" {
39#endif
40
Manuel Pégourié-Gonnardca878db2015-03-24 12:13:30 +010041/**
42 * Message digest information.
43 * Allows message digest functions to be called in a generic way.
44 */
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020045struct mbedtls_md_info_t
Manuel Pégourié-Gonnardf5fc6492015-04-02 14:43:57 +010046{
Manuel Pégourié-Gonnardca878db2015-03-24 12:13:30 +010047 /** Name of the message digest */
48 const char * name;
49
Gilles Peskine2838b7b2019-07-19 16:03:39 +020050 /** Digest identifier */
51 mbedtls_md_type_t type;
52
Manuel Pégourié-Gonnardb8186a52015-06-18 14:58:58 +020053 /** Output length of the digest function in bytes */
Gilles Peskine2838b7b2019-07-19 16:03:39 +020054 unsigned char size;
Manuel Pégourié-Gonnardca878db2015-03-24 12:13:30 +010055
Manuel Pégourié-Gonnardb8186a52015-06-18 14:58:58 +020056 /** Block length of the digest function in bytes */
Gilles Peskine2838b7b2019-07-19 16:03:39 +020057 unsigned char block_size;
Manuel Pégourié-Gonnardca878db2015-03-24 12:13:30 +010058};
59
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020060#if defined(MBEDTLS_MD2_C)
61extern const mbedtls_md_info_t mbedtls_md2_info;
Paul Bakker17373852011-01-06 14:20:01 +000062#endif
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020063#if defined(MBEDTLS_MD4_C)
64extern const mbedtls_md_info_t mbedtls_md4_info;
Paul Bakker17373852011-01-06 14:20:01 +000065#endif
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020066#if defined(MBEDTLS_MD5_C)
67extern const mbedtls_md_info_t mbedtls_md5_info;
Paul Bakker17373852011-01-06 14:20:01 +000068#endif
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020069#if defined(MBEDTLS_RIPEMD160_C)
70extern const mbedtls_md_info_t mbedtls_ripemd160_info;
Manuel Pégourié-Gonnarde4d47a62014-01-17 20:41:32 +010071#endif
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020072#if defined(MBEDTLS_SHA1_C)
73extern const mbedtls_md_info_t mbedtls_sha1_info;
Paul Bakker17373852011-01-06 14:20:01 +000074#endif
Mateusz Starzyke3c48b42021-04-19 16:46:28 +020075#if defined(MBEDTLS_SHA224_C)
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020076extern const mbedtls_md_info_t mbedtls_sha224_info;
Mateusz Starzyke3c48b42021-04-19 16:46:28 +020077#endif
78#if defined(MBEDTLS_SHA256_C)
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020079extern const mbedtls_md_info_t mbedtls_sha256_info;
Paul Bakker17373852011-01-06 14:20:01 +000080#endif
Mateusz Starzyk3352a532021-04-06 14:28:22 +020081#if defined(MBEDTLS_SHA384_C)
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020082extern const mbedtls_md_info_t mbedtls_sha384_info;
Manuel Pégourié-Gonnardd6020842019-07-17 16:28:21 +020083#endif
Mateusz Starzyk3352a532021-04-06 14:28:22 +020084#if defined(MBEDTLS_SHA512_C)
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020085extern const mbedtls_md_info_t mbedtls_sha512_info;
Paul Bakker17373852011-01-06 14:20:01 +000086#endif
87
88#ifdef __cplusplus
89}
90#endif
91
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020092#endif /* MBEDTLS_MD_WRAP_H */