blob: 60c514a49ecbf82151f86cd60ebd7130a4f6465b [file] [log] [blame]
Paul Bakker5121ce52009-01-03 21:22:43 +00001/**
Simon Butcher5b331b92016-01-03 16:14:14 +00002 * \file sha1.h
Paul Bakkere0ccd0a2009-01-04 16:27:10 +00003 *
Rose Zadik82741422018-03-27 12:49:48 +01004 * \brief This file contains SHA-1 definitions and functions.
5 *
Darryl Green11999bb2018-03-13 15:22:58 +00006 * The Secure Hash Algorithm 1 (SHA-1) cryptographic hash function is defined in
Rose Zadik82741422018-03-27 12:49:48 +01007 * <em>FIPS 180-4: Secure Hash Standard (SHS)</em>.
Hanno Beckerbbca8c52017-09-25 14:53:51 +01008 *
9 * \warning SHA-1 is considered a weak message digest and its use constitutes
10 * a security risk. We recommend considering stronger message
11 * digests instead.
Darryl Greena40a1012018-01-05 15:33:17 +000012 */
13/*
Bence Szépkútia2947ac2020-08-19 16:37:36 +020014 * Copyright The Mbed TLS Contributors
Bence Szépkútif744bd72020-06-05 13:02:18 +020015 * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
16 *
17 * This file is provided under the Apache License 2.0, or the
18 * GNU General Public License v2.0 or later.
19 *
20 * **********
21 * Apache License 2.0:
Manuel Pégourié-Gonnard37ff1402015-09-04 14:21:07 +020022 *
23 * Licensed under the Apache License, Version 2.0 (the "License"); you may
24 * not use this file except in compliance with the License.
25 * You may obtain a copy of the License at
26 *
27 * http://www.apache.org/licenses/LICENSE-2.0
28 *
29 * Unless required by applicable law or agreed to in writing, software
30 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
31 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
32 * See the License for the specific language governing permissions and
33 * limitations under the License.
Paul Bakkerb96f1542010-07-18 20:36:00 +000034 *
Bence Szépkútif744bd72020-06-05 13:02:18 +020035 * **********
36 *
37 * **********
38 * GNU General Public License v2.0 or later:
39 *
40 * This program is free software; you can redistribute it and/or modify
41 * it under the terms of the GNU General Public License as published by
42 * the Free Software Foundation; either version 2 of the License, or
43 * (at your option) any later version.
44 *
45 * This program is distributed in the hope that it will be useful,
46 * but WITHOUT ANY WARRANTY; without even the implied warranty of
47 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
48 * GNU General Public License for more details.
49 *
50 * You should have received a copy of the GNU General Public License along
51 * with this program; if not, write to the Free Software Foundation, Inc.,
52 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
53 *
54 * **********
Paul Bakker5121ce52009-01-03 21:22:43 +000055 */
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020056#ifndef MBEDTLS_SHA1_H
57#define MBEDTLS_SHA1_H
Paul Bakker5121ce52009-01-03 21:22:43 +000058
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020059#if !defined(MBEDTLS_CONFIG_FILE)
Paul Bakker90995b52013-06-24 19:20:35 +020060#include "config.h"
Manuel Pégourié-Gonnardcef4ad22014-04-29 12:39:06 +020061#else
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020062#include MBEDTLS_CONFIG_FILE
Manuel Pégourié-Gonnardcef4ad22014-04-29 12:39:06 +020063#endif
Paul Bakker90995b52013-06-24 19:20:35 +020064
Rich Evans00ab4702015-02-06 13:43:58 +000065#include <stddef.h>
Manuel Pégourié-Gonnardab229102015-04-15 11:53:16 +020066#include <stdint.h>
Paul Bakker5c2364c2012-10-01 14:41:15 +000067
Ron Eldor9924bdc2018-10-04 10:59:13 +030068/* MBEDTLS_ERR_SHA1_HW_ACCEL_FAILED is deprecated and should not be used. */
Gilles Peskinea381fe82018-01-23 18:16:11 +010069#define MBEDTLS_ERR_SHA1_HW_ACCEL_FAILED -0x0035 /**< SHA-1 hardware accelerator failed */
Andres Amaya Garciac523e012018-12-10 10:11:47 +000070#define MBEDTLS_ERR_SHA1_BAD_INPUT_DATA -0x0073 /**< SHA-1 input data was malformed. */
Gilles Peskinea381fe82018-01-23 18:16:11 +010071
Paul Bakker407a0da2013-06-27 14:29:21 +020072#ifdef __cplusplus
73extern "C" {
74#endif
75
Ron Eldorb2aacec2017-05-18 16:53:08 +030076#if !defined(MBEDTLS_SHA1_ALT)
77// Regular implementation
78//
79
Paul Bakker5121ce52009-01-03 21:22:43 +000080/**
Rose Zadik44833d92018-01-26 08:41:09 +000081 * \brief The SHA-1 context structure.
Hanno Beckerbbca8c52017-09-25 14:53:51 +010082 *
83 * \warning SHA-1 is considered a weak message digest and its use
84 * constitutes a security risk. We recommend considering
85 * stronger message digests instead.
86 *
Paul Bakker5121ce52009-01-03 21:22:43 +000087 */
Dawid Drozd428cc522018-07-24 10:02:47 +020088typedef struct mbedtls_sha1_context
Paul Bakker5121ce52009-01-03 21:22:43 +000089{
Rose Zadik44833d92018-01-26 08:41:09 +000090 uint32_t total[2]; /*!< The number of Bytes processed. */
91 uint32_t state[5]; /*!< The intermediate digest state. */
92 unsigned char buffer[64]; /*!< The data block being processed. */
Paul Bakker5121ce52009-01-03 21:22:43 +000093}
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020094mbedtls_sha1_context;
Paul Bakker5121ce52009-01-03 21:22:43 +000095
Ron Eldorb2aacec2017-05-18 16:53:08 +030096#else /* MBEDTLS_SHA1_ALT */
97#include "sha1_alt.h"
98#endif /* MBEDTLS_SHA1_ALT */
99
Paul Bakker5121ce52009-01-03 21:22:43 +0000100/**
Rose Zadik44833d92018-01-26 08:41:09 +0000101 * \brief This function initializes a SHA-1 context.
Paul Bakker5b4af392014-06-26 12:09:34 +0200102 *
Hanno Beckerbbca8c52017-09-25 14:53:51 +0100103 * \warning SHA-1 is considered a weak message digest and its use
104 * constitutes a security risk. We recommend considering
105 * stronger message digests instead.
106 *
Rose Zadik82741422018-03-27 12:49:48 +0100107 * \param ctx The SHA-1 context to initialize.
Hanno Becker5359ca82018-12-18 11:11:18 +0000108 * This must not be \c NULL.
Rose Zadik82741422018-03-27 12:49:48 +0100109 *
Paul Bakker5b4af392014-06-26 12:09:34 +0200110 */
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200111void mbedtls_sha1_init( mbedtls_sha1_context *ctx );
Paul Bakker5b4af392014-06-26 12:09:34 +0200112
113/**
Rose Zadik44833d92018-01-26 08:41:09 +0000114 * \brief This function clears a SHA-1 context.
Paul Bakker5b4af392014-06-26 12:09:34 +0200115 *
Hanno Beckerbbca8c52017-09-25 14:53:51 +0100116 * \warning SHA-1 is considered a weak message digest and its use
117 * constitutes a security risk. We recommend considering
118 * stronger message digests instead.
119 *
Hanno Becker5359ca82018-12-18 11:11:18 +0000120 * \param ctx The SHA-1 context to clear. This may be \c NULL,
121 * in which case this function does nothing. If it is
122 * not \c NULL, it must point to an initialized
123 * SHA-1 context.
Rose Zadik82741422018-03-27 12:49:48 +0100124 *
Paul Bakker5b4af392014-06-26 12:09:34 +0200125 */
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200126void mbedtls_sha1_free( mbedtls_sha1_context *ctx );
Paul Bakker5b4af392014-06-26 12:09:34 +0200127
128/**
Rose Zadik44833d92018-01-26 08:41:09 +0000129 * \brief This function clones the state of a SHA-1 context.
Manuel Pégourié-Gonnard16d412f2015-07-06 15:26:26 +0200130 *
Hanno Beckerbbca8c52017-09-25 14:53:51 +0100131 * \warning SHA-1 is considered a weak message digest and its use
132 * constitutes a security risk. We recommend considering
133 * stronger message digests instead.
134 *
Hanno Becker5359ca82018-12-18 11:11:18 +0000135 * \param dst The SHA-1 context to clone to. This must be initialized.
136 * \param src The SHA-1 context to clone from. This must be initialized.
Rose Zadik82741422018-03-27 12:49:48 +0100137 *
Manuel Pégourié-Gonnard16d412f2015-07-06 15:26:26 +0200138 */
139void mbedtls_sha1_clone( mbedtls_sha1_context *dst,
140 const mbedtls_sha1_context *src );
141
142/**
Rose Zadik44833d92018-01-26 08:41:09 +0000143 * \brief This function starts a SHA-1 checksum calculation.
Paul Bakker5121ce52009-01-03 21:22:43 +0000144 *
Hanno Beckerbbca8c52017-09-25 14:53:51 +0100145 * \warning SHA-1 is considered a weak message digest and its use
146 * constitutes a security risk. We recommend considering
147 * stronger message digests instead.
148 *
Hanno Becker5359ca82018-12-18 11:11:18 +0000149 * \param ctx The SHA-1 context to initialize. This must be initialized.
Rose Zadik82741422018-03-27 12:49:48 +0100150 *
151 * \return \c 0 on success.
Hanno Becker5359ca82018-12-18 11:11:18 +0000152 * \return A negative error code on failure.
Rose Zadik82741422018-03-27 12:49:48 +0100153 *
Paul Bakker5121ce52009-01-03 21:22:43 +0000154 */
Gilles Peskine9e4f77c2018-01-22 11:48:08 +0100155int mbedtls_sha1_starts_ret( mbedtls_sha1_context *ctx );
Paul Bakker5121ce52009-01-03 21:22:43 +0000156
157/**
Rose Zadik44833d92018-01-26 08:41:09 +0000158 * \brief This function feeds an input buffer into an ongoing SHA-1
159 * checksum calculation.
Paul Bakker5121ce52009-01-03 21:22:43 +0000160 *
Hanno Beckerbbca8c52017-09-25 14:53:51 +0100161 * \warning SHA-1 is considered a weak message digest and its use
162 * constitutes a security risk. We recommend considering
163 * stronger message digests instead.
164 *
Hanno Becker5359ca82018-12-18 11:11:18 +0000165 * \param ctx The SHA-1 context. This must be initialized
166 * and have a hash operation started.
Rose Zadik82741422018-03-27 12:49:48 +0100167 * \param input The buffer holding the input data.
Hanno Becker5359ca82018-12-18 11:11:18 +0000168 * This must be a readable buffer of length \p ilen Bytes.
Hanno Becker5359ca82018-12-18 11:11:18 +0000169 * \param ilen The length of the input data \p input in Bytes.
Rose Zadik82741422018-03-27 12:49:48 +0100170 *
171 * \return \c 0 on success.
Hanno Becker5359ca82018-12-18 11:11:18 +0000172 * \return A negative error code on failure.
Paul Bakker5121ce52009-01-03 21:22:43 +0000173 */
Gilles Peskine9e4f77c2018-01-22 11:48:08 +0100174int mbedtls_sha1_update_ret( mbedtls_sha1_context *ctx,
Andres Amaya Garcia034ea7e2017-04-28 15:14:50 +0100175 const unsigned char *input,
176 size_t ilen );
Paul Bakker5121ce52009-01-03 21:22:43 +0000177
178/**
Rose Zadik44833d92018-01-26 08:41:09 +0000179 * \brief This function finishes the SHA-1 operation, and writes
180 * the result to the output buffer.
Paul Bakker5121ce52009-01-03 21:22:43 +0000181 *
Hanno Beckerbbca8c52017-09-25 14:53:51 +0100182 * \warning SHA-1 is considered a weak message digest and its use
183 * constitutes a security risk. We recommend considering
184 * stronger message digests instead.
185 *
Hanno Becker5359ca82018-12-18 11:11:18 +0000186 * \param ctx The SHA-1 context to use. This must be initialized and
187 * have a hash operation started.
Hanno Becker5359ca82018-12-18 11:11:18 +0000188 * \param output The SHA-1 checksum result. This must be a writable
189 * buffer of length \c 20 Bytes.
Rose Zadik82741422018-03-27 12:49:48 +0100190 *
191 * \return \c 0 on success.
Hanno Becker5359ca82018-12-18 11:11:18 +0000192 * \return A negative error code on failure.
Paul Bakker5121ce52009-01-03 21:22:43 +0000193 */
Gilles Peskine9e4f77c2018-01-22 11:48:08 +0100194int mbedtls_sha1_finish_ret( mbedtls_sha1_context *ctx,
Andres Amaya Garcia034ea7e2017-04-28 15:14:50 +0100195 unsigned char output[20] );
Paul Bakker5121ce52009-01-03 21:22:43 +0000196
Andres Amaya Garcia034ea7e2017-04-28 15:14:50 +0100197/**
Rose Zadik82741422018-03-27 12:49:48 +0100198 * \brief SHA-1 process data block (internal use only).
Hanno Beckerbbca8c52017-09-25 14:53:51 +0100199 *
200 * \warning SHA-1 is considered a weak message digest and its use
201 * constitutes a security risk. We recommend considering
202 * stronger message digests instead.
203 *
Hanno Becker79b9e392018-12-18 23:17:49 +0000204 * \param ctx The SHA-1 context to use. This must be initialized.
Hanno Becker5359ca82018-12-18 11:11:18 +0000205 * \param data The data block being processed. This must be a
206 * readable buffer of length \c 64 Bytes.
Rose Zadik82741422018-03-27 12:49:48 +0100207 *
208 * \return \c 0 on success.
Hanno Becker5359ca82018-12-18 11:11:18 +0000209 * \return A negative error code on failure.
Rose Zadik82741422018-03-27 12:49:48 +0100210 *
Andres Amaya Garcia034ea7e2017-04-28 15:14:50 +0100211 */
Andres Amaya Garciacccfe082017-06-28 10:36:39 +0100212int mbedtls_internal_sha1_process( mbedtls_sha1_context *ctx,
213 const unsigned char data[64] );
Andres Amaya Garcia034ea7e2017-04-28 15:14:50 +0100214
215#if !defined(MBEDTLS_DEPRECATED_REMOVED)
216#if defined(MBEDTLS_DEPRECATED_WARNING)
217#define MBEDTLS_DEPRECATED __attribute__((deprecated))
218#else
219#define MBEDTLS_DEPRECATED
220#endif
221/**
Rose Zadik82741422018-03-27 12:49:48 +0100222 * \brief This function starts a SHA-1 checksum calculation.
Hanno Beckerbbca8c52017-09-25 14:53:51 +0100223 *
224 * \warning SHA-1 is considered a weak message digest and its use
225 * constitutes a security risk. We recommend considering
226 * stronger message digests instead.
227 *
Rose Zadik82741422018-03-27 12:49:48 +0100228 * \deprecated Superseded by mbedtls_sha1_starts_ret() in 2.7.0.
229 *
Hanno Becker5359ca82018-12-18 11:11:18 +0000230 * \param ctx The SHA-1 context to initialize. This must be initialized.
Rose Zadik82741422018-03-27 12:49:48 +0100231 *
Andres Amaya Garcia034ea7e2017-04-28 15:14:50 +0100232 */
Jaeden Amero041039f2018-02-19 15:28:08 +0000233MBEDTLS_DEPRECATED void mbedtls_sha1_starts( mbedtls_sha1_context *ctx );
Andres Amaya Garcia034ea7e2017-04-28 15:14:50 +0100234
235/**
Rose Zadik82741422018-03-27 12:49:48 +0100236 * \brief This function feeds an input buffer into an ongoing SHA-1
237 * checksum calculation.
Hanno Beckerbbca8c52017-09-25 14:53:51 +0100238 *
239 * \warning SHA-1 is considered a weak message digest and its use
240 * constitutes a security risk. We recommend considering
241 * stronger message digests instead.
242 *
Rose Zadik82741422018-03-27 12:49:48 +0100243 * \deprecated Superseded by mbedtls_sha1_update_ret() in 2.7.0.
244 *
Hanno Becker42f783d2018-12-18 18:39:32 +0000245 * \param ctx The SHA-1 context. This must be initialized and
Hanno Becker5359ca82018-12-18 11:11:18 +0000246 * have a hash operation started.
Rose Zadik82741422018-03-27 12:49:48 +0100247 * \param input The buffer holding the input data.
Hanno Becker5359ca82018-12-18 11:11:18 +0000248 * This must be a readable buffer of length \p ilen Bytes.
Hanno Becker5359ca82018-12-18 11:11:18 +0000249 * \param ilen The length of the input data \p input in Bytes.
Rose Zadik82741422018-03-27 12:49:48 +0100250 *
Andres Amaya Garcia034ea7e2017-04-28 15:14:50 +0100251 */
Jaeden Amero041039f2018-02-19 15:28:08 +0000252MBEDTLS_DEPRECATED void mbedtls_sha1_update( mbedtls_sha1_context *ctx,
253 const unsigned char *input,
254 size_t ilen );
Andres Amaya Garcia034ea7e2017-04-28 15:14:50 +0100255
256/**
Rose Zadik82741422018-03-27 12:49:48 +0100257 * \brief This function finishes the SHA-1 operation, and writes
258 * the result to the output buffer.
Hanno Beckerbbca8c52017-09-25 14:53:51 +0100259 *
260 * \warning SHA-1 is considered a weak message digest and its use
261 * constitutes a security risk. We recommend considering
262 * stronger message digests instead.
263 *
Rose Zadik82741422018-03-27 12:49:48 +0100264 * \deprecated Superseded by mbedtls_sha1_finish_ret() in 2.7.0.
265 *
Hanno Becker5359ca82018-12-18 11:11:18 +0000266 * \param ctx The SHA-1 context. This must be initialized and
267 * have a hash operation started.
Rose Zadik82741422018-03-27 12:49:48 +0100268 * \param output The SHA-1 checksum result.
Hanno Becker5359ca82018-12-18 11:11:18 +0000269 * This must be a writable buffer of length \c 20 Bytes.
Andres Amaya Garcia034ea7e2017-04-28 15:14:50 +0100270 */
Jaeden Amero041039f2018-02-19 15:28:08 +0000271MBEDTLS_DEPRECATED void mbedtls_sha1_finish( mbedtls_sha1_context *ctx,
272 unsigned char output[20] );
Andres Amaya Garcia034ea7e2017-04-28 15:14:50 +0100273
274/**
Rose Zadik82741422018-03-27 12:49:48 +0100275 * \brief SHA-1 process data block (internal use only).
Hanno Beckerbbca8c52017-09-25 14:53:51 +0100276 *
277 * \warning SHA-1 is considered a weak message digest and its use
278 * constitutes a security risk. We recommend considering
279 * stronger message digests instead.
280 *
Rose Zadik82741422018-03-27 12:49:48 +0100281 * \deprecated Superseded by mbedtls_internal_sha1_process() in 2.7.0.
282 *
Hanno Becker79b9e392018-12-18 23:17:49 +0000283 * \param ctx The SHA-1 context. This must be initialized.
Rose Zadik82741422018-03-27 12:49:48 +0100284 * \param data The data block being processed.
Hanno Becker5359ca82018-12-18 11:11:18 +0000285 * This must be a readable buffer of length \c 64 bytes.
Rose Zadik82741422018-03-27 12:49:48 +0100286 *
Andres Amaya Garcia034ea7e2017-04-28 15:14:50 +0100287 */
Jaeden Amero041039f2018-02-19 15:28:08 +0000288MBEDTLS_DEPRECATED void mbedtls_sha1_process( mbedtls_sha1_context *ctx,
289 const unsigned char data[64] );
Andres Amaya Garcia034ea7e2017-04-28 15:14:50 +0100290
291#undef MBEDTLS_DEPRECATED
292#endif /* !MBEDTLS_DEPRECATED_REMOVED */
Paul Bakker90995b52013-06-24 19:20:35 +0200293
Paul Bakker5121ce52009-01-03 21:22:43 +0000294/**
Rose Zadik44833d92018-01-26 08:41:09 +0000295 * \brief This function calculates the SHA-1 checksum of a buffer.
Paul Bakker5121ce52009-01-03 21:22:43 +0000296 *
Rose Zadik44833d92018-01-26 08:41:09 +0000297 * The function allocates the context, performs the
298 * calculation, and frees the context.
Andres Amaya Garcia034ea7e2017-04-28 15:14:50 +0100299 *
Rose Zadik44833d92018-01-26 08:41:09 +0000300 * The SHA-1 result is calculated as
301 * output = SHA-1(input buffer).
302 *
Rose Zadik82741422018-03-27 12:49:48 +0100303 * \warning SHA-1 is considered a weak message digest and its use
304 * constitutes a security risk. We recommend considering
305 * stronger message digests instead.
306 *
Rose Zadik44833d92018-01-26 08:41:09 +0000307 * \param input The buffer holding the input data.
Hanno Becker5359ca82018-12-18 11:11:18 +0000308 * This must be a readable buffer of length \p ilen Bytes.
Hanno Becker5359ca82018-12-18 11:11:18 +0000309 * \param ilen The length of the input data \p input in Bytes.
Rose Zadik44833d92018-01-26 08:41:09 +0000310 * \param output The SHA-1 checksum result.
Hanno Becker5359ca82018-12-18 11:11:18 +0000311 * This must be a writable buffer of length \c 20 Bytes.
Rose Zadik44833d92018-01-26 08:41:09 +0000312 *
Rose Zadik82741422018-03-27 12:49:48 +0100313 * \return \c 0 on success.
Hanno Becker5359ca82018-12-18 11:11:18 +0000314 * \return A negative error code on failure.
Hanno Beckerbbca8c52017-09-25 14:53:51 +0100315 *
Paul Bakker5121ce52009-01-03 21:22:43 +0000316 */
Gilles Peskine9e4f77c2018-01-22 11:48:08 +0100317int mbedtls_sha1_ret( const unsigned char *input,
Andres Amaya Garcia034ea7e2017-04-28 15:14:50 +0100318 size_t ilen,
319 unsigned char output[20] );
320
321#if !defined(MBEDTLS_DEPRECATED_REMOVED)
322#if defined(MBEDTLS_DEPRECATED_WARNING)
323#define MBEDTLS_DEPRECATED __attribute__((deprecated))
324#else
325#define MBEDTLS_DEPRECATED
326#endif
327/**
Gilles Peskine2e1934a2018-04-18 16:05:29 +0200328 * \brief This function calculates the SHA-1 checksum of a buffer.
Rose Zadik82741422018-03-27 12:49:48 +0100329 *
330 * The function allocates the context, performs the
331 * calculation, and frees the context.
332 *
333 * The SHA-1 result is calculated as
334 * output = SHA-1(input buffer).
335 *
336 * \warning SHA-1 is considered a weak message digest and its use
337 * constitutes a security risk. We recommend considering
338 * stronger message digests instead.
Andres Amaya Garcia034ea7e2017-04-28 15:14:50 +0100339 *
Gilles Peskine3e28d702018-01-22 12:18:59 +0100340 * \deprecated Superseded by mbedtls_sha1_ret() in 2.7.0
Andres Amaya Garcia034ea7e2017-04-28 15:14:50 +0100341 *
Rose Zadik44833d92018-01-26 08:41:09 +0000342 * \param input The buffer holding the input data.
Hanno Becker5359ca82018-12-18 11:11:18 +0000343 * This must be a readable buffer of length \p ilen Bytes.
Hanno Becker5359ca82018-12-18 11:11:18 +0000344 * \param ilen The length of the input data \p input in Bytes.
345 * \param output The SHA-1 checksum result. This must be a writable
346 * buffer of size \c 20 Bytes.
Hanno Beckerbbca8c52017-09-25 14:53:51 +0100347 *
Paul Bakker5121ce52009-01-03 21:22:43 +0000348 */
Jaeden Amero041039f2018-02-19 15:28:08 +0000349MBEDTLS_DEPRECATED void mbedtls_sha1( const unsigned char *input,
350 size_t ilen,
351 unsigned char output[20] );
Andres Amaya Garcia034ea7e2017-04-28 15:14:50 +0100352
353#undef MBEDTLS_DEPRECATED
354#endif /* !MBEDTLS_DEPRECATED_REMOVED */
Paul Bakker5121ce52009-01-03 21:22:43 +0000355
Ron Eldorfa8f6352017-06-20 15:48:46 +0300356#if defined(MBEDTLS_SELF_TEST)
357
Paul Bakker5121ce52009-01-03 21:22:43 +0000358/**
Rose Zadik44833d92018-01-26 08:41:09 +0000359 * \brief The SHA-1 checkup routine.
Paul Bakker5121ce52009-01-03 21:22:43 +0000360 *
Hanno Beckerbbca8c52017-09-25 14:53:51 +0100361 * \warning SHA-1 is considered a weak message digest and its use
362 * constitutes a security risk. We recommend considering
363 * stronger message digests instead.
364 *
Rose Zadik82741422018-03-27 12:49:48 +0100365 * \return \c 0 on success.
366 * \return \c 1 on failure.
367 *
Paul Bakker5121ce52009-01-03 21:22:43 +0000368 */
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200369int mbedtls_sha1_self_test( int verbose );
Paul Bakker5121ce52009-01-03 21:22:43 +0000370
Ron Eldorfa8f6352017-06-20 15:48:46 +0300371#endif /* MBEDTLS_SELF_TEST */
372
Paul Bakker5121ce52009-01-03 21:22:43 +0000373#ifdef __cplusplus
374}
375#endif
376
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200377#endif /* mbedtls_sha1.h */