mirror of
https://gitlab.freedesktop.org/libbsd/libbsd.git
synced 2025-10-20 05:49:08 +02:00
Compare commits
26 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
9bed430ee3 | ||
![]() |
cbfe0ebca9 | ||
![]() |
f3b566bd7c | ||
![]() |
e86c1b5f43 | ||
![]() |
b7ce33cf51 | ||
![]() |
ed84bec5aa | ||
![]() |
cbe3057703 | ||
![]() |
5a32ea0a72 | ||
![]() |
2fb148a290 | ||
![]() |
c8f0723d2b | ||
![]() |
008316aa29 | ||
![]() |
e4ab2c62cd | ||
![]() |
bf5573f86c | ||
![]() |
229f85794f | ||
![]() |
7a75687541 | ||
![]() |
f84004baf2 | ||
![]() |
cdf998a056 | ||
![]() |
2c77ad593c | ||
![]() |
48ac79b188 | ||
![]() |
290a1ce8f2 | ||
![]() |
6bcb1312f4 | ||
![]() |
da137a0921 | ||
![]() |
d2f59a23d5 | ||
![]() |
01b77f0dcf | ||
![]() |
75729394af | ||
![]() |
8493c7f27d |
438
COPYING
438
COPYING
@@ -1,10 +1,18 @@
|
|||||||
The following 4-clause BSD licenses are only for man pages, specifically
|
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
|
||||||
for man/arc4random.3, man/tree.3 and man/getprogname.3.
|
|
||||||
|
|
||||||
|
Files:
|
||||||
|
*
|
||||||
|
Copyright:
|
||||||
|
Copyright © 2004-2006, 2008-2015 Guillem Jover <guillem@hadrons.org>
|
||||||
|
License: BSD-3-clause
|
||||||
|
|
||||||
|
Files:
|
||||||
|
man/arc4random.3
|
||||||
|
man/tree.3
|
||||||
|
Copyright:
|
||||||
Copyright 1997 Niels Provos <provos@physnet.uni-hamburg.de>
|
Copyright 1997 Niels Provos <provos@physnet.uni-hamburg.de>
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
License: BSD-4-clause-Niels-Provos
|
||||||
Redistribution and use in source and binary forms, with or without
|
Redistribution and use in source and binary forms, with or without
|
||||||
modification, are permitted provided that the following conditions
|
modification, are permitted provided that the following conditions
|
||||||
are met:
|
are met:
|
||||||
@@ -18,7 +26,7 @@ for man/arc4random.3, man/tree.3 and man/getprogname.3.
|
|||||||
This product includes software developed by Niels Provos.
|
This product includes software developed by Niels Provos.
|
||||||
4. The name of the author may not be used to endorse or promote products
|
4. The name of the author may not be used to endorse or promote products
|
||||||
derived from this software without specific prior written permission.
|
derived from this software without specific prior written permission.
|
||||||
|
.
|
||||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||||
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||||
@@ -30,11 +38,12 @@ for man/arc4random.3, man/tree.3 and man/getprogname.3.
|
|||||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||||
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
--
|
Files:
|
||||||
|
man/getprogname.3
|
||||||
|
Copyright:
|
||||||
Copyright © 2001 Christopher G. Demetriou
|
Copyright © 2001 Christopher G. Demetriou
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
License: BSD-4-clause-Christopher-G-Demetriou
|
||||||
Redistribution and use in source and binary forms, with or without
|
Redistribution and use in source and binary forms, with or without
|
||||||
modification, are permitted provided that the following conditions
|
modification, are permitted provided that the following conditions
|
||||||
are met:
|
are met:
|
||||||
@@ -50,7 +59,7 @@ for man/arc4random.3, man/tree.3 and man/getprogname.3.
|
|||||||
information about NetBSD.
|
information about NetBSD.
|
||||||
4. The name of the author may not be used to endorse or promote products
|
4. The name of the author may not be used to endorse or promote products
|
||||||
derived from this software without specific prior written permission.
|
derived from this software without specific prior written permission.
|
||||||
|
.
|
||||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||||
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||||
@@ -62,68 +71,85 @@ for man/arc4random.3, man/tree.3 and man/getprogname.3.
|
|||||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||||
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
Files:
|
||||||
The rest of the licenses apply to code and/or man pages.
|
include/bsd/err.h
|
||||||
|
include/bsd/stdlib.h
|
||||||
|
include/bsd/unistd.h
|
||||||
Copyright © 2004-2006, 2008-2015 Guillem Jover <guillem@hadrons.org>
|
src/bsd_getopt.c
|
||||||
|
src/err.c
|
||||||
|
src/fgetln.c
|
||||||
|
src/progname.c
|
||||||
|
Copyright:
|
||||||
|
Copyright © 2005, 2008-2012 Guillem Jover <guillem@hadrons.org>
|
||||||
Copyright © 2005 Hector Garcia Alvarez
|
Copyright © 2005 Hector Garcia Alvarez
|
||||||
Copyright © 2005 Aurelien Jarno
|
Copyright © 2005 Aurelien Jarno
|
||||||
Copyright © 2006 Robert Millan
|
Copyright © 2006 Robert Millan
|
||||||
|
License: BSD-3-clause
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
Files:
|
||||||
modification, are permitted provided that the following conditions
|
include/bsd/netinet/ip_icmp.h
|
||||||
are met:
|
include/bsd/sys/bitstring.h
|
||||||
1. Redistributions of source code must retain the above copyright
|
include/bsd/sys/queue.h
|
||||||
notice, this list of conditions and the following disclaimer.
|
include/bsd/timeconv.h
|
||||||
2. Redistributions in binary form must reproduce the above copyright
|
include/bsd/vis.h
|
||||||
notice, this list of conditions and the following disclaimer in the
|
man/bitstring.3
|
||||||
documentation and/or other materials provided with the distribution.
|
man/explicit_bzero.3
|
||||||
3. The name of the author may not be used to endorse or promote products
|
man/fgetln.3
|
||||||
derived from this software without specific prior written permission.
|
man/fgetwln.3
|
||||||
|
man/funopen.3bsd
|
||||||
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
man/getbsize.3
|
||||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
man/heapsort.3
|
||||||
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
man/nlist.3
|
||||||
THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
man/queue.3bsd
|
||||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
man/radixsort.3
|
||||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
man/reallocarray.3
|
||||||
OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
man/reallocf.3
|
||||||
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
man/setmode.3
|
||||||
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
man/strmode.3
|
||||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
man/strnstr.3
|
||||||
|
man/unvis.3
|
||||||
--
|
man/vis.3
|
||||||
|
man/wcslcpy.3
|
||||||
|
src/getbsize.c
|
||||||
|
src/heapsort.c
|
||||||
|
src/merge.c
|
||||||
|
src/nlist.c
|
||||||
|
src/radixsort.c
|
||||||
|
src/setmode.c
|
||||||
|
src/strmode.c
|
||||||
|
src/strnstr.c
|
||||||
|
src/unvis.c
|
||||||
|
src/vis.c
|
||||||
|
Copyright:
|
||||||
Copyright © 1980, 1982, 1986, 1989-1994
|
Copyright © 1980, 1982, 1986, 1989-1994
|
||||||
The Regents of the University of California. All rights reserved.
|
The Regents of the University of California. All rights reserved.
|
||||||
Copyright © 2001 Mike Barcroft <mike@FreeBSD.org>
|
Copyright © 2001 Mike Barcroft <mike@FreeBSD.org>
|
||||||
|
.
|
||||||
Some code is derived from software contributed to Berkeley by
|
Some code is derived from software contributed to Berkeley by
|
||||||
the American National Standards Committee X3, on Information
|
the American National Standards Committee X3, on Information
|
||||||
Processing Systems.
|
Processing Systems.
|
||||||
|
.
|
||||||
Some code is derived from software contributed to Berkeley by
|
Some code is derived from software contributed to Berkeley by
|
||||||
Peter McIlroy.
|
Peter McIlroy.
|
||||||
|
.
|
||||||
Some code is derived from software contributed to Berkeley by
|
Some code is derived from software contributed to Berkeley by
|
||||||
Ronnie Kon at Mindcraft Inc., Kevin Lew and Elmer Yglesias.
|
Ronnie Kon at Mindcraft Inc., Kevin Lew and Elmer Yglesias.
|
||||||
|
.
|
||||||
Some code is derived from software contributed to Berkeley by
|
Some code is derived from software contributed to Berkeley by
|
||||||
Dave Borman at Cray Research, Inc.
|
Dave Borman at Cray Research, Inc.
|
||||||
|
.
|
||||||
Some code is derived from software contributed to Berkeley by
|
Some code is derived from software contributed to Berkeley by
|
||||||
Paul Vixie.
|
Paul Vixie.
|
||||||
|
.
|
||||||
Some code is derived from software contributed to Berkeley by
|
Some code is derived from software contributed to Berkeley by
|
||||||
Chris Torek.
|
Chris Torek.
|
||||||
|
.
|
||||||
© UNIX System Laboratories, Inc.
|
Copyright © UNIX System Laboratories, Inc.
|
||||||
All or some portions of this file are derived from material licensed
|
All or some portions of this file are derived from material licensed
|
||||||
to the University of California by American Telephone and Telegraph
|
to the University of California by American Telephone and Telegraph
|
||||||
Co. or Unix System Laboratories, Inc. and are reproduced herein with
|
Co. or Unix System Laboratories, Inc. and are reproduced herein with
|
||||||
the permission of UNIX System Laboratories, Inc.
|
the permission of UNIX System Laboratories, Inc.
|
||||||
|
License: BSD-3-clause-Regents
|
||||||
Redistribution and use in source and binary forms, with or without
|
Redistribution and use in source and binary forms, with or without
|
||||||
modification, are permitted provided that the following conditions
|
modification, are permitted provided that the following conditions
|
||||||
are met:
|
are met:
|
||||||
@@ -135,7 +161,7 @@ The rest of the licenses apply to code and/or man pages.
|
|||||||
3. Neither the name of the University nor the names of its contributors
|
3. Neither the name of the University nor the names of its contributors
|
||||||
may be used to endorse or promote products derived from this software
|
may be used to endorse or promote products derived from this software
|
||||||
without specific prior written permission.
|
without specific prior written permission.
|
||||||
|
.
|
||||||
THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
@@ -148,18 +174,14 @@ The rest of the licenses apply to code and/or man pages.
|
|||||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
SUCH DAMAGE.
|
SUCH DAMAGE.
|
||||||
|
|
||||||
--
|
Files:
|
||||||
|
include/bsd/libutil.h
|
||||||
|
Copyright:
|
||||||
Copyright © 1996 Peter Wemm <peter@FreeBSD.org>.
|
Copyright © 1996 Peter Wemm <peter@FreeBSD.org>.
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
Copyright © 2002 Networks Associates Technology, Inc.
|
Copyright © 2002 Networks Associates Technology, Inc.
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
License: BSD-3-clause-Peter-Wemm
|
||||||
Portions of this software were developed for the FreeBSD Project by
|
|
||||||
ThinkSec AS and NAI Labs, the Security Research Division of Network
|
|
||||||
Associates, Inc. under DARPA/SPAWAR contract N66001-01-C-8035
|
|
||||||
("CBOSS"), as part of the DARPA CHATS research program.
|
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
Redistribution and use in source and binary forms, with or without
|
||||||
modification, is permitted provided that the following conditions
|
modification, is permitted provided that the following conditions
|
||||||
are met:
|
are met:
|
||||||
@@ -171,7 +193,7 @@ The rest of the licenses apply to code and/or man pages.
|
|||||||
3. The name of the author may not be used to endorse or promote
|
3. The name of the author may not be used to endorse or promote
|
||||||
products derived from this software without specific prior written
|
products derived from this software without specific prior written
|
||||||
permission.
|
permission.
|
||||||
|
.
|
||||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
@@ -184,11 +206,12 @@ The rest of the licenses apply to code and/or man pages.
|
|||||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
SUCH DAMAGE.
|
SUCH DAMAGE.
|
||||||
|
|
||||||
--
|
Files:
|
||||||
|
man/setproctitle.3
|
||||||
|
Copyright:
|
||||||
Copyright © 1995 Peter Wemm <peter@FreeBSD.org>
|
Copyright © 1995 Peter Wemm <peter@FreeBSD.org>
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
License: BSD-5-clause-Peter-Wemm
|
||||||
Redistribution and use in source and binary forms, with or without
|
Redistribution and use in source and binary forms, with or without
|
||||||
modification, is permitted provided that the following conditions
|
modification, is permitted provided that the following conditions
|
||||||
are met:
|
are met:
|
||||||
@@ -205,26 +228,33 @@ The rest of the licenses apply to code and/or man pages.
|
|||||||
5. Modifications may be freely made to this file providing the above
|
5. Modifications may be freely made to this file providing the above
|
||||||
conditions are met.
|
conditions are met.
|
||||||
|
|
||||||
--
|
Files:
|
||||||
|
include/bsd/stringlist.h
|
||||||
|
man/fmtcheck.3
|
||||||
|
man/humanize_number.3
|
||||||
|
man/stringlist.3
|
||||||
|
src/fmtcheck.c
|
||||||
|
src/humanize_number.c
|
||||||
|
src/stringlist.c
|
||||||
|
Copyright:
|
||||||
Copyright © 1994, 1997-2000, 2002, 2008 The NetBSD Foundation, Inc.
|
Copyright © 1994, 1997-2000, 2002, 2008 The NetBSD Foundation, Inc.
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
.
|
||||||
Some code was contributed to The NetBSD Foundation by Allen Briggs.
|
Some code was contributed to The NetBSD Foundation by Allen Briggs.
|
||||||
|
.
|
||||||
Some code was contributed to The NetBSD Foundation by Luke Mewburn.
|
Some code was contributed to The NetBSD Foundation by Luke Mewburn.
|
||||||
|
.
|
||||||
Some code is derived from software contributed to The NetBSD Foundation
|
Some code is derived from software contributed to The NetBSD Foundation
|
||||||
by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
|
by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
|
||||||
NASA Ames Research Center, by Luke Mewburn and by Tomas Svensson.
|
NASA Ames Research Center, by Luke Mewburn and by Tomas Svensson.
|
||||||
|
.
|
||||||
Some code is derived from software contributed to The NetBSD Foundation
|
Some code is derived from software contributed to The NetBSD Foundation
|
||||||
by Julio M. Merino Vidal, developed as part of Google's Summer of Code
|
by Julio M. Merino Vidal, developed as part of Google's Summer of Code
|
||||||
2005 program.
|
2005 program.
|
||||||
|
.
|
||||||
Some code is derived from software contributed to The NetBSD Foundation
|
Some code is derived from software contributed to The NetBSD Foundation
|
||||||
by Christos Zoulas.
|
by Christos Zoulas.
|
||||||
|
License: BSD-2-clause-NetBSD
|
||||||
Redistribution and use in source and binary forms, with or without
|
Redistribution and use in source and binary forms, with or without
|
||||||
modification, are permitted provided that the following conditions
|
modification, are permitted provided that the following conditions
|
||||||
are met:
|
are met:
|
||||||
@@ -233,7 +263,7 @@ The rest of the licenses apply to code and/or man pages.
|
|||||||
2. Redistributions in binary form must reproduce the above copyright
|
2. Redistributions in binary form must reproduce the above copyright
|
||||||
notice, this list of conditions and the following disclaimer in the
|
notice, this list of conditions and the following disclaimer in the
|
||||||
documentation and/or other materials provided with the distribution.
|
documentation and/or other materials provided with the distribution.
|
||||||
|
.
|
||||||
THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||||
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
@@ -246,46 +276,68 @@ The rest of the licenses apply to code and/or man pages.
|
|||||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
POSSIBILITY OF SUCH DAMAGE.
|
POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
--
|
Files:
|
||||||
|
include/bsd/sys/endian.h
|
||||||
|
man/expand_number.3
|
||||||
|
man/closefrom.3
|
||||||
|
man/flopen.3
|
||||||
|
man/getpeereid.3
|
||||||
|
man/pidfile.3
|
||||||
|
src/expand_number.c
|
||||||
|
src/hash/sha512.h
|
||||||
|
src/hash/sha512c.c
|
||||||
|
src/pidfile.c
|
||||||
|
src/reallocf.c
|
||||||
|
src/timeconv.c
|
||||||
|
Copyright:
|
||||||
Copyright © 1998, M. Warner Losh <imp@freebsd.org>
|
Copyright © 1998, M. Warner Losh <imp@freebsd.org>
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
.
|
||||||
Copyright © 2001 Dima Dorfman.
|
Copyright © 2001 Dima Dorfman.
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
.
|
||||||
Copyright © 2001 FreeBSD Inc.
|
Copyright © 2001 FreeBSD Inc.
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
.
|
||||||
Copyright © 2002 Thomas Moestl <tmm@FreeBSD.org>
|
Copyright © 2002 Thomas Moestl <tmm@FreeBSD.org>
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
.
|
||||||
Copyright © 2005 Pawel Jakub Dawidek <pjd@FreeBSD.org>
|
Copyright © 2005 Pawel Jakub Dawidek <pjd@FreeBSD.org>
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
.
|
||||||
Copyright © 2005 Colin Percival
|
Copyright © 2005 Colin Percival
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
.
|
||||||
Copyright © 2007 Eric Anderson <anderson@FreeBSD.org>
|
Copyright © 2007 Eric Anderson <anderson@FreeBSD.org>
|
||||||
Copyright © 2007 Pawel Jakub Dawidek <pjd@FreeBSD.org>
|
Copyright © 2007 Pawel Jakub Dawidek <pjd@FreeBSD.org>
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
.
|
||||||
Copyright © 2007 Dag-Erling Coïdan Smørgrav
|
Copyright © 2007 Dag-Erling Coïdan Smørgrav
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
.
|
||||||
Copyright © 2009 Advanced Computing Technologies LLC
|
Copyright © 2009 Advanced Computing Technologies LLC
|
||||||
Written by: John H. Baldwin <jhb@FreeBSD.org>
|
Written by: John H. Baldwin <jhb@FreeBSD.org>
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
.
|
||||||
|
Copyright © 2011 Guillem Jover <guillem@hadrons.org>
|
||||||
|
License: BSD-2-clause
|
||||||
|
|
||||||
|
Files:
|
||||||
|
src/flopen.c
|
||||||
|
Copyright:
|
||||||
|
Copyright © 2007 Dag-Erling Coïdan Smørgrav
|
||||||
|
All rights reserved.
|
||||||
|
License: BSD-2-clause-verbatim
|
||||||
Redistribution and use in source and binary forms, with or without
|
Redistribution and use in source and binary forms, with or without
|
||||||
modification, are permitted provided that the following conditions
|
modification, are permitted provided that the following conditions
|
||||||
are met:
|
are met:
|
||||||
1. Redistributions of source code must retain the above copyright
|
1. Redistributions of source code must retain the above copyright
|
||||||
notice, this list of conditions and the following disclaimer.
|
notice, this list of conditions and the following disclaimer
|
||||||
|
in this position and unchanged.
|
||||||
2. Redistributions in binary form must reproduce the above copyright
|
2. Redistributions in binary form must reproduce the above copyright
|
||||||
notice, this list of conditions and the following disclaimer in the
|
notice, this list of conditions and the following disclaimer in the
|
||||||
documentation and/or other materials provided with the distribution.
|
documentation and/or other materials provided with the distribution.
|
||||||
|
.
|
||||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
@@ -298,14 +350,17 @@ The rest of the licenses apply to code and/or man pages.
|
|||||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
SUCH DAMAGE.
|
SUCH DAMAGE.
|
||||||
|
|
||||||
--
|
Files:
|
||||||
|
include/bsd/sys/tree.h
|
||||||
|
man/fparseln.3
|
||||||
|
src/fparseln.c
|
||||||
|
Copyright:
|
||||||
Copyright © 1997 Christos Zoulas.
|
Copyright © 1997 Christos Zoulas.
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
.
|
||||||
Copyright © 2002 Niels Provos <provos@citi.umich.edu>
|
Copyright © 2002 Niels Provos <provos@citi.umich.edu>
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
License: BSD-2-clause-author
|
||||||
Redistribution and use in source and binary forms, with or without
|
Redistribution and use in source and binary forms, with or without
|
||||||
modification, are permitted provided that the following conditions
|
modification, are permitted provided that the following conditions
|
||||||
are met:
|
are met:
|
||||||
@@ -314,7 +369,7 @@ The rest of the licenses apply to code and/or man pages.
|
|||||||
2. Redistributions in binary form must reproduce the above copyright
|
2. Redistributions in binary form must reproduce the above copyright
|
||||||
notice, this list of conditions and the following disclaimer in the
|
notice, this list of conditions and the following disclaimer in the
|
||||||
documentation and/or other materials provided with the distribution.
|
documentation and/or other materials provided with the distribution.
|
||||||
|
.
|
||||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||||
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||||
@@ -326,40 +381,34 @@ The rest of the licenses apply to code and/or man pages.
|
|||||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||||
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
--
|
Files:
|
||||||
|
include/bsd/readpassphrase.h
|
||||||
Copyright © 2007 Dag-Erling Coïdan Smørgrav
|
man/readpassphrase.3
|
||||||
All rights reserved.
|
man/strlcpy.3
|
||||||
|
man/strtonum.3
|
||||||
Redistribution and use in source and binary forms, with or without
|
src/arc4random.c
|
||||||
modification, are permitted provided that the following conditions
|
src/arc4random_openbsd.h
|
||||||
are met:
|
src/arc4random_uniform.c
|
||||||
1. Redistributions of source code must retain the above copyright
|
src/arc4random_unix.h
|
||||||
notice, this list of conditions and the following disclaimer
|
src/closefrom.c
|
||||||
in this position and unchanged.
|
src/getentropy_aix.c
|
||||||
2. Redistributions in binary form must reproduce the above copyright
|
src/getentropy_bsd.c
|
||||||
notice, this list of conditions and the following disclaimer in the
|
src/getentropy_hpux.c
|
||||||
documentation and/or other materials provided with the distribution.
|
src/getentropy_hurd.c
|
||||||
|
src/getentropy_linux.c
|
||||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
src/getentropy_osx.c
|
||||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
src/getentropy_solaris.c
|
||||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
src/readpassphrase.c
|
||||||
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
src/reallocarray.c
|
||||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
src/strlcat.c
|
||||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
src/strlcpy.c
|
||||||
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
src/strtonum.c
|
||||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
Copyright:
|
||||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
||||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
||||||
SUCH DAMAGE.
|
|
||||||
|
|
||||||
--
|
|
||||||
|
|
||||||
Copyright © 2004 Ted Unangst and Todd Miller
|
Copyright © 2004 Ted Unangst and Todd Miller
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
.
|
||||||
Copyright © 1996 David Mazieres <dm@uun.org>
|
Copyright © 1996 David Mazieres <dm@uun.org>
|
||||||
Copyright © 1998, 2000, 2004-2005, 2010, 2012-2014
|
Copyright © 1998, 2000-2002, 2004-2005, 2007, 2010, 2012-2014
|
||||||
Todd C. Miller <Todd.Miller@courtesan.com>
|
Todd C. Miller <Todd.Miller@courtesan.com>
|
||||||
Copyright © 2004 Ted Unangst
|
Copyright © 2004 Ted Unangst
|
||||||
Copyright © 2008 Damien Miller <djm@openbsd.org>
|
Copyright © 2008 Damien Miller <djm@openbsd.org>
|
||||||
@@ -371,11 +420,11 @@ The rest of the licenses apply to code and/or man pages.
|
|||||||
Copyright © 2014 Theo de Raadt <deraadt@openbsd.org>
|
Copyright © 2014 Theo de Raadt <deraadt@openbsd.org>
|
||||||
Copyright © 2015 Michael Felt <aixtools@gmail.com>
|
Copyright © 2015 Michael Felt <aixtools@gmail.com>
|
||||||
Copyright © 2015 Guillem Jover <guillem@hadrons.org>
|
Copyright © 2015 Guillem Jover <guillem@hadrons.org>
|
||||||
|
License: ISC
|
||||||
Permission to use, copy, modify, and distribute this software for any
|
Permission to use, copy, modify, and distribute this software for any
|
||||||
purpose with or without fee is hereby granted, provided that the above
|
purpose with or without fee is hereby granted, provided that the above
|
||||||
copyright notice and this permission notice appear in all copies.
|
copyright notice and this permission notice appear in all copies.
|
||||||
|
.
|
||||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||||
@@ -384,34 +433,15 @@ The rest of the licenses apply to code and/or man pages.
|
|||||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
--
|
Files:
|
||||||
|
src/inet_net_pton.c
|
||||||
Copyright © 2000-2002, 2007 Todd C. Miller <Todd.Miller@courtesan.com>
|
Copyright:
|
||||||
|
|
||||||
Permission to use, copy, modify, and distribute this software for any
|
|
||||||
purpose with or without fee is hereby granted, provided that the above
|
|
||||||
copyright notice and this permission notice appear in all copies.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
||||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
||||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
||||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
||||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
||||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
||||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
||||||
|
|
||||||
Sponsored in part by the Defense Advanced Research Projects
|
|
||||||
Agency (DARPA) and Air Force Research Laboratory, Air Force
|
|
||||||
Materiel Command, USAF, under agreement number F39502-99-1-0512
|
|
||||||
|
|
||||||
--
|
|
||||||
|
|
||||||
Copyright © 1996 by Internet Software Consortium.
|
Copyright © 1996 by Internet Software Consortium.
|
||||||
|
License: ISC-Original
|
||||||
Permission to use, copy, modify, and distribute this software for any
|
Permission to use, copy, modify, and distribute this software for any
|
||||||
purpose with or without fee is hereby granted, provided that the above
|
purpose with or without fee is hereby granted, provided that the above
|
||||||
copyright notice and this permission notice appear in all copies.
|
copyright notice and this permission notice appear in all copies.
|
||||||
|
.
|
||||||
THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
|
THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
|
||||||
ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
|
ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
|
||||||
OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
|
OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
|
||||||
@@ -421,46 +451,12 @@ The rest of the licenses apply to code and/or man pages.
|
|||||||
ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
|
|
||||||
--
|
Files:
|
||||||
|
src/setproctitle.c
|
||||||
Copyright © 1996, David Mazieres <dm@uun.org>
|
Copyright:
|
||||||
Copyright © 2008, Damien Miller <djm@openbsd.org>
|
|
||||||
|
|
||||||
Permission to use, copy, modify, and distribute this software for any
|
|
||||||
purpose with or without fee is hereby granted, provided that the above
|
|
||||||
copyright notice and this permission notice appear in all copies.
|
|
||||||
|
|
||||||
Modification and redistribution in source and binary forms is
|
|
||||||
permitted provided that due credit is given to the author and the
|
|
||||||
OpenBSD project (for instance by leaving this copyright notice
|
|
||||||
intact).
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
||||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
||||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
||||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
||||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
||||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
||||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
||||||
|
|
||||||
This code is derived from section 17.1 of Applied Cryptography,
|
|
||||||
second edition, which describes a stream cipher allegedly
|
|
||||||
compatible with RSA Labs "RC4" cipher (the actual description of
|
|
||||||
which is a trade secret). The same algorithm is used as a stream
|
|
||||||
cipher called "arcfour" in Tatu Ylonen's ssh package.
|
|
||||||
|
|
||||||
Here the stream cipher has been modified always to include the time
|
|
||||||
when initializing the state. That makes it impossible to
|
|
||||||
regenerate the same random sequence twice, so this can't be used
|
|
||||||
for encryption, but will generate good random numbers.
|
|
||||||
|
|
||||||
RC4 is a registered trademark of RSA Laboratories.
|
|
||||||
|
|
||||||
--
|
|
||||||
|
|
||||||
Copyright © 2010 William Ahern
|
Copyright © 2010 William Ahern
|
||||||
Copyright © 2012 Guillem Jover <guillem@hadrons.org>
|
Copyright © 2012 Guillem Jover <guillem@hadrons.org>
|
||||||
|
License: Expat
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a
|
Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
copy of this software and associated documentation files (the
|
copy of this software and associated documentation files (the
|
||||||
"Software"), to deal in the Software without restriction, including
|
"Software"), to deal in the Software without restriction, including
|
||||||
@@ -468,10 +464,10 @@ The rest of the licenses apply to code and/or man pages.
|
|||||||
distribute, sublicense, and/or sell copies of the Software, and to permit
|
distribute, sublicense, and/or sell copies of the Software, and to permit
|
||||||
persons to whom the Software is furnished to do so, subject to the
|
persons to whom the Software is furnished to do so, subject to the
|
||||||
following conditions:
|
following conditions:
|
||||||
|
.
|
||||||
The above copyright notice and this permission notice shall be included
|
The above copyright notice and this permission notice shall be included
|
||||||
in all copies or substantial portions of the Software.
|
in all copies or substantial portions of the Software.
|
||||||
|
.
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||||
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
||||||
@@ -480,26 +476,78 @@ The rest of the licenses apply to code and/or man pages.
|
|||||||
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||||
USE OR OTHER DEALINGS IN THE SOFTWARE.
|
USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
--
|
Files:
|
||||||
|
include/bsd/md5.h
|
||||||
|
src/hash/md5.c
|
||||||
|
Copyright:
|
||||||
|
None
|
||||||
|
License: public-domain-Colin-Plumb
|
||||||
This code implements the MD5 message-digest algorithm.
|
This code implements the MD5 message-digest algorithm.
|
||||||
The algorithm is due to Ron Rivest. This code was
|
The algorithm is due to Ron Rivest. This code was
|
||||||
written by Colin Plumb in 1993, no copyright is claimed.
|
written by Colin Plumb in 1993, no copyright is claimed.
|
||||||
This code is in the public domain; do with it what you wish.
|
This code is in the public domain; do with it what you wish.
|
||||||
|
|
||||||
Equivalent code is available from RSA Data Security, Inc.
|
Files:
|
||||||
This code has been tested against that, and is equivalent,
|
src/explicit_bzero.c
|
||||||
except that you don't need to include two pages of legalese
|
src/chacha_private.h
|
||||||
with every copy.
|
Copyright:
|
||||||
|
None
|
||||||
To compute the message digest of a chunk of bytes, declare an
|
License: public-domain
|
||||||
MD5Context structure, pass it to MD5Init, call MD5Update as
|
Public domain.
|
||||||
needed on buffers full of bytes, and then call MD5Final, which
|
|
||||||
will fill a supplied 16-byte array with the digest.
|
|
||||||
|
|
||||||
--
|
|
||||||
|
|
||||||
|
Files:
|
||||||
|
man/mdX.3bsd
|
||||||
|
src/hash/md5hl.c
|
||||||
|
src/hash/helper.c
|
||||||
|
Copyright:
|
||||||
|
None
|
||||||
|
License: Beerware
|
||||||
"THE BEER-WARE LICENSE" (Revision 42):
|
"THE BEER-WARE LICENSE" (Revision 42):
|
||||||
<phk@login.dkuug.dk> wrote this file. As long as you retain this notice you
|
<phk@login.dkuug.dk> wrote this file. As long as you retain this notice you
|
||||||
can do whatever you want with this stuff. If we meet some day, and you think
|
can do whatever you want with this stuff. If we meet some day, and you think
|
||||||
this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
|
this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
|
||||||
|
|
||||||
|
License: BSD-3-clause
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions
|
||||||
|
are met:
|
||||||
|
1. Redistributions of source code must retain the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer.
|
||||||
|
2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer in the
|
||||||
|
documentation and/or other materials provided with the distribution.
|
||||||
|
3. The name of the author may not be used to endorse or promote products
|
||||||
|
derived from this software without specific prior written permission.
|
||||||
|
.
|
||||||
|
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||||
|
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
|
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||||
|
THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
|
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||||
|
OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||||
|
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||||
|
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||||
|
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
License: BSD-2-clause
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions
|
||||||
|
are met:
|
||||||
|
1. Redistributions of source code must retain the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer.
|
||||||
|
2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer in the
|
||||||
|
documentation and/or other materials provided with the distribution.
|
||||||
|
.
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||||
|
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||||
|
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||||
|
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
|
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
|
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
SUCH DAMAGE.
|
||||||
|
13
README
13
README
@@ -9,7 +9,7 @@ code over and over again on each project.
|
|||||||
Releases
|
Releases
|
||||||
--------
|
--------
|
||||||
|
|
||||||
<http://libbsd.freedesktop.org/releases/>
|
<https://libbsd.freedesktop.org/releases/>
|
||||||
|
|
||||||
|
|
||||||
Mailing List
|
Mailing List
|
||||||
@@ -17,7 +17,7 @@ Mailing List
|
|||||||
|
|
||||||
The subscription interface and web archives can be found at:
|
The subscription interface and web archives can be found at:
|
||||||
|
|
||||||
<http://lists.freedesktop.org/mailman/listinfo/libbsd>
|
<https://lists.freedesktop.org/mailman/listinfo/libbsd>
|
||||||
|
|
||||||
The mail address is:
|
The mail address is:
|
||||||
|
|
||||||
@@ -27,5 +27,10 @@ The mail address is:
|
|||||||
Source Repository
|
Source Repository
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
<http://cgit.freedesktop.org/libbsd>
|
The master repository can be browsed at:
|
||||||
<git://anongit.freedesktop.org/git/libbsd>
|
|
||||||
|
<https://cgit.freedesktop.org/libbsd>
|
||||||
|
|
||||||
|
and cloned from:
|
||||||
|
|
||||||
|
<https://anongit.freedesktop.org/git/libbsd>
|
||||||
|
12
configure.ac
12
configure.ac
@@ -13,7 +13,7 @@ m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
|
|||||||
|
|
||||||
LIBBSD_ABI_MAJOR=0
|
LIBBSD_ABI_MAJOR=0
|
||||||
LIBBSD_ABI_MINOR=8
|
LIBBSD_ABI_MINOR=8
|
||||||
LIBBSD_ABI_PATCH=0
|
LIBBSD_ABI_PATCH=3
|
||||||
|
|
||||||
LIBBSD_ABI="$LIBBSD_ABI_MAJOR:$LIBBSD_ABI_MINOR:$LIBBSD_ABI_PATCH"
|
LIBBSD_ABI="$LIBBSD_ABI_MAJOR:$LIBBSD_ABI_MINOR:$LIBBSD_ABI_PATCH"
|
||||||
AC_SUBST([LIBBSD_ABI])
|
AC_SUBST([LIBBSD_ABI])
|
||||||
@@ -44,6 +44,16 @@ AC_SUBST([TESTU01_LIBS])
|
|||||||
AM_CONDITIONAL([HAVE_LIBTESTU01],
|
AM_CONDITIONAL([HAVE_LIBTESTU01],
|
||||||
[test "x$ac_cv_lib_testu01_unif01_CreateExternGenBits" = "xyes"])
|
[test "x$ac_cv_lib_testu01_unif01_CreateExternGenBits" = "xyes"])
|
||||||
|
|
||||||
|
# In old glibc versions (< 2.17) clock_gettime() is in librt.
|
||||||
|
AS_CASE([$host_os],
|
||||||
|
[*-gnu], [
|
||||||
|
saved_LIBS="$LIBS"
|
||||||
|
AC_SEARCH_LIBS([clock_gettime], [rt], [CLOCK_GETTIME_LIBS="-lrt"])
|
||||||
|
AC_SUBST([CLOCK_GETTIME_LIBS])
|
||||||
|
LIBS="$saved_LIBS"
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
||||||
# Checks for header files.
|
# Checks for header files.
|
||||||
AC_CHECK_HEADERS([sys/ndir.h sys/dir.h ndir.h dirent.h])
|
AC_CHECK_HEADERS([sys/ndir.h sys/dir.h ndir.h dirent.h])
|
||||||
|
|
||||||
|
@@ -27,10 +27,12 @@
|
|||||||
#ifndef LIBBSD_H
|
#ifndef LIBBSD_H
|
||||||
#define LIBBSD_H
|
#define LIBBSD_H
|
||||||
|
|
||||||
|
#ifdef LIBBSD_OVERLAY
|
||||||
|
#warning "This header is meant to be used w/o the libbsd overlay."
|
||||||
|
#else
|
||||||
/*
|
/*
|
||||||
* Include all bsd compat headers.
|
* Include all bsd compat headers.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <bsd/sys/cdefs.h>
|
#include <bsd/sys/cdefs.h>
|
||||||
#include <bsd/sys/queue.h>
|
#include <bsd/sys/queue.h>
|
||||||
#include <bsd/sys/tree.h>
|
#include <bsd/sys/tree.h>
|
||||||
@@ -40,5 +42,6 @@
|
|||||||
#include <bsd/err.h>
|
#include <bsd/err.h>
|
||||||
#include <bsd/getopt.h>
|
#include <bsd/getopt.h>
|
||||||
#include <bsd/md5.h>
|
#include <bsd/md5.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -34,7 +34,11 @@
|
|||||||
#ifndef LIBBSD_ERR_H
|
#ifndef LIBBSD_ERR_H
|
||||||
#define LIBBSD_ERR_H
|
#define LIBBSD_ERR_H
|
||||||
|
|
||||||
|
#ifdef LIBBSD_OVERLAY
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
|
#else
|
||||||
|
#include <bsd/sys/cdefs.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
|
@@ -28,6 +28,7 @@ typedef struct MD5Context {
|
|||||||
} MD5_CTX;
|
} MD5_CTX;
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
__BEGIN_DECLS
|
__BEGIN_DECLS
|
||||||
void MD5Init(MD5_CTX *);
|
void MD5Init(MD5_CTX *);
|
||||||
|
@@ -1,6 +1,9 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright © 2011 Guillem Jover <guillem@hadrons.org>
|
* Copyright © 2011 Guillem Jover <guillem@hadrons.org>
|
||||||
*
|
*
|
||||||
|
* Copyright © 2002 Thomas Moestl <tmm@FreeBSD.org>
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
* are met:
|
* are met:
|
||||||
@@ -9,19 +12,18 @@
|
|||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
* 3. The name of the author may not be used to endorse or promote products
|
|
||||||
* derived from this software without specific prior written permission.
|
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
* THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
* SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef LIBBSD_OVERLAY
|
#ifdef LIBBSD_OVERLAY
|
||||||
@@ -49,32 +51,6 @@
|
|||||||
#define _PDP_ENDIAN __PDP_ENDIAN
|
#define _PDP_ENDIAN __PDP_ENDIAN
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
|
||||||
* Copyright © 2002 Thomas Moestl <tmm@FreeBSD.org>
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
||||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
||||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
||||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
||||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
||||||
* SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
/* Alignment-agnostic encode/decode bytestream to/from little/big endian. */
|
/* Alignment-agnostic encode/decode bytestream to/from little/big endian. */
|
||||||
|
@@ -34,7 +34,11 @@
|
|||||||
#ifndef LIBBSD_UNISTD_H
|
#ifndef LIBBSD_UNISTD_H
|
||||||
#define LIBBSD_UNISTD_H
|
#define LIBBSD_UNISTD_H
|
||||||
|
|
||||||
|
#ifdef LIBBSD_OVERLAY
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
|
#else
|
||||||
|
#include <bsd/sys/cdefs.h>
|
||||||
|
#endif
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
#ifndef S_ISTXT
|
#ifndef S_ISTXT
|
||||||
|
@@ -1059,7 +1059,7 @@ However, unlike their unsafe counterparts,
|
|||||||
.Nm TAILQ_FOREACH
|
.Nm TAILQ_FOREACH
|
||||||
and
|
and
|
||||||
.Nm TAILQ_FOREACH_REVERSE
|
.Nm TAILQ_FOREACH_REVERSE
|
||||||
permit to both remove
|
make it possible to both remove
|
||||||
.Fa var
|
.Fa var
|
||||||
as well as free it from within the loop safely without interfering with the
|
as well as free it from within the loop safely without interfering with the
|
||||||
traversal.
|
traversal.
|
||||||
|
@@ -12,6 +12,7 @@ libbsd_la_included_sources = \
|
|||||||
getentropy_aix.c \
|
getentropy_aix.c \
|
||||||
getentropy_bsd.c \
|
getentropy_bsd.c \
|
||||||
getentropy_hpux.c \
|
getentropy_hpux.c \
|
||||||
|
getentropy_hurd.c \
|
||||||
getentropy_linux.c \
|
getentropy_linux.c \
|
||||||
getentropy_osx.c \
|
getentropy_osx.c \
|
||||||
getentropy_solaris.c \
|
getentropy_solaris.c \
|
||||||
@@ -51,14 +52,14 @@ hash/md5hl.c: $(srcdir)/hash/helper.c
|
|||||||
libbsd_la_DEPENDENCIES = \
|
libbsd_la_DEPENDENCIES = \
|
||||||
$(libbsd_la_included_sources) \
|
$(libbsd_la_included_sources) \
|
||||||
libbsd.map
|
libbsd.map
|
||||||
|
libbsd_la_LIBADD = \
|
||||||
|
$(CLOCK_GETTIME_LIBS)
|
||||||
libbsd_la_LDFLAGS = \
|
libbsd_la_LDFLAGS = \
|
||||||
-Wl,--version-script=$(srcdir)/libbsd.map \
|
-Wl,--version-script=$(srcdir)/libbsd.map \
|
||||||
-version-number $(LIBBSD_ABI)
|
-version-number $(LIBBSD_ABI)
|
||||||
libbsd_la_SOURCES = \
|
libbsd_la_SOURCES = \
|
||||||
arc4random.c \
|
arc4random.c \
|
||||||
arc4random.h \
|
arc4random.h \
|
||||||
arc4random_bsd.h \
|
|
||||||
arc4random_linux.h \
|
|
||||||
arc4random_unix.h \
|
arc4random_unix.h \
|
||||||
arc4random_openbsd.h \
|
arc4random_openbsd.h \
|
||||||
arc4random_uniform.c \
|
arc4random_uniform.c \
|
||||||
|
@@ -1,3 +1,29 @@
|
|||||||
|
/*
|
||||||
|
* Copyright © 2015 Guillem Jover <guillem@hadrons.org>
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* 3. The name of the author may not be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||||
|
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
|
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||||
|
* THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||||
|
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||||
|
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||||
|
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||||
|
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
#ifndef LIBBSD_ARC4RANDOM_H
|
#ifndef LIBBSD_ARC4RANDOM_H
|
||||||
#define LIBBSD_ARC4RANDOM_H
|
#define LIBBSD_ARC4RANDOM_H
|
||||||
|
|
||||||
@@ -6,24 +32,10 @@
|
|||||||
int
|
int
|
||||||
getentropy(void *buf, size_t len);
|
getentropy(void *buf, size_t len);
|
||||||
|
|
||||||
#if defined(__linux__)
|
#if defined(__OpenBSD__)
|
||||||
#include "arc4random_linux.h"
|
|
||||||
#elif defined(__FreeBSD__)
|
|
||||||
#include "arc4random_bsd.h"
|
|
||||||
#elif defined(__NetBSD__)
|
|
||||||
#include "arc4random_bsd.h"
|
|
||||||
#elif defined(__OpenBSD__)
|
|
||||||
#include "arc4random_openbsd.h"
|
#include "arc4random_openbsd.h"
|
||||||
#elif defined(__sun)
|
|
||||||
#include "arc4random_unix.h"
|
|
||||||
#elif defined(__APPLE__)
|
|
||||||
#include "arc4random_unix.h"
|
|
||||||
#elif defined(_AIX)
|
|
||||||
#include "arc4random_unix.h"
|
|
||||||
#elif defined(__hpux)
|
|
||||||
#include "arc4random_unix.h"
|
|
||||||
#else
|
#else
|
||||||
#error "No arc4random hooks defined for this platform."
|
#include "arc4random_unix.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -1,86 +0,0 @@
|
|||||||
/* $OpenBSD: arc4random_freebsd.h,v 1.2 2015/01/15 06:57:18 deraadt Exp $ */
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Copyright (c) 1996, David Mazieres <dm@uun.org>
|
|
||||||
* Copyright (c) 2008, Damien Miller <djm@openbsd.org>
|
|
||||||
* Copyright (c) 2013, Markus Friedl <markus@openbsd.org>
|
|
||||||
* Copyright (c) 2014, Theo de Raadt <deraadt@openbsd.org>
|
|
||||||
*
|
|
||||||
* Permission to use, copy, modify, and distribute this software for any
|
|
||||||
* purpose with or without fee is hereby granted, provided that the above
|
|
||||||
* copyright notice and this permission notice appear in all copies.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
||||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
||||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
||||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
||||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
||||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
||||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Stub functions for portability.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <sys/mman.h>
|
|
||||||
|
|
||||||
#include <pthread.h>
|
|
||||||
#include <signal.h>
|
|
||||||
|
|
||||||
static pthread_mutex_t arc4random_mtx = PTHREAD_MUTEX_INITIALIZER;
|
|
||||||
#define _ARC4_LOCK() pthread_mutex_lock(&arc4random_mtx)
|
|
||||||
#define _ARC4_UNLOCK() pthread_mutex_unlock(&arc4random_mtx)
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Unfortunately, pthread_atfork() is broken on FreeBSD (at least 9 and 10) if
|
|
||||||
* a program does not link to -lthr. Callbacks registered with pthread_atfork()
|
|
||||||
* appear to fail silently. So, it is not always possible to detect a PID
|
|
||||||
* wraparound.
|
|
||||||
*/
|
|
||||||
#define _ARC4_ATFORK(f) pthread_atfork(NULL, NULL, (f))
|
|
||||||
|
|
||||||
static inline void
|
|
||||||
_getentropy_fail(void)
|
|
||||||
{
|
|
||||||
raise(SIGKILL);
|
|
||||||
}
|
|
||||||
|
|
||||||
static volatile sig_atomic_t _rs_forked;
|
|
||||||
|
|
||||||
static inline void
|
|
||||||
_rs_forkhandler(void)
|
|
||||||
{
|
|
||||||
_rs_forked = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void
|
|
||||||
_rs_forkdetect(void)
|
|
||||||
{
|
|
||||||
static pid_t _rs_pid = 0;
|
|
||||||
pid_t pid = getpid();
|
|
||||||
|
|
||||||
if (_rs_pid == 0 || _rs_pid != pid || _rs_forked) {
|
|
||||||
_rs_pid = pid;
|
|
||||||
_rs_forked = 0;
|
|
||||||
if (rs)
|
|
||||||
memset(rs, 0, sizeof(*rs));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline int
|
|
||||||
_rs_allocate(struct _rs **rsp, struct _rsx **rsxp)
|
|
||||||
{
|
|
||||||
if ((*rsp = mmap(NULL, sizeof(**rsp), PROT_READ|PROT_WRITE,
|
|
||||||
MAP_ANON|MAP_PRIVATE, -1, 0)) == MAP_FAILED)
|
|
||||||
return (-1);
|
|
||||||
|
|
||||||
if ((*rsxp = mmap(NULL, sizeof(**rsxp), PROT_READ|PROT_WRITE,
|
|
||||||
MAP_ANON|MAP_PRIVATE, -1, 0)) == MAP_FAILED) {
|
|
||||||
munmap(*rsp, sizeof(**rsp));
|
|
||||||
return (-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
_ARC4_ATFORK(_rs_forkhandler);
|
|
||||||
return (0);
|
|
||||||
}
|
|
@@ -1,86 +0,0 @@
|
|||||||
/* $OpenBSD: arc4random_linux.h,v 1.8 2014/08/13 06:04:10 deraadt Exp $ */
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Copyright (c) 1996, David Mazieres <dm@uun.org>
|
|
||||||
* Copyright (c) 2008, Damien Miller <djm@openbsd.org>
|
|
||||||
* Copyright (c) 2013, Markus Friedl <markus@openbsd.org>
|
|
||||||
* Copyright (c) 2014, Theo de Raadt <deraadt@openbsd.org>
|
|
||||||
*
|
|
||||||
* Permission to use, copy, modify, and distribute this software for any
|
|
||||||
* purpose with or without fee is hereby granted, provided that the above
|
|
||||||
* copyright notice and this permission notice appear in all copies.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
||||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
||||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
||||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
||||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
||||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
||||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Stub functions for portability.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <sys/mman.h>
|
|
||||||
|
|
||||||
#include <pthread.h>
|
|
||||||
#include <signal.h>
|
|
||||||
|
|
||||||
static pthread_mutex_t arc4random_mtx = PTHREAD_MUTEX_INITIALIZER;
|
|
||||||
#define _ARC4_LOCK() pthread_mutex_lock(&arc4random_mtx)
|
|
||||||
#define _ARC4_UNLOCK() pthread_mutex_unlock(&arc4random_mtx)
|
|
||||||
|
|
||||||
#ifdef __GLIBC__
|
|
||||||
extern void *__dso_handle;
|
|
||||||
extern int __register_atfork(void (*)(void), void(*)(void), void (*)(void), void *);
|
|
||||||
#define _ARC4_ATFORK(f) __register_atfork(NULL, NULL, (f), __dso_handle)
|
|
||||||
#else
|
|
||||||
#define _ARC4_ATFORK(f) pthread_atfork(NULL, NULL, (f))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static inline void
|
|
||||||
_getentropy_fail(void)
|
|
||||||
{
|
|
||||||
raise(SIGKILL);
|
|
||||||
}
|
|
||||||
|
|
||||||
static volatile sig_atomic_t _rs_forked;
|
|
||||||
|
|
||||||
static inline void
|
|
||||||
_rs_forkhandler(void)
|
|
||||||
{
|
|
||||||
_rs_forked = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void
|
|
||||||
_rs_forkdetect(void)
|
|
||||||
{
|
|
||||||
static pid_t _rs_pid = 0;
|
|
||||||
pid_t pid = getpid();
|
|
||||||
|
|
||||||
if (_rs_pid == 0 || _rs_pid != pid || _rs_forked) {
|
|
||||||
_rs_pid = pid;
|
|
||||||
_rs_forked = 0;
|
|
||||||
if (rs)
|
|
||||||
memset(rs, 0, sizeof(*rs));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline int
|
|
||||||
_rs_allocate(struct _rs **rsp, struct _rsx **rsxp)
|
|
||||||
{
|
|
||||||
if ((*rsp = mmap(NULL, sizeof(**rsp), PROT_READ|PROT_WRITE,
|
|
||||||
MAP_ANON|MAP_PRIVATE, -1, 0)) == MAP_FAILED)
|
|
||||||
return (-1);
|
|
||||||
|
|
||||||
if ((*rsxp = mmap(NULL, sizeof(**rsxp), PROT_READ|PROT_WRITE,
|
|
||||||
MAP_ANON|MAP_PRIVATE, -1, 0)) == MAP_FAILED) {
|
|
||||||
munmap(*rsp, sizeof(**rsp));
|
|
||||||
return (-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
_ARC4_ATFORK(_rs_forkhandler);
|
|
||||||
return (0);
|
|
||||||
}
|
|
@@ -1,4 +1,4 @@
|
|||||||
/* $OpenBSD: arc4random_hpux.h,v 1.1 2015/01/06 21:08:11 bcook Exp $ */
|
/* $OpenBSD: arc4random_linux.h,v 1.8 2014/08/13 06:04:10 deraadt Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1996, David Mazieres <dm@uun.org>
|
* Copyright (c) 1996, David Mazieres <dm@uun.org>
|
||||||
@@ -32,7 +32,19 @@ static pthread_mutex_t arc4random_mtx = PTHREAD_MUTEX_INITIALIZER;
|
|||||||
#define _ARC4_LOCK() pthread_mutex_lock(&arc4random_mtx)
|
#define _ARC4_LOCK() pthread_mutex_lock(&arc4random_mtx)
|
||||||
#define _ARC4_UNLOCK() pthread_mutex_unlock(&arc4random_mtx)
|
#define _ARC4_UNLOCK() pthread_mutex_unlock(&arc4random_mtx)
|
||||||
|
|
||||||
|
#ifdef __GLIBC__
|
||||||
|
extern void *__dso_handle;
|
||||||
|
extern int __register_atfork(void (*)(void), void(*)(void), void (*)(void), void *);
|
||||||
|
#define _ARC4_ATFORK(f) __register_atfork(NULL, NULL, (f), __dso_handle)
|
||||||
|
#else
|
||||||
|
/*
|
||||||
|
* Unfortunately, pthread_atfork() is broken on FreeBSD (at least 9 and 10) if
|
||||||
|
* a program does not link to -lthr. Callbacks registered with pthread_atfork()
|
||||||
|
* appear to fail silently. So, it is not always possible to detect a PID
|
||||||
|
* wraparound.
|
||||||
|
*/
|
||||||
#define _ARC4_ATFORK(f) pthread_atfork(NULL, NULL, (f))
|
#define _ARC4_ATFORK(f) pthread_atfork(NULL, NULL, (f))
|
||||||
|
#endif
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
_getentropy_fail(void)
|
_getentropy_fail(void)
|
||||||
|
@@ -136,7 +136,7 @@ closefrom_procfs(int lowfd)
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* Use /proc/self/fd (or /dev/fd on FreeBSD) if it exists. */
|
/* Use /proc/self/fd (or /dev/fd on FreeBSD) if it exists. */
|
||||||
# if defined(__FreeBSD__) || defined(__APPLE__)
|
# if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__APPLE__)
|
||||||
path = "/dev/fd";
|
path = "/dev/fd";
|
||||||
# else
|
# else
|
||||||
path = "/proc/self/fd";
|
path = "/proc/self/fd";
|
||||||
|
@@ -60,7 +60,7 @@ fgetwln(FILE *stream, size_t *lenp)
|
|||||||
fb->fp = stream;
|
fb->fp = stream;
|
||||||
|
|
||||||
while ((wc = fgetwc(stream)) != WEOF) {
|
while ((wc = fgetwc(stream)) != WEOF) {
|
||||||
if (!fb->len || wused > fb->len) {
|
if (!fb->len || wused >= fb->len) {
|
||||||
wchar_t *wp;
|
wchar_t *wp;
|
||||||
|
|
||||||
if (fb->len)
|
if (fb->len)
|
||||||
|
@@ -32,6 +32,7 @@ __FBSDID("$FreeBSD$");
|
|||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <fcntl.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <libutil.h>
|
#include <libutil.h>
|
||||||
|
@@ -26,18 +26,20 @@
|
|||||||
|
|
||||||
#if defined(__linux__)
|
#if defined(__linux__)
|
||||||
#include "getentropy_linux.c"
|
#include "getentropy_linux.c"
|
||||||
#elif defined(__FreeBSD__)
|
#elif defined(__GNU__)
|
||||||
#include "arc4random_bsd.c"
|
#include "getentropy_hurd.c"
|
||||||
|
#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||||
|
#include "getentropy_bsd.c"
|
||||||
#elif defined(__NetBSD__)
|
#elif defined(__NetBSD__)
|
||||||
#include "arc4random_bsd.c"
|
#include "getentropy_bsd.c"
|
||||||
#elif defined(__sun)
|
#elif defined(__sun)
|
||||||
#include "arc4random_solaris.c"
|
#include "getentropy_solaris.c"
|
||||||
#elif defined(__APPLE__)
|
#elif defined(__APPLE__)
|
||||||
#include "arc4random_osx.c"
|
#include "getentropy_osx.c"
|
||||||
#elif defined(_AIX)
|
#elif defined(_AIX)
|
||||||
#include "arc4random_aix.c"
|
#include "getentropy_aix.c"
|
||||||
#elif defined(__hpux)
|
#elif defined(__hpux)
|
||||||
#include "arc4random_hpux.c"
|
#include "getentropy_hpux.c"
|
||||||
#else
|
#else
|
||||||
#error "No getentropy hooks defined for this platform."
|
#error "No getentropy hooks defined for this platform."
|
||||||
#endif
|
#endif
|
||||||
|
@@ -39,7 +39,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <termios.h>
|
#include <termios.h>
|
||||||
|
|
||||||
#include <openssl/sha.h>
|
#include "hash/sha512.h"
|
||||||
|
|
||||||
#include <libperfstat.h>
|
#include <libperfstat.h>
|
||||||
|
|
||||||
|
@@ -41,7 +41,8 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <openssl/sha.h>
|
|
||||||
|
#include "hash/sha512.h"
|
||||||
|
|
||||||
#include <sys/vfs.h>
|
#include <sys/vfs.h>
|
||||||
|
|
||||||
|
446
src/getentropy_hurd.c
Normal file
446
src/getentropy_hurd.c
Normal file
@@ -0,0 +1,446 @@
|
|||||||
|
/* $OpenBSD: getentropy_linux.c,v 1.40 2015/08/25 17:26:43 deraadt Exp $ */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2014 Theo de Raadt <deraadt@openbsd.org>
|
||||||
|
* Copyright (c) 2014 Bob Beck <beck@obtuse.com>
|
||||||
|
*
|
||||||
|
* Permission to use, copy, modify, and distribute this software for any
|
||||||
|
* purpose with or without fee is hereby granted, provided that the above
|
||||||
|
* copyright notice and this permission notice appear in all copies.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||||
|
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||||
|
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||||
|
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||||
|
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||||
|
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||||
|
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
*
|
||||||
|
* Emulation of getentropy(2) as documented at:
|
||||||
|
* http://www.openbsd.org/cgi-bin/man.cgi/OpenBSD-current/man2/getentropy.2
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define _POSIX_C_SOURCE 199309L
|
||||||
|
#define _GNU_SOURCE 1
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/param.h>
|
||||||
|
#include <sys/ioctl.h>
|
||||||
|
#include <sys/resource.h>
|
||||||
|
#include <sys/syscall.h>
|
||||||
|
#include <sys/statvfs.h>
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#include <sys/mman.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <sys/time.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <link.h>
|
||||||
|
#include <termios.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <signal.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
|
#include "hash/sha512.h"
|
||||||
|
|
||||||
|
#ifdef HAVE_GETAUXVAL
|
||||||
|
#include <sys/auxv.h>
|
||||||
|
#endif
|
||||||
|
#include <sys/vfs.h>
|
||||||
|
|
||||||
|
#define REPEAT 5
|
||||||
|
#define min(a, b) (((a) < (b)) ? (a) : (b))
|
||||||
|
|
||||||
|
#define HX(a, b) \
|
||||||
|
do { \
|
||||||
|
if ((a)) \
|
||||||
|
HD(errno); \
|
||||||
|
else \
|
||||||
|
HD(b); \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#define HR(x, l) (SHA512_Update(&ctx, (char *)(x), (l)))
|
||||||
|
#define HD(x) (SHA512_Update(&ctx, (char *)&(x), sizeof (x)))
|
||||||
|
#define HF(x) (SHA512_Update(&ctx, (char *)&(x), sizeof (void*)))
|
||||||
|
|
||||||
|
int getentropy(void *buf, size_t len);
|
||||||
|
|
||||||
|
static int gotdata(char *buf, size_t len);
|
||||||
|
static int getentropy_urandom(void *buf, size_t len);
|
||||||
|
static int getentropy_fallback(void *buf, size_t len);
|
||||||
|
static int getentropy_phdr(struct dl_phdr_info *info, size_t size, void *data);
|
||||||
|
|
||||||
|
int
|
||||||
|
getentropy(void *buf, size_t len)
|
||||||
|
{
|
||||||
|
int ret = -1;
|
||||||
|
|
||||||
|
if (len > 256) {
|
||||||
|
errno = EIO;
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Try to get entropy with /dev/urandom
|
||||||
|
*
|
||||||
|
* This can fail if the process is inside a chroot or if file
|
||||||
|
* descriptors are exhausted.
|
||||||
|
*/
|
||||||
|
ret = getentropy_urandom(buf, len);
|
||||||
|
if (ret != -1)
|
||||||
|
return (ret);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Entropy collection via /dev/urandom has failed.
|
||||||
|
*
|
||||||
|
* No other API exists for collecting entropy. See the large
|
||||||
|
* comment block above.
|
||||||
|
*
|
||||||
|
* We have very few options:
|
||||||
|
* - Even syslog_r is unsafe to call at this low level, so
|
||||||
|
* there is no way to alert the user or program.
|
||||||
|
* - Cannot call abort() because some systems have unsafe
|
||||||
|
* corefiles.
|
||||||
|
* - Could raise(SIGKILL) resulting in silent program termination.
|
||||||
|
* - Return EIO, to hint that arc4random's stir function
|
||||||
|
* should raise(SIGKILL)
|
||||||
|
* - Do the best under the circumstances....
|
||||||
|
*
|
||||||
|
* This code path exists to bring light to the issue that Hurd
|
||||||
|
* does not provide a failsafe API for entropy collection.
|
||||||
|
*
|
||||||
|
* We hope this demonstrates that Hurd should either get a
|
||||||
|
* sysctl ABI, or consider providing a new failsafe API which
|
||||||
|
* works in a chroot or when file descriptors are exhausted.
|
||||||
|
*/
|
||||||
|
#undef FAIL_INSTEAD_OF_TRYING_FALLBACK
|
||||||
|
#ifdef FAIL_INSTEAD_OF_TRYING_FALLBACK
|
||||||
|
raise(SIGKILL);
|
||||||
|
#endif
|
||||||
|
ret = getentropy_fallback(buf, len);
|
||||||
|
if (ret != -1)
|
||||||
|
return (ret);
|
||||||
|
|
||||||
|
errno = EIO;
|
||||||
|
return (ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Basic sanity checking; wish we could do better.
|
||||||
|
*/
|
||||||
|
static int
|
||||||
|
gotdata(char *buf, size_t len)
|
||||||
|
{
|
||||||
|
char any_set = 0;
|
||||||
|
size_t i;
|
||||||
|
|
||||||
|
for (i = 0; i < len; ++i)
|
||||||
|
any_set |= buf[i];
|
||||||
|
if (any_set == 0)
|
||||||
|
return (-1);
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
getentropy_urandom(void *buf, size_t len)
|
||||||
|
{
|
||||||
|
struct stat st;
|
||||||
|
size_t i;
|
||||||
|
int fd, flags;
|
||||||
|
int save_errno = errno;
|
||||||
|
|
||||||
|
start:
|
||||||
|
|
||||||
|
flags = O_RDONLY;
|
||||||
|
#ifdef O_NOFOLLOW
|
||||||
|
flags |= O_NOFOLLOW;
|
||||||
|
#endif
|
||||||
|
#ifdef O_CLOEXEC
|
||||||
|
flags |= O_CLOEXEC;
|
||||||
|
#endif
|
||||||
|
fd = open("/dev/urandom", flags, 0);
|
||||||
|
if (fd == -1) {
|
||||||
|
if (errno == EINTR)
|
||||||
|
goto start;
|
||||||
|
goto nodevrandom;
|
||||||
|
}
|
||||||
|
#ifndef O_CLOEXEC
|
||||||
|
fcntl(fd, F_SETFD, fcntl(fd, F_GETFD) | FD_CLOEXEC);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Lightly verify that the device node looks sane */
|
||||||
|
if (fstat(fd, &st) == -1 || !S_ISCHR(st.st_mode)) {
|
||||||
|
close(fd);
|
||||||
|
goto nodevrandom;
|
||||||
|
}
|
||||||
|
for (i = 0; i < len; ) {
|
||||||
|
size_t wanted = len - i;
|
||||||
|
ssize_t ret = read(fd, (char *)buf + i, wanted);
|
||||||
|
|
||||||
|
if (ret == -1) {
|
||||||
|
if (errno == EAGAIN || errno == EINTR)
|
||||||
|
continue;
|
||||||
|
close(fd);
|
||||||
|
goto nodevrandom;
|
||||||
|
}
|
||||||
|
i += ret;
|
||||||
|
}
|
||||||
|
close(fd);
|
||||||
|
if (gotdata(buf, len) == 0) {
|
||||||
|
errno = save_errno;
|
||||||
|
return (0); /* satisfied */
|
||||||
|
}
|
||||||
|
nodevrandom:
|
||||||
|
errno = EIO;
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
static const int cl[] = {
|
||||||
|
CLOCK_REALTIME,
|
||||||
|
#ifdef CLOCK_MONOTONIC
|
||||||
|
CLOCK_MONOTONIC,
|
||||||
|
#endif
|
||||||
|
#ifdef CLOCK_MONOTONIC_RAW
|
||||||
|
CLOCK_MONOTONIC_RAW,
|
||||||
|
#endif
|
||||||
|
#ifdef CLOCK_TAI
|
||||||
|
CLOCK_TAI,
|
||||||
|
#endif
|
||||||
|
#ifdef CLOCK_VIRTUAL
|
||||||
|
CLOCK_VIRTUAL,
|
||||||
|
#endif
|
||||||
|
#ifdef CLOCK_UPTIME
|
||||||
|
CLOCK_UPTIME,
|
||||||
|
#endif
|
||||||
|
#ifdef CLOCK_PROCESS_CPUTIME_ID
|
||||||
|
CLOCK_PROCESS_CPUTIME_ID,
|
||||||
|
#endif
|
||||||
|
#ifdef CLOCK_THREAD_CPUTIME_ID
|
||||||
|
CLOCK_THREAD_CPUTIME_ID,
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
|
static int
|
||||||
|
getentropy_phdr(struct dl_phdr_info *info, size_t size, void *data)
|
||||||
|
{
|
||||||
|
SHA512_CTX *ctx = data;
|
||||||
|
|
||||||
|
SHA512_Update(ctx, &info->dlpi_addr, sizeof (info->dlpi_addr));
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
getentropy_fallback(void *buf, size_t len)
|
||||||
|
{
|
||||||
|
uint8_t results[SHA512_DIGEST_LENGTH];
|
||||||
|
int save_errno = errno, e, pgs = getpagesize(), faster = 0, repeat;
|
||||||
|
static int cnt;
|
||||||
|
struct timespec ts;
|
||||||
|
struct timeval tv;
|
||||||
|
struct rusage ru;
|
||||||
|
sigset_t sigset;
|
||||||
|
struct stat st;
|
||||||
|
SHA512_CTX ctx;
|
||||||
|
static pid_t lastpid;
|
||||||
|
pid_t pid;
|
||||||
|
size_t i, ii, m;
|
||||||
|
char *p;
|
||||||
|
|
||||||
|
pid = getpid();
|
||||||
|
if (lastpid == pid) {
|
||||||
|
faster = 1;
|
||||||
|
repeat = 2;
|
||||||
|
} else {
|
||||||
|
faster = 0;
|
||||||
|
lastpid = pid;
|
||||||
|
repeat = REPEAT;
|
||||||
|
}
|
||||||
|
for (i = 0; i < len; ) {
|
||||||
|
int j;
|
||||||
|
SHA512_Init(&ctx);
|
||||||
|
for (j = 0; j < repeat; j++) {
|
||||||
|
HX((e = gettimeofday(&tv, NULL)) == -1, tv);
|
||||||
|
if (e != -1) {
|
||||||
|
cnt += (int)tv.tv_sec;
|
||||||
|
cnt += (int)tv.tv_usec;
|
||||||
|
}
|
||||||
|
|
||||||
|
dl_iterate_phdr(getentropy_phdr, &ctx);
|
||||||
|
|
||||||
|
for (ii = 0; ii < sizeof(cl)/sizeof(cl[0]); ii++)
|
||||||
|
HX(clock_gettime(cl[ii], &ts) == -1, ts);
|
||||||
|
|
||||||
|
HX((pid = getpid()) == -1, pid);
|
||||||
|
HX((pid = getsid(pid)) == -1, pid);
|
||||||
|
HX((pid = getppid()) == -1, pid);
|
||||||
|
HX((pid = getpgid(0)) == -1, pid);
|
||||||
|
HX((e = getpriority(0, 0)) == -1, e);
|
||||||
|
|
||||||
|
if (!faster) {
|
||||||
|
ts.tv_sec = 0;
|
||||||
|
ts.tv_nsec = 1;
|
||||||
|
(void) nanosleep(&ts, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
HX(sigpending(&sigset) == -1, sigset);
|
||||||
|
HX(sigprocmask(SIG_BLOCK, NULL, &sigset) == -1,
|
||||||
|
sigset);
|
||||||
|
|
||||||
|
HF(getentropy); /* an addr in this library */
|
||||||
|
HF(printf); /* an addr in libc */
|
||||||
|
p = (char *)&p;
|
||||||
|
HD(p); /* an addr on stack */
|
||||||
|
p = (char *)&errno;
|
||||||
|
HD(p); /* the addr of errno */
|
||||||
|
|
||||||
|
if (i == 0) {
|
||||||
|
struct sockaddr_storage ss;
|
||||||
|
struct statvfs stvfs;
|
||||||
|
struct termios tios;
|
||||||
|
struct statfs stfs;
|
||||||
|
socklen_t ssl;
|
||||||
|
off_t off;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Prime-sized mappings encourage fragmentation;
|
||||||
|
* thus exposing some address entropy.
|
||||||
|
*/
|
||||||
|
struct mm {
|
||||||
|
size_t npg;
|
||||||
|
void *p;
|
||||||
|
} mm[] = {
|
||||||
|
{ 17, MAP_FAILED }, { 3, MAP_FAILED },
|
||||||
|
{ 11, MAP_FAILED }, { 2, MAP_FAILED },
|
||||||
|
{ 5, MAP_FAILED }, { 3, MAP_FAILED },
|
||||||
|
{ 7, MAP_FAILED }, { 1, MAP_FAILED },
|
||||||
|
{ 57, MAP_FAILED }, { 3, MAP_FAILED },
|
||||||
|
{ 131, MAP_FAILED }, { 1, MAP_FAILED },
|
||||||
|
};
|
||||||
|
|
||||||
|
for (m = 0; m < sizeof mm/sizeof(mm[0]); m++) {
|
||||||
|
HX(mm[m].p = mmap(NULL,
|
||||||
|
mm[m].npg * pgs,
|
||||||
|
PROT_READ|PROT_WRITE,
|
||||||
|
MAP_PRIVATE|MAP_ANON, -1,
|
||||||
|
(off_t)0), mm[m].p);
|
||||||
|
if (mm[m].p != MAP_FAILED) {
|
||||||
|
size_t mo;
|
||||||
|
|
||||||
|
/* Touch some memory... */
|
||||||
|
p = mm[m].p;
|
||||||
|
mo = cnt %
|
||||||
|
(mm[m].npg * pgs - 1);
|
||||||
|
p[mo] = 1;
|
||||||
|
cnt += (int)((long)(mm[m].p)
|
||||||
|
/ pgs);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check cnts and times... */
|
||||||
|
for (ii = 0; ii < sizeof(cl)/sizeof(cl[0]);
|
||||||
|
ii++) {
|
||||||
|
HX((e = clock_gettime(cl[ii],
|
||||||
|
&ts)) == -1, ts);
|
||||||
|
if (e != -1)
|
||||||
|
cnt += (int)ts.tv_nsec;
|
||||||
|
}
|
||||||
|
|
||||||
|
HX((e = getrusage(RUSAGE_SELF,
|
||||||
|
&ru)) == -1, ru);
|
||||||
|
if (e != -1) {
|
||||||
|
cnt += (int)ru.ru_utime.tv_sec;
|
||||||
|
cnt += (int)ru.ru_utime.tv_usec;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (m = 0; m < sizeof mm/sizeof(mm[0]); m++) {
|
||||||
|
if (mm[m].p != MAP_FAILED)
|
||||||
|
munmap(mm[m].p, mm[m].npg * pgs);
|
||||||
|
mm[m].p = MAP_FAILED;
|
||||||
|
}
|
||||||
|
|
||||||
|
HX(stat(".", &st) == -1, st);
|
||||||
|
HX(statvfs(".", &stvfs) == -1, stvfs);
|
||||||
|
HX(statfs(".", &stfs) == -1, stfs);
|
||||||
|
|
||||||
|
HX(stat("/", &st) == -1, st);
|
||||||
|
HX(statvfs("/", &stvfs) == -1, stvfs);
|
||||||
|
HX(statfs("/", &stfs) == -1, stfs);
|
||||||
|
|
||||||
|
HX((e = fstat(0, &st)) == -1, st);
|
||||||
|
if (e == -1) {
|
||||||
|
if (S_ISREG(st.st_mode) ||
|
||||||
|
S_ISFIFO(st.st_mode) ||
|
||||||
|
S_ISSOCK(st.st_mode)) {
|
||||||
|
HX(fstatvfs(0, &stvfs) == -1,
|
||||||
|
stvfs);
|
||||||
|
HX(fstatfs(0, &stfs) == -1,
|
||||||
|
stfs);
|
||||||
|
HX((off = lseek(0, (off_t)0,
|
||||||
|
SEEK_CUR)) < 0, off);
|
||||||
|
}
|
||||||
|
if (S_ISCHR(st.st_mode)) {
|
||||||
|
HX(tcgetattr(0, &tios) == -1,
|
||||||
|
tios);
|
||||||
|
} else if (S_ISSOCK(st.st_mode)) {
|
||||||
|
memset(&ss, 0, sizeof ss);
|
||||||
|
ssl = sizeof(ss);
|
||||||
|
HX(getpeername(0,
|
||||||
|
(void *)&ss, &ssl) == -1,
|
||||||
|
ss);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
HX((e = getrusage(RUSAGE_CHILDREN,
|
||||||
|
&ru)) == -1, ru);
|
||||||
|
if (e != -1) {
|
||||||
|
cnt += (int)ru.ru_utime.tv_sec;
|
||||||
|
cnt += (int)ru.ru_utime.tv_usec;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
/* Subsequent hashes absorb previous result */
|
||||||
|
HD(results);
|
||||||
|
}
|
||||||
|
|
||||||
|
HX((e = gettimeofday(&tv, NULL)) == -1, tv);
|
||||||
|
if (e != -1) {
|
||||||
|
cnt += (int)tv.tv_sec;
|
||||||
|
cnt += (int)tv.tv_usec;
|
||||||
|
}
|
||||||
|
|
||||||
|
HD(cnt);
|
||||||
|
}
|
||||||
|
#ifdef HAVE_GETAUXVAL
|
||||||
|
#ifdef AT_RANDOM
|
||||||
|
/* Not as random as you think but we take what we are given */
|
||||||
|
p = (char *) getauxval(AT_RANDOM);
|
||||||
|
if (p)
|
||||||
|
HR(p, 16);
|
||||||
|
#endif
|
||||||
|
#ifdef AT_SYSINFO_EHDR
|
||||||
|
p = (char *) getauxval(AT_SYSINFO_EHDR);
|
||||||
|
if (p)
|
||||||
|
HR(p, pgs);
|
||||||
|
#endif
|
||||||
|
#ifdef AT_BASE
|
||||||
|
p = (char *) getauxval(AT_BASE);
|
||||||
|
if (p)
|
||||||
|
HD(p);
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
SHA512_Final(results, &ctx);
|
||||||
|
memcpy((char *)buf + i, results, min(sizeof(results), len - i));
|
||||||
|
i += min(sizeof(results), len - i);
|
||||||
|
}
|
||||||
|
explicit_bzero(&ctx, sizeof ctx);
|
||||||
|
explicit_bzero(results, sizeof results);
|
||||||
|
if (gotdata(buf, len) == 0) {
|
||||||
|
errno = save_errno;
|
||||||
|
return (0); /* satisfied */
|
||||||
|
}
|
||||||
|
errno = EIO;
|
||||||
|
return (-1);
|
||||||
|
}
|
@@ -47,7 +47,8 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <openssl/sha.h>
|
|
||||||
|
#include "hash/sha512.h"
|
||||||
|
|
||||||
#include <linux/types.h>
|
#include <linux/types.h>
|
||||||
#include <linux/random.h>
|
#include <linux/random.h>
|
||||||
|
@@ -67,8 +67,10 @@ HASHFileChunk(const char *filename, char *buf, off_t off, off_t len)
|
|||||||
}
|
}
|
||||||
len = sb.st_size;
|
len = sb.st_size;
|
||||||
}
|
}
|
||||||
if ((len < 0) || (off > 0 && lseek(fd, off, SEEK_SET) < 0))
|
if ((len < 0) || (off > 0 && lseek(fd, off, SEEK_SET) < 0)) {
|
||||||
|
close(fd);
|
||||||
return (NULL);
|
return (NULL);
|
||||||
|
}
|
||||||
|
|
||||||
while ((nr = read(fd, buffer,
|
while ((nr = read(fd, buffer,
|
||||||
(size_t)(len ? MIN(BUFSIZ, len) : BUFSIZ))) > 0) {
|
(size_t)(len ? MIN(BUFSIZ, len) : BUFSIZ))) > 0) {
|
||||||
|
@@ -31,6 +31,8 @@
|
|||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
#define SHA512_DIGEST_LENGTH 64
|
||||||
|
|
||||||
typedef struct SHA512Context {
|
typedef struct SHA512Context {
|
||||||
uint64_t state[8];
|
uint64_t state[8];
|
||||||
uint64_t count[2];
|
uint64_t count[2];
|
||||||
|
@@ -6,7 +6,7 @@ includedir=@includedir@
|
|||||||
Name: libbsd-ctor
|
Name: libbsd-ctor
|
||||||
Description: Automatic constructor functions for libbsd
|
Description: Automatic constructor functions for libbsd
|
||||||
Version: @VERSION@
|
Version: @VERSION@
|
||||||
URL: http://libbsd.freedesktop.org/
|
URL: https://libbsd.freedesktop.org/
|
||||||
Cflags: -I${includedir}
|
Cflags: -I${includedir}
|
||||||
Libs: -L${libdir} -Wl,-z,nodlopen -Wl,-u,libbsd_init_func -lbsd-ctor
|
Libs: -L${libdir} -Wl,-z,nodlopen -Wl,-u,libbsd_init_func -lbsd-ctor
|
||||||
Requires: libbsd
|
Requires: libbsd
|
||||||
|
@@ -6,6 +6,6 @@ includedir=@includedir@
|
|||||||
Name: libbsd
|
Name: libbsd
|
||||||
Description: Utility functions from BSD systems (overlay)
|
Description: Utility functions from BSD systems (overlay)
|
||||||
Version: @VERSION@
|
Version: @VERSION@
|
||||||
URL: http://libbsd.freedesktop.org/
|
URL: https://libbsd.freedesktop.org/
|
||||||
Libs: -L${libdir} -lbsd
|
Libs: -L${libdir} -lbsd
|
||||||
Cflags: -isystem ${includedir}/bsd -DLIBBSD_OVERLAY
|
Cflags: -isystem ${includedir}/bsd -DLIBBSD_OVERLAY
|
||||||
|
@@ -6,6 +6,6 @@ includedir=@includedir@
|
|||||||
Name: libbsd
|
Name: libbsd
|
||||||
Description: Utility functions from BSD systems
|
Description: Utility functions from BSD systems
|
||||||
Version: @VERSION@
|
Version: @VERSION@
|
||||||
URL: http://libbsd.freedesktop.org/
|
URL: https://libbsd.freedesktop.org/
|
||||||
Libs: -L${libdir} -lbsd
|
Libs: -L${libdir} -lbsd
|
||||||
Cflags: -I${includedir}
|
Cflags: -I${includedir}
|
||||||
|
@@ -39,6 +39,7 @@ static char sccsid[] = "@(#)nlist.c 8.1 (Berkeley) 6/4/93";
|
|||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <fcntl.h>
|
||||||
#include <a.out.h>
|
#include <a.out.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@@ -26,8 +26,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Rejected in glibc (http://sourceware.org/ml/libc-alpha/2006-03/msg00125.html)
|
* Rejected in glibc
|
||||||
*/
|
* <https://sourceware.org/ml/libc-alpha/2006-03/msg00125.html>.
|
||||||
|
*/
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@@ -118,7 +118,7 @@ sradixsort(const u_char **a, int n, const u_char *tab, u_int endch)
|
|||||||
if (n < THRESHOLD)
|
if (n < THRESHOLD)
|
||||||
simplesort(a, n, 0, tr, endch);
|
simplesort(a, n, 0, tr, endch);
|
||||||
else {
|
else {
|
||||||
ta = reallocarray(NULL, n, sizeof(a));
|
ta = reallocarray(NULL, n, sizeof(*a));
|
||||||
if (ta == NULL)
|
if (ta == NULL)
|
||||||
return (-1);
|
return (-1);
|
||||||
r_sort_b(a, ta, n, 0, tr, endch);
|
r_sort_b(a, ta, n, 0, tr, endch);
|
||||||
|
@@ -56,7 +56,7 @@ spt_min(size_t a, size_t b)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* For discussion on the portability of the various methods, see
|
* For discussion on the portability of the various methods, see
|
||||||
* http://lists.freebsd.org/pipermail/freebsd-stable/2008-June/043136.html
|
* https://lists.freebsd.org/pipermail/freebsd-stable/2008-June/043136.html
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
spt_clearenv(void)
|
spt_clearenv(void)
|
||||||
|
3
test/.gitignore
vendored
3
test/.gitignore
vendored
@@ -6,8 +6,9 @@ fgetln
|
|||||||
funopen
|
funopen
|
||||||
fparseln
|
fparseln
|
||||||
fpurge
|
fpurge
|
||||||
headers
|
headers-gen.c
|
||||||
humanize
|
humanize
|
||||||
|
md5
|
||||||
overlay
|
overlay
|
||||||
proctitle-init
|
proctitle-init
|
||||||
proctitle
|
proctitle
|
||||||
|
@@ -1,16 +1,35 @@
|
|||||||
## Process this file with automake to produce Makefile.in
|
## Process this file with automake to produce Makefile.in
|
||||||
|
|
||||||
AM_CPPFLAGS = \
|
HEADERS_CPPFLAGS = \
|
||||||
-I$(top_builddir) \
|
-I$(top_builddir) \
|
||||||
-isystem $(top_srcdir)/include/bsd/ \
|
|
||||||
-include $(top_builddir)/config.h \
|
-include $(top_builddir)/config.h \
|
||||||
-DLIBBSD_OVERLAY -DLIBBSD_DISABLE_DEPRECATED \
|
-DLIBBSD_DISABLE_DEPRECATED \
|
||||||
-D__REENTRANT
|
-D__REENTRANT
|
||||||
|
|
||||||
|
AM_CPPFLAGS = \
|
||||||
|
-isystem $(top_srcdir)/include/bsd/ \
|
||||||
|
$(HEADERS_CPPFLAGS) \
|
||||||
|
-DLIBBSD_OVERLAY
|
||||||
|
|
||||||
|
AM_TESTS_ENVIRONMENT = \
|
||||||
|
export CC="$(CC)"; \
|
||||||
|
export CPPFLAGS="$(HEADERS_CPPFLAGS)"; \
|
||||||
|
export top_srcdir="$(top_srcdir)"; \
|
||||||
|
$(nil)
|
||||||
|
|
||||||
LDADD = $(top_builddir)/src/libbsd.la
|
LDADD = $(top_builddir)/src/libbsd.la
|
||||||
|
|
||||||
|
EXTRA_DIST = \
|
||||||
|
headers-overlay.sh \
|
||||||
|
headers-system.sh \
|
||||||
|
$(nil)
|
||||||
|
|
||||||
|
check_SCRIPTS = \
|
||||||
|
headers-overlay.sh \
|
||||||
|
headers-system.sh \
|
||||||
|
$(nil)
|
||||||
|
|
||||||
check_PROGRAMS = \
|
check_PROGRAMS = \
|
||||||
headers \
|
|
||||||
overlay \
|
overlay \
|
||||||
bzero \
|
bzero \
|
||||||
closefrom \
|
closefrom \
|
||||||
@@ -20,6 +39,7 @@ check_PROGRAMS = \
|
|||||||
funopen \
|
funopen \
|
||||||
fparseln \
|
fparseln \
|
||||||
fpurge \
|
fpurge \
|
||||||
|
md5 \
|
||||||
proctitle-init \
|
proctitle-init \
|
||||||
strmode \
|
strmode \
|
||||||
$(nil)
|
$(nil)
|
||||||
@@ -47,4 +67,4 @@ fparseln_SOURCES = test-stream.c test-stream.h fparseln.c
|
|||||||
proctitle_init_SOURCES = proctitle.c
|
proctitle_init_SOURCES = proctitle.c
|
||||||
proctitle_init_CPPFLAGS = $(AM_CPPFLAGS) -DTEST_USE_SETPROCTITLE_INIT=1
|
proctitle_init_CPPFLAGS = $(AM_CPPFLAGS) -DTEST_USE_SETPROCTITLE_INIT=1
|
||||||
|
|
||||||
TESTS = $(check_PROGRAMS)
|
TESTS = $(check_SCRIPTS) $(check_PROGRAMS)
|
||||||
|
@@ -99,6 +99,8 @@ main(int argc, char **argv)
|
|||||||
/* XXX: We should probably FAIL the test, but we currently
|
/* XXX: We should probably FAIL the test, but we currently
|
||||||
* have one test always failing. */
|
* have one test always failing. */
|
||||||
rc = TEST_SKIP;
|
rc = TEST_SKIP;
|
||||||
|
} else {
|
||||||
|
rc = TEST_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
|
25
test/headers-overlay.sh
Executable file
25
test/headers-overlay.sh
Executable file
@@ -0,0 +1,25 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
run()
|
||||||
|
{
|
||||||
|
echo "$@"
|
||||||
|
"$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
incdir="${top_srcdir}/include/bsd"
|
||||||
|
CPPFLAGS="$CPPFLAGS -DLIBBSD_OVERLAY"
|
||||||
|
|
||||||
|
for inc in $(cd $incdir; find -name '*.h' | sort | cut -c3-); do
|
||||||
|
cat >headers-overlay-gen.c <<SOURCE
|
||||||
|
#include <$inc>
|
||||||
|
int main() { return 0; }
|
||||||
|
SOURCE
|
||||||
|
|
||||||
|
echo "testing header $inc"
|
||||||
|
run $CC -isystem "$incdir" $CPPFLAGS headers-overlay-gen.c -o /dev/null
|
||||||
|
echo
|
||||||
|
|
||||||
|
rm -f headers-overlay-gen*
|
||||||
|
done
|
24
test/headers-system.sh
Executable file
24
test/headers-system.sh
Executable file
@@ -0,0 +1,24 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
run()
|
||||||
|
{
|
||||||
|
echo "$@"
|
||||||
|
"$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
incdir="${top_srcdir}/include"
|
||||||
|
|
||||||
|
for inc in $(cd $incdir; find -name '*.h' | sort | cut -c3-); do
|
||||||
|
cat >headers-system-gen.c <<SOURCE
|
||||||
|
#include <$inc>
|
||||||
|
int main() { return 0; }
|
||||||
|
SOURCE
|
||||||
|
|
||||||
|
echo "testing header $inc"
|
||||||
|
run $CC -isystem "$incdir" $CPPFLAGS headers-system-gen.c -o /dev/null
|
||||||
|
echo
|
||||||
|
|
||||||
|
rm -f headers-system-gen.*
|
||||||
|
done
|
@@ -1,25 +0,0 @@
|
|||||||
/* Check that all libbsd overlayed headers preprocess. */
|
|
||||||
#include <sys/cdefs.h>
|
|
||||||
#include <sys/endian.h>
|
|
||||||
#include <sys/bitstring.h>
|
|
||||||
#include <sys/queue.h>
|
|
||||||
#include <sys/tree.h>
|
|
||||||
#include <sys/poll.h>
|
|
||||||
|
|
||||||
#include <err.h>
|
|
||||||
#include <getopt.h>
|
|
||||||
#include <libutil.h>
|
|
||||||
#include <md5.h>
|
|
||||||
#include <nlist.h>
|
|
||||||
#include <readpassphrase.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <vis.h>
|
|
||||||
|
|
||||||
int
|
|
||||||
main()
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
47
test/md5.c
Normal file
47
test/md5.c
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
/*
|
||||||
|
* Copyright © 2016 Guillem Jover <guillem@hadrons.org>
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* 3. The name of the author may not be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||||
|
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
|
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||||
|
* THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||||
|
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||||
|
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||||
|
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||||
|
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
|
#include <md5.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
void
|
||||||
|
test_md5(const char *digest, const char *string)
|
||||||
|
{
|
||||||
|
char result[MD5_DIGEST_STRING_LENGTH];
|
||||||
|
|
||||||
|
assert(strcmp(digest, MD5Data((uint8_t *)string, strlen(string), result)) == 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
main()
|
||||||
|
{
|
||||||
|
test_md5("d41d8cd98f00b204e9800998ecf8427e", "");
|
||||||
|
test_md5("900150983cd24fb0d6963f7d28e17f72", "abc");
|
||||||
|
test_md5("827ccb0eea8a706c4c34a16891f84e7b", "12345");
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
@@ -1,3 +1,29 @@
|
|||||||
|
/*
|
||||||
|
* Copyright © 2012 Guillem Jover <guillem@hadrons.org>
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* 3. The name of the author may not be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||||
|
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
|
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||||
|
* THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||||
|
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||||
|
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||||
|
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||||
|
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
/* Include system headers that are “known” to pull bits selectively from
|
/* Include system headers that are “known” to pull bits selectively from
|
||||||
* other headers through magic macros, to check that the overlay is working
|
* other headers through magic macros, to check that the overlay is working
|
||||||
* properly. */
|
* properly. */
|
||||||
|
@@ -24,6 +24,7 @@
|
|||||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <sys/stat.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user