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 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 | 389 |
390 SECStatus | 390 SECStatus |
391 SHA1_HashBuf(unsigned char *dest, const unsigned char *src, uint32 src_length) | 391 SHA1_HashBuf(unsigned char *dest, const unsigned char *src, uint32 src_length) |
392 { | 392 { |
393 SHA1Context ctx; | 393 SHA1Context ctx; |
394 unsigned int outLen; | 394 unsigned int outLen; |
395 | 395 |
396 SHA1_Begin(&ctx); | 396 SHA1_Begin(&ctx); |
397 SHA1_Update(&ctx, src, src_length); | 397 SHA1_Update(&ctx, src, src_length); |
398 SHA1_End(&ctx, dest, &outLen, SHA1_LENGTH); | 398 SHA1_End(&ctx, dest, &outLen, SHA1_LENGTH); |
| 399 memset(&ctx, 0, sizeof ctx); |
399 return SECSuccess; | 400 return SECSuccess; |
400 } | 401 } |
401 | 402 |
402 /* Hash a null-terminated character string. */ | 403 /* Hash a null-terminated character string. */ |
403 SECStatus | 404 SECStatus |
404 SHA1_Hash(unsigned char *dest, const char *src) | 405 SHA1_Hash(unsigned char *dest, const char *src) |
405 { | 406 { |
406 return SHA1_HashBuf(dest, (const unsigned char *)src, PORT_Strlen (src)); | 407 return SHA1_HashBuf(dest, (const unsigned char *)src, PORT_Strlen (src)); |
407 } | 408 } |
408 | 409 |
(...skipping 27 matching lines...) Expand all Loading... |
436 void SHA1_Clone(SHA1Context *dest, SHA1Context *src) | 437 void SHA1_Clone(SHA1Context *dest, SHA1Context *src) |
437 { | 438 { |
438 memcpy(dest, src, sizeof *dest); | 439 memcpy(dest, src, sizeof *dest); |
439 } | 440 } |
440 | 441 |
441 void | 442 void |
442 SHA1_TraceState(SHA1Context *ctx) | 443 SHA1_TraceState(SHA1Context *ctx) |
443 { | 444 { |
444 PORT_SetError(PR_NOT_IMPLEMENTED_ERROR); | 445 PORT_SetError(PR_NOT_IMPLEMENTED_ERROR); |
445 } | 446 } |
OLD | NEW |