Wed Apr 15 08:31:05 2015 UTC ()
On big endian machines needs to include sys/endian.h for le32dec

Mainly affects cross builds on big endian; tested on FreeBSD mips
and Linux ppc.


(justin)
diff -r1.5 -r1.6 src/common/lib/libc/hash/rmd160/rmd160.c

cvs diff -r1.5 -r1.6 src/common/lib/libc/hash/rmd160/rmd160.c (expand / switch to unified diff)

--- src/common/lib/libc/hash/rmd160/rmd160.c 2009/08/21 09:40:51 1.5
+++ src/common/lib/libc/hash/rmd160/rmd160.c 2015/04/15 08:31:05 1.6
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: rmd160.c,v 1.5 2009/08/21 09:40:51 skrll Exp $ */ 1/* $NetBSD: rmd160.c,v 1.6 2015/04/15 08:31:05 justin Exp $ */
2/* $KAME: rmd160.c,v 1.2 2003/07/25 09:37:55 itojun Exp $ */ 2/* $KAME: rmd160.c,v 1.2 2003/07/25 09:37:55 itojun Exp $ */
3/* $OpenBSD: rmd160.c,v 1.3 2001/09/26 21:40:13 markus Exp $ */ 3/* $OpenBSD: rmd160.c,v 1.3 2001/09/26 21:40:13 markus Exp $ */
4/* 4/*
5 * Copyright (c) 2001 Markus Friedl. All rights reserved. 5 * Copyright (c) 2001 Markus Friedl. All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -23,42 +23,43 @@ @@ -23,42 +23,43 @@
23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27/* 27/*
28 * Preneel, Bosselaers, Dobbertin, "The Cryptographic Hash Function RIPEMD-160", 28 * Preneel, Bosselaers, Dobbertin, "The Cryptographic Hash Function RIPEMD-160",
29 * RSA Laboratories, CryptoBytes, Volume 3, Number 2, Autumn 1997, 29 * RSA Laboratories, CryptoBytes, Volume 3, Number 2, Autumn 1997,
30 * ftp://ftp.rsasecurity.com/pub/cryptobytes/crypto3n2.pdf 30 * ftp://ftp.rsasecurity.com/pub/cryptobytes/crypto3n2.pdf
31 */ 31 */
32 32
33#include <sys/cdefs.h> 33#include <sys/cdefs.h>
34 34
35#if defined(_KERNEL) || defined(_STANDALONE) 35#if defined(_KERNEL) || defined(_STANDALONE)
36__KERNEL_RCSID(0, "$NetBSD: rmd160.c,v 1.5 2009/08/21 09:40:51 skrll Exp $"); 36__KERNEL_RCSID(0, "$NetBSD: rmd160.c,v 1.6 2015/04/15 08:31:05 justin Exp $");
37 37
38#include <lib/libkern/libkern.h> 38#include <lib/libkern/libkern.h>
39 39
40#else 40#else
41 41
42#if defined(LIBC_SCCS) && !defined(lint) 42#if defined(LIBC_SCCS) && !defined(lint)
43__RCSID("$NetBSD: rmd160.c,v 1.5 2009/08/21 09:40:51 skrll Exp $"); 43__RCSID("$NetBSD: rmd160.c,v 1.6 2015/04/15 08:31:05 justin Exp $");
44#endif /* LIBC_SCCS and not lint */ 44#endif /* LIBC_SCCS and not lint */
45 45
46#include "namespace.h" 46#include "namespace.h"
47#include <assert.h> 47#include <assert.h>
48#include <string.h> 48#include <string.h>
49 49
50#endif 50#endif
51 51
 52#include <sys/endian.h>
52#include <sys/types.h> 53#include <sys/types.h>
53#include <sys/param.h> 54#include <sys/param.h>
54#include <sys/rmd160.h> 55#include <sys/rmd160.h>
55 56
56 57
57#define PUT_64BIT_LE(cp, value) do { \ 58#define PUT_64BIT_LE(cp, value) do { \
58 (cp)[7] = (u_char)((value) >> 56); \ 59 (cp)[7] = (u_char)((value) >> 56); \
59 (cp)[6] = (u_char)((value) >> 48); \ 60 (cp)[6] = (u_char)((value) >> 48); \
60 (cp)[5] = (u_char)((value) >> 40); \ 61 (cp)[5] = (u_char)((value) >> 40); \
61 (cp)[4] = (u_char)((value) >> 32); \ 62 (cp)[4] = (u_char)((value) >> 32); \
62 (cp)[3] = (u_char)((value) >> 24); \ 63 (cp)[3] = (u_char)((value) >> 24); \
63 (cp)[2] = (u_char)((value) >> 16); \ 64 (cp)[2] = (u_char)((value) >> 16); \
64 (cp)[1] = (u_char)((value) >> 8); \ 65 (cp)[1] = (u_char)((value) >> 8); \