summaryrefslogtreecommitdiff
path: root/openbsd-compat
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@dtucker.net>2020-01-14 07:24:46 +1100
committerDarren Tucker <dtucker@dtucker.net>2020-01-14 12:05:00 +1100
commit26b2675b0c3e3efea11a52609073aec01736ec84 (patch)
tree7a4f5109d7032bfb9c7fb4c2393488fc8112364f /openbsd-compat
parented3ad71b17adcd1fb4431d145f53cee1c6a1135e (diff)
Remove configure test & compat code for ripemd160.
RIPEMD160 support was removed upstream in 2017, however we still had a configure test and compat code for it, so clean those up now.
Diffstat (limited to 'openbsd-compat')
-rw-r--r--openbsd-compat/Makefile.in1
-rw-r--r--openbsd-compat/openbsd-compat.h1
-rw-r--r--openbsd-compat/openssl-compat.h6
-rw-r--r--openbsd-compat/rmd160.c378
-rw-r--r--openbsd-compat/rmd160.h61
5 files changed, 0 insertions, 447 deletions
diff --git a/openbsd-compat/Makefile.in b/openbsd-compat/Makefile.in
index 43544eba0..3eb188f0b 100644
--- a/openbsd-compat/Makefile.in
+++ b/openbsd-compat/Makefile.in
@@ -44,7 +44,6 @@ OPENBSD=base64.o \
44 readpassphrase.o \ 44 readpassphrase.o \
45 reallocarray.o \ 45 reallocarray.o \
46 recallocarray.o \ 46 recallocarray.o \
47 rmd160.o \
48 rresvport.o \ 47 rresvport.o \
49 setenv.o \ 48 setenv.o \
50 setproctitle.o \ 49 setproctitle.o \
diff --git a/openbsd-compat/openbsd-compat.h b/openbsd-compat/openbsd-compat.h
index 8c97173b1..4a16702ef 100644
--- a/openbsd-compat/openbsd-compat.h
+++ b/openbsd-compat/openbsd-compat.h
@@ -44,7 +44,6 @@
44#include "getrrsetbyname.h" 44#include "getrrsetbyname.h"
45#include "sha1.h" 45#include "sha1.h"
46#include "sha2.h" 46#include "sha2.h"
47#include "rmd160.h"
48#include "md5.h" 47#include "md5.h"
49#include "blf.h" 48#include "blf.h"
50#include "fnmatch.h" 49#include "fnmatch.h"
diff --git a/openbsd-compat/openssl-compat.h b/openbsd-compat/openssl-compat.h
index 917bc6f7c..abdcb8763 100644
--- a/openbsd-compat/openssl-compat.h
+++ b/openbsd-compat/openssl-compat.h
@@ -87,12 +87,6 @@ void ssh_aes_ctr_iv(EVP_CIPHER_CTX *, int, u_char *, size_t);
87# endif 87# endif
88#endif 88#endif
89 89
90#if defined(HAVE_EVP_RIPEMD160)
91# if defined(OPENSSL_NO_RIPEMD) || defined(OPENSSL_NO_RMD160)
92# undef HAVE_EVP_RIPEMD160
93# endif
94#endif
95
96/* LibreSSL/OpenSSL 1.1x API compat */ 90/* LibreSSL/OpenSSL 1.1x API compat */
97#ifndef HAVE_DSA_GET0_PQG 91#ifndef HAVE_DSA_GET0_PQG
98void DSA_get0_pqg(const DSA *d, const BIGNUM **p, const BIGNUM **q, 92void DSA_get0_pqg(const DSA *d, const BIGNUM **p, const BIGNUM **q,
diff --git a/openbsd-compat/rmd160.c b/openbsd-compat/rmd160.c
deleted file mode 100644
index e915141a5..000000000
--- a/openbsd-compat/rmd160.c
+++ /dev/null
@@ -1,378 +0,0 @@
1/*
2 * Copyright (c) 2001 Markus Friedl. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
14 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
15 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
16 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
17 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
18 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
19 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
20 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
22 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 */
24/*
25 * Preneel, Bosselaers, Dobbertin, "The Cryptographic Hash Function RIPEMD-160",
26 * RSA Laboratories, CryptoBytes, Volume 3, Number 2, Autumn 1997,
27 * ftp://ftp.rsasecurity.com/pub/cryptobytes/crypto3n2.pdf
28 */
29
30#include "includes.h"
31
32#ifndef WITH_OPENSSL
33
34#include <sys/types.h>
35#ifdef HAVE_ENDIAN_H
36#include <endian.h>
37#endif
38#include <string.h>
39#include <rmd160.h>
40
41#define PUT_64BIT_LE(cp, value) do { \
42 (cp)[7] = (value) >> 56; \
43 (cp)[6] = (value) >> 48; \
44 (cp)[5] = (value) >> 40; \
45 (cp)[4] = (value) >> 32; \
46 (cp)[3] = (value) >> 24; \
47 (cp)[2] = (value) >> 16; \
48 (cp)[1] = (value) >> 8; \
49 (cp)[0] = (value); } while (0)
50
51#define PUT_32BIT_LE(cp, value) do { \
52 (cp)[3] = (value) >> 24; \
53 (cp)[2] = (value) >> 16; \
54 (cp)[1] = (value) >> 8; \
55 (cp)[0] = (value); } while (0)
56
57#define H0 0x67452301U
58#define H1 0xEFCDAB89U
59#define H2 0x98BADCFEU
60#define H3 0x10325476U
61#define H4 0xC3D2E1F0U
62
63#define K0 0x00000000U
64#define K1 0x5A827999U
65#define K2 0x6ED9EBA1U
66#define K3 0x8F1BBCDCU
67#define K4 0xA953FD4EU
68
69#define KK0 0x50A28BE6U
70#define KK1 0x5C4DD124U
71#define KK2 0x6D703EF3U
72#define KK3 0x7A6D76E9U
73#define KK4 0x00000000U
74
75/* rotate x left n bits. */
76#define ROL(n, x) (((x) << (n)) | ((x) >> (32-(n))))
77
78#define F0(x, y, z) ((x) ^ (y) ^ (z))
79#define F1(x, y, z) (((x) & (y)) | ((~x) & (z)))
80#define F2(x, y, z) (((x) | (~y)) ^ (z))
81#define F3(x, y, z) (((x) & (z)) | ((y) & (~z)))
82#define F4(x, y, z) ((x) ^ ((y) | (~z)))
83
84#define R(a, b, c, d, e, Fj, Kj, sj, rj) \
85 do { \
86 a = ROL(sj, a + Fj(b,c,d) + X(rj) + Kj) + e; \
87 c = ROL(10, c); \
88 } while(0)
89
90#define X(i) x[i]
91
92static u_int8_t PADDING[RMD160_BLOCK_LENGTH] = {
93 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
94 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
95 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
96};
97
98void
99RMD160Init(RMD160_CTX *ctx)
100{
101 ctx->count = 0;
102 ctx->state[0] = H0;
103 ctx->state[1] = H1;
104 ctx->state[2] = H2;
105 ctx->state[3] = H3;
106 ctx->state[4] = H4;
107}
108
109void
110RMD160Update(RMD160_CTX *ctx, const u_int8_t *input, size_t len)
111{
112 size_t have, off, need;
113
114 have = (ctx->count / 8) % RMD160_BLOCK_LENGTH;
115 need = RMD160_BLOCK_LENGTH - have;
116 ctx->count += 8 * len;
117 off = 0;
118
119 if (len >= need) {
120 if (have) {
121 memcpy(ctx->buffer + have, input, need);
122 RMD160Transform(ctx->state, ctx->buffer);
123 off = need;
124 have = 0;
125 }
126 /* now the buffer is empty */
127 while (off + RMD160_BLOCK_LENGTH <= len) {
128 RMD160Transform(ctx->state, input+off);
129 off += RMD160_BLOCK_LENGTH;
130 }
131 }
132 if (off < len)
133 memcpy(ctx->buffer + have, input+off, len-off);
134}
135
136void
137RMD160Pad(RMD160_CTX *ctx)
138{
139 u_int8_t size[8];
140 size_t padlen;
141
142 PUT_64BIT_LE(size, ctx->count);
143
144 /*
145 * pad to RMD160_BLOCK_LENGTH byte blocks, at least one byte from
146 * PADDING plus 8 bytes for the size
147 */
148 padlen = RMD160_BLOCK_LENGTH - ((ctx->count / 8) % RMD160_BLOCK_LENGTH);
149 if (padlen < 1 + 8)
150 padlen += RMD160_BLOCK_LENGTH;
151 RMD160Update(ctx, PADDING, padlen - 8); /* padlen - 8 <= 64 */
152 RMD160Update(ctx, size, 8);
153}
154
155void
156RMD160Final(u_int8_t digest[RMD160_DIGEST_LENGTH], RMD160_CTX *ctx)
157{
158 int i;
159
160 RMD160Pad(ctx);
161 for (i = 0; i < 5; i++)
162 PUT_32BIT_LE(digest + i*4, ctx->state[i]);
163 memset(ctx, 0, sizeof (*ctx));
164}
165
166void
167RMD160Transform(u_int32_t state[5], const u_int8_t block[RMD160_BLOCK_LENGTH])
168{
169 u_int32_t a, b, c, d, e, aa, bb, cc, dd, ee, t, x[16];
170
171#if BYTE_ORDER == LITTLE_ENDIAN
172 memcpy(x, block, RMD160_BLOCK_LENGTH);
173#else
174 int i;
175
176 for (i = 0; i < 16; i++)
177 x[i] = (u_int32_t)(
178 (u_int32_t)(block[i*4 + 0]) |
179 (u_int32_t)(block[i*4 + 1]) << 8 |
180 (u_int32_t)(block[i*4 + 2]) << 16 |
181 (u_int32_t)(block[i*4 + 3]) << 24);
182#endif
183
184 a = state[0];
185 b = state[1];
186 c = state[2];
187 d = state[3];
188 e = state[4];
189
190 /* Round 1 */
191 R(a, b, c, d, e, F0, K0, 11, 0);
192 R(e, a, b, c, d, F0, K0, 14, 1);
193 R(d, e, a, b, c, F0, K0, 15, 2);
194 R(c, d, e, a, b, F0, K0, 12, 3);
195 R(b, c, d, e, a, F0, K0, 5, 4);
196 R(a, b, c, d, e, F0, K0, 8, 5);
197 R(e, a, b, c, d, F0, K0, 7, 6);
198 R(d, e, a, b, c, F0, K0, 9, 7);
199 R(c, d, e, a, b, F0, K0, 11, 8);
200 R(b, c, d, e, a, F0, K0, 13, 9);
201 R(a, b, c, d, e, F0, K0, 14, 10);
202 R(e, a, b, c, d, F0, K0, 15, 11);
203 R(d, e, a, b, c, F0, K0, 6, 12);
204 R(c, d, e, a, b, F0, K0, 7, 13);
205 R(b, c, d, e, a, F0, K0, 9, 14);
206 R(a, b, c, d, e, F0, K0, 8, 15); /* #15 */
207 /* Round 2 */
208 R(e, a, b, c, d, F1, K1, 7, 7);
209 R(d, e, a, b, c, F1, K1, 6, 4);
210 R(c, d, e, a, b, F1, K1, 8, 13);
211 R(b, c, d, e, a, F1, K1, 13, 1);
212 R(a, b, c, d, e, F1, K1, 11, 10);
213 R(e, a, b, c, d, F1, K1, 9, 6);
214 R(d, e, a, b, c, F1, K1, 7, 15);
215 R(c, d, e, a, b, F1, K1, 15, 3);
216 R(b, c, d, e, a, F1, K1, 7, 12);
217 R(a, b, c, d, e, F1, K1, 12, 0);
218 R(e, a, b, c, d, F1, K1, 15, 9);
219 R(d, e, a, b, c, F1, K1, 9, 5);
220 R(c, d, e, a, b, F1, K1, 11, 2);
221 R(b, c, d, e, a, F1, K1, 7, 14);
222 R(a, b, c, d, e, F1, K1, 13, 11);
223 R(e, a, b, c, d, F1, K1, 12, 8); /* #31 */
224 /* Round 3 */
225 R(d, e, a, b, c, F2, K2, 11, 3);
226 R(c, d, e, a, b, F2, K2, 13, 10);
227 R(b, c, d, e, a, F2, K2, 6, 14);
228 R(a, b, c, d, e, F2, K2, 7, 4);
229 R(e, a, b, c, d, F2, K2, 14, 9);
230 R(d, e, a, b, c, F2, K2, 9, 15);
231 R(c, d, e, a, b, F2, K2, 13, 8);
232 R(b, c, d, e, a, F2, K2, 15, 1);
233 R(a, b, c, d, e, F2, K2, 14, 2);
234 R(e, a, b, c, d, F2, K2, 8, 7);
235 R(d, e, a, b, c, F2, K2, 13, 0);
236 R(c, d, e, a, b, F2, K2, 6, 6);
237 R(b, c, d, e, a, F2, K2, 5, 13);
238 R(a, b, c, d, e, F2, K2, 12, 11);
239 R(e, a, b, c, d, F2, K2, 7, 5);
240 R(d, e, a, b, c, F2, K2, 5, 12); /* #47 */
241 /* Round 4 */
242 R(c, d, e, a, b, F3, K3, 11, 1);
243 R(b, c, d, e, a, F3, K3, 12, 9);
244 R(a, b, c, d, e, F3, K3, 14, 11);
245 R(e, a, b, c, d, F3, K3, 15, 10);
246 R(d, e, a, b, c, F3, K3, 14, 0);
247 R(c, d, e, a, b, F3, K3, 15, 8);
248 R(b, c, d, e, a, F3, K3, 9, 12);
249 R(a, b, c, d, e, F3, K3, 8, 4);
250 R(e, a, b, c, d, F3, K3, 9, 13);
251 R(d, e, a, b, c, F3, K3, 14, 3);
252 R(c, d, e, a, b, F3, K3, 5, 7);
253 R(b, c, d, e, a, F3, K3, 6, 15);
254 R(a, b, c, d, e, F3, K3, 8, 14);
255 R(e, a, b, c, d, F3, K3, 6, 5);
256 R(d, e, a, b, c, F3, K3, 5, 6);
257 R(c, d, e, a, b, F3, K3, 12, 2); /* #63 */
258 /* Round 5 */
259 R(b, c, d, e, a, F4, K4, 9, 4);
260 R(a, b, c, d, e, F4, K4, 15, 0);
261 R(e, a, b, c, d, F4, K4, 5, 5);
262 R(d, e, a, b, c, F4, K4, 11, 9);
263 R(c, d, e, a, b, F4, K4, 6, 7);
264 R(b, c, d, e, a, F4, K4, 8, 12);
265 R(a, b, c, d, e, F4, K4, 13, 2);
266 R(e, a, b, c, d, F4, K4, 12, 10);
267 R(d, e, a, b, c, F4, K4, 5, 14);
268 R(c, d, e, a, b, F4, K4, 12, 1);
269 R(b, c, d, e, a, F4, K4, 13, 3);
270 R(a, b, c, d, e, F4, K4, 14, 8);
271 R(e, a, b, c, d, F4, K4, 11, 11);
272 R(d, e, a, b, c, F4, K4, 8, 6);
273 R(c, d, e, a, b, F4, K4, 5, 15);
274 R(b, c, d, e, a, F4, K4, 6, 13); /* #79 */
275
276 aa = a ; bb = b; cc = c; dd = d; ee = e;
277
278 a = state[0];
279 b = state[1];
280 c = state[2];
281 d = state[3];
282 e = state[4];
283
284 /* Parallel round 1 */
285 R(a, b, c, d, e, F4, KK0, 8, 5);
286 R(e, a, b, c, d, F4, KK0, 9, 14);
287 R(d, e, a, b, c, F4, KK0, 9, 7);
288 R(c, d, e, a, b, F4, KK0, 11, 0);
289 R(b, c, d, e, a, F4, KK0, 13, 9);
290 R(a, b, c, d, e, F4, KK0, 15, 2);
291 R(e, a, b, c, d, F4, KK0, 15, 11);
292 R(d, e, a, b, c, F4, KK0, 5, 4);
293 R(c, d, e, a, b, F4, KK0, 7, 13);
294 R(b, c, d, e, a, F4, KK0, 7, 6);
295 R(a, b, c, d, e, F4, KK0, 8, 15);
296 R(e, a, b, c, d, F4, KK0, 11, 8);
297 R(d, e, a, b, c, F4, KK0, 14, 1);
298 R(c, d, e, a, b, F4, KK0, 14, 10);
299 R(b, c, d, e, a, F4, KK0, 12, 3);
300 R(a, b, c, d, e, F4, KK0, 6, 12); /* #15 */
301 /* Parallel round 2 */
302 R(e, a, b, c, d, F3, KK1, 9, 6);
303 R(d, e, a, b, c, F3, KK1, 13, 11);
304 R(c, d, e, a, b, F3, KK1, 15, 3);
305 R(b, c, d, e, a, F3, KK1, 7, 7);
306 R(a, b, c, d, e, F3, KK1, 12, 0);
307 R(e, a, b, c, d, F3, KK1, 8, 13);
308 R(d, e, a, b, c, F3, KK1, 9, 5);
309 R(c, d, e, a, b, F3, KK1, 11, 10);
310 R(b, c, d, e, a, F3, KK1, 7, 14);
311 R(a, b, c, d, e, F3, KK1, 7, 15);
312 R(e, a, b, c, d, F3, KK1, 12, 8);
313 R(d, e, a, b, c, F3, KK1, 7, 12);
314 R(c, d, e, a, b, F3, KK1, 6, 4);
315 R(b, c, d, e, a, F3, KK1, 15, 9);
316 R(a, b, c, d, e, F3, KK1, 13, 1);
317 R(e, a, b, c, d, F3, KK1, 11, 2); /* #31 */
318 /* Parallel round 3 */
319 R(d, e, a, b, c, F2, KK2, 9, 15);
320 R(c, d, e, a, b, F2, KK2, 7, 5);
321 R(b, c, d, e, a, F2, KK2, 15, 1);
322 R(a, b, c, d, e, F2, KK2, 11, 3);
323 R(e, a, b, c, d, F2, KK2, 8, 7);
324 R(d, e, a, b, c, F2, KK2, 6, 14);
325 R(c, d, e, a, b, F2, KK2, 6, 6);
326 R(b, c, d, e, a, F2, KK2, 14, 9);
327 R(a, b, c, d, e, F2, KK2, 12, 11);
328 R(e, a, b, c, d, F2, KK2, 13, 8);
329 R(d, e, a, b, c, F2, KK2, 5, 12);
330 R(c, d, e, a, b, F2, KK2, 14, 2);
331 R(b, c, d, e, a, F2, KK2, 13, 10);
332 R(a, b, c, d, e, F2, KK2, 13, 0);
333 R(e, a, b, c, d, F2, KK2, 7, 4);
334 R(d, e, a, b, c, F2, KK2, 5, 13); /* #47 */
335 /* Parallel round 4 */
336 R(c, d, e, a, b, F1, KK3, 15, 8);
337 R(b, c, d, e, a, F1, KK3, 5, 6);
338 R(a, b, c, d, e, F1, KK3, 8, 4);
339 R(e, a, b, c, d, F1, KK3, 11, 1);
340 R(d, e, a, b, c, F1, KK3, 14, 3);
341 R(c, d, e, a, b, F1, KK3, 14, 11);
342 R(b, c, d, e, a, F1, KK3, 6, 15);
343 R(a, b, c, d, e, F1, KK3, 14, 0);
344 R(e, a, b, c, d, F1, KK3, 6, 5);
345 R(d, e, a, b, c, F1, KK3, 9, 12);
346 R(c, d, e, a, b, F1, KK3, 12, 2);
347 R(b, c, d, e, a, F1, KK3, 9, 13);
348 R(a, b, c, d, e, F1, KK3, 12, 9);
349 R(e, a, b, c, d, F1, KK3, 5, 7);
350 R(d, e, a, b, c, F1, KK3, 15, 10);
351 R(c, d, e, a, b, F1, KK3, 8, 14); /* #63 */
352 /* Parallel round 5 */
353 R(b, c, d, e, a, F0, KK4, 8, 12);
354 R(a, b, c, d, e, F0, KK4, 5, 15);
355 R(e, a, b, c, d, F0, KK4, 12, 10);
356 R(d, e, a, b, c, F0, KK4, 9, 4);
357 R(c, d, e, a, b, F0, KK4, 12, 1);
358 R(b, c, d, e, a, F0, KK4, 5, 5);
359 R(a, b, c, d, e, F0, KK4, 14, 8);
360 R(e, a, b, c, d, F0, KK4, 6, 7);
361 R(d, e, a, b, c, F0, KK4, 8, 6);
362 R(c, d, e, a, b, F0, KK4, 13, 2);
363 R(b, c, d, e, a, F0, KK4, 6, 13);
364 R(a, b, c, d, e, F0, KK4, 5, 14);
365 R(e, a, b, c, d, F0, KK4, 15, 0);
366 R(d, e, a, b, c, F0, KK4, 13, 3);
367 R(c, d, e, a, b, F0, KK4, 11, 9);
368 R(b, c, d, e, a, F0, KK4, 11, 11); /* #79 */
369
370 t = state[1] + cc + d;
371 state[1] = state[2] + dd + e;
372 state[2] = state[3] + ee + a;
373 state[3] = state[4] + aa + b;
374 state[4] = state[0] + bb + c;
375 state[0] = t;
376}
377
378#endif /* !WITH_OPENSSL */
diff --git a/openbsd-compat/rmd160.h b/openbsd-compat/rmd160.h
deleted file mode 100644
index 99c1dcdc0..000000000
--- a/openbsd-compat/rmd160.h
+++ /dev/null
@@ -1,61 +0,0 @@
1/* $OpenBSD: rmd160.h,v 1.17 2012/12/05 23:19:57 deraadt Exp $ */
2/*
3 * Copyright (c) 2001 Markus Friedl. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
15 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
18 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
25#ifndef _RMD160_H
26#define _RMD160_H
27
28#ifndef WITH_OPENSSL
29
30#define RMD160_BLOCK_LENGTH 64
31#define RMD160_DIGEST_LENGTH 20
32#define RMD160_DIGEST_STRING_LENGTH (RMD160_DIGEST_LENGTH * 2 + 1)
33
34/* RMD160 context. */
35typedef struct RMD160Context {
36 u_int32_t state[5]; /* state */
37 u_int64_t count; /* number of bits, mod 2^64 */
38 u_int8_t buffer[RMD160_BLOCK_LENGTH]; /* input buffer */
39} RMD160_CTX;
40
41void RMD160Init(RMD160_CTX *);
42void RMD160Transform(u_int32_t [5], const u_int8_t [RMD160_BLOCK_LENGTH])
43 __attribute__((__bounded__(__minbytes__,1,5)))
44 __attribute__((__bounded__(__minbytes__,2,RMD160_BLOCK_LENGTH)));
45void RMD160Update(RMD160_CTX *, const u_int8_t *, size_t)
46 __attribute__((__bounded__(__string__,2,3)));
47void RMD160Pad(RMD160_CTX *);
48void RMD160Final(u_int8_t [RMD160_DIGEST_LENGTH], RMD160_CTX *)
49 __attribute__((__bounded__(__minbytes__,1,RMD160_DIGEST_LENGTH)));
50char *RMD160End(RMD160_CTX *, char *)
51 __attribute__((__bounded__(__minbytes__,2,RMD160_DIGEST_STRING_LENGTH)));
52char *RMD160File(const char *, char *)
53 __attribute__((__bounded__(__minbytes__,2,RMD160_DIGEST_STRING_LENGTH)));
54char *RMD160FileChunk(const char *, char *, off_t, off_t)
55 __attribute__((__bounded__(__minbytes__,2,RMD160_DIGEST_STRING_LENGTH)));
56char *RMD160Data(const u_int8_t *, size_t, char *)
57 __attribute__((__bounded__(__string__,1,2)))
58 __attribute__((__bounded__(__minbytes__,3,RMD160_DIGEST_STRING_LENGTH)));
59
60#endif /* !WITH_OPENSSL */
61#endif /* _RMD160_H */