diff options
author | jsing <> | 2023-07-08 07:08:11 +0000 |
---|---|---|
committer | jsing <> | 2023-07-08 07:08:11 +0000 |
commit | 9fd37e06e49f349066b61c8890e3b9ba79944481 (patch) | |
tree | b6836c7e2f1ede8be72e75312609262aae1dfa8d /src | |
parent | 14762a1367685298c541c7b55d0ee63926888cd4 (diff) | |
download | openbsd-9fd37e06e49f349066b61c8890e3b9ba79944481.tar.gz openbsd-9fd37e06e49f349066b61c8890e3b9ba79944481.tar.bz2 openbsd-9fd37e06e49f349066b61c8890e3b9ba79944481.zip |
style(9)
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/libcrypto/sha/sha.h | 69 |
1 files changed, 33 insertions, 36 deletions
diff --git a/src/lib/libcrypto/sha/sha.h b/src/lib/libcrypto/sha/sha.h index 87fdf8d186..e1de79f4f4 100644 --- a/src/lib/libcrypto/sha/sha.h +++ b/src/lib/libcrypto/sha/sha.h | |||
@@ -1,25 +1,25 @@ | |||
1 | /* $OpenBSD: sha.h,v 1.21 2015/09/13 21:09:56 doug Exp $ */ | 1 | /* $OpenBSD: sha.h,v 1.22 2023/07/08 07:08:11 jsing Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
5 | * This package is an SSL implementation written | 5 | * This package is an SSL implementation written |
6 | * by Eric Young (eay@cryptsoft.com). | 6 | * by Eric Young (eay@cryptsoft.com). |
7 | * The implementation was written so as to conform with Netscapes SSL. | 7 | * The implementation was written so as to conform with Netscapes SSL. |
8 | * | 8 | * |
9 | * This library is free for commercial and non-commercial use as long as | 9 | * This library is free for commercial and non-commercial use as long as |
10 | * the following conditions are aheared to. The following conditions | 10 | * the following conditions are aheared to. The following conditions |
11 | * apply to all code found in this distribution, be it the RC4, RSA, | 11 | * apply to all code found in this distribution, be it the RC4, RSA, |
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation |
13 | * included with this distribution is covered by the same copyright terms | 13 | * included with this distribution is covered by the same copyright terms |
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). |
15 | * | 15 | * |
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | 16 | * Copyright remains Eric Young's, and as such any Copyright notices in |
17 | * the code are not to be removed. | 17 | * the code are not to be removed. |
18 | * If this package is used in a product, Eric Young should be given attribution | 18 | * If this package is used in a product, Eric Young should be given attribution |
19 | * as the author of the parts of the library used. | 19 | * as the author of the parts of the library used. |
20 | * This can be in the form of a textual message at program startup or | 20 | * This can be in the form of a textual message at program startup or |
21 | * in documentation (online or textual) provided with the package. | 21 | * in documentation (online or textual) provided with the package. |
22 | * | 22 | * |
23 | * Redistribution and use in source and binary forms, with or without | 23 | * Redistribution and use in source and binary forms, with or without |
24 | * modification, are permitted provided that the following conditions | 24 | * modification, are permitted provided that the following conditions |
25 | * are met: | 25 | * are met: |
@@ -34,10 +34,10 @@ | |||
34 | * Eric Young (eay@cryptsoft.com)" | 34 | * Eric Young (eay@cryptsoft.com)" |
35 | * The word 'cryptographic' can be left out if the rouines from the library | 35 | * The word 'cryptographic' can be left out if the rouines from the library |
36 | * being used are not cryptographic related :-). | 36 | * being used are not cryptographic related :-). |
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | 37 | * 4. If you include any Windows specific code (or a derivative thereof) from |
38 | * the apps directory (application code) you must include an acknowledgement: | 38 | * the apps directory (application code) you must include an acknowledgement: |
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" |
40 | * | 40 | * |
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND |
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
@@ -49,7 +49,7 @@ | |||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
51 | * SUCH DAMAGE. | 51 | * SUCH DAMAGE. |
52 | * | 52 | * |
53 | * The licence and distribution terms for any publically available version or | 53 | * The licence and distribution terms for any publically available version or |
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be |
55 | * copied and put under another distribution licence | 55 | * copied and put under another distribution licence |
@@ -89,21 +89,20 @@ extern "C" { | |||
89 | #define SHA_LAST_BLOCK (SHA_CBLOCK-8) | 89 | #define SHA_LAST_BLOCK (SHA_CBLOCK-8) |
90 | #define SHA_DIGEST_LENGTH 20 | 90 | #define SHA_DIGEST_LENGTH 20 |
91 | 91 | ||
92 | typedef struct SHAstate_st | 92 | typedef struct SHAstate_st { |
93 | { | 93 | SHA_LONG h0, h1, h2, h3, h4; |
94 | SHA_LONG h0,h1,h2,h3,h4; | 94 | SHA_LONG Nl, Nh; |
95 | SHA_LONG Nl,Nh; | ||
96 | SHA_LONG data[SHA_LBLOCK]; | 95 | SHA_LONG data[SHA_LBLOCK]; |
97 | unsigned int num; | 96 | unsigned int num; |
98 | } SHA_CTX; | 97 | } SHA_CTX; |
99 | 98 | ||
100 | #ifndef OPENSSL_NO_SHA1 | 99 | #ifndef OPENSSL_NO_SHA1 |
101 | int SHA1_Init(SHA_CTX *c); | 100 | int SHA1_Init(SHA_CTX *c); |
102 | int SHA1_Update(SHA_CTX *c, const void *data, size_t len) | 101 | int SHA1_Update(SHA_CTX *c, const void *data, size_t len) |
103 | __attribute__ ((__bounded__(__buffer__,2,3))); | 102 | __attribute__ ((__bounded__(__buffer__, 2, 3))); |
104 | int SHA1_Final(unsigned char *md, SHA_CTX *c); | 103 | int SHA1_Final(unsigned char *md, SHA_CTX *c); |
105 | unsigned char *SHA1(const unsigned char *d, size_t n, unsigned char *md) | 104 | unsigned char *SHA1(const unsigned char *d, size_t n, unsigned char *md) |
106 | __attribute__ ((__bounded__(__buffer__,1,2))); | 105 | __attribute__ ((__bounded__(__buffer__, 1, 2))); |
107 | void SHA1_Transform(SHA_CTX *c, const unsigned char *data); | 106 | void SHA1_Transform(SHA_CTX *c, const unsigned char *data); |
108 | #endif | 107 | #endif |
109 | 108 | ||
@@ -113,27 +112,26 @@ void SHA1_Transform(SHA_CTX *c, const unsigned char *data); | |||
113 | #define SHA224_DIGEST_LENGTH 28 | 112 | #define SHA224_DIGEST_LENGTH 28 |
114 | #define SHA256_DIGEST_LENGTH 32 | 113 | #define SHA256_DIGEST_LENGTH 32 |
115 | 114 | ||
116 | typedef struct SHA256state_st | 115 | typedef struct SHA256state_st { |
117 | { | ||
118 | SHA_LONG h[8]; | 116 | SHA_LONG h[8]; |
119 | SHA_LONG Nl,Nh; | 117 | SHA_LONG Nl, Nh; |
120 | SHA_LONG data[SHA_LBLOCK]; | 118 | SHA_LONG data[SHA_LBLOCK]; |
121 | unsigned int num,md_len; | 119 | unsigned int num, md_len; |
122 | } SHA256_CTX; | 120 | } SHA256_CTX; |
123 | 121 | ||
124 | #ifndef OPENSSL_NO_SHA256 | 122 | #ifndef OPENSSL_NO_SHA256 |
125 | int SHA224_Init(SHA256_CTX *c); | 123 | int SHA224_Init(SHA256_CTX *c); |
126 | int SHA224_Update(SHA256_CTX *c, const void *data, size_t len) | 124 | int SHA224_Update(SHA256_CTX *c, const void *data, size_t len) |
127 | __attribute__ ((__bounded__(__buffer__,2,3))); | 125 | __attribute__ ((__bounded__(__buffer__, 2, 3))); |
128 | int SHA224_Final(unsigned char *md, SHA256_CTX *c); | 126 | int SHA224_Final(unsigned char *md, SHA256_CTX *c); |
129 | unsigned char *SHA224(const unsigned char *d, size_t n,unsigned char *md) | 127 | unsigned char *SHA224(const unsigned char *d, size_t n, unsigned char *md) |
130 | __attribute__ ((__bounded__(__buffer__,1,2))); | 128 | __attribute__ ((__bounded__(__buffer__, 1, 2))); |
131 | int SHA256_Init(SHA256_CTX *c); | 129 | int SHA256_Init(SHA256_CTX *c); |
132 | int SHA256_Update(SHA256_CTX *c, const void *data, size_t len) | 130 | int SHA256_Update(SHA256_CTX *c, const void *data, size_t len) |
133 | __attribute__ ((__bounded__(__buffer__,2,3))); | 131 | __attribute__ ((__bounded__(__buffer__, 2, 3))); |
134 | int SHA256_Final(unsigned char *md, SHA256_CTX *c); | 132 | int SHA256_Final(unsigned char *md, SHA256_CTX *c); |
135 | unsigned char *SHA256(const unsigned char *d, size_t n,unsigned char *md) | 133 | unsigned char *SHA256(const unsigned char *d, size_t n, unsigned char *md) |
136 | __attribute__ ((__bounded__(__buffer__,1,2))); | 134 | __attribute__ ((__bounded__(__buffer__, 1, 2))); |
137 | void SHA256_Transform(SHA256_CTX *c, const unsigned char *data); | 135 | void SHA256_Transform(SHA256_CTX *c, const unsigned char *data); |
138 | #endif | 136 | #endif |
139 | 137 | ||
@@ -157,31 +155,30 @@ void SHA256_Transform(SHA256_CTX *c, const unsigned char *data); | |||
157 | #define U64(C) C##ULL | 155 | #define U64(C) C##ULL |
158 | #endif | 156 | #endif |
159 | 157 | ||
160 | typedef struct SHA512state_st | 158 | typedef struct SHA512state_st { |
161 | { | ||
162 | SHA_LONG64 h[8]; | 159 | SHA_LONG64 h[8]; |
163 | SHA_LONG64 Nl,Nh; | 160 | SHA_LONG64 Nl, Nh; |
164 | union { | 161 | union { |
165 | SHA_LONG64 d[SHA_LBLOCK]; | 162 | SHA_LONG64 d[SHA_LBLOCK]; |
166 | unsigned char p[SHA512_CBLOCK]; | 163 | unsigned char p[SHA512_CBLOCK]; |
167 | } u; | 164 | } u; |
168 | unsigned int num,md_len; | 165 | unsigned int num, md_len; |
169 | } SHA512_CTX; | 166 | } SHA512_CTX; |
170 | #endif | 167 | #endif |
171 | 168 | ||
172 | #ifndef OPENSSL_NO_SHA512 | 169 | #ifndef OPENSSL_NO_SHA512 |
173 | int SHA384_Init(SHA512_CTX *c); | 170 | int SHA384_Init(SHA512_CTX *c); |
174 | int SHA384_Update(SHA512_CTX *c, const void *data, size_t len) | 171 | int SHA384_Update(SHA512_CTX *c, const void *data, size_t len) |
175 | __attribute__ ((__bounded__(__buffer__,2,3))); | 172 | __attribute__ ((__bounded__(__buffer__, 2, 3))); |
176 | int SHA384_Final(unsigned char *md, SHA512_CTX *c); | 173 | int SHA384_Final(unsigned char *md, SHA512_CTX *c); |
177 | unsigned char *SHA384(const unsigned char *d, size_t n,unsigned char *md) | 174 | unsigned char *SHA384(const unsigned char *d, size_t n, unsigned char *md) |
178 | __attribute__ ((__bounded__(__buffer__,1,2))); | 175 | __attribute__ ((__bounded__(__buffer__, 1, 2))); |
179 | int SHA512_Init(SHA512_CTX *c); | 176 | int SHA512_Init(SHA512_CTX *c); |
180 | int SHA512_Update(SHA512_CTX *c, const void *data, size_t len) | 177 | int SHA512_Update(SHA512_CTX *c, const void *data, size_t len) |
181 | __attribute__ ((__bounded__(__buffer__,2,3))); | 178 | __attribute__ ((__bounded__(__buffer__, 2, 3))); |
182 | int SHA512_Final(unsigned char *md, SHA512_CTX *c); | 179 | int SHA512_Final(unsigned char *md, SHA512_CTX *c); |
183 | unsigned char *SHA512(const unsigned char *d, size_t n,unsigned char *md) | 180 | unsigned char *SHA512(const unsigned char *d, size_t n, unsigned char *md) |
184 | __attribute__ ((__bounded__(__buffer__,1,2))); | 181 | __attribute__ ((__bounded__(__buffer__, 1, 2))); |
185 | void SHA512_Transform(SHA512_CTX *c, const unsigned char *data); | 182 | void SHA512_Transform(SHA512_CTX *c, const unsigned char *data); |
186 | #endif | 183 | #endif |
187 | 184 | ||