Mbed OS Reference
Loading...
Searching...
No Matches
ripemd160.h
Go to the documentation of this file.
1/**
2 * \file ripemd160.h
3 *
4 * \brief RIPE MD-160 message digest
5 */
6/*
7 * Copyright The Mbed TLS Contributors
8 * SPDX-License-Identifier: Apache-2.0
9 *
10 * Licensed under the Apache License, Version 2.0 (the "License"); you may
11 * not use this file except in compliance with the License.
12 * You may obtain a copy of the License at
13 *
14 * http://www.apache.org/licenses/LICENSE-2.0
15 *
16 * Unless required by applicable law or agreed to in writing, software
17 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
18 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 * See the License for the specific language governing permissions and
20 * limitations under the License.
21 */
22#ifndef MBEDTLS_RIPEMD160_H
23#define MBEDTLS_RIPEMD160_H
24
25#if !defined(MBEDTLS_CONFIG_FILE)
26#include "mbedtls/config.h"
27#else
28#include MBEDTLS_CONFIG_FILE
29#endif
30
31#include <stddef.h>
32#include <stdint.h>
33
34/**
35 * \addtogroup mbedtls
36 * \{
37 * \defgroup mbedtls_ripemd160_module RIPE MD-160
38 * \{
39 */
40
41/* MBEDTLS_ERR_RIPEMD160_HW_ACCEL_FAILED is deprecated and should not be used.
42 */
43#define MBEDTLS_ERR_RIPEMD160_HW_ACCEL_FAILED -0x0031 /**< RIPEMD160 hardware accelerator failed */
44
45#ifdef __cplusplus
46extern "C" {
47#endif
48
49#if !defined(MBEDTLS_RIPEMD160_ALT)
50// Regular implementation
51//
52
53/**
54 * \brief RIPEMD-160 context structure
55 */
57{
58 uint32_t total[2]; /*!< number of bytes processed */
59 uint32_t state[5]; /*!< intermediate digest state */
60 unsigned char buffer[64]; /*!< data block being processed */
61}
63
64#else /* MBEDTLS_RIPEMD160_ALT */
65#include "ripemd160_alt.h"
66#endif /* MBEDTLS_RIPEMD160_ALT */
67
68/**
69 * \brief Initialize RIPEMD-160 context
70 *
71 * \param ctx RIPEMD-160 context to be initialized
72 */
74
75/**
76 * \brief Clear RIPEMD-160 context
77 *
78 * \param ctx RIPEMD-160 context to be cleared
79 */
81
82/**
83 * \brief Clone (the state of) an RIPEMD-160 context
84 *
85 * \param dst The destination context
86 * \param src The context to be cloned
87 */
89 const mbedtls_ripemd160_context *src );
90
91/**
92 * \brief RIPEMD-160 context setup
93 *
94 * \param ctx context to be initialized
95 *
96 * \return 0 if successful
97 */
99
100/**
101 * \brief RIPEMD-160 process buffer
102 *
103 * \param ctx RIPEMD-160 context
104 * \param input buffer holding the data
105 * \param ilen length of the input data
106 *
107 * \return 0 if successful
108 */
110 const unsigned char *input,
111 size_t ilen );
112
113/**
114 * \brief RIPEMD-160 final digest
115 *
116 * \param ctx RIPEMD-160 context
117 * \param output RIPEMD-160 checksum result
118 *
119 * \return 0 if successful
120 */
122 unsigned char output[20] );
123
124/**
125 * \brief RIPEMD-160 process data block (internal use only)
126 *
127 * \param ctx RIPEMD-160 context
128 * \param data buffer holding one block of data
129 *
130 * \return 0 if successful
131 */
133 const unsigned char data[64] );
134
135#if !defined(MBEDTLS_DEPRECATED_REMOVED)
136#if defined(MBEDTLS_DEPRECATED_WARNING)
137#define MBEDTLS_DEPRECATED __attribute__((deprecated))
138#else
139#define MBEDTLS_DEPRECATED
140#endif
141/**
142 * \brief RIPEMD-160 context setup
143 *
144 * \deprecated Superseded by mbedtls_ripemd160_starts_ret() in 2.7.0
145 *
146 * \param ctx context to be initialized
147 */
148MBEDTLS_DEPRECATED void mbedtls_ripemd160_starts(
150
151/**
152 * \brief RIPEMD-160 process buffer
153 *
154 * \deprecated Superseded by mbedtls_ripemd160_update_ret() in 2.7.0
155 *
156 * \param ctx RIPEMD-160 context
157 * \param input buffer holding the data
158 * \param ilen length of the input data
159 */
160MBEDTLS_DEPRECATED void mbedtls_ripemd160_update(
162 const unsigned char *input,
163 size_t ilen );
164
165/**
166 * \brief RIPEMD-160 final digest
167 *
168 * \deprecated Superseded by mbedtls_ripemd160_finish_ret() in 2.7.0
169 *
170 * \param ctx RIPEMD-160 context
171 * \param output RIPEMD-160 checksum result
172 */
173MBEDTLS_DEPRECATED void mbedtls_ripemd160_finish(
175 unsigned char output[20] );
176
177/**
178 * \brief RIPEMD-160 process data block (internal use only)
179 *
180 * \deprecated Superseded by mbedtls_internal_ripemd160_process() in 2.7.0
181 *
182 * \param ctx RIPEMD-160 context
183 * \param data buffer holding one block of data
184 */
185MBEDTLS_DEPRECATED void mbedtls_ripemd160_process(
187 const unsigned char data[64] );
188
189#undef MBEDTLS_DEPRECATED
190#endif /* !MBEDTLS_DEPRECATED_REMOVED */
191
192/**
193 * \brief Output = RIPEMD-160( input buffer )
194 *
195 * \param input buffer holding the data
196 * \param ilen length of the input data
197 * \param output RIPEMD-160 checksum result
198 *
199 * \return 0 if successful
200 */
201int mbedtls_ripemd160_ret( const unsigned char *input,
202 size_t ilen,
203 unsigned char output[20] );
204
205#if !defined(MBEDTLS_DEPRECATED_REMOVED)
206#if defined(MBEDTLS_DEPRECATED_WARNING)
207#define MBEDTLS_DEPRECATED __attribute__((deprecated))
208#else
209#define MBEDTLS_DEPRECATED
210#endif
211/**
212 * \brief Output = RIPEMD-160( input buffer )
213 *
214 * \deprecated Superseded by mbedtls_ripemd160_ret() in 2.7.0
215 *
216 * \param input buffer holding the data
217 * \param ilen length of the input data
218 * \param output RIPEMD-160 checksum result
219 */
220MBEDTLS_DEPRECATED void mbedtls_ripemd160( const unsigned char *input,
221 size_t ilen,
222 unsigned char output[20] );
223
224#undef MBEDTLS_DEPRECATED
225#endif /* !MBEDTLS_DEPRECATED_REMOVED */
226
227#if defined(MBEDTLS_SELF_TEST)
228
229/**
230 * \brief Checkup routine
231 *
232 * \return 0 if successful, or 1 if the test failed
233 */
234int mbedtls_ripemd160_self_test( int verbose );
235
236#endif /* MBEDTLS_SELF_TEST */
237
238#ifdef __cplusplus
239}
240#endif
241
242/// \}
243/// \}
244
245#endif /* mbedtls_ripemd160.h */
Configuration options (set of defines)
void mbedtls_ripemd160_process(mbedtls_ripemd160_context *ctx, const unsigned char data[64])
RIPEMD-160 process data block (internal use only)
void mbedtls_ripemd160_clone(mbedtls_ripemd160_context *dst, const mbedtls_ripemd160_context *src)
Clone (the state of) an RIPEMD-160 context.
void mbedtls_ripemd160_update(mbedtls_ripemd160_context *ctx, const unsigned char *input, size_t ilen)
RIPEMD-160 process buffer.
void mbedtls_ripemd160_init(mbedtls_ripemd160_context *ctx)
Initialize RIPEMD-160 context.
int mbedtls_internal_ripemd160_process(mbedtls_ripemd160_context *ctx, const unsigned char data[64])
RIPEMD-160 process data block (internal use only)
void mbedtls_ripemd160_starts(mbedtls_ripemd160_context *ctx)
RIPEMD-160 context setup.
void mbedtls_ripemd160_finish(mbedtls_ripemd160_context *ctx, unsigned char output[20])
RIPEMD-160 final digest.
void mbedtls_ripemd160_free(mbedtls_ripemd160_context *ctx)
Clear RIPEMD-160 context.
int mbedtls_ripemd160_update_ret(mbedtls_ripemd160_context *ctx, const unsigned char *input, size_t ilen)
RIPEMD-160 process buffer.
int mbedtls_ripemd160_ret(const unsigned char *input, size_t ilen, unsigned char output[20])
Output = RIPEMD-160( input buffer )
int mbedtls_ripemd160_finish_ret(mbedtls_ripemd160_context *ctx, unsigned char output[20])
RIPEMD-160 final digest.
void mbedtls_ripemd160(const unsigned char *input, size_t ilen, unsigned char output[20])
Output = RIPEMD-160( input buffer )
int mbedtls_ripemd160_starts_ret(mbedtls_ripemd160_context *ctx)
RIPEMD-160 context setup.
RIPEMD-160 context structure.
Definition: ripemd160.h:57
unsigned char buffer[64]
Definition: ripemd160.h:60