blob: cd539b54be32d45d01672734c349e18858821fdd [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
Bence Szépkútic662b362021-05-27 11:25:03 +020029#include "mbedtls/build_info.h"
Manuel Pégourié-Gonnard6c5abfa2015-02-13 14:12:07 +000030
Jaeden Ameroc49fbbf2019-07-04 20:01:14 +010031#include "mbedtls/md.h"
Paul Bakker17373852011-01-06 14:20:01 +000032
Paul Bakker17373852011-01-06 14:20:01 +000033#ifdef __cplusplus
34extern "C" {
35#endif
36
Manuel Pégourié-Gonnardca878db2015-03-24 12:13:30 +010037/**
38 * Message digest information.
39 * Allows message digest functions to be called in a generic way.
40 */
Mateusz Starzykc0eabdc2021-08-03 14:09:02 +020041struct mbedtls_md_info_t {
Manuel Pégourié-Gonnardca878db2015-03-24 12:13:30 +010042 /** Name of the message digest */
Mateusz Starzykc0eabdc2021-08-03 14:09:02 +020043 const char *name;
Manuel Pégourié-Gonnardca878db2015-03-24 12:13:30 +010044
Gilles Peskine2838b7b2019-07-19 16:03:39 +020045 /** Digest identifier */
46 mbedtls_md_type_t type;
47
Manuel Pégourié-Gonnardb8186a52015-06-18 14:58:58 +020048 /** Output length of the digest function in bytes */
Gilles Peskine2838b7b2019-07-19 16:03:39 +020049 unsigned char size;
Manuel Pégourié-Gonnardca878db2015-03-24 12:13:30 +010050
Manuel Pégourié-Gonnardb8186a52015-06-18 14:58:58 +020051 /** Block length of the digest function in bytes */
Gilles Peskine2838b7b2019-07-19 16:03:39 +020052 unsigned char block_size;
Manuel Pégourié-Gonnardca878db2015-03-24 12:13:30 +010053};
54
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020055#if defined(MBEDTLS_MD5_C)
56extern const mbedtls_md_info_t mbedtls_md5_info;
Paul Bakker17373852011-01-06 14:20:01 +000057#endif
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020058#if defined(MBEDTLS_RIPEMD160_C)
59extern const mbedtls_md_info_t mbedtls_ripemd160_info;
Manuel Pégourié-Gonnarde4d47a62014-01-17 20:41:32 +010060#endif
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020061#if defined(MBEDTLS_SHA1_C)
62extern const mbedtls_md_info_t mbedtls_sha1_info;
Paul Bakker17373852011-01-06 14:20:01 +000063#endif
Mateusz Starzyke3c48b42021-04-19 16:46:28 +020064#if defined(MBEDTLS_SHA224_C)
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020065extern const mbedtls_md_info_t mbedtls_sha224_info;
Mateusz Starzyke3c48b42021-04-19 16:46:28 +020066#endif
67#if defined(MBEDTLS_SHA256_C)
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020068extern const mbedtls_md_info_t mbedtls_sha256_info;
Paul Bakker17373852011-01-06 14:20:01 +000069#endif
Mateusz Starzyk3352a532021-04-06 14:28:22 +020070#if defined(MBEDTLS_SHA384_C)
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020071extern const mbedtls_md_info_t mbedtls_sha384_info;
Manuel Pégourié-Gonnardd6020842019-07-17 16:28:21 +020072#endif
Mateusz Starzyk3352a532021-04-06 14:28:22 +020073#if defined(MBEDTLS_SHA512_C)
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020074extern const mbedtls_md_info_t mbedtls_sha512_info;
Paul Bakker17373852011-01-06 14:20:01 +000075#endif
76
77#ifdef __cplusplus
78}
79#endif
80
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020081#endif /* MBEDTLS_MD_WRAP_H */