| 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 PRUint32 tmpbuf[5]; \ |
| 150 tmpbuf[0] = SHA_HTONL(ctx->H[0]); \ | 151 tmpbuf[0] = SHA_HTONL(ctx->H[0]); \ |
| 151 tmpbuf[1] = SHA_HTONL(ctx->H[1]); \ | 152 tmpbuf[1] = SHA_HTONL(ctx->H[1]); \ |
| 152 tmpbuf[2] = SHA_HTONL(ctx->H[2]); \ | 153 tmpbuf[2] = SHA_HTONL(ctx->H[2]); \ |
| 153 tmpbuf[3] = SHA_HTONL(ctx->H[3]); \ | 154 tmpbuf[3] = SHA_HTONL(ctx->H[3]); \ |
| 154 tmpbuf[4] = SHA_HTONL(ctx->H[4]); \ | 155 tmpbuf[4] = SHA_HTONL(ctx->H[4]); \ |
| 155 memcpy(hashout, tmpbuf, SHA1_LENGTH); \ | 156 memcpy(hashout, tmpbuf, SHA1_LENGTH); \ |
| 156 } | 157 } |
| 157 | 158 |
| 158 #else | 159 #else |
| 159 #define SHA_STORE_RESULT \ | 160 #define SHA_STORE_RESULT \ |
| 160 if (!((ptrdiff_t)hashout % sizeof(PRUint32))) { \ | 161 if (!((ptrdiff_t)hashout % sizeof(PRUint32))) { \ |
| 161 SHA_STORE(0); \ | 162 SHA_STORE(0); \ |
| 162 SHA_STORE(1); \ | 163 SHA_STORE(1); \ |
| 163 SHA_STORE(2); \ | 164 SHA_STORE(2); \ |
| 164 SHA_STORE(3); \ | 165 SHA_STORE(3); \ |
| 165 SHA_STORE(4); \ | 166 SHA_STORE(4); \ |
| 166 } else { \ | 167 } else { \ |
| 167 memcpy(hashout, ctx->H, SHA1_LENGTH); \ | 168 memcpy(hashout, ctx->H, SHA1_LENGTH); \ |
| 168 } | 169 } |
| 169 #endif | 170 #endif |
| 170 | 171 |
| 171 #endif /* _SHA_FAST_H_ */ | 172 #endif /* _SHA_FAST_H_ */ |
| OLD | NEW |