diff options
Diffstat (limited to 'openbsd-compat/sha2.h')
-rw-r--r-- | openbsd-compat/sha2.h | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/openbsd-compat/sha2.h b/openbsd-compat/sha2.h index 52ddb3f79..bf7dafc52 100644 --- a/openbsd-compat/sha2.h +++ b/openbsd-compat/sha2.h | |||
@@ -34,9 +34,16 @@ | |||
34 | * $From: sha2.h,v 1.1 2001/11/08 00:02:01 adg Exp adg $ | 34 | * $From: sha2.h,v 1.1 2001/11/08 00:02:01 adg Exp adg $ |
35 | */ | 35 | */ |
36 | 36 | ||
37 | #ifndef _SHA2_H | 37 | /* OPENBSD ORIGINAL: include/sha2.h */ |
38 | #define _SHA2_H | ||
39 | 38 | ||
39 | #ifndef _SSHSHA2_H | ||
40 | #define _SSHSHA2_H | ||
41 | |||
42 | #include "includes.h" | ||
43 | #include <sys/cdefs.h> | ||
44 | |||
45 | #if !defined(HAVE_SHA256UPDATE) || !defined(HAVE_SHA384UPDATE) || \ | ||
46 | !defined(HAVE_SHA512UPDATE) | ||
40 | 47 | ||
41 | /*** SHA-256/384/512 Various Length Definitions ***********************/ | 48 | /*** SHA-256/384/512 Various Length Definitions ***********************/ |
42 | #define SHA224_BLOCK_LENGTH 64 | 49 | #define SHA224_BLOCK_LENGTH 64 |
@@ -66,6 +73,7 @@ typedef struct _SHA2_CTX { | |||
66 | u_int8_t buffer[SHA512_BLOCK_LENGTH]; | 73 | u_int8_t buffer[SHA512_BLOCK_LENGTH]; |
67 | } SHA2_CTX; | 74 | } SHA2_CTX; |
68 | 75 | ||
76 | #if 0 | ||
69 | __BEGIN_DECLS | 77 | __BEGIN_DECLS |
70 | void SHA224Init(SHA2_CTX *); | 78 | void SHA224Init(SHA2_CTX *); |
71 | void SHA224Transform(u_int32_t state[8], const u_int8_t [SHA224_BLOCK_LENGTH]); | 79 | void SHA224Transform(u_int32_t state[8], const u_int8_t [SHA224_BLOCK_LENGTH]); |
@@ -83,7 +91,9 @@ char *SHA224FileChunk(const char *, char *, off_t, off_t) | |||
83 | char *SHA224Data(const u_int8_t *, size_t, char *) | 91 | char *SHA224Data(const u_int8_t *, size_t, char *) |
84 | __attribute__((__bounded__(__string__,1,2))) | 92 | __attribute__((__bounded__(__string__,1,2))) |
85 | __attribute__((__bounded__(__minbytes__,3,SHA224_DIGEST_STRING_LENGTH))); | 93 | __attribute__((__bounded__(__minbytes__,3,SHA224_DIGEST_STRING_LENGTH))); |
94 | #endif /* 0 */ | ||
86 | 95 | ||
96 | #ifndef HAVE_SHA256UPDATE | ||
87 | void SHA256Init(SHA2_CTX *); | 97 | void SHA256Init(SHA2_CTX *); |
88 | void SHA256Transform(u_int32_t state[8], const u_int8_t [SHA256_BLOCK_LENGTH]); | 98 | void SHA256Transform(u_int32_t state[8], const u_int8_t [SHA256_BLOCK_LENGTH]); |
89 | void SHA256Update(SHA2_CTX *, const u_int8_t *, size_t) | 99 | void SHA256Update(SHA2_CTX *, const u_int8_t *, size_t) |
@@ -100,7 +110,9 @@ char *SHA256FileChunk(const char *, char *, off_t, off_t) | |||
100 | char *SHA256Data(const u_int8_t *, size_t, char *) | 110 | char *SHA256Data(const u_int8_t *, size_t, char *) |
101 | __attribute__((__bounded__(__string__,1,2))) | 111 | __attribute__((__bounded__(__string__,1,2))) |
102 | __attribute__((__bounded__(__minbytes__,3,SHA256_DIGEST_STRING_LENGTH))); | 112 | __attribute__((__bounded__(__minbytes__,3,SHA256_DIGEST_STRING_LENGTH))); |
113 | #endif /* HAVE_SHA256UPDATE */ | ||
103 | 114 | ||
115 | #ifndef HAVE_SHA384UPDATE | ||
104 | void SHA384Init(SHA2_CTX *); | 116 | void SHA384Init(SHA2_CTX *); |
105 | void SHA384Transform(u_int64_t state[8], const u_int8_t [SHA384_BLOCK_LENGTH]); | 117 | void SHA384Transform(u_int64_t state[8], const u_int8_t [SHA384_BLOCK_LENGTH]); |
106 | void SHA384Update(SHA2_CTX *, const u_int8_t *, size_t) | 118 | void SHA384Update(SHA2_CTX *, const u_int8_t *, size_t) |
@@ -117,7 +129,9 @@ char *SHA384FileChunk(const char *, char *, off_t, off_t) | |||
117 | char *SHA384Data(const u_int8_t *, size_t, char *) | 129 | char *SHA384Data(const u_int8_t *, size_t, char *) |
118 | __attribute__((__bounded__(__string__,1,2))) | 130 | __attribute__((__bounded__(__string__,1,2))) |
119 | __attribute__((__bounded__(__minbytes__,3,SHA384_DIGEST_STRING_LENGTH))); | 131 | __attribute__((__bounded__(__minbytes__,3,SHA384_DIGEST_STRING_LENGTH))); |
132 | #endif /* HAVE_SHA384UPDATE */ | ||
120 | 133 | ||
134 | #ifndef HAVE_SHA512UPDATE | ||
121 | void SHA512Init(SHA2_CTX *); | 135 | void SHA512Init(SHA2_CTX *); |
122 | void SHA512Transform(u_int64_t state[8], const u_int8_t [SHA512_BLOCK_LENGTH]); | 136 | void SHA512Transform(u_int64_t state[8], const u_int8_t [SHA512_BLOCK_LENGTH]); |
123 | void SHA512Update(SHA2_CTX *, const u_int8_t *, size_t) | 137 | void SHA512Update(SHA2_CTX *, const u_int8_t *, size_t) |
@@ -134,7 +148,9 @@ char *SHA512FileChunk(const char *, char *, off_t, off_t) | |||
134 | char *SHA512Data(const u_int8_t *, size_t, char *) | 148 | char *SHA512Data(const u_int8_t *, size_t, char *) |
135 | __attribute__((__bounded__(__string__,1,2))) | 149 | __attribute__((__bounded__(__string__,1,2))) |
136 | __attribute__((__bounded__(__minbytes__,3,SHA512_DIGEST_STRING_LENGTH))); | 150 | __attribute__((__bounded__(__minbytes__,3,SHA512_DIGEST_STRING_LENGTH))); |
151 | #endif /* HAVE_SHA512UPDATE */ | ||
137 | 152 | ||
153 | #if 0 | ||
138 | void SHA512_256Init(SHA2_CTX *); | 154 | void SHA512_256Init(SHA2_CTX *); |
139 | void SHA512_256Transform(u_int64_t state[8], const u_int8_t [SHA512_256_BLOCK_LENGTH]); | 155 | void SHA512_256Transform(u_int64_t state[8], const u_int8_t [SHA512_256_BLOCK_LENGTH]); |
140 | void SHA512_256Update(SHA2_CTX *, const u_int8_t *, size_t) | 156 | void SHA512_256Update(SHA2_CTX *, const u_int8_t *, size_t) |
@@ -152,5 +168,8 @@ char *SHA512_256Data(const u_int8_t *, size_t, char *) | |||
152 | __attribute__((__bounded__(__string__,1,2))) | 168 | __attribute__((__bounded__(__string__,1,2))) |
153 | __attribute__((__bounded__(__minbytes__,3,SHA512_256_DIGEST_STRING_LENGTH))); | 169 | __attribute__((__bounded__(__minbytes__,3,SHA512_256_DIGEST_STRING_LENGTH))); |
154 | __END_DECLS | 170 | __END_DECLS |
171 | #endif /* 0 */ | ||
172 | |||
173 | #endif /* HAVE_SHA{256,384,512}UPDATE */ | ||
155 | 174 | ||
156 | #endif /* _SHA2_H */ | 175 | #endif /* _SSHSHA2_H */ |