1 /* 2 * RIPE MD-160 implementation 3 * 4 * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved 5 * SPDX-License-Identifier: GPL-2.0 6 * 7 * This program is free software; you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation; either version 2 of the License, or 10 * (at your option) any later version. 11 * 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License along 18 * with this program; if not, write to the Free Software Foundation, Inc., 19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * This file is part of mbed TLS (https://tls.mbed.org) 22 */ 23 24 /* 25 * The RIPEMD-160 algorithm was designed by RIPE in 1996 26 * http://homes.esat.kuleuven.be/~bosselae/mbedtls_ripemd160.html 27 * http://ehash.iaik.tugraz.at/wiki/RIPEMD-160 28 */ 29 30 #if !defined(MBEDTLS_CONFIG_FILE) 31 #include "mbedtls/config.h" 32 #else 33 #include MBEDTLS_CONFIG_FILE 34 #endif 35 36 #if defined(MBEDTLS_RIPEMD160_C) 37 38 #include "mbedtls/ripemd160.h" 39 40 #include <string.h> 41 42 #if defined(MBEDTLS_SELF_TEST) 43 #if defined(MBEDTLS_PLATFORM_C) 44 #include "mbedtls/platform.h" 45 #else 46 #include <stdio.h> 47 #define mbedtls_printf printf 48 #endif /* MBEDTLS_PLATFORM_C */ 49 #endif /* MBEDTLS_SELF_TEST */ 50 51 #if !defined(MBEDTLS_RIPEMD160_ALT) 52 53 /* 54 * 32-bit integer manipulation macros (little endian) 55 */ 56 #ifndef GET_UINT32_LE 57 #define GET_UINT32_LE(n,b,i) \ 58 { \ 59 (n) = ( (uint32_t) (b)[(i) ] ) \ 60 | ( (uint32_t) (b)[(i) + 1] << 8 ) \ 61 | ( (uint32_t) (b)[(i) + 2] << 16 ) \ 62 | ( (uint32_t) (b)[(i) + 3] << 24 ); \ 63 } 64 #endif 65 66 #ifndef PUT_UINT32_LE 67 #define PUT_UINT32_LE(n,b,i) \ 68 { \ 69 (b)[(i) ] = (unsigned char) ( ( (n) ) & 0xFF ); \ 70 (b)[(i) + 1] = (unsigned char) ( ( (n) >> 8 ) & 0xFF ); \ 71 (b)[(i) + 2] = (unsigned char) ( ( (n) >> 16 ) & 0xFF ); \ 72 (b)[(i) + 3] = (unsigned char) ( ( (n) >> 24 ) & 0xFF ); \ 73 } 74 #endif 75 76 /* Implementation that should never be optimized out by the compiler */ 77 static void mbedtls_zeroize( void *v, size_t n ) { 78 volatile unsigned char *p = v; while( n-- ) *p++ = 0; 79 } 80 81 void mbedtls_ripemd160_init( mbedtls_ripemd160_context *ctx ) 82 { 83 memset( ctx, 0, sizeof( mbedtls_ripemd160_context ) ); 84 } 85 86 void mbedtls_ripemd160_free( mbedtls_ripemd160_context *ctx ) 87 { 88 if( ctx == NULL ) 89 return; 90 91 mbedtls_zeroize( ctx, sizeof( mbedtls_ripemd160_context ) ); 92 } 93 94 void mbedtls_ripemd160_clone( mbedtls_ripemd160_context *dst, 95 const mbedtls_ripemd160_context *src ) 96 { 97 *dst = *src; 98 } 99 100 /* 101 * RIPEMD-160 context setup 102 */ 103 int mbedtls_ripemd160_starts_ret( mbedtls_ripemd160_context *ctx ) 104 { 105 ctx->total[0] = 0; 106 ctx->total[1] = 0; 107 108 ctx->state[0] = 0x67452301; 109 ctx->state[1] = 0xEFCDAB89; 110 ctx->state[2] = 0x98BADCFE; 111 ctx->state[3] = 0x10325476; 112 ctx->state[4] = 0xC3D2E1F0; 113 114 return( 0 ); 115 } 116 117 #if !defined(MBEDTLS_DEPRECATED_REMOVED) 118 void mbedtls_ripemd160_starts( mbedtls_ripemd160_context *ctx ) 119 { 120 mbedtls_ripemd160_starts_ret( ctx ); 121 } 122 #endif 123 124 #if !defined(MBEDTLS_RIPEMD160_PROCESS_ALT) 125 /* 126 * Process one block 127 */ 128 int mbedtls_internal_ripemd160_process( mbedtls_ripemd160_context *ctx, 129 const unsigned char data[64] ) 130 { 131 uint32_t A, B, C, D, E, Ap, Bp, Cp, Dp, Ep, X[16]; 132 133 GET_UINT32_LE( X[ 0], data, 0 ); 134 GET_UINT32_LE( X[ 1], data, 4 ); 135 GET_UINT32_LE( X[ 2], data, 8 ); 136 GET_UINT32_LE( X[ 3], data, 12 ); 137 GET_UINT32_LE( X[ 4], data, 16 ); 138 GET_UINT32_LE( X[ 5], data, 20 ); 139 GET_UINT32_LE( X[ 6], data, 24 ); 140 GET_UINT32_LE( X[ 7], data, 28 ); 141 GET_UINT32_LE( X[ 8], data, 32 ); 142 GET_UINT32_LE( X[ 9], data, 36 ); 143 GET_UINT32_LE( X[10], data, 40 ); 144 GET_UINT32_LE( X[11], data, 44 ); 145 GET_UINT32_LE( X[12], data, 48 ); 146 GET_UINT32_LE( X[13], data, 52 ); 147 GET_UINT32_LE( X[14], data, 56 ); 148 GET_UINT32_LE( X[15], data, 60 ); 149 150 A = Ap = ctx->state[0]; 151 B = Bp = ctx->state[1]; 152 C = Cp = ctx->state[2]; 153 D = Dp = ctx->state[3]; 154 E = Ep = ctx->state[4]; 155 156 #define F1( x, y, z ) ( x ^ y ^ z ) 157 #define F2( x, y, z ) ( ( x & y ) | ( ~x & z ) ) 158 #define F3( x, y, z ) ( ( x | ~y ) ^ z ) 159 #define F4( x, y, z ) ( ( x & z ) | ( y & ~z ) ) 160 #define F5( x, y, z ) ( x ^ ( y | ~z ) ) 161 162 #define S( x, n ) ( ( x << n ) | ( x >> (32 - n) ) ) 163 164 #define P( a, b, c, d, e, r, s, f, k ) \ 165 a += f( b, c, d ) + X[r] + k; \ 166 a = S( a, s ) + e; \ 167 c = S( c, 10 ); 168 169 #define P2( a, b, c, d, e, r, s, rp, sp ) \ 170 P( a, b, c, d, e, r, s, F, K ); \ 171 P( a ## p, b ## p, c ## p, d ## p, e ## p, rp, sp, Fp, Kp ); 172 173 #define F F1 174 #define K 0x00000000 175 #define Fp F5 176 #define Kp 0x50A28BE6 177 P2( A, B, C, D, E, 0, 11, 5, 8 ); 178 P2( E, A, B, C, D, 1, 14, 14, 9 ); 179 P2( D, E, A, B, C, 2, 15, 7, 9 ); 180 P2( C, D, E, A, B, 3, 12, 0, 11 ); 181 P2( B, C, D, E, A, 4, 5, 9, 13 ); 182 P2( A, B, C, D, E, 5, 8, 2, 15 ); 183 P2( E, A, B, C, D, 6, 7, 11, 15 ); 184 P2( D, E, A, B, C, 7, 9, 4, 5 ); 185 P2( C, D, E, A, B, 8, 11, 13, 7 ); 186 P2( B, C, D, E, A, 9, 13, 6, 7 ); 187 P2( A, B, C, D, E, 10, 14, 15, 8 ); 188 P2( E, A, B, C, D, 11, 15, 8, 11 ); 189 P2( D, E, A, B, C, 12, 6, 1, 14 ); 190 P2( C, D, E, A, B, 13, 7, 10, 14 ); 191 P2( B, C, D, E, A, 14, 9, 3, 12 ); 192 P2( A, B, C, D, E, 15, 8, 12, 6 ); 193 #undef F 194 #undef K 195 #undef Fp 196 #undef Kp 197 198 #define F F2 199 #define K 0x5A827999 200 #define Fp F4 201 #define Kp 0x5C4DD124 202 P2( E, A, B, C, D, 7, 7, 6, 9 ); 203 P2( D, E, A, B, C, 4, 6, 11, 13 ); 204 P2( C, D, E, A, B, 13, 8, 3, 15 ); 205 P2( B, C, D, E, A, 1, 13, 7, 7 ); 206 P2( A, B, C, D, E, 10, 11, 0, 12 ); 207 P2( E, A, B, C, D, 6, 9, 13, 8 ); 208 P2( D, E, A, B, C, 15, 7, 5, 9 ); 209 P2( C, D, E, A, B, 3, 15, 10, 11 ); 210 P2( B, C, D, E, A, 12, 7, 14, 7 ); 211 P2( A, B, C, D, E, 0, 12, 15, 7 ); 212 P2( E, A, B, C, D, 9, 15, 8, 12 ); 213 P2( D, E, A, B, C, 5, 9, 12, 7 ); 214 P2( C, D, E, A, B, 2, 11, 4, 6 ); 215 P2( B, C, D, E, A, 14, 7, 9, 15 ); 216 P2( A, B, C, D, E, 11, 13, 1, 13 ); 217 P2( E, A, B, C, D, 8, 12, 2, 11 ); 218 #undef F 219 #undef K 220 #undef Fp 221 #undef Kp 222 223 #define F F3 224 #define K 0x6ED9EBA1 225 #define Fp F3 226 #define Kp 0x6D703EF3 227 P2( D, E, A, B, C, 3, 11, 15, 9 ); 228 P2( C, D, E, A, B, 10, 13, 5, 7 ); 229 P2( B, C, D, E, A, 14, 6, 1, 15 ); 230 P2( A, B, C, D, E, 4, 7, 3, 11 ); 231 P2( E, A, B, C, D, 9, 14, 7, 8 ); 232 P2( D, E, A, B, C, 15, 9, 14, 6 ); 233 P2( C, D, E, A, B, 8, 13, 6, 6 ); 234 P2( B, C, D, E, A, 1, 15, 9, 14 ); 235 P2( A, B, C, D, E, 2, 14, 11, 12 ); 236 P2( E, A, B, C, D, 7, 8, 8, 13 ); 237 P2( D, E, A, B, C, 0, 13, 12, 5 ); 238 P2( C, D, E, A, B, 6, 6, 2, 14 ); 239 P2( B, C, D, E, A, 13, 5, 10, 13 ); 240 P2( A, B, C, D, E, 11, 12, 0, 13 ); 241 P2( E, A, B, C, D, 5, 7, 4, 7 ); 242 P2( D, E, A, B, C, 12, 5, 13, 5 ); 243 #undef F 244 #undef K 245 #undef Fp 246 #undef Kp 247 248 #define F F4 249 #define K 0x8F1BBCDC 250 #define Fp F2 251 #define Kp 0x7A6D76E9 252 P2( C, D, E, A, B, 1, 11, 8, 15 ); 253 P2( B, C, D, E, A, 9, 12, 6, 5 ); 254 P2( A, B, C, D, E, 11, 14, 4, 8 ); 255 P2( E, A, B, C, D, 10, 15, 1, 11 ); 256 P2( D, E, A, B, C, 0, 14, 3, 14 ); 257 P2( C, D, E, A, B, 8, 15, 11, 14 ); 258 P2( B, C, D, E, A, 12, 9, 15, 6 ); 259 P2( A, B, C, D, E, 4, 8, 0, 14 ); 260 P2( E, A, B, C, D, 13, 9, 5, 6 ); 261 P2( D, E, A, B, C, 3, 14, 12, 9 ); 262 P2( C, D, E, A, B, 7, 5, 2, 12 ); 263 P2( B, C, D, E, A, 15, 6, 13, 9 ); 264 P2( A, B, C, D, E, 14, 8, 9, 12 ); 265 P2( E, A, B, C, D, 5, 6, 7, 5 ); 266 P2( D, E, A, B, C, 6, 5, 10, 15 ); 267 P2( C, D, E, A, B, 2, 12, 14, 8 ); 268 #undef F 269 #undef K 270 #undef Fp 271 #undef Kp 272 273 #define F F5 274 #define K 0xA953FD4E 275 #define Fp F1 276 #define Kp 0x00000000 277 P2( B, C, D, E, A, 4, 9, 12, 8 ); 278 P2( A, B, C, D, E, 0, 15, 15, 5 ); 279 P2( E, A, B, C, D, 5, 5, 10, 12 ); 280 P2( D, E, A, B, C, 9, 11, 4, 9 ); 281 P2( C, D, E, A, B, 7, 6, 1, 12 ); 282 P2( B, C, D, E, A, 12, 8, 5, 5 ); 283 P2( A, B, C, D, E, 2, 13, 8, 14 ); 284 P2( E, A, B, C, D, 10, 12, 7, 6 ); 285 P2( D, E, A, B, C, 14, 5, 6, 8 ); 286 P2( C, D, E, A, B, 1, 12, 2, 13 ); 287 P2( B, C, D, E, A, 3, 13, 13, 6 ); 288 P2( A, B, C, D, E, 8, 14, 14, 5 ); 289 P2( E, A, B, C, D, 11, 11, 0, 15 ); 290 P2( D, E, A, B, C, 6, 8, 3, 13 ); 291 P2( C, D, E, A, B, 15, 5, 9, 11 ); 292 P2( B, C, D, E, A, 13, 6, 11, 11 ); 293 #undef F 294 #undef K 295 #undef Fp 296 #undef Kp 297 298 C = ctx->state[1] + C + Dp; 299 ctx->state[1] = ctx->state[2] + D + Ep; 300 ctx->state[2] = ctx->state[3] + E + Ap; 301 ctx->state[3] = ctx->state[4] + A + Bp; 302 ctx->state[4] = ctx->state[0] + B + Cp; 303 ctx->state[0] = C; 304 305 return( 0 ); 306 } 307 308 #if !defined(MBEDTLS_DEPRECATED_REMOVED) 309 void mbedtls_ripemd160_process( mbedtls_ripemd160_context *ctx, 310 const unsigned char data[64] ) 311 { 312 mbedtls_internal_ripemd160_process( ctx, data ); 313 } 314 #endif 315 #endif /* !MBEDTLS_RIPEMD160_PROCESS_ALT */ 316 317 /* 318 * RIPEMD-160 process buffer 319 */ 320 int mbedtls_ripemd160_update_ret( mbedtls_ripemd160_context *ctx, 321 const unsigned char *input, 322 size_t ilen ) 323 { 324 int ret; 325 size_t fill; 326 uint32_t left; 327 328 if( ilen == 0 ) 329 return( 0 ); 330 331 left = ctx->total[0] & 0x3F; 332 fill = 64 - left; 333 334 ctx->total[0] += (uint32_t) ilen; 335 ctx->total[0] &= 0xFFFFFFFF; 336 337 if( ctx->total[0] < (uint32_t) ilen ) 338 ctx->total[1]++; 339 340 if( left && ilen >= fill ) 341 { 342 memcpy( (void *) (ctx->buffer + left), input, fill ); 343 344 if( ( ret = mbedtls_internal_ripemd160_process( ctx, ctx->buffer ) ) != 0 ) 345 return( ret ); 346 347 input += fill; 348 ilen -= fill; 349 left = 0; 350 } 351 352 while( ilen >= 64 ) 353 { 354 if( ( ret = mbedtls_internal_ripemd160_process( ctx, input ) ) != 0 ) 355 return( ret ); 356 357 input += 64; 358 ilen -= 64; 359 } 360 361 if( ilen > 0 ) 362 { 363 memcpy( (void *) (ctx->buffer + left), input, ilen ); 364 } 365 366 return( 0 ); 367 } 368 369 #if !defined(MBEDTLS_DEPRECATED_REMOVED) 370 void mbedtls_ripemd160_update( mbedtls_ripemd160_context *ctx, 371 const unsigned char *input, 372 size_t ilen ) 373 { 374 mbedtls_ripemd160_update_ret( ctx, input, ilen ); 375 } 376 #endif 377 378 static const unsigned char ripemd160_padding[64] = 379 { 380 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 381 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 382 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 383 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 384 }; 385 386 /* 387 * RIPEMD-160 final digest 388 */ 389 int mbedtls_ripemd160_finish_ret( mbedtls_ripemd160_context *ctx, 390 unsigned char output[20] ) 391 { 392 int ret; 393 uint32_t last, padn; 394 uint32_t high, low; 395 unsigned char msglen[8]; 396 397 high = ( ctx->total[0] >> 29 ) 398 | ( ctx->total[1] << 3 ); 399 low = ( ctx->total[0] << 3 ); 400 401 PUT_UINT32_LE( low, msglen, 0 ); 402 PUT_UINT32_LE( high, msglen, 4 ); 403 404 last = ctx->total[0] & 0x3F; 405 padn = ( last < 56 ) ? ( 56 - last ) : ( 120 - last ); 406 407 ret = mbedtls_ripemd160_update_ret( ctx, ripemd160_padding, padn ); 408 if( ret != 0 ) 409 return( ret ); 410 411 ret = mbedtls_ripemd160_update_ret( ctx, msglen, 8 ); 412 if( ret != 0 ) 413 return( ret ); 414 415 PUT_UINT32_LE( ctx->state[0], output, 0 ); 416 PUT_UINT32_LE( ctx->state[1], output, 4 ); 417 PUT_UINT32_LE( ctx->state[2], output, 8 ); 418 PUT_UINT32_LE( ctx->state[3], output, 12 ); 419 PUT_UINT32_LE( ctx->state[4], output, 16 ); 420 421 return( 0 ); 422 } 423 424 #if !defined(MBEDTLS_DEPRECATED_REMOVED) 425 void mbedtls_ripemd160_finish( mbedtls_ripemd160_context *ctx, 426 unsigned char output[20] ) 427 { 428 mbedtls_ripemd160_finish_ret( ctx, output ); 429 } 430 #endif 431 432 #endif /* ! MBEDTLS_RIPEMD160_ALT */ 433 434 /* 435 * output = RIPEMD-160( input buffer ) 436 */ 437 int mbedtls_ripemd160_ret( const unsigned char *input, 438 size_t ilen, 439 unsigned char output[20] ) 440 { 441 int ret; 442 mbedtls_ripemd160_context ctx; 443 444 mbedtls_ripemd160_init( &ctx ); 445 446 if( ( ret = mbedtls_ripemd160_starts_ret( &ctx ) ) != 0 ) 447 goto exit; 448 449 if( ( ret = mbedtls_ripemd160_update_ret( &ctx, input, ilen ) ) != 0 ) 450 goto exit; 451 452 if( ( ret = mbedtls_ripemd160_finish_ret( &ctx, output ) ) != 0 ) 453 goto exit; 454 455 exit: 456 mbedtls_ripemd160_free( &ctx ); 457 458 return( ret ); 459 } 460 461 #if !defined(MBEDTLS_DEPRECATED_REMOVED) 462 void mbedtls_ripemd160( const unsigned char *input, 463 size_t ilen, 464 unsigned char output[20] ) 465 { 466 mbedtls_ripemd160_ret( input, ilen, output ); 467 } 468 #endif 469 470 #if defined(MBEDTLS_SELF_TEST) 471 /* 472 * Test vectors from the RIPEMD-160 paper and 473 * http://homes.esat.kuleuven.be/~bosselae/mbedtls_ripemd160.html#HMAC 474 */ 475 #define TESTS 8 476 static const unsigned char ripemd160_test_str[TESTS][81] = 477 { 478 { "" }, 479 { "a" }, 480 { "abc" }, 481 { "message digest" }, 482 { "abcdefghijklmnopqrstuvwxyz" }, 483 { "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq" }, 484 { "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" }, 485 { "12345678901234567890123456789012345678901234567890123456789012" 486 "345678901234567890" }, 487 }; 488 489 static const size_t ripemd160_test_strlen[TESTS] = 490 { 491 0, 1, 3, 14, 26, 56, 62, 80 492 }; 493 494 static const unsigned char ripemd160_test_md[TESTS][20] = 495 { 496 { 0x9c, 0x11, 0x85, 0xa5, 0xc5, 0xe9, 0xfc, 0x54, 0x61, 0x28, 497 0x08, 0x97, 0x7e, 0xe8, 0xf5, 0x48, 0xb2, 0x25, 0x8d, 0x31 }, 498 { 0x0b, 0xdc, 0x9d, 0x2d, 0x25, 0x6b, 0x3e, 0xe9, 0xda, 0xae, 499 0x34, 0x7b, 0xe6, 0xf4, 0xdc, 0x83, 0x5a, 0x46, 0x7f, 0xfe }, 500 { 0x8e, 0xb2, 0x08, 0xf7, 0xe0, 0x5d, 0x98, 0x7a, 0x9b, 0x04, 501 0x4a, 0x8e, 0x98, 0xc6, 0xb0, 0x87, 0xf1, 0x5a, 0x0b, 0xfc }, 502 { 0x5d, 0x06, 0x89, 0xef, 0x49, 0xd2, 0xfa, 0xe5, 0x72, 0xb8, 503 0x81, 0xb1, 0x23, 0xa8, 0x5f, 0xfa, 0x21, 0x59, 0x5f, 0x36 }, 504 { 0xf7, 0x1c, 0x27, 0x10, 0x9c, 0x69, 0x2c, 0x1b, 0x56, 0xbb, 505 0xdc, 0xeb, 0x5b, 0x9d, 0x28, 0x65, 0xb3, 0x70, 0x8d, 0xbc }, 506 { 0x12, 0xa0, 0x53, 0x38, 0x4a, 0x9c, 0x0c, 0x88, 0xe4, 0x05, 507 0xa0, 0x6c, 0x27, 0xdc, 0xf4, 0x9a, 0xda, 0x62, 0xeb, 0x2b }, 508 { 0xb0, 0xe2, 0x0b, 0x6e, 0x31, 0x16, 0x64, 0x02, 0x86, 0xed, 509 0x3a, 0x87, 0xa5, 0x71, 0x30, 0x79, 0xb2, 0x1f, 0x51, 0x89 }, 510 { 0x9b, 0x75, 0x2e, 0x45, 0x57, 0x3d, 0x4b, 0x39, 0xf4, 0xdb, 511 0xd3, 0x32, 0x3c, 0xab, 0x82, 0xbf, 0x63, 0x32, 0x6b, 0xfb }, 512 }; 513 514 /* 515 * Checkup routine 516 */ 517 int mbedtls_ripemd160_self_test( int verbose ) 518 { 519 int i, ret = 0; 520 unsigned char output[20]; 521 522 memset( output, 0, sizeof output ); 523 524 for( i = 0; i < TESTS; i++ ) 525 { 526 if( verbose != 0 ) 527 mbedtls_printf( " RIPEMD-160 test #%d: ", i + 1 ); 528 529 ret = mbedtls_ripemd160_ret( ripemd160_test_str[i], 530 ripemd160_test_strlen[i], output ); 531 if( ret != 0 ) 532 goto fail; 533 534 if( memcmp( output, ripemd160_test_md[i], 20 ) != 0 ) 535 { 536 ret = 1; 537 goto fail; 538 } 539 540 if( verbose != 0 ) 541 mbedtls_printf( "passed\n" ); 542 } 543 544 if( verbose != 0 ) 545 mbedtls_printf( "\n" ); 546 547 return( 0 ); 548 549 fail: 550 if( verbose != 0 ) 551 mbedtls_printf( "failed\n" ); 552 553 return( ret ); 554 } 555 556 #endif /* MBEDTLS_SELF_TEST */ 557 558 #endif /* MBEDTLS_RIPEMD160_C */ 559