OLD | NEW |
1 /* crypto/sha/sha_locl.h */ | 1 /* crypto/sha/sha_locl.h */ |
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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 #endif | 115 #endif |
116 | 116 |
117 #include "md32_common.h" | 117 #include "md32_common.h" |
118 | 118 |
119 #define INIT_DATA_h0 0x67452301UL | 119 #define INIT_DATA_h0 0x67452301UL |
120 #define INIT_DATA_h1 0xefcdab89UL | 120 #define INIT_DATA_h1 0xefcdab89UL |
121 #define INIT_DATA_h2 0x98badcfeUL | 121 #define INIT_DATA_h2 0x98badcfeUL |
122 #define INIT_DATA_h3 0x10325476UL | 122 #define INIT_DATA_h3 0x10325476UL |
123 #define INIT_DATA_h4 0xc3d2e1f0UL | 123 #define INIT_DATA_h4 0xc3d2e1f0UL |
124 | 124 |
125 #if defined(SHA_0) && defined(OPENSSL_FIPS) | |
126 FIPS_NON_FIPS_MD_Init(SHA) | |
127 #else | |
128 int HASH_INIT (SHA_CTX *c) | 125 int HASH_INIT (SHA_CTX *c) |
129 #endif | |
130 { | 126 { |
131 #if defined(SHA_1) && defined(OPENSSL_FIPS) | 127 » memset (c,0,sizeof(*c)); |
132 » FIPS_selftest_check(); | |
133 #endif | |
134 c->h0=INIT_DATA_h0; | 128 c->h0=INIT_DATA_h0; |
135 c->h1=INIT_DATA_h1; | 129 c->h1=INIT_DATA_h1; |
136 c->h2=INIT_DATA_h2; | 130 c->h2=INIT_DATA_h2; |
137 c->h3=INIT_DATA_h3; | 131 c->h3=INIT_DATA_h3; |
138 c->h4=INIT_DATA_h4; | 132 c->h4=INIT_DATA_h4; |
139 c->Nl=0; | |
140 c->Nh=0; | |
141 c->num=0; | |
142 return 1; | 133 return 1; |
143 } | 134 } |
144 | 135 |
145 #define K_00_19 0x5a827999UL | 136 #define K_00_19 0x5a827999UL |
146 #define K_20_39 0x6ed9eba1UL | 137 #define K_20_39 0x6ed9eba1UL |
147 #define K_40_59 0x8f1bbcdcUL | 138 #define K_40_59 0x8f1bbcdcUL |
148 #define K_60_79 0xca62c1d6UL | 139 #define K_60_79 0xca62c1d6UL |
149 | 140 |
150 /* As pointed out by Wei Dai <weidai@eskimo.com>, F() below can be | 141 /* As pointed out by Wei Dai <weidai@eskimo.com>, F() below can be |
151 * simplified to the code in F_00_19. Wei attributes these optimisations | 142 * simplified to the code in F_00_19. Wei attributes these optimisations |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
437 B=c->h1; | 428 B=c->h1; |
438 C=c->h2; | 429 C=c->h2; |
439 D=c->h3; | 430 D=c->h3; |
440 E=c->h4; | 431 E=c->h4; |
441 | 432 |
442 } | 433 } |
443 } | 434 } |
444 #endif | 435 #endif |
445 | 436 |
446 #endif | 437 #endif |
OLD | NEW |