OLD | NEW |
1 /* This Source Code Form is subject to the terms of the Mozilla Public | 1 /* This Source Code Form is subject to the terms of the Mozilla Public |
2 * License, v. 2.0. If a copy of the MPL was not distributed with this | 2 * License, v. 2.0. If a copy of the MPL was not distributed with this |
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
4 | 4 |
5 #ifndef _SHA_FAST_H_ | 5 #ifndef _SHA_FAST_H_ |
6 #define _SHA_FAST_H_ | 6 #define _SHA_FAST_H_ |
7 | 7 |
8 #include "prlong.h" | 8 #include "prlong.h" |
9 | 9 |
10 #define SHA1_INPUT_LEN 64 | 10 #define SHA1_INPUT_LEN 64 |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 | 140 |
141 #elif defined(IS_LITTLE_ENDIAN) || defined( SHA1_USING_64_BIT ) | 141 #elif defined(IS_LITTLE_ENDIAN) || defined( SHA1_USING_64_BIT ) |
142 #define SHA_STORE_RESULT \ | 142 #define SHA_STORE_RESULT \ |
143 if (!((ptrdiff_t)hashout % sizeof(PRUint32))) { \ | 143 if (!((ptrdiff_t)hashout % sizeof(PRUint32))) { \ |
144 SHA_STORE(0); \ | 144 SHA_STORE(0); \ |
145 SHA_STORE(1); \ | 145 SHA_STORE(1); \ |
146 SHA_STORE(2); \ | 146 SHA_STORE(2); \ |
147 SHA_STORE(3); \ | 147 SHA_STORE(3); \ |
148 SHA_STORE(4); \ | 148 SHA_STORE(4); \ |
149 } else { \ | 149 } else { \ |
150 ctx->u.w[0] = SHA_HTONL(ctx->H[0]); \ | 150 tmpbuf[0] = SHA_HTONL(ctx->H[0]); \ |
151 ctx->u.w[1] = SHA_HTONL(ctx->H[1]); \ | 151 tmpbuf[1] = SHA_HTONL(ctx->H[1]); \ |
152 ctx->u.w[2] = SHA_HTONL(ctx->H[2]); \ | 152 tmpbuf[2] = SHA_HTONL(ctx->H[2]); \ |
153 ctx->u.w[3] = SHA_HTONL(ctx->H[3]); \ | 153 tmpbuf[3] = SHA_HTONL(ctx->H[3]); \ |
154 ctx->u.w[4] = SHA_HTONL(ctx->H[4]); \ | 154 tmpbuf[4] = SHA_HTONL(ctx->H[4]); \ |
155 memcpy(hashout, ctx->u.w, SHA1_LENGTH); \ | 155 memcpy(hashout, tmpbuf, SHA1_LENGTH); \ |
156 } | 156 } |
157 | 157 |
158 #else | 158 #else |
159 #define SHA_STORE_RESULT \ | 159 #define SHA_STORE_RESULT \ |
160 if (!((ptrdiff_t)hashout % sizeof(PRUint32))) { \ | 160 if (!((ptrdiff_t)hashout % sizeof(PRUint32))) { \ |
161 SHA_STORE(0); \ | 161 SHA_STORE(0); \ |
162 SHA_STORE(1); \ | 162 SHA_STORE(1); \ |
163 SHA_STORE(2); \ | 163 SHA_STORE(2); \ |
164 SHA_STORE(3); \ | 164 SHA_STORE(3); \ |
165 SHA_STORE(4); \ | 165 SHA_STORE(4); \ |
166 } else { \ | 166 } else { \ |
167 memcpy(hashout, ctx->H, SHA1_LENGTH); \ | 167 memcpy(hashout, ctx->H, SHA1_LENGTH); \ |
168 } | 168 } |
169 #endif | 169 #endif |
170 | 170 |
171 #endif /* _SHA_FAST_H_ */ | 171 #endif /* _SHA_FAST_H_ */ |
OLD | NEW |