Home | History | Annotate | only in /src/common/lib/libc/hash
History log of /src/common/lib/libc/hash
RevisionDateAuthorComments
 1.9 15-Sep-2025  christos pacify lint
 1.8 20-Aug-2019  para add now required includes for memcpy prototypes analogue to other hash functions

(fix the build)
 1.7 20-Aug-2019  riastradh Fix byte order bug in murmurhash and pacify sanitizers.
 1.6 26-Oct-2013  rmind branches: 1.6.26; 1.6.28;
murmurhash2: add an optimised path for the aligned pointer case.
 1.5 30-Jun-2013  rmind RUMP fix: ifdef weak alias. Pointed out by martin@.
 1.4 10-Jul-2012  christos branches: 1.4.2; 1.4.4;
Fix kernel compilation: no namespace.h
Fix libc RCSID protection.
Remove useless cast.
 1.3 09-Jul-2012  rmind Add weak symbol for murmurhash2.
 1.2 08-Jul-2012  rmind Shut up lint.
 1.1 08-Jul-2012  rmind Add MurmurHash2 -- a non-cryptographic hash function by Austin Appleby.
The code is taken from the upstream and is in the public domain.

OK christos@
 1.4.4.3 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.4.4.2 30-Oct-2012  yamt sync with head
 1.4.4.1 10-Jul-2012  yamt file murmurhash.c was added on branch yamt-pagecache on 2012-10-30 18:46:13 +0000
 1.4.2.1 19-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.6.28.1 08-Dec-2019  martin Pull up following revision(s) (requested by riastradh in ticket #505):

common/lib/libc/hash/murmurhash/murmurhash.c: revision 1.7
common/lib/libc/hash/murmurhash/murmurhash.c: revision 1.8
sys/sys/param.h: revision 1.610
sys/arch/amd64/include/param.h: revision 1.31
sys/arch/i386/include/param.h: revision 1.85

New macro ALIGNED_POINTER_LOAD.

To be used with ALIGNED_POINTER(p,t) instead of writing *(const t *)p
directly. This way, on machines without strict alignment, we can use
memcpy to pacify sanitizers, while getting the same compiled code in
the end with a single (say) MOV instruction.

Fix byte order bug in murmurhash and pacify sanitizers.
add now required includes for memcpy prototypes analogue to other hash functions
(fix the build)
 1.6.26.3 21-Apr-2020  martin Ooops, restore accidently removed files from merge mishap
 1.6.26.2 21-Apr-2020  martin Sync with HEAD
 1.6.26.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.7 21-Apr-2015  riastradh branches: 1.7.16;
Sort includes.
 1.6 15-Apr-2015  justin 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.
 1.5 21-Aug-2009  skrll Don't define weak aliases if _STANDALONE.
 1.4 16-Feb-2008  apb For all files under src/common, as well as related man pages under
src/lib/libc, or related headers under src/sys/sys: change u_intNN_t to
uintNN_t.
 1.3 18-Jul-2007  joerg branches: 1.3.4; 1.3.8;
Fix SIGBUS issues on strict alignment issues. Use le32dec in RMD160
as the data pointer to RMD160_Update doesn't have to be aligned.
In SHA256_Update and SHA512_Update, only operate directly on the passed
in data if no left-over in the context exists and the data is correctly
aligned. The problem was exposed by the audit-packages rewrite in C
and reported for the libnbcompat version in PR pkg/36662.
 1.2 01-Nov-2006  he branches: 1.2.2; 1.2.4; 1.2.12;
Add include of <sys/param.h>, to allow vax kernels to build again.
For vax, this causes <machine/macros.h> to be included and the
redefine of memset() to take effect.
 1.1 27-Oct-2006  christos this is shared with the kernel now.
 1.2.12.1 03-Sep-2007  wrstuden Sync w/ NetBSD-4-RC_1
 1.2.4.2 18-Nov-2008  snj Pull up following revision(s) (requested by tsutsui in ticket #1224):
common/lib/libc/gen/bswap64.c: revision 1.2
common/lib/libprop/prop_data.c: revision 1.10
common/lib/libc/inet/inet_addr.c: revision 1.2
common/lib/libc/hash/rmd160/rmd160.c: revision 1.4
common/lib/libc/gen/bswap32.c: revision 1.2
common/lib/libc/gen/bswap16.c: revision 1.2
common/lib/libc/arch/alpha/gen/byte_swap_4.S: revision 1.3
common/lib/libc/arch/sh3/string/memset.S: revision 1.2
common/lib/libc/arch/alpha/gen/byte_swap_2.S: revision 1.3
common/lib/libc/md/md5c.c: revision 1.3
common/lib/libc/hash/sha1/sha1.c: revision 1.3
common/lib/libc/md/md4c.c: revision 1.3
sys/sys/rmd160.h: revision 1.2
sys/sys/sha2.h: revision 1.2
For all files under src/common, as well as related man pages under
src/lib/libc, or related headers under src/sys/sys: change u_intNN_t to
uintNN_t.
 1.2.4.1 18-Jul-2007  liamjfoy Pull up following revision(s) (requested by joerg in ticket #776):
common/lib/libc/hash/sha2/sha2.c: revision 1.5
common/lib/libc/hash/sha2/sha2.c: revision 1.6
common/lib/libc/hash/rmd160/rmd160.c: revision 1.3
Fix SIGBUS issues on strict alignment issues. Use le32dec in RMD160
as the data pointer to RMD160_Update doesn't have to be aligned.
In SHA256_Update and SHA512_Update, only operate directly on the passed
in data if no left-over in the context exists and the data is correctly
aligned. The problem was exposed by the audit-packages rewrite in C
and reported for the libnbcompat version in PR pkg/36662.
cast to void* to avoid a fatal warning
 1.2.2.2 01-Nov-2006  he Add include of <sys/param.h>, to allow vax kernels to build again.
For vax, this causes <machine/macros.h> to be included and the
redefine of memset() to take effect.
 1.2.2.1 01-Nov-2006  he file rmd160.c was added on branch newlock2 on 2006-11-01 11:29:09 +0000
 1.3.8.2 18-Jul-2007  joerg Fix SIGBUS issues on strict alignment issues. Use le32dec in RMD160
as the data pointer to RMD160_Update doesn't have to be aligned.
In SHA256_Update and SHA512_Update, only operate directly on the passed
in data if no left-over in the context exists and the data is correctly
aligned. The problem was exposed by the audit-packages rewrite in C
and reported for the libnbcompat version in PR pkg/36662.
 1.3.8.1 18-Jul-2007  joerg file rmd160.c was added on branch matt-mips64 on 2007-07-18 13:57:55 +0000
 1.3.4.1 23-Mar-2008  matt sync with HEAD
 1.7.16.2 21-Apr-2020  martin Ooops, restore accidently removed files from merge mishap
 1.7.16.1 21-Apr-2020  martin Sync with HEAD
 1.7 28-Oct-2021  christos Use defined constant instead of direct value (Etienne Brateau)
 1.6 06-Nov-2009  joerg branches: 1.6.48;
Improve portability and clarity by using uint8_t for the byte data
and expanding u_int to not depend on the !POSIX types.
 1.5 21-Aug-2009  skrll Don't define weak aliases if _STANDALONE.
 1.4 16-Mar-2009  cegger ansify function definitions
 1.3 16-Feb-2008  apb branches: 1.3.12;
For all files under src/common, as well as related man pages under
src/lib/libc, or related headers under src/sys/sys: change u_intNN_t to
uintNN_t.
 1.2 27-Oct-2006  christos branches: 1.2.2; 1.2.4; 1.2.16;
restruct the include files to look like the other hash functions.
 1.1 20-Dec-2005  christos add files I forgot to commit.
 1.2.16.1 23-Mar-2008  matt sync with HEAD
 1.2.4.1 18-Nov-2008  snj Pull up following revision(s) (requested by tsutsui in ticket #1224):
common/lib/libc/gen/bswap64.c: revision 1.2
common/lib/libprop/prop_data.c: revision 1.10
common/lib/libc/inet/inet_addr.c: revision 1.2
common/lib/libc/hash/rmd160/rmd160.c: revision 1.4
common/lib/libc/gen/bswap32.c: revision 1.2
common/lib/libc/gen/bswap16.c: revision 1.2
common/lib/libc/arch/alpha/gen/byte_swap_4.S: revision 1.3
common/lib/libc/arch/sh3/string/memset.S: revision 1.2
common/lib/libc/arch/alpha/gen/byte_swap_2.S: revision 1.3
common/lib/libc/md/md5c.c: revision 1.3
common/lib/libc/hash/sha1/sha1.c: revision 1.3
common/lib/libc/md/md4c.c: revision 1.3
sys/sys/rmd160.h: revision 1.2
sys/sys/sha2.h: revision 1.2
For all files under src/common, as well as related man pages under
src/lib/libc, or related headers under src/sys/sys: change u_intNN_t to
uintNN_t.
 1.2.2.2 27-Oct-2006  christos restruct the include files to look like the other hash functions.
 1.2.2.1 27-Oct-2006  christos file sha1.c was added on branch newlock2 on 2006-10-27 21:25:22 +0000
 1.3.12.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.6.48.2 21-Apr-2020  martin Ooops, restore accidently removed files from merge mishap
 1.6.48.1 21-Apr-2020  martin Sync with HEAD
 1.26 20-Jan-2024  christos move local decls to headers
 1.25 28-Oct-2021  christos Fix build with -Werror=array-parameter (Etienne Brateau)
 1.24 09-Jun-2013  christos branches: 1.24.28;
no need for the local defs of he enc functions; compat_defs.h provides them.
 1.23 09-Jun-2013  christos Use be{32,64}enc, suggested by joerg.
 1.22 07-Jun-2013  christos PR/47908: Gary Grebus: SHA256_Transform and SHA512_Transform are called
by openssl with unaligned buffers. All other Transforms can handle unaligned
buffers so make these handle them too.
XXX[1]: any better fixes are welcome
XXX[2]: pullup-5, pullup-6
 1.21 24-Jan-2010  joerg branches: 1.21.6; 1.21.12;
Fix unaligned access in *_Final for SHA224/SHA256/SHA384.
Remaining part of PR 42273. Tested by snj.
 1.20 06-Nov-2009  joerg Fix unaligned access as reported in PR port-sparc/42273
 1.19 21-Aug-2009  skrll Don't define weak aliases if _STANDALONE.
 1.18 25-Jun-2009  joerg Fix initialisation of SHA224.
 1.17 19-Jun-2009  tsutsui - move #include <sys/param.h> inside #if defined(_KERNEL) section
where it's actually required
- add XXX comments that notes <sys/param.h> is required for vax memset(9)
 1.16 18-Jun-2009  he Back out the addition of memset.c to the vax libkern, and instead do
as tsutsui@ suggested, and include <sys/param.h> in sha2.c instead.
On the vax, this causes <machine/macros.h> to be included, and it contains
that machine's memset() macro+inline.
 1.15 14-Jun-2009  martin Fix copy&paste errors
 1.14 11-Jun-2009  joerg Provide fallback definitions of be[32|64]toh and htobe[32|64] for
systems without sys/endian.h.
 1.13 11-Jun-2009  christos use memcpy for bitcount writes to the buffer to avoid type punning issues.
 1.12 11-Jun-2009  christos - fix sha224 functions that used sha256 ctx, and add casts.
- fix sha224 function lengths.
- wrap long lines
- use NULL
- fix whitespace
- put all 224 functions together in the same spirit as 384
 1.11 11-Jun-2009  joerg KNF
 1.10 11-Jun-2009  joerg De-uglify:
- drop useless asserts
- use uintXX_t directly
- use NULL
 1.9 11-Jun-2009  joerg Simplify by using sys/endian.h functions. Fixes Big Endian case for SHA2.
 1.8 26-May-2009  joerg Add SHA224 implementation to libc.
Make libcrypto use the SHA2 implementation of libc.
Bump minor versions of libc and libcrypto.
 1.7 16-Feb-2008  apb branches: 1.7.10; 1.7.12; 1.7.14;
C99 is no longer "very recent". Adjust a comment accordingly, and
start using uintNN_t instead of u_intNN_t in the definitions of
sha2_{byte,word32,word64}.
 1.6 18-Jul-2007  drochner branches: 1.6.4; 1.6.8;
cast to void* to avoid a fatal warning
 1.5 18-Jul-2007  joerg Fix SIGBUS issues on strict alignment issues. Use le32dec in RMD160
as the data pointer to RMD160_Update doesn't have to be aligned.
In SHA256_Update and SHA512_Update, only operate directly on the passed
in data if no left-over in the context exists and the data is correctly
aligned. The problem was exposed by the audit-packages rewrite in C
and reported for the libnbcompat version in PR pkg/36662.
 1.4 18-Feb-2007  christos Make SHA512_Last static since it is not part of the API. Suggested by
Matthias Scheler
 1.3 17-Feb-2007  christos make SHA512_Last weak.
 1.2 01-Nov-2006  he branches: 1.2.2; 1.2.4;
Add include of <sys/param.h>, to allow vax kernels to build again.
For vax, this causes <machine/macros.h> to be included and the
redefine of memset() to take effect.
 1.1 27-Oct-2006  christos this is shared with the kernel now.
 1.2.4.7 27-Jan-2010  bouyer Pull up following revision(s) (requested by joerg in ticket #1382):
common/lib/libc/hash/sha2/sha2.c: revision 1.21
Fix unaligned access in *_Final for SHA224/SHA256/SHA384.
Remaining part of PR 42273. Tested by snj.
 1.2.4.6 27-Jan-2010  bouyer Pull up following revision(s) (requested by joerg in ticket #1381):
common/lib/libc/hash/sha2/sha2.c: revision 1.20
Fix unaligned access as reported in PR port-sparc/42273
 1.2.4.5 22-Jul-2009  snj Apply patch (requested by joerg in ticket #1338):
- Add support for SHA224 to libc
- Fix Big Endian support in some cases
- Use libc support in libcrypto
 1.2.4.4 18-Nov-2008  snj Pull up following revision(s) (requested by tsutsui in ticket #1224):
common/lib/libc/hash/sha2/sha2.c: revision 1.7
C99 is no longer "very recent". Adjust a comment accordingly, and
start using uintNN_t instead of u_intNN_t in the definitions of
sha2_{byte,word32,word64}.
 1.2.4.3 18-Jul-2007  liamjfoy branches: 1.2.4.3.2;
Pull up following revision(s) (requested by joerg in ticket #776):
common/lib/libc/hash/sha2/sha2.c: revision 1.5
common/lib/libc/hash/sha2/sha2.c: revision 1.6
common/lib/libc/hash/rmd160/rmd160.c: revision 1.3
Fix SIGBUS issues on strict alignment issues. Use le32dec in RMD160
as the data pointer to RMD160_Update doesn't have to be aligned.
In SHA256_Update and SHA512_Update, only operate directly on the passed
in data if no left-over in the context exists and the data is correctly
aligned. The problem was exposed by the audit-packages rewrite in C
and reported for the libnbcompat version in PR pkg/36662.
cast to void* to avoid a fatal warning
 1.2.4.2 19-Feb-2007  tron branches: 1.2.4.2.2;
Pull up following revision(s) (requested by christos in ticket #456):
common/lib/libc/hash/sha2/sha2.c: revision 1.4
Make SHA512_Last static since it is not part of the API. Suggested by
Matthias Scheler
 1.2.4.1 19-Feb-2007  tron Pull up following revision(s) (requested by christos in ticket #456):
common/lib/libc/hash/sha2/sha2.c: revision 1.3
make SHA512_Last weak.
 1.2.4.3.2.1 22-Jul-2009  snj Apply patch (requested by joerg in ticket #1338):
- Add support for SHA224 to libc
- Fix Big Endian support in some cases
- Use libc support in libcrypto
 1.2.4.2.2.1 03-Sep-2007  wrstuden Sync w/ NetBSD-4-RC_1
 1.2.2.2 01-Nov-2006  he Add include of <sys/param.h>, to allow vax kernels to build again.
For vax, this causes <machine/macros.h> to be included and the
redefine of memset() to take effect.
 1.2.2.1 01-Nov-2006  he file sha2.c was added on branch newlock2 on 2006-11-01 11:29:09 +0000
 1.6.8.2 18-Jul-2007  drochner cast to void* to avoid a fatal warning
 1.6.8.1 18-Jul-2007  drochner file sha2.c was added on branch matt-mips64 on 2007-07-18 16:58:15 +0000
 1.6.4.1 23-Mar-2008  matt sync with HEAD
 1.7.14.3 30-Jan-2010  snj Pull up following revision(s) (requested by joerg in ticket #1276):
common/lib/libc/hash/sha2/sha2.c: revision 1.21
Fix unaligned access in *_Final for SHA224/SHA256/SHA384.
Remaining part of PR 42273. Tested by snj.
 1.7.14.2 30-Jan-2010  snj Pull up following revision(s) (requested by joerg in ticket #1275):
common/lib/libc/hash/sha2/sha2.c: revision 1.20
Fix unaligned access as reported in PR port-sparc/42273
 1.7.14.1 14-Jul-2009  snj branches: 1.7.14.1.2;
Pull up following revisions (requested by joerg in ticket #855):
common/lib/libc/hash/sha2/sha2.c: revisions 1.8-1.18 via patch
crypto/dist/openssl/crypto/evp/m_sha1.c: revisions 1.2-1.3 via patch
distrib/sets/lists/base/md.amd64: revision 1.51 via patch
distrib/sets/lists/base/md.sparc64: revision 1.46 via patch
distrib/sets/lists/base/shl.mi: revision 1.474 via patch
distrib/sets/lists/comp/mi: revision 1.1263 via patch
lib/libc/shlib_version: patch
lib/libc/hash/sha2/Makefile.inc: revision 1.4 via patch
lib/libc/hash/sha2/sha2.3: revision 1.5 via patch
lib/libc/hash/sha2/sha224hl.c: revision 1.1 via patch
lib/libc/include/namespace.h: revision 1.138 via patch
lib/libcrypto/libc-sha256.c: revision 1.1 via patch
lib/libcrypto/libc-sha512.c: revision 1.1 via patch
lib/libcrypto/sha.inc: revision 1.10 via patch
lib/libcrypto/shlib_version: patch
sys/lib/libkern/arch/vax/Makefile.inc: revision 1.21 via patch
sys/sys/sha2.h: revision 1.3 via patch
Add SHA224 implementation to libc.
Make libcrypto use the SHA2 implementation of libc.
Bump minor versions of libc and libcrypto.
 1.7.14.1.2.1 21-Apr-2010  matt sync to netbsd-5
 1.7.12.1 23-Jul-2009  jym Sync with HEAD.
 1.7.10.3 30-Jan-2010  snj Pull up following revision(s) (requested by joerg in ticket #1276):
common/lib/libc/hash/sha2/sha2.c: revision 1.21
Fix unaligned access in *_Final for SHA224/SHA256/SHA384.
Remaining part of PR 42273. Tested by snj.
 1.7.10.2 30-Jan-2010  snj Pull up following revision(s) (requested by joerg in ticket #1275):
common/lib/libc/hash/sha2/sha2.c: revision 1.20
Fix unaligned access as reported in PR port-sparc/42273.
 1.7.10.1 14-Jul-2009  snj Pull up following revisions (requested by joerg in ticket #855):
common/lib/libc/hash/sha2/sha2.c: revisions 1.8-1.18 via patch
crypto/dist/openssl/crypto/evp/m_sha1.c: revisions 1.2-1.3 via patch
distrib/sets/lists/base/md.amd64: revision 1.51 via patch
distrib/sets/lists/base/md.sparc64: revision 1.46 via patch
distrib/sets/lists/base/shl.mi: revision 1.474 via patch
distrib/sets/lists/comp/mi: revision 1.1263 via patch
lib/libc/shlib_version: patch
lib/libc/hash/sha2/Makefile.inc: revision 1.4 via patch
lib/libc/hash/sha2/sha2.3: revision 1.5 via patch
lib/libc/hash/sha2/sha224hl.c: revision 1.1 via patch
lib/libc/include/namespace.h: revision 1.138 via patch
lib/libcrypto/libc-sha256.c: revision 1.1 via patch
lib/libcrypto/libc-sha512.c: revision 1.1 via patch
lib/libcrypto/sha.inc: revision 1.10 via patch
lib/libcrypto/shlib_version: patch
sys/sys/sha2.h: revision 1.3 via patch
Add SHA224 implementation to libc.
Make libcrypto use the SHA2 implementation of libc.
Bump minor versions of libc and libcrypto.
 1.21.12.1 23-Jun-2013  tls resync from head
 1.21.6.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.24.28.2 21-Apr-2020  martin Ooops, restore accidently removed files from merge mishap
 1.24.28.1 21-Apr-2020  martin Sync with HEAD
 1.1 30-Nov-2017  riastradh branches: 1.1.4;
Import SHA-3 code into libc and libkern.

No new public symbols in libc, but publishing the symbols is a simple
matter if/when we decide to do so.

Proposed on tech-kern and tech-userlevel with no objections:

https://mail-index.NetBSD.org/tech-kern/2017/11/11/msg022581.html
https://mail-index.NetBSD.org/tech-userlevel/2017/11/11/msg010968.html
 1.1.4.2 21-Apr-2020  martin Ooops, restore accidently removed files from merge mishap
 1.1.4.1 21-Apr-2020  martin Sync with HEAD
 1.1 30-Nov-2017  riastradh branches: 1.1.4;
Import SHA-3 code into libc and libkern.

No new public symbols in libc, but publishing the symbols is a simple
matter if/when we decide to do so.

Proposed on tech-kern and tech-userlevel with no objections:

https://mail-index.NetBSD.org/tech-kern/2017/11/11/msg022581.html
https://mail-index.NetBSD.org/tech-userlevel/2017/11/11/msg010968.html
 1.1.4.2 21-Apr-2020  martin Ooops, restore accidently removed files from merge mishap
 1.1.4.1 21-Apr-2020  martin Sync with HEAD
 1.4 19-Jan-2024  christos use size_t
 1.3 31-Jul-2021  andvar fix more typos in style found one in file - check/fix them all.
 1.2 30-May-2020  riastradh Merge updates from upstream to reduce stack usage of SHA3_Selftest.
 1.1 30-Nov-2017  riastradh branches: 1.1.4;
Import SHA-3 code into libc and libkern.

No new public symbols in libc, but publishing the symbols is a simple
matter if/when we decide to do so.

Proposed on tech-kern and tech-userlevel with no objections:

https://mail-index.NetBSD.org/tech-kern/2017/11/11/msg022581.html
https://mail-index.NetBSD.org/tech-userlevel/2017/11/11/msg010968.html
 1.1.4.2 21-Apr-2020  martin Ooops, restore accidently removed files from merge mishap
 1.1.4.1 21-Apr-2020  martin Sync with HEAD

RSS XML Feed