X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=crypto%2Fsha%2Fsha.h;h=3fd54a10cc7ca6f418def5f99de804bf28ca402e;hb=02cbedc387e5f6aee8886a02e64db9bb42f73ff7;hp=9e22fa87c01d6827fd57caca02d4f2461ad58202;hpb=eda1f21f1af8b6f77327e7b37573af9c1ba73726;p=oweals%2Fopenssl.git diff --git a/crypto/sha/sha.h b/crypto/sha/sha.h index 9e22fa87c0..3fd54a10cc 100644 --- a/crypto/sha/sha.h +++ b/crypto/sha/sha.h @@ -1,5 +1,5 @@ /* crypto/sha/sha.h */ -/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written @@ -59,45 +59,61 @@ #ifndef HEADER_SHA_H #define HEADER_SHA_H +#include + #ifdef __cplusplus extern "C" { #endif -#define SHA_CBLOCK 64 +#if defined(OPENSSL_NO_SHA) || (defined(OPENSSL_NO_SHA0) && defined(OPENSSL_NO_SHA1)) +#error SHA is disabled. +#endif + +/* + * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + * ! SHA_LONG has to be at least 32 bits wide. If it's wider, then ! + * ! SHA_LONG_LOG2 has to be defined along. ! + * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + */ + +#if defined(OPENSSL_SYS_WIN16) || defined(__LP32__) +#define SHA_LONG unsigned long +#elif defined(OPENSSL_SYS_CRAY) || defined(__ILP64__) +#define SHA_LONG unsigned long +#define SHA_LONG_LOG2 3 +#else +#define SHA_LONG unsigned int +#endif + #define SHA_LBLOCK 16 -#define SHA_BLOCK 16 -#define SHA_LAST_BLOCK 56 -#define SHA_LENGTH_BLOCK 8 +#define SHA_CBLOCK (SHA_LBLOCK*4) /* SHA treats input data as a + * contiguous array of 32 bit + * wide big-endian values. */ +#define SHA_LAST_BLOCK (SHA_CBLOCK-8) #define SHA_DIGEST_LENGTH 20 typedef struct SHAstate_st { - unsigned long h0,h1,h2,h3,h4; - unsigned long Nl,Nh; - unsigned long data[SHA_LBLOCK]; + SHA_LONG h0,h1,h2,h3,h4; + SHA_LONG Nl,Nh; + SHA_LONG data[SHA_LBLOCK]; int num; } SHA_CTX; -#ifndef NOPROTO -void SHA_Init(SHA_CTX *c); -void SHA_Update(SHA_CTX *c, unsigned char *data, unsigned long len); -void SHA_Final(unsigned char *md, SHA_CTX *c); -unsigned char *SHA(unsigned char *d, unsigned long n,unsigned char *md); -void SHA1_Init(SHA_CTX *c); -void SHA1_Update(SHA_CTX *c, unsigned char *data, unsigned long len); -void SHA1_Final(unsigned char *md, SHA_CTX *c); -unsigned char *SHA1(unsigned char *d, unsigned long n,unsigned char *md); -#else -void SHA_Init(); -void SHA_Update(); -void SHA_Final(); -unsigned char *SHA(); -void SHA1_Init(); -void SHA1_Update(); -void SHA1_Final(); -unsigned char *SHA1(); +#ifndef OPENSSL_NO_SHA0 +int SHA_Init(SHA_CTX *c); +int SHA_Update(SHA_CTX *c, const void *data, unsigned long len); +int SHA_Final(unsigned char *md, SHA_CTX *c); +unsigned char *SHA(const unsigned char *d, unsigned long n,unsigned char *md); +void SHA_Transform(SHA_CTX *c, const unsigned char *data); +#endif +#ifndef OPENSSL_NO_SHA1 +int SHA1_Init(SHA_CTX *c); +int SHA1_Update(SHA_CTX *c, const void *data, unsigned long len); +int SHA1_Final(unsigned char *md, SHA_CTX *c); +unsigned char *SHA1(const unsigned char *d, unsigned long n,unsigned char *md); +void SHA1_Transform(SHA_CTX *c, const unsigned char *data); #endif - #ifdef __cplusplus } #endif