update atrs list
[RRG-proxmark3.git] / common / mbedtls / ripemd160.h
bloba394f0551437d2c92f5e79f541f114f964f915e1
1 /**
2 * \file ripemd160.h
4 * \brief RIPE MD-160 message digest
5 */
6 /*
7 * Copyright The Mbed TLS Contributors
8 * SPDX-License-Identifier: Apache-2.0
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
14 * http://www.apache.org/licenses/LICENSE-2.0
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.
22 #ifndef MBEDTLS_RIPEMD160_H
23 #define MBEDTLS_RIPEMD160_H
25 #if !defined(MBEDTLS_CONFIG_FILE)
26 #include "mbedtls/config.h"
27 #else
28 #include MBEDTLS_CONFIG_FILE
29 #endif
31 #include <stddef.h>
32 #include <stdint.h>
34 /* MBEDTLS_ERR_RIPEMD160_HW_ACCEL_FAILED is deprecated and should not be used.
36 #define MBEDTLS_ERR_RIPEMD160_HW_ACCEL_FAILED -0x0031 /**< RIPEMD160 hardware accelerator failed */
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
42 #if !defined(MBEDTLS_RIPEMD160_ALT)
43 // Regular implementation
46 /**
47 * \brief RIPEMD-160 context structure
49 typedef struct mbedtls_ripemd160_context {
50 uint32_t total[2]; /*!< number of bytes processed */
51 uint32_t state[5]; /*!< intermediate digest state */
52 unsigned char buffer[64]; /*!< data block being processed */
54 mbedtls_ripemd160_context;
56 #else /* MBEDTLS_RIPEMD160_ALT */
57 #include "ripemd160_alt.h"
58 #endif /* MBEDTLS_RIPEMD160_ALT */
60 /**
61 * \brief Initialize RIPEMD-160 context
63 * \param ctx RIPEMD-160 context to be initialized
65 void mbedtls_ripemd160_init(mbedtls_ripemd160_context *ctx);
67 /**
68 * \brief Clear RIPEMD-160 context
70 * \param ctx RIPEMD-160 context to be cleared
72 void mbedtls_ripemd160_free(mbedtls_ripemd160_context *ctx);
74 /**
75 * \brief Clone (the state of) an RIPEMD-160 context
77 * \param dst The destination context
78 * \param src The context to be cloned
80 void mbedtls_ripemd160_clone(mbedtls_ripemd160_context *dst,
81 const mbedtls_ripemd160_context *src);
83 /**
84 * \brief RIPEMD-160 context setup
86 * \param ctx context to be initialized
88 * \return 0 if successful
90 int mbedtls_ripemd160_starts_ret(mbedtls_ripemd160_context *ctx);
92 /**
93 * \brief RIPEMD-160 process buffer
95 * \param ctx RIPEMD-160 context
96 * \param input buffer holding the data
97 * \param ilen length of the input data
99 * \return 0 if successful
101 int mbedtls_ripemd160_update_ret(mbedtls_ripemd160_context *ctx,
102 const unsigned char *input,
103 size_t ilen);
106 * \brief RIPEMD-160 final digest
108 * \param ctx RIPEMD-160 context
109 * \param output RIPEMD-160 checksum result
111 * \return 0 if successful
113 int mbedtls_ripemd160_finish_ret(mbedtls_ripemd160_context *ctx,
114 unsigned char output[20]);
117 * \brief RIPEMD-160 process data block (internal use only)
119 * \param ctx RIPEMD-160 context
120 * \param data buffer holding one block of data
122 * \return 0 if successful
124 int mbedtls_internal_ripemd160_process(mbedtls_ripemd160_context *ctx,
125 const unsigned char data[64]);
127 #if !defined(MBEDTLS_DEPRECATED_REMOVED)
128 #if defined(MBEDTLS_DEPRECATED_WARNING)
129 #define MBEDTLS_DEPRECATED __attribute__((deprecated))
130 #else
131 #define MBEDTLS_DEPRECATED
132 #endif
134 * \brief RIPEMD-160 context setup
136 * \deprecated Superseded by mbedtls_ripemd160_starts_ret() in 2.7.0
138 * \param ctx context to be initialized
140 MBEDTLS_DEPRECATED void mbedtls_ripemd160_starts(
141 mbedtls_ripemd160_context *ctx);
144 * \brief RIPEMD-160 process buffer
146 * \deprecated Superseded by mbedtls_ripemd160_update_ret() in 2.7.0
148 * \param ctx RIPEMD-160 context
149 * \param input buffer holding the data
150 * \param ilen length of the input data
152 MBEDTLS_DEPRECATED void mbedtls_ripemd160_update(
153 mbedtls_ripemd160_context *ctx,
154 const unsigned char *input,
155 size_t ilen);
158 * \brief RIPEMD-160 final digest
160 * \deprecated Superseded by mbedtls_ripemd160_finish_ret() in 2.7.0
162 * \param ctx RIPEMD-160 context
163 * \param output RIPEMD-160 checksum result
165 MBEDTLS_DEPRECATED void mbedtls_ripemd160_finish(
166 mbedtls_ripemd160_context *ctx,
167 unsigned char output[20]);
170 * \brief RIPEMD-160 process data block (internal use only)
172 * \deprecated Superseded by mbedtls_internal_ripemd160_process() in 2.7.0
174 * \param ctx RIPEMD-160 context
175 * \param data buffer holding one block of data
177 MBEDTLS_DEPRECATED void mbedtls_ripemd160_process(
178 mbedtls_ripemd160_context *ctx,
179 const unsigned char data[64]);
181 #undef MBEDTLS_DEPRECATED
182 #endif /* !MBEDTLS_DEPRECATED_REMOVED */
185 * \brief Output = RIPEMD-160( input buffer )
187 * \param input buffer holding the data
188 * \param ilen length of the input data
189 * \param output RIPEMD-160 checksum result
191 * \return 0 if successful
193 int mbedtls_ripemd160_ret(const unsigned char *input,
194 size_t ilen,
195 unsigned char output[20]);
197 #if !defined(MBEDTLS_DEPRECATED_REMOVED)
198 #if defined(MBEDTLS_DEPRECATED_WARNING)
199 #define MBEDTLS_DEPRECATED __attribute__((deprecated))
200 #else
201 #define MBEDTLS_DEPRECATED
202 #endif
204 * \brief Output = RIPEMD-160( input buffer )
206 * \deprecated Superseded by mbedtls_ripemd160_ret() in 2.7.0
208 * \param input buffer holding the data
209 * \param ilen length of the input data
210 * \param output RIPEMD-160 checksum result
212 MBEDTLS_DEPRECATED void mbedtls_ripemd160(const unsigned char *input,
213 size_t ilen,
214 unsigned char output[20]);
216 #undef MBEDTLS_DEPRECATED
217 #endif /* !MBEDTLS_DEPRECATED_REMOVED */
219 #if defined(MBEDTLS_SELF_TEST)
222 * \brief Checkup routine
224 * \return 0 if successful, or 1 if the test failed
226 int mbedtls_ripemd160_self_test(int verbose);
228 #endif /* MBEDTLS_SELF_TEST */
230 #ifdef __cplusplus
232 #endif
234 #endif /* mbedtls_ripemd160.h */