summaryrefslogtreecommitdiff
path: root/openbsd-compat/sha2.h
diff options
context:
space:
mode:
Diffstat (limited to 'openbsd-compat/sha2.h')
-rw-r--r--openbsd-compat/sha2.h19
1 files changed, 10 insertions, 9 deletions
diff --git a/openbsd-compat/sha2.h b/openbsd-compat/sha2.h
index 73e94f150..c8bfc3cd1 100644
--- a/openbsd-compat/sha2.h
+++ b/openbsd-compat/sha2.h
@@ -41,10 +41,16 @@
41 41
42#include "includes.h" 42#include "includes.h"
43 43
44#include <openssl/opensslv.h> 44#ifdef WITH_OPENSSL
45# include <openssl/opensslv.h>
46# if !defined(HAVE_EVP_SHA256) && (OPENSSL_VERSION_NUMBER >= 0x00907000L)
47# define _NEED_SHA2 1
48# endif
49#else
50# define _NEED_SHA2 1
51#endif
45 52
46#if !defined(HAVE_EVP_SHA256) && !defined(HAVE_SHA256_UPDATE) && \ 53#if defined(_NEED_SHA2) && !defined(HAVE_SHA256_UPDATE)
47 (OPENSSL_VERSION_NUMBER >= 0x00907000L)
48 54
49/*** SHA-256/384/512 Various Length Definitions ***********************/ 55/*** SHA-256/384/512 Various Length Definitions ***********************/
50#define SHA256_BLOCK_LENGTH 64 56#define SHA256_BLOCK_LENGTH 64
@@ -70,9 +76,7 @@ typedef struct _SHA512_CTX {
70 u_int8_t buffer[SHA512_BLOCK_LENGTH]; 76 u_int8_t buffer[SHA512_BLOCK_LENGTH];
71} SHA512_CTX; 77} SHA512_CTX;
72 78
73#if 0
74typedef SHA512_CTX SHA384_CTX; 79typedef SHA512_CTX SHA384_CTX;
75#endif
76 80
77void SHA256_Init(SHA256_CTX *); 81void SHA256_Init(SHA256_CTX *);
78void SHA256_Transform(u_int32_t state[8], const u_int8_t [SHA256_BLOCK_LENGTH]); 82void SHA256_Transform(u_int32_t state[8], const u_int8_t [SHA256_BLOCK_LENGTH]);
@@ -91,7 +95,6 @@ char *SHA256_Data(const u_int8_t *, size_t, char *)
91 __attribute__((__bounded__(__string__,1,2))) 95 __attribute__((__bounded__(__string__,1,2)))
92 __attribute__((__bounded__(__minbytes__,3,SHA256_DIGEST_STRING_LENGTH))); 96 __attribute__((__bounded__(__minbytes__,3,SHA256_DIGEST_STRING_LENGTH)));
93 97
94#if 0
95void SHA384_Init(SHA384_CTX *); 98void SHA384_Init(SHA384_CTX *);
96void SHA384_Transform(u_int64_t state[8], const u_int8_t [SHA384_BLOCK_LENGTH]); 99void SHA384_Transform(u_int64_t state[8], const u_int8_t [SHA384_BLOCK_LENGTH]);
97void SHA384_Update(SHA384_CTX *, const u_int8_t *, size_t) 100void SHA384_Update(SHA384_CTX *, const u_int8_t *, size_t)
@@ -108,7 +111,6 @@ char *SHA384_FileChunk(const char *, char *, off_t, off_t)
108char *SHA384_Data(const u_int8_t *, size_t, char *) 111char *SHA384_Data(const u_int8_t *, size_t, char *)
109 __attribute__((__bounded__(__string__,1,2))) 112 __attribute__((__bounded__(__string__,1,2)))
110 __attribute__((__bounded__(__minbytes__,3,SHA384_DIGEST_STRING_LENGTH))); 113 __attribute__((__bounded__(__minbytes__,3,SHA384_DIGEST_STRING_LENGTH)));
111#endif /* 0 */
112 114
113void SHA512_Init(SHA512_CTX *); 115void SHA512_Init(SHA512_CTX *);
114void SHA512_Transform(u_int64_t state[8], const u_int8_t [SHA512_BLOCK_LENGTH]); 116void SHA512_Transform(u_int64_t state[8], const u_int8_t [SHA512_BLOCK_LENGTH]);
@@ -127,7 +129,6 @@ char *SHA512_Data(const u_int8_t *, size_t, char *)
127 __attribute__((__bounded__(__string__,1,2))) 129 __attribute__((__bounded__(__string__,1,2)))
128 __attribute__((__bounded__(__minbytes__,3,SHA512_DIGEST_STRING_LENGTH))); 130 __attribute__((__bounded__(__minbytes__,3,SHA512_DIGEST_STRING_LENGTH)));
129 131
130#endif /* !defined(HAVE_EVP_SHA256) && !defined(HAVE_SHA256_UPDATE) && \ 132#endif /* defined(_NEED_SHA2) && !defined(HAVE_SHA256_UPDATE) */
131 (OPENSSL_VERSION_NUMBER >= 0x00907000L) */
132 133
133#endif /* _SSHSHA2_H */ 134#endif /* _SSHSHA2_H */