summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/sha/sha.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/sha/sha.h')
-rw-r--r--src/lib/libcrypto/sha/sha.h72
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
63extern "C" { 65extern "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
73typedef struct SHAstate_st 95typedef 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
82void SHA_Init(SHA_CTX *c); 104int SHA_Init(SHA_CTX *c);
83void SHA_Update(SHA_CTX *c, unsigned char *data, unsigned long len); 105int SHA_Update(SHA_CTX *c, const void *data, unsigned long len);
84void SHA_Final(unsigned char *md, SHA_CTX *c); 106int SHA_Final(unsigned char *md, SHA_CTX *c);
85unsigned char *SHA(unsigned char *d, unsigned long n,unsigned char *md); 107unsigned char *SHA(const unsigned char *d, unsigned long n,unsigned char *md);
86void SHA_Transform(SHA_CTX *c, unsigned char *data); 108void SHA_Transform(SHA_CTX *c, const unsigned char *data);
87void SHA1_Init(SHA_CTX *c); 109#endif
88void SHA1_Update(SHA_CTX *c, unsigned char *data, unsigned long len); 110#ifndef OPENSSL_NO_SHA1
89void SHA1_Final(unsigned char *md, SHA_CTX *c); 111int SHA1_Init(SHA_CTX *c);
90unsigned char *SHA1(unsigned char *d, unsigned long n,unsigned char *md); 112int SHA1_Update(SHA_CTX *c, const void *data, unsigned long len);
91void SHA1_Transform(SHA_CTX *c, unsigned char *data); 113int SHA1_Final(unsigned char *md, SHA_CTX *c);
92#else 114unsigned char *SHA1(const unsigned char *d, unsigned long n,unsigned char *md);
93void SHA_Init(); 115void SHA1_Transform(SHA_CTX *c, const unsigned char *data);
94void SHA_Update();
95void SHA_Final();
96unsigned char *SHA();
97void SHA_Transform();
98void SHA1_Init();
99void SHA1_Update();
100void SHA1_Final();
101unsigned char *SHA1();
102void SHA1_Transform();
103#endif 116#endif
104
105#ifdef __cplusplus 117#ifdef __cplusplus
106} 118}
107#endif 119#endif