diff options
Diffstat (limited to 'src/lib/libcrypto/sha/sha.h')
-rw-r--r-- | src/lib/libcrypto/sha/sha.h | 72 |
1 files changed, 42 insertions, 30 deletions
diff --git a/src/lib/libcrypto/sha/sha.h b/src/lib/libcrypto/sha/sha.h index 4cf0ea0225..3fd54a10cc 100644 --- a/src/lib/libcrypto/sha/sha.h +++ b/src/lib/libcrypto/sha/sha.h | |||
@@ -59,49 +59,61 @@ | |||
59 | #ifndef HEADER_SHA_H | 59 | #ifndef HEADER_SHA_H |
60 | #define HEADER_SHA_H | 60 | #define HEADER_SHA_H |
61 | 61 | ||
62 | #include <openssl/e_os2.h> | ||
63 | |||
62 | #ifdef __cplusplus | 64 | #ifdef __cplusplus |
63 | extern "C" { | 65 | extern "C" { |
64 | #endif | 66 | #endif |
65 | 67 | ||
66 | #define SHA_CBLOCK 64 | 68 | #if defined(OPENSSL_NO_SHA) || (defined(OPENSSL_NO_SHA0) && defined(OPENSSL_NO_SHA1)) |
69 | #error SHA is disabled. | ||
70 | #endif | ||
71 | |||
72 | /* | ||
73 | * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
74 | * ! SHA_LONG has to be at least 32 bits wide. If it's wider, then ! | ||
75 | * ! SHA_LONG_LOG2 has to be defined along. ! | ||
76 | * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
77 | */ | ||
78 | |||
79 | #if defined(OPENSSL_SYS_WIN16) || defined(__LP32__) | ||
80 | #define SHA_LONG unsigned long | ||
81 | #elif defined(OPENSSL_SYS_CRAY) || defined(__ILP64__) | ||
82 | #define SHA_LONG unsigned long | ||
83 | #define SHA_LONG_LOG2 3 | ||
84 | #else | ||
85 | #define SHA_LONG unsigned int | ||
86 | #endif | ||
87 | |||
67 | #define SHA_LBLOCK 16 | 88 | #define SHA_LBLOCK 16 |
68 | #define SHA_BLOCK 16 | 89 | #define SHA_CBLOCK (SHA_LBLOCK*4) /* SHA treats input data as a |
69 | #define SHA_LAST_BLOCK 56 | 90 | * contiguous array of 32 bit |
70 | #define SHA_LENGTH_BLOCK 8 | 91 | * wide big-endian values. */ |
92 | #define SHA_LAST_BLOCK (SHA_CBLOCK-8) | ||
71 | #define SHA_DIGEST_LENGTH 20 | 93 | #define SHA_DIGEST_LENGTH 20 |
72 | 94 | ||
73 | typedef struct SHAstate_st | 95 | typedef struct SHAstate_st |
74 | { | 96 | { |
75 | unsigned long h0,h1,h2,h3,h4; | 97 | SHA_LONG h0,h1,h2,h3,h4; |
76 | unsigned long Nl,Nh; | 98 | SHA_LONG Nl,Nh; |
77 | unsigned long data[SHA_LBLOCK]; | 99 | SHA_LONG data[SHA_LBLOCK]; |
78 | int num; | 100 | int num; |
79 | } SHA_CTX; | 101 | } SHA_CTX; |
80 | 102 | ||
81 | #ifndef NOPROTO | 103 | #ifndef OPENSSL_NO_SHA0 |
82 | void SHA_Init(SHA_CTX *c); | 104 | int SHA_Init(SHA_CTX *c); |
83 | void SHA_Update(SHA_CTX *c, unsigned char *data, unsigned long len); | 105 | int SHA_Update(SHA_CTX *c, const void *data, unsigned long len); |
84 | void SHA_Final(unsigned char *md, SHA_CTX *c); | 106 | int SHA_Final(unsigned char *md, SHA_CTX *c); |
85 | unsigned char *SHA(unsigned char *d, unsigned long n,unsigned char *md); | 107 | unsigned char *SHA(const unsigned char *d, unsigned long n,unsigned char *md); |
86 | void SHA_Transform(SHA_CTX *c, unsigned char *data); | 108 | void SHA_Transform(SHA_CTX *c, const unsigned char *data); |
87 | void SHA1_Init(SHA_CTX *c); | 109 | #endif |
88 | void SHA1_Update(SHA_CTX *c, unsigned char *data, unsigned long len); | 110 | #ifndef OPENSSL_NO_SHA1 |
89 | void SHA1_Final(unsigned char *md, SHA_CTX *c); | 111 | int SHA1_Init(SHA_CTX *c); |
90 | unsigned char *SHA1(unsigned char *d, unsigned long n,unsigned char *md); | 112 | int SHA1_Update(SHA_CTX *c, const void *data, unsigned long len); |
91 | void SHA1_Transform(SHA_CTX *c, unsigned char *data); | 113 | int SHA1_Final(unsigned char *md, SHA_CTX *c); |
92 | #else | 114 | unsigned char *SHA1(const unsigned char *d, unsigned long n,unsigned char *md); |
93 | void SHA_Init(); | 115 | void SHA1_Transform(SHA_CTX *c, const unsigned char *data); |
94 | void SHA_Update(); | ||
95 | void SHA_Final(); | ||
96 | unsigned char *SHA(); | ||
97 | void SHA_Transform(); | ||
98 | void SHA1_Init(); | ||
99 | void SHA1_Update(); | ||
100 | void SHA1_Final(); | ||
101 | unsigned char *SHA1(); | ||
102 | void SHA1_Transform(); | ||
103 | #endif | 116 | #endif |
104 | |||
105 | #ifdef __cplusplus | 117 | #ifdef __cplusplus |
106 | } | 118 | } |
107 | #endif | 119 | #endif |