| OLD | NEW |
| 1 /* crypto/ripemd/rmd_dgst.c */ | 1 /* crypto/ripemd/rmd_dgst.c */ |
| 2 /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 * All rights reserved. | 3 * All rights reserved. |
| 4 * | 4 * |
| 5 * This package is an SSL implementation written | 5 * This package is an SSL implementation written |
| 6 * by Eric Young (eay@cryptsoft.com). | 6 * by Eric Young (eay@cryptsoft.com). |
| 7 * The implementation was written so as to conform with Netscapes SSL. | 7 * The implementation was written so as to conform with Netscapes SSL. |
| 8 * | 8 * |
| 9 * This library is free for commercial and non-commercial use as long as | 9 * This library is free for commercial and non-commercial use as long as |
| 10 * the following conditions are aheared to. The following conditions | 10 * the following conditions are aheared to. The following conditions |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 * | 52 * |
| 53 * The licence and distribution terms for any publically available version or | 53 * The licence and distribution terms for any publically available version or |
| 54 * derivative of this code cannot be changed. i.e. this code cannot simply be | 54 * derivative of this code cannot be changed. i.e. this code cannot simply be |
| 55 * copied and put under another distribution licence | 55 * copied and put under another distribution licence |
| 56 * [including the GNU Public Licence.] | 56 * [including the GNU Public Licence.] |
| 57 */ | 57 */ |
| 58 | 58 |
| 59 #include <stdio.h> | 59 #include <stdio.h> |
| 60 #include "rmd_locl.h" | 60 #include "rmd_locl.h" |
| 61 #include <openssl/opensslv.h> | 61 #include <openssl/opensslv.h> |
| 62 #include <openssl/err.h> | |
| 63 #ifdef OPENSSL_FIPS | |
| 64 #include <openssl/fips.h> | |
| 65 #endif | |
| 66 | |
| 67 | 62 |
| 68 const char RMD160_version[]="RIPE-MD160" OPENSSL_VERSION_PTEXT; | 63 const char RMD160_version[]="RIPE-MD160" OPENSSL_VERSION_PTEXT; |
| 69 | 64 |
| 70 # ifdef RMD160_ASM | 65 # ifdef RMD160_ASM |
| 71 void ripemd160_block_x86(RIPEMD160_CTX *c, unsigned long *p,size_t num); | 66 void ripemd160_block_x86(RIPEMD160_CTX *c, unsigned long *p,size_t num); |
| 72 # define ripemd160_block ripemd160_block_x86 | 67 # define ripemd160_block ripemd160_block_x86 |
| 73 # else | 68 # else |
| 74 void ripemd160_block(RIPEMD160_CTX *c, unsigned long *p,size_t num); | 69 void ripemd160_block(RIPEMD160_CTX *c, unsigned long *p,size_t num); |
| 75 # endif | 70 # endif |
| 76 | 71 |
| 77 FIPS_NON_FIPS_MD_Init(RIPEMD160) | 72 int RIPEMD160_Init(RIPEMD160_CTX *c) |
| 78 { | 73 { |
| 74 memset (c,0,sizeof(*c)); |
| 79 c->A=RIPEMD160_A; | 75 c->A=RIPEMD160_A; |
| 80 c->B=RIPEMD160_B; | 76 c->B=RIPEMD160_B; |
| 81 c->C=RIPEMD160_C; | 77 c->C=RIPEMD160_C; |
| 82 c->D=RIPEMD160_D; | 78 c->D=RIPEMD160_D; |
| 83 c->E=RIPEMD160_E; | 79 c->E=RIPEMD160_E; |
| 84 c->Nl=0; | |
| 85 c->Nh=0; | |
| 86 c->num=0; | |
| 87 return 1; | 80 return 1; |
| 88 } | 81 } |
| 89 | 82 |
| 90 #ifndef ripemd160_block_data_order | 83 #ifndef ripemd160_block_data_order |
| 91 #ifdef X | 84 #ifdef X |
| 92 #undef X | 85 #undef X |
| 93 #endif | 86 #endif |
| 94 void ripemd160_block_data_order (RIPEMD160_CTX *ctx, const void *p, size_t num) | 87 void ripemd160_block_data_order (RIPEMD160_CTX *ctx, const void *p, size_t num) |
| 95 { | 88 { |
| 96 const unsigned char *data=p; | 89 const unsigned char *data=p; |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 D =ctx->B+c+D; | 282 D =ctx->B+c+D; |
| 290 ctx->B=ctx->C+d+E; | 283 ctx->B=ctx->C+d+E; |
| 291 ctx->C=ctx->D+e+A; | 284 ctx->C=ctx->D+e+A; |
| 292 ctx->D=ctx->E+a+B; | 285 ctx->D=ctx->E+a+B; |
| 293 ctx->E=ctx->A+b+C; | 286 ctx->E=ctx->A+b+C; |
| 294 ctx->A=D; | 287 ctx->A=D; |
| 295 | 288 |
| 296 } | 289 } |
| 297 } | 290 } |
| 298 #endif | 291 #endif |
| OLD | NEW |