diff options
Diffstat (limited to 'src/lib/libcrypto/sha/sha.h')
-rw-r--r-- | src/lib/libcrypto/sha/sha.h | 90 |
1 files changed, 9 insertions, 81 deletions
diff --git a/src/lib/libcrypto/sha/sha.h b/src/lib/libcrypto/sha/sha.h index eed44d7f94..79c07b0fd1 100644 --- a/src/lib/libcrypto/sha/sha.h +++ b/src/lib/libcrypto/sha/sha.h | |||
@@ -60,7 +60,6 @@ | |||
60 | #define HEADER_SHA_H | 60 | #define HEADER_SHA_H |
61 | 61 | ||
62 | #include <openssl/e_os2.h> | 62 | #include <openssl/e_os2.h> |
63 | #include <stddef.h> | ||
64 | 63 | ||
65 | #ifdef __cplusplus | 64 | #ifdef __cplusplus |
66 | extern "C" { | 65 | extern "C" { |
@@ -71,7 +70,7 @@ extern "C" { | |||
71 | #endif | 70 | #endif |
72 | 71 | ||
73 | #if defined(OPENSSL_FIPS) | 72 | #if defined(OPENSSL_FIPS) |
74 | #define FIPS_SHA_SIZE_T size_t | 73 | #define FIPS_SHA_SIZE_T unsigned long |
75 | #endif | 74 | #endif |
76 | 75 | ||
77 | /* | 76 | /* |
@@ -102,97 +101,26 @@ typedef struct SHAstate_st | |||
102 | SHA_LONG h0,h1,h2,h3,h4; | 101 | SHA_LONG h0,h1,h2,h3,h4; |
103 | SHA_LONG Nl,Nh; | 102 | SHA_LONG Nl,Nh; |
104 | SHA_LONG data[SHA_LBLOCK]; | 103 | SHA_LONG data[SHA_LBLOCK]; |
105 | unsigned int num; | 104 | int num; |
106 | } SHA_CTX; | 105 | } SHA_CTX; |
107 | 106 | ||
108 | #ifndef OPENSSL_NO_SHA0 | 107 | #ifndef OPENSSL_NO_SHA0 |
108 | #ifdef OPENSSL_FIPS | ||
109 | int private_SHA_Init(SHA_CTX *c); | ||
110 | #endif | ||
109 | int SHA_Init(SHA_CTX *c); | 111 | int SHA_Init(SHA_CTX *c); |
110 | int SHA_Update(SHA_CTX *c, const void *data, size_t len); | 112 | int SHA_Update(SHA_CTX *c, const void *data, unsigned long len); |
111 | int SHA_Final(unsigned char *md, SHA_CTX *c); | 113 | int SHA_Final(unsigned char *md, SHA_CTX *c); |
112 | unsigned char *SHA(const unsigned char *d, size_t n, unsigned char *md); | 114 | unsigned char *SHA(const unsigned char *d, unsigned long n,unsigned char *md); |
113 | void SHA_Transform(SHA_CTX *c, const unsigned char *data); | 115 | void SHA_Transform(SHA_CTX *c, const unsigned char *data); |
114 | #endif | 116 | #endif |
115 | #ifndef OPENSSL_NO_SHA1 | 117 | #ifndef OPENSSL_NO_SHA1 |
116 | int SHA1_Init(SHA_CTX *c); | 118 | int SHA1_Init(SHA_CTX *c); |
117 | int SHA1_Update(SHA_CTX *c, const void *data, size_t len); | 119 | int SHA1_Update(SHA_CTX *c, const void *data, unsigned long len); |
118 | int SHA1_Final(unsigned char *md, SHA_CTX *c); | 120 | int SHA1_Final(unsigned char *md, SHA_CTX *c); |
119 | unsigned char *SHA1(const unsigned char *d, size_t n, unsigned char *md); | 121 | unsigned char *SHA1(const unsigned char *d, unsigned long n,unsigned char *md); |
120 | void SHA1_Transform(SHA_CTX *c, const unsigned char *data); | 122 | void SHA1_Transform(SHA_CTX *c, const unsigned char *data); |
121 | #endif | 123 | #endif |
122 | |||
123 | #define SHA256_CBLOCK (SHA_LBLOCK*4) /* SHA-256 treats input data as a | ||
124 | * contiguous array of 32 bit | ||
125 | * wide big-endian values. */ | ||
126 | #define SHA224_DIGEST_LENGTH 28 | ||
127 | #define SHA256_DIGEST_LENGTH 32 | ||
128 | |||
129 | typedef struct SHA256state_st | ||
130 | { | ||
131 | SHA_LONG h[8]; | ||
132 | SHA_LONG Nl,Nh; | ||
133 | SHA_LONG data[SHA_LBLOCK]; | ||
134 | unsigned int num,md_len; | ||
135 | } SHA256_CTX; | ||
136 | |||
137 | #ifndef OPENSSL_NO_SHA256 | ||
138 | int SHA224_Init(SHA256_CTX *c); | ||
139 | int SHA224_Update(SHA256_CTX *c, const void *data, size_t len); | ||
140 | int SHA224_Final(unsigned char *md, SHA256_CTX *c); | ||
141 | unsigned char *SHA224(const unsigned char *d, size_t n,unsigned char *md); | ||
142 | int SHA256_Init(SHA256_CTX *c); | ||
143 | int SHA256_Update(SHA256_CTX *c, const void *data, size_t len); | ||
144 | int SHA256_Final(unsigned char *md, SHA256_CTX *c); | ||
145 | unsigned char *SHA256(const unsigned char *d, size_t n,unsigned char *md); | ||
146 | void SHA256_Transform(SHA256_CTX *c, const unsigned char *data); | ||
147 | #endif | ||
148 | |||
149 | #define SHA384_DIGEST_LENGTH 48 | ||
150 | #define SHA512_DIGEST_LENGTH 64 | ||
151 | |||
152 | #ifndef OPENSSL_NO_SHA512 | ||
153 | /* | ||
154 | * Unlike 32-bit digest algorithms, SHA-512 *relies* on SHA_LONG64 | ||
155 | * being exactly 64-bit wide. See Implementation Notes in sha512.c | ||
156 | * for further details. | ||
157 | */ | ||
158 | #define SHA512_CBLOCK (SHA_LBLOCK*8) /* SHA-512 treats input data as a | ||
159 | * contiguous array of 64 bit | ||
160 | * wide big-endian values. */ | ||
161 | #if (defined(_WIN32) || defined(_WIN64)) && !defined(__MINGW32__) | ||
162 | #define SHA_LONG64 unsigned __int64 | ||
163 | #define U64(C) C##UI64 | ||
164 | #elif defined(__arch64__) | ||
165 | #define SHA_LONG64 unsigned long | ||
166 | #define U64(C) C##UL | ||
167 | #else | ||
168 | #define SHA_LONG64 unsigned long long | ||
169 | #define U64(C) C##ULL | ||
170 | #endif | ||
171 | |||
172 | typedef struct SHA512state_st | ||
173 | { | ||
174 | SHA_LONG64 h[8]; | ||
175 | SHA_LONG64 Nl,Nh; | ||
176 | union { | ||
177 | SHA_LONG64 d[SHA_LBLOCK]; | ||
178 | unsigned char p[SHA512_CBLOCK]; | ||
179 | } u; | ||
180 | unsigned int num,md_len; | ||
181 | } SHA512_CTX; | ||
182 | #endif | ||
183 | |||
184 | #ifndef OPENSSL_NO_SHA512 | ||
185 | int SHA384_Init(SHA512_CTX *c); | ||
186 | int SHA384_Update(SHA512_CTX *c, const void *data, size_t len); | ||
187 | int SHA384_Final(unsigned char *md, SHA512_CTX *c); | ||
188 | unsigned char *SHA384(const unsigned char *d, size_t n,unsigned char *md); | ||
189 | int SHA512_Init(SHA512_CTX *c); | ||
190 | int SHA512_Update(SHA512_CTX *c, const void *data, size_t len); | ||
191 | int SHA512_Final(unsigned char *md, SHA512_CTX *c); | ||
192 | unsigned char *SHA512(const unsigned char *d, size_t n,unsigned char *md); | ||
193 | void SHA512_Transform(SHA512_CTX *c, const unsigned char *data); | ||
194 | #endif | ||
195 | |||
196 | #ifdef __cplusplus | 124 | #ifdef __cplusplus |
197 | } | 125 | } |
198 | #endif | 126 | #endif |