| 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 #ifdef FREEBL_NO_DEPEND | 5 #ifdef FREEBL_NO_DEPEND |
| 6 #include "stubs.h" | 6 #include "stubs.h" |
| 7 #endif | 7 #endif |
| 8 | 8 |
| 9 #include <memory.h> | 9 #include <memory.h> |
| 10 #include "blapi.h" | 10 #include "blapi.h" |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 | 141 |
| 142 /* | 142 /* |
| 143 * SHA: Generate hash value from context | 143 * SHA: Generate hash value from context |
| 144 */ | 144 */ |
| 145 void | 145 void |
| 146 SHA1_End(SHA1Context *ctx, unsigned char *hashout, | 146 SHA1_End(SHA1Context *ctx, unsigned char *hashout, |
| 147 unsigned int *pDigestLen, unsigned int maxDigestLen) | 147 unsigned int *pDigestLen, unsigned int maxDigestLen) |
| 148 { | 148 { |
| 149 register PRUint64 size; | 149 register PRUint64 size; |
| 150 register PRUint32 lenB; | 150 register PRUint32 lenB; |
| 151 PRUint32 tmpbuf[5]; | |
| 152 | 151 |
| 153 static const unsigned char bulk_pad[64] = { 0x80,0,0,0,0,0,0,0,0,0, | 152 static const unsigned char bulk_pad[64] = { 0x80,0,0,0,0,0,0,0,0,0, |
| 154 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, | 153 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
| 155 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }; | 154 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }; |
| 156 #define tmp lenB | 155 #define tmp lenB |
| 157 | 156 |
| 158 PORT_Assert (maxDigestLen >= SHA1_LENGTH); | 157 PORT_Assert (maxDigestLen >= SHA1_LENGTH); |
| 159 | 158 |
| 160 /* | 159 /* |
| 161 * Pad with a binary 1 (e.g. 0x80), then zeroes, then length in bits | 160 * Pad with a binary 1 (e.g. 0x80), then zeroes, then length in bits |
| (...skipping 19 matching lines...) Expand all Loading... |
| 181 #undef tmp | 180 #undef tmp |
| 182 } | 181 } |
| 183 | 182 |
| 184 void | 183 void |
| 185 SHA1_EndRaw(SHA1Context *ctx, unsigned char *hashout, | 184 SHA1_EndRaw(SHA1Context *ctx, unsigned char *hashout, |
| 186 unsigned int *pDigestLen, unsigned int maxDigestLen) | 185 unsigned int *pDigestLen, unsigned int maxDigestLen) |
| 187 { | 186 { |
| 188 #if defined(SHA_NEED_TMP_VARIABLE) | 187 #if defined(SHA_NEED_TMP_VARIABLE) |
| 189 register PRUint32 tmp; | 188 register PRUint32 tmp; |
| 190 #endif | 189 #endif |
| 191 PRUint32 tmpbuf[5]; | |
| 192 PORT_Assert (maxDigestLen >= SHA1_LENGTH); | 190 PORT_Assert (maxDigestLen >= SHA1_LENGTH); |
| 193 | 191 |
| 194 SHA_STORE_RESULT; | 192 SHA_STORE_RESULT; |
| 195 if (pDigestLen) | 193 if (pDigestLen) |
| 196 *pDigestLen = SHA1_LENGTH; | 194 *pDigestLen = SHA1_LENGTH; |
| 197 } | 195 } |
| 198 | 196 |
| 199 #undef B | 197 #undef B |
| 200 /* | 198 /* |
| 201 * SHA: Compression function, unrolled. | 199 * SHA: Compression function, unrolled. |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 454 void SHA1_Clone(SHA1Context *dest, SHA1Context *src) | 452 void SHA1_Clone(SHA1Context *dest, SHA1Context *src) |
| 455 { | 453 { |
| 456 memcpy(dest, src, sizeof *dest); | 454 memcpy(dest, src, sizeof *dest); |
| 457 } | 455 } |
| 458 | 456 |
| 459 void | 457 void |
| 460 SHA1_TraceState(SHA1Context *ctx) | 458 SHA1_TraceState(SHA1Context *ctx) |
| 461 { | 459 { |
| 462 PORT_SetError(PR_NOT_IMPLEMENTED_ERROR); | 460 PORT_SetError(PR_NOT_IMPLEMENTED_ERROR); |
| 463 } | 461 } |
| OLD | NEW |