diff -r 18f64da82512 -r fa985af77159 ssl/libcrypto/src/crypto/sha/sha.h --- a/ssl/libcrypto/src/crypto/sha/sha.h Sat Feb 20 00:31:00 2010 +0200 +++ b/ssl/libcrypto/src/crypto/sha/sha.h Fri Mar 12 15:50:56 2010 +0200 @@ -56,7 +56,7 @@ * [including the GNU Public Licence.] */ /* - © Portions copyright (c) 2006 Nokia Corporation. All rights reserved. + © Portions copyright (c) 2006-2010 Nokia Corporation. All rights reserved. */ #ifndef HEADER_SHA_H @@ -129,6 +129,85 @@ IMPORT_C unsigned char *SHA1(const unsigned char *d, size_t n, unsigned char *md); IMPORT_C void SHA1_Transform(SHA_CTX *c, const unsigned char *data); #endif + +#define SHA256_CBLOCK (SHA_LBLOCK*4) /* SHA-256 treats input data as a + * contiguous array of 32 bit + * wide big-endian values. */ +#define SHA224_DIGEST_LENGTH 28 +#define SHA256_DIGEST_LENGTH 32 + +typedef struct SHA256state_st + { + SHA_LONG h[8]; + SHA_LONG Nl,Nh; + SHA_LONG data[SHA_LBLOCK]; + unsigned int num,md_len; + } SHA256_CTX; + +#ifndef OPENSSL_NO_SHA256 +IMPORT_C int SHA224_Init(SHA256_CTX *c); +IMPORT_C int SHA224_Update(SHA256_CTX *c, const void *data, size_t len); +IMPORT_C int SHA224_Final(unsigned char *md, SHA256_CTX *c); +IMPORT_C unsigned char *SHA224(const unsigned char *d, size_t n,unsigned char *md); +IMPORT_C int SHA256_Init(SHA256_CTX *c); +IMPORT_C int SHA256_Update(SHA256_CTX *c, const void *data, size_t len); +IMPORT_C int SHA256_Final(unsigned char *md, SHA256_CTX *c); +IMPORT_C unsigned char *SHA256(const unsigned char *d, size_t n,unsigned char *md); +IMPORT_C void SHA256_Transform(SHA256_CTX *c, const unsigned char *data); +#endif + +#define SHA384_DIGEST_LENGTH 48 +#define SHA512_DIGEST_LENGTH 64 + +#ifndef OPENSSL_NO_SHA512 +/* + * Unlike 32-bit digest algorithms, SHA-512 *relies* on SHA_LONG64 + * being exactly 64-bit wide. See Implementation Notes in sha512.c + * for further details. + */ +#define SHA512_CBLOCK (SHA_LBLOCK*8) /* SHA-512 treats input data as a + * contiguous array of 64 bit + * wide big-endian values. */ +#ifdef SYMBIAN +#define SHA_LONG64 TUint64 +#define U64(C) C##ULL +#else +#if (defined(_WIN32) || defined(_WIN64)) && !defined(__MINGW32__) +#define SHA_LONG64 unsigned __int64 +#define U64(C) C##UI64 +#elif defined(__arch64__) +#define SHA_LONG64 unsigned long +#define U64(C) C##UL +#else +#define SHA_LONG64 unsigned long long +#define U64(C) C##ULL +#endif +#endif + +typedef struct SHA512state_st + { + SHA_LONG64 h[8]; + SHA_LONG64 Nl,Nh; + union { + SHA_LONG64 d[SHA_LBLOCK]; + unsigned char p[SHA512_CBLOCK]; + } u; + unsigned int num,md_len; + } SHA512_CTX; +#endif + +#ifndef OPENSSL_NO_SHA512 +IMPORT_C int SHA384_Init(SHA512_CTX *c); +IMPORT_C int SHA384_Update(SHA512_CTX *c, const void *data, size_t len); +IMPORT_C int SHA384_Final(unsigned char *md, SHA512_CTX *c); +IMPORT_C unsigned char *SHA384(const unsigned char *d, size_t n,unsigned char *md); +IMPORT_C int SHA512_Init(SHA512_CTX *c); +IMPORT_C int SHA512_Update(SHA512_CTX *c, const void *data, size_t len); +IMPORT_C int SHA512_Final(unsigned char *md, SHA512_CTX *c); +IMPORT_C unsigned char *SHA512(const unsigned char *d, size_t n,unsigned char *md); +IMPORT_C void SHA512_Transform(SHA512_CTX *c, const unsigned char *data); +#endif + #ifdef __cplusplus } #endif