| OLD | NEW |
| 1 /* crypto/sha/sha1_one.c */ | 1 /* crypto/sha/sha1_one.c */ |
| 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 * derivative of this code cannot be changed. i.e. this code cannot simply be | 54 * derivative of this code cannot be changed. i.e. this code cannot simply be |
| 55 * copied and put under another distribution licence | 55 * copied and put under another distribution licence |
| 56 * [including the GNU Public Licence.] | 56 * [including the GNU Public Licence.] |
| 57 */ | 57 */ |
| 58 | 58 |
| 59 #include <stdio.h> | 59 #include <stdio.h> |
| 60 #include <string.h> | 60 #include <string.h> |
| 61 #include <openssl/sha.h> | 61 #include <openssl/sha.h> |
| 62 #include <openssl/crypto.h> | 62 #include <openssl/crypto.h> |
| 63 | 63 |
| 64 #if !defined(OPENSSL_NO_SHA1) | 64 #ifndef OPENSSL_NO_SHA1 |
| 65 unsigned char *SHA1(const unsigned char *d, size_t n, unsigned char *md) | 65 unsigned char *SHA1(const unsigned char *d, size_t n, unsigned char *md) |
| 66 { | 66 { |
| 67 SHA_CTX c; | 67 SHA_CTX c; |
| 68 static unsigned char m[SHA_DIGEST_LENGTH]; | 68 static unsigned char m[SHA_DIGEST_LENGTH]; |
| 69 | 69 |
| 70 if (md == NULL) md=m; | 70 if (md == NULL) md=m; |
| 71 if (!SHA1_Init(&c)) | 71 if (!SHA1_Init(&c)) |
| 72 return NULL; | 72 return NULL; |
| 73 SHA1_Update(&c,d,n); | 73 SHA1_Update(&c,d,n); |
| 74 SHA1_Final(md,&c); | 74 SHA1_Final(md,&c); |
| 75 OPENSSL_cleanse(&c,sizeof(c)); | 75 OPENSSL_cleanse(&c,sizeof(c)); |
| 76 return(md); | 76 return(md); |
| 77 } | 77 } |
| 78 #endif | 78 #endif |
| OLD | NEW |