ripemd160.c
Go to the documentation of this file.
1 /**
2  * @file ripemd160.c
3  * @brief RIPEMD-160 hash function
4  *
5  * @section License
6  *
7  * SPDX-License-Identifier: GPL-2.0-or-later
8  *
9  * Copyright (C) 2010-2019 Oryx Embedded SARL. All rights reserved.
10  *
11  * This file is part of CycloneCrypto Open.
12  *
13  * This program is free software; you can redistribute it and/or
14  * modify it under the terms of the GNU General Public License
15  * as published by the Free Software Foundation; either version 2
16  * of the License, or (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program; if not, write to the Free Software Foundation,
25  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
26  *
27  * @author Oryx Embedded SARL (www.oryx-embedded.com)
28  * @version 1.9.6
29  **/
30 
31 //Switch to the appropriate trace level
32 #define TRACE_LEVEL CRYPTO_TRACE_LEVEL
33 
34 //Dependencies
35 #include "core/crypto.h"
36 #include "hash/ripemd160.h"
37 
38 //Check crypto library configuration
39 #if (RIPEMD160_SUPPORT == ENABLED)
40 
41 //RIPEMD-160 auxiliary functions
42 #define F(x, y, z) ((x) ^ (y) ^ (z))
43 #define G(x, y, z) (((x) & (y)) | (~(x) & (z)))
44 #define H(x, y, z) (((x) | ~(y)) ^ (z))
45 #define I(x, y, z) (((x) & (z)) | ((y) & ~(z)))
46 #define J(x, y, z) ((x) ^ ((y) | ~(z)))
47 
48 #define FF(a, b, c, d, e, x, s) a += F(b, c, d) + (x), a = ROL32(a, s) + (e), c = ROL32(c, 10)
49 #define GG(a, b, c, d, e, x, s) a += G(b, c, d) + (x) + 0x5A827999, a = ROL32(a, s) + (e), c = ROL32(c, 10)
50 #define HH(a, b, c, d, e, x, s) a += H(b, c, d) + (x) + 0x6ED9EBA1, a = ROL32(a, s) + (e), c = ROL32(c, 10)
51 #define II(a, b, c, d, e, x, s) a += I(b, c, d) + (x) + 0x8F1BBCDC, a = ROL32(a, s) + (e), c = ROL32(c, 10)
52 #define JJ(a, b, c, d, e, x, s) a += J(b, c, d) + (x) + 0xA953FD4E, a = ROL32(a, s) + (e), c = ROL32(c, 10)
53 
54 #define FFF(a, b, c, d, e, x, s) a += F(b, c, d) + (x), a = ROL32(a, s) + (e), c = ROL32(c, 10)
55 #define GGG(a, b, c, d, e, x, s) a += G(b, c, d) + (x) + 0x7A6D76E9, a = ROL32(a, s) + (e), c = ROL32(c, 10)
56 #define HHH(a, b, c, d, e, x, s) a += H(b, c, d) + (x) + 0x6D703EF3, a = ROL32(a, s) + (e), c = ROL32(c, 10)
57 #define III(a, b, c, d, e, x, s) a += I(b, c, d) + (x) + 0x5C4DD124, a = ROL32(a, s) + (e), c = ROL32(c, 10)
58 #define JJJ(a, b, c, d, e, x, s) a += J(b, c, d) + (x) + 0x50A28BE6, a = ROL32(a, s) + (e), c = ROL32(c, 10)
59 
60 //RIPEMD-160 padding
61 static const uint8_t padding[64] =
62 {
63  0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
64  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
65  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
66  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
67 };
68 
69 //RIPEMD-160 object identifier (1.3.36.3.2.1)
70 const uint8_t ripemd160Oid[5] = {0x2B, 0x24, 0x03, 0x02, 0x01};
71 
72 //Common interface for hash algorithms
74 {
75  "RIPEMD-160",
77  sizeof(ripemd160Oid),
78  sizeof(Ripemd160Context),
82  FALSE,
87  NULL
88 };
89 
90 
91 /**
92  * @brief Digest a message using RIPEMD-160
93  * @param[in] data Pointer to the message being hashed
94  * @param[in] length Length of the message
95  * @param[out] digest Pointer to the calculated digest
96  * @return Error code
97  **/
98 
99 error_t ripemd160Compute(const void *data, size_t length, uint8_t *digest)
100 {
101  //Allocate a memory buffer to hold the RIPEMD-160 context
103  //Failed to allocate memory?
104  if(context == NULL)
105  return ERROR_OUT_OF_MEMORY;
106 
107  //Initialize the RIPEMD-160 context
108  ripemd160Init(context);
109  //Digest the message
110  ripemd160Update(context, data, length);
111  //Finalize the RIPEMD-160 message digest
112  ripemd160Final(context, digest);
113 
114  //Free previously allocated memory
115  cryptoFreeMem(context);
116  //Successful processing
117  return NO_ERROR;
118 }
119 
120 
121 /**
122  * @brief Initialize RIPEMD-160 message digest context
123  * @param[in] context Pointer to the RIPEMD-160 context to initialize
124  **/
125 
127 {
128  //Set initial hash value
129  context->h[0] = 0x67452301;
130  context->h[1] = 0xEFCDAB89;
131  context->h[2] = 0x98BADCFE;
132  context->h[3] = 0x10325476;
133  context->h[4] = 0xC3D2E1F0;
134 
135  //Number of bytes in the buffer
136  context->size = 0;
137  //Total length of the message
138  context->totalSize = 0;
139 }
140 
141 
142 /**
143  * @brief Update the RIPEMD-160 context with a portion of the message being hashed
144  * @param[in] context Pointer to the RIPEMD-160 context
145  * @param[in] data Pointer to the buffer being hashed
146  * @param[in] length Length of the buffer
147  **/
148 
149 void ripemd160Update(Ripemd160Context *context, const void *data, size_t length)
150 {
151  size_t n;
152 
153  //Process the incoming data
154  while(length > 0)
155  {
156  //The buffer can hold at most 64 bytes
157  n = MIN(length, 64 - context->size);
158 
159  //Copy the data to the buffer
160  cryptoMemcpy(context->buffer + context->size, data, n);
161 
162  //Update the RIPEMD-160 context
163  context->size += n;
164  context->totalSize += n;
165  //Advance the data pointer
166  data = (uint8_t *) data + n;
167  //Remaining bytes to process
168  length -= n;
169 
170  //Process message in 16-word blocks
171  if(context->size == 64)
172  {
173  //Transform the 16-word block
174  ripemd160ProcessBlock(context);
175  //Empty the buffer
176  context->size = 0;
177  }
178  }
179 }
180 
181 
182 /**
183  * @brief Finish the RIPEMD-160 message digest
184  * @param[in] context Pointer to the RIPEMD-160 context
185  * @param[out] digest Calculated digest (optional parameter)
186  **/
187 
188 void ripemd160Final(Ripemd160Context *context, uint8_t *digest)
189 {
190  uint_t i;
191  size_t paddingSize;
192  uint64_t totalSize;
193 
194  //Length of the original message (before padding)
195  totalSize = context->totalSize * 8;
196 
197  //Pad the message so that its length is congruent to 56 modulo 64
198  if(context->size < 56)
199  paddingSize = 56 - context->size;
200  else
201  paddingSize = 64 + 56 - context->size;
202 
203  //Append padding
204  ripemd160Update(context, padding, paddingSize);
205 
206  //Append the length of the original message
207  context->x[14] = htole32((uint32_t) totalSize);
208  context->x[15] = htole32((uint32_t) (totalSize >> 32));
209 
210  //Calculate the message digest
211  ripemd160ProcessBlock(context);
212 
213  //Convert from host byte order to little-endian byte order
214  for(i = 0; i < 4; i++)
215  {
216  context->h[i] = htole32(context->h[i]);
217  }
218 
219  //Copy the resulting digest
220  if(digest != NULL)
221  cryptoMemcpy(digest, context->digest, RIPEMD160_DIGEST_SIZE);
222 }
223 
224 
225 /**
226  * @brief Process message in 16-word blocks
227  * @param[in] context Pointer to the RIPEMD-160 context
228  **/
229 
231 {
232  uint_t i;
233 
234  //Initialize the working registers
235  uint32_t aa= context->h[0];
236  uint32_t bb = context->h[1];
237  uint32_t cc = context->h[2];
238  uint32_t dd = context->h[3];
239  uint32_t ee = context->h[4];
240  uint32_t aaa = context->h[0];
241  uint32_t bbb = context->h[1];
242  uint32_t ccc = context->h[2];
243  uint32_t ddd = context->h[3];
244  uint32_t eee = context->h[4];
245 
246  //Process message in 16-word blocks
247  uint32_t *x = context->x;
248 
249  //Convert from little-endian byte order to host byte order
250  for(i = 0; i < 16; i++)
251  {
252  x[i] = letoh32(x[i]);
253  }
254 
255  //Round 1
256  FF(aa, bb, cc, dd, ee, x[0], 11);
257  FF(ee, aa, bb, cc, dd, x[1], 14);
258  FF(dd, ee, aa, bb, cc, x[2], 15);
259  FF(cc, dd, ee, aa, bb, x[3], 12);
260  FF(bb, cc, dd, ee, aa, x[4], 5);
261  FF(aa, bb, cc, dd, ee, x[5], 8);
262  FF(ee, aa, bb, cc, dd, x[6], 7);
263  FF(dd, ee, aa, bb, cc, x[7], 9);
264  FF(cc, dd, ee, aa, bb, x[8], 11);
265  FF(bb, cc, dd, ee, aa, x[9], 13);
266  FF(aa, bb, cc, dd, ee, x[10], 14);
267  FF(ee, aa, bb, cc, dd, x[11], 15);
268  FF(dd, ee, aa, bb, cc, x[12], 6);
269  FF(cc, dd, ee, aa, bb, x[13], 7);
270  FF(bb, cc, dd, ee, aa, x[14], 9);
271  FF(aa, bb, cc, dd, ee, x[15], 8);
272 
273  //Round 2
274  GG(ee, aa, bb, cc, dd, x[7], 7);
275  GG(dd, ee, aa, bb, cc, x[4], 6);
276  GG(cc, dd, ee, aa, bb, x[13], 8);
277  GG(bb, cc, dd, ee, aa, x[1], 13);
278  GG(aa, bb, cc, dd, ee, x[10], 11);
279  GG(ee, aa, bb, cc, dd, x[6], 9);
280  GG(dd, ee, aa, bb, cc, x[15], 7);
281  GG(cc, dd, ee, aa, bb, x[3], 15);
282  GG(bb, cc, dd, ee, aa, x[12], 7);
283  GG(aa, bb, cc, dd, ee, x[0], 12);
284  GG(ee, aa, bb, cc, dd, x[9], 15);
285  GG(dd, ee, aa, bb, cc, x[5], 9);
286  GG(cc, dd, ee, aa, bb, x[2], 11);
287  GG(bb, cc, dd, ee, aa, x[14], 7);
288  GG(aa, bb, cc, dd, ee, x[11], 13);
289  GG(ee, aa, bb, cc, dd, x[8], 12);
290 
291  //Round 3
292  HH(dd, ee, aa, bb, cc, x[3], 11);
293  HH(cc, dd, ee, aa, bb, x[10], 13);
294  HH(bb, cc, dd, ee, aa, x[14], 6);
295  HH(aa, bb, cc, dd, ee, x[4], 7);
296  HH(ee, aa, bb, cc, dd, x[9], 14);
297  HH(dd, ee, aa, bb, cc, x[15], 9);
298  HH(cc, dd, ee, aa, bb, x[8], 13);
299  HH(bb, cc, dd, ee, aa, x[1], 15);
300  HH(aa, bb, cc, dd, ee, x[2], 14);
301  HH(ee, aa, bb, cc, dd, x[7], 8);
302  HH(dd, ee, aa, bb, cc, x[0], 13);
303  HH(cc, dd, ee, aa, bb, x[6], 6);
304  HH(bb, cc, dd, ee, aa, x[13], 5);
305  HH(aa, bb, cc, dd, ee, x[11], 12);
306  HH(ee, aa, bb, cc, dd, x[5], 7);
307  HH(dd, ee, aa, bb, cc, x[12], 5);
308 
309  //Round 4
310  II(cc, dd, ee, aa, bb, x[1], 11);
311  II(bb, cc, dd, ee, aa, x[9], 12);
312  II(aa, bb, cc, dd, ee, x[11], 14);
313  II(ee, aa, bb, cc, dd, x[10], 15);
314  II(dd, ee, aa, bb, cc, x[0], 14);
315  II(cc, dd, ee, aa, bb, x[8], 15);
316  II(bb, cc, dd, ee, aa, x[12], 9);
317  II(aa, bb, cc, dd, ee, x[4], 8);
318  II(ee, aa, bb, cc, dd, x[13], 9);
319  II(dd, ee, aa, bb, cc, x[3], 14);
320  II(cc, dd, ee, aa, bb, x[7], 5);
321  II(bb, cc, dd, ee, aa, x[15], 6);
322  II(aa, bb, cc, dd, ee, x[14], 8);
323  II(ee, aa, bb, cc, dd, x[5], 6);
324  II(dd, ee, aa, bb, cc, x[6], 5);
325  II(cc, dd, ee, aa, bb, x[2], 12);
326 
327  //Round 5
328  JJ(bb, cc, dd, ee, aa, x[4], 9);
329  JJ(aa, bb, cc, dd, ee, x[0], 15);
330  JJ(ee, aa, bb, cc, dd, x[5], 5);
331  JJ(dd, ee, aa, bb, cc, x[9], 11);
332  JJ(cc, dd, ee, aa, bb, x[7], 6);
333  JJ(bb, cc, dd, ee, aa, x[12], 8);
334  JJ(aa, bb, cc, dd, ee, x[2], 13);
335  JJ(ee, aa, bb, cc, dd, x[10], 12);
336  JJ(dd, ee, aa, bb, cc, x[14], 5);
337  JJ(cc, dd, ee, aa, bb, x[1], 12);
338  JJ(bb, cc, dd, ee, aa, x[3], 13);
339  JJ(aa, bb, cc, dd, ee, x[8], 14);
340  JJ(ee, aa, bb, cc, dd, x[11], 11);
341  JJ(dd, ee, aa, bb, cc, x[6], 8);
342  JJ(cc, dd, ee, aa, bb, x[15], 5);
343  JJ(bb, cc, dd, ee, aa, x[13], 6);
344 
345  //Parallel round 1
346  JJJ(aaa, bbb, ccc, ddd, eee, x[5], 8);
347  JJJ(eee, aaa, bbb, ccc, ddd, x[14], 9);
348  JJJ(ddd, eee, aaa, bbb, ccc, x[7], 9);
349  JJJ(ccc, ddd, eee, aaa, bbb, x[0], 11);
350  JJJ(bbb, ccc, ddd, eee, aaa, x[9], 13);
351  JJJ(aaa, bbb, ccc, ddd, eee, x[2], 15);
352  JJJ(eee, aaa, bbb, ccc, ddd, x[11], 15);
353  JJJ(ddd, eee, aaa, bbb, ccc, x[4], 5);
354  JJJ(ccc, ddd, eee, aaa, bbb, x[13], 7);
355  JJJ(bbb, ccc, ddd, eee, aaa, x[6], 7);
356  JJJ(aaa, bbb, ccc, ddd, eee, x[15], 8);
357  JJJ(eee, aaa, bbb, ccc, ddd, x[8], 11);
358  JJJ(ddd, eee, aaa, bbb, ccc, x[1], 14);
359  JJJ(ccc, ddd, eee, aaa, bbb, x[10], 14);
360  JJJ(bbb, ccc, ddd, eee, aaa, x[3], 12);
361  JJJ(aaa, bbb, ccc, ddd, eee, x[12], 6);
362 
363  //Parallel round 2
364  III(eee, aaa, bbb, ccc, ddd, x[6], 9);
365  III(ddd, eee, aaa, bbb, ccc, x[11], 13);
366  III(ccc, ddd, eee, aaa, bbb, x[3], 15);
367  III(bbb, ccc, ddd, eee, aaa, x[7], 7);
368  III(aaa, bbb, ccc, ddd, eee, x[0], 12);
369  III(eee, aaa, bbb, ccc, ddd, x[13], 8);
370  III(ddd, eee, aaa, bbb, ccc, x[5], 9);
371  III(ccc, ddd, eee, aaa, bbb, x[10], 11);
372  III(bbb, ccc, ddd, eee, aaa, x[14], 7);
373  III(aaa, bbb, ccc, ddd, eee, x[15], 7);
374  III(eee, aaa, bbb, ccc, ddd, x[8], 12);
375  III(ddd, eee, aaa, bbb, ccc, x[12], 7);
376  III(ccc, ddd, eee, aaa, bbb, x[4], 6);
377  III(bbb, ccc, ddd, eee, aaa, x[9], 15);
378  III(aaa, bbb, ccc, ddd, eee, x[1], 13);
379  III(eee, aaa, bbb, ccc, ddd, x[2], 11);
380 
381  //Parallel round 3
382  HHH(ddd, eee, aaa, bbb, ccc, x[15], 9);
383  HHH(ccc, ddd, eee, aaa, bbb, x[5], 7);
384  HHH(bbb, ccc, ddd, eee, aaa, x[1], 15);
385  HHH(aaa, bbb, ccc, ddd, eee, x[3], 11);
386  HHH(eee, aaa, bbb, ccc, ddd, x[7], 8);
387  HHH(ddd, eee, aaa, bbb, ccc, x[14], 6);
388  HHH(ccc, ddd, eee, aaa, bbb, x[6], 6);
389  HHH(bbb, ccc, ddd, eee, aaa, x[9], 14);
390  HHH(aaa, bbb, ccc, ddd, eee, x[11], 12);
391  HHH(eee, aaa, bbb, ccc, ddd, x[8], 13);
392  HHH(ddd, eee, aaa, bbb, ccc, x[12], 5);
393  HHH(ccc, ddd, eee, aaa, bbb, x[2], 14);
394  HHH(bbb, ccc, ddd, eee, aaa, x[10], 13);
395  HHH(aaa, bbb, ccc, ddd, eee, x[0], 13);
396  HHH(eee, aaa, bbb, ccc, ddd, x[4], 7);
397  HHH(ddd, eee, aaa, bbb, ccc, x[13], 5);
398 
399  //Parallel round 4
400  GGG(ccc, ddd, eee, aaa, bbb, x[8], 15);
401  GGG(bbb, ccc, ddd, eee, aaa, x[6], 5);
402  GGG(aaa, bbb, ccc, ddd, eee, x[4], 8);
403  GGG(eee, aaa, bbb, ccc, ddd, x[1], 11);
404  GGG(ddd, eee, aaa, bbb, ccc, x[3], 14);
405  GGG(ccc, ddd, eee, aaa, bbb, x[11], 14);
406  GGG(bbb, ccc, ddd, eee, aaa, x[15], 6);
407  GGG(aaa, bbb, ccc, ddd, eee, x[0], 14);
408  GGG(eee, aaa, bbb, ccc, ddd, x[5], 6);
409  GGG(ddd, eee, aaa, bbb, ccc, x[12], 9);
410  GGG(ccc, ddd, eee, aaa, bbb, x[2], 12);
411  GGG(bbb, ccc, ddd, eee, aaa, x[13], 9);
412  GGG(aaa, bbb, ccc, ddd, eee, x[9], 12);
413  GGG(eee, aaa, bbb, ccc, ddd, x[7], 5);
414  GGG(ddd, eee, aaa, bbb, ccc, x[10], 15);
415  GGG(ccc, ddd, eee, aaa, bbb, x[14], 8);
416 
417  //Parallel round 5
418  FFF(bbb, ccc, ddd, eee, aaa, x[12], 8);
419  FFF(aaa, bbb, ccc, ddd, eee, x[15], 5);
420  FFF(eee, aaa, bbb, ccc, ddd, x[10], 12);
421  FFF(ddd, eee, aaa, bbb, ccc, x[4], 9);
422  FFF(ccc, ddd, eee, aaa, bbb, x[1], 12);
423  FFF(bbb, ccc, ddd, eee, aaa, x[5], 5);
424  FFF(aaa, bbb, ccc, ddd, eee, x[8], 14);
425  FFF(eee, aaa, bbb, ccc, ddd, x[7], 6);
426  FFF(ddd, eee, aaa, bbb, ccc, x[6], 8);
427  FFF(ccc, ddd, eee, aaa, bbb, x[2], 13);
428  FFF(bbb, ccc, ddd, eee, aaa, x[13], 6);
429  FFF(aaa, bbb, ccc, ddd, eee, x[14], 5);
430  FFF(eee, aaa, bbb, ccc, ddd, x[0], 15);
431  FFF(ddd, eee, aaa, bbb, ccc, x[3], 13);
432  FFF(ccc, ddd, eee, aaa, bbb, x[9], 11);
433  FFF(bbb, ccc, ddd, eee, aaa, x[11], 11);
434 
435  //Combine results
436  ddd = context->h[1] + cc + ddd;
437  context->h[1] = context->h[2] + dd + eee;
438  context->h[2] = context->h[3] + ee + aaa;
439  context->h[3] = context->h[4] + aa + bbb;
440  context->h[4] = context->h[0] + bb + ccc;
441  context->h[0] = ddd;
442 }
443 
444 #endif
uint8_t length
Definition: dtls_misc.h:149
void ripemd160ProcessBlock(Ripemd160Context *context)
Process message in 16-word blocks.
Definition: ripemd160.c:230
void(* HashAlgoInit)(void *context)
Definition: crypto.h:1094
uint64_t totalSize
Definition: ripemd160.h:71
#define GGG(a, b, c, d, e, x, s)
Definition: ripemd160.c:55
uint8_t aa
Definition: dns_common.h:171
@ ERROR_OUT_OF_MEMORY
Definition: error.h:63
void ripemd160Update(Ripemd160Context *context, const void *data, size_t length)
Update the RIPEMD-160 context with a portion of the message being hashed.
Definition: ripemd160.c:149
void ripemd160Final(Ripemd160Context *context, uint8_t *digest)
Finish the RIPEMD-160 message digest.
Definition: ripemd160.c:188
void(* HashAlgoUpdate)(void *context, const void *data, size_t length)
Definition: crypto.h:1095
#define RIPEMD160_MIN_PAD_SIZE
Definition: ripemd160.h:42
#define letoh32(value)
Definition: cpu_endian.h:414
#define FALSE
Definition: os_port.h:46
#define FF(a, b, c, d, e, x, s)
Definition: ripemd160.c:48
#define III(a, b, c, d, e, x, s)
Definition: ripemd160.c:57
error_t
Error codes.
Definition: error.h:42
#define htole32(value)
Definition: cpu_endian.h:406
#define RIPEMD160_DIGEST_SIZE
Definition: ripemd160.h:40
#define GG(a, b, c, d, e, x, s)
Definition: ripemd160.c:49
General definitions for cryptographic algorithms.
RIPEMD-160 algorithm context.
Definition: ripemd160.h:58
uint8_t buffer[64]
Definition: ripemd160.h:68
void ripemd160Init(Ripemd160Context *context)
Initialize RIPEMD-160 message digest context.
Definition: ripemd160.c:126
#define MIN(a, b)
Definition: os_port.h:62
#define HHH(a, b, c, d, e, x, s)
Definition: ripemd160.c:56
const HashAlgo ripemd160HashAlgo
Definition: ripemd160.c:73
void(* HashAlgoFinal)(void *context, uint8_t *digest)
Definition: crypto.h:1096
uint8_t digest[20]
Definition: ripemd160.h:63
RIPEMD-160 hash function.
#define II(a, b, c, d, e, x, s)
Definition: ripemd160.c:51
#define JJ(a, b, c, d, e, x, s)
Definition: ripemd160.c:52
uint8_t n
const uint8_t ripemd160Oid[5]
Definition: ripemd160.c:70
#define cryptoMemcpy(dest, src, length)
Definition: crypto.h:642
#define cryptoFreeMem(p)
Definition: crypto.h:630
#define JJJ(a, b, c, d, e, x, s)
Definition: ripemd160.c:58
uint32_t totalSize
#define RIPEMD160_BLOCK_SIZE
Definition: ripemd160.h:38
uint32_t h[5]
Definition: ripemd160.h:62
#define FFF(a, b, c, d, e, x, s)
Definition: ripemd160.c:54
#define cryptoAllocMem(size)
Definition: crypto.h:625
#define HH(a, b, c, d, e, x, s)
Definition: ripemd160.c:50
Common interface for hash algorithms.
Definition: crypto.h:1128
error_t ripemd160Compute(const void *data, size_t length, uint8_t *digest)
Digest a message using RIPEMD-160.
Definition: ripemd160.c:99
unsigned int uint_t
Definition: compiler_port.h:45
uint8_t data[]
Definition: dtls_misc.h:176
error_t(* HashAlgoCompute)(const void *data, size_t length, uint8_t *digest)
Definition: crypto.h:1093
@ NO_ERROR
Success.
Definition: error.h:44
uint32_t x[16]
Definition: ripemd160.h:67