Up to [cvs.NetBSD.org] / src / lib / libc / gen
Request diff between arbitrary revisions
Default branch: MAIN
Revision 1.4.2.1 / (download) - annotate - [select for diffs], Fri Aug 11 14:35:24 2023 UTC (8 months, 1 week ago) by martin
Branch: netbsd-10
CVS Tags: netbsd-10-0-RELEASE,
netbsd-10-0-RC6,
netbsd-10-0-RC5,
netbsd-10-0-RC4,
netbsd-10-0-RC3,
netbsd-10-0-RC2,
netbsd-10-0-RC1
Changes since 1.4: +48 -23
lines
Diff to previous 1.4 (unified) next main 1.5 (unified)
Pull up following revision(s) (requested by riastradh in ticket #319): sys/dev/pci/ubsec.c: revision 1.64 sys/dev/pci/hifn7751.c: revision 1.82 lib/libc/gen/getentropy.3: revision 1.5 lib/libc/gen/getentropy.3: revision 1.6 share/man/man4/rnd.4: revision 1.41 lib/libc/sys/getrandom.2: revision 1.2 lib/libc/sys/getrandom.2: revision 1.3 share/man/man5/rc.conf.5: revision 1.193 share/man/man7/entropy.7: revision 1.5 share/man/man7/entropy.7: revision 1.6 share/man/man7/entropy.7: revision 1.7 share/man/man7/entropy.7: revision 1.8 etc/security: revision 1.130 share/man/man7/entropy.7: revision 1.9 etc/security: revision 1.131 sys/crypto/cprng_fast/cprng_fast.c: revision 1.19 sys/sys/rndio.h: revision 1.3 tests/lib/libc/sys/t_getrandom.c: revision 1.5 etc/defaults/rc.conf: revision 1.164 etc/defaults/rc.conf: revision 1.165 sys/sys/rndsource.h: revision 1.10 sys/kern/kern_entropy.c: revision 1.62 sys/kern/kern_entropy.c: revision 1.63 sys/kern/kern_entropy.c: revision 1.64 sys/kern/subr_cprng.c: revision 1.44 sys/kern/kern_entropy.c: revision 1.65 sys/kern/kern_clock.c: revision 1.149 sys/dev/pci/viornd.c: revision 1.22 share/man/man9/rnd.9: revision 1.32 sys/kern/subr_prf.c: revision 1.202 sys/sys/rndsource.h: revision 1.8 sys/sys/rndsource.h: revision 1.9 share/man/man7/entropy.7: revision 1.10 1. Reinstate netbsd<=9 entropy estimator to unblock /dev/random, in parallel with assessment of only confident entropy sources (seed, HWRNG) for security warnings like sshd keys in motd and daily insecurity report. 2. Make multiuser boot wait for first /dev/random output soon after loading a seed and configuring rndctl, so that getentropy(3) meets its contract starting early at boot without introducing blocking paths that could cause hangs in init(8) or single-user mode. Operators can choose to disable this wait in rc.conf. 3. Fix some bugs left over from reducing the global entropy lock from a spin lock at IPL_VM to an adaptive lock at IPL_SOFTSERIAL. 4. Update man pages.
Revision 1.6 / (download) - annotate - [select for diffs], Fri Jun 30 22:15:14 2023 UTC (9 months, 2 weeks ago) by uwe
Branch: MAIN
CVS Tags: HEAD
Changes since 1.5: +4 -2
lines
Diff to previous 1.5 (unified)
getentropy(3): use .Sx to xref CAVEATS
Revision 1.5 / (download) - annotate - [select for diffs], Fri Jun 30 21:44:22 2023 UTC (9 months, 2 weeks ago) by riastradh
Branch: MAIN
Changes since 1.4: +46 -23
lines
Diff to previous 1.4 (unified)
getrandom(2), getentropy(3): Rework man pages. Make supportable promises. Omit needless verbiage. Give caveats with cross-references to entropy(7). Emphasize that security is necessarily relative to system configuration. XXX pullup-10
Revision 1.4 / (download) - annotate - [select for diffs], Tue May 31 13:42:59 2022 UTC (22 months, 2 weeks ago) by riastradh
Branch: MAIN
CVS Tags: netbsd-10-base
Branch point for: netbsd-10
Changes since 1.3: +9 -8
lines
Diff to previous 1.3 (unified)
libc: Reintroduce getentropy. This was introduced two years ago when the getrandom/getentropy API question was still open, and removed because the discussion was ongoing. Now getentropy is more widely adopted and soon to be in POSIX. So reintroduce the symbol into libc since we'll be keeping it anyway. Discussion of details of the semantics, as interpreted by NetBSD, is ongoing, but the symbol needs to get in before the netbsd-10 branch. The draft POSIX text is (https://www.opengroup.org/austin/docs/austin_1110.pdf): SYNOPSIS #include <unistd.h> int getentropy(void *buffer, size_t length); DESCRIPTION The getentropy() function shall write length bytes of data starting at the location pointed to by buffer. The output shall be unpredictable high quality random data, generated by a cryptographically secure pseudo-random number generator. The maximum permitted value for the length argument is given by the {GETENTROPY_MAX} symbolic constant defined in <limits.h>. RETURN VALUES Upon successful completion, getentropy() shall return 0; otherwise, -1 shall be retunred and errno set to indicate the error. ERRORS The getentropy() function shall fail if: [EINVAL] The value of length is greater than {GETENTROPY_MAX}. The getentropy() function may fail if: [ENOSYS] The system does not provide the necessary source of entropy. RATIONALE The getentropy() function is not a cancellation point. Minor changes from the previous introduction of getentropy into libc: - Return EINVAL, not EIO, on buflen > 256. - Define GETENTROPY_MAX in limits.h. The declaration of getentropy in unistd.h and definition of GETENTROPY_MAX in limits.h are currently conditional on _NETBSD_SOURCE. When the next revision of POSIX is finalized, we can expose them also under _POSIX_C_SOURCE > 20yymmL as usual -- and this can be done as a pullup without breaking existing compiled programs.
Revision 1.3, Tue Sep 22 21:37:47 2020 UTC (3 years, 6 months ago) by nia
Branch: MAIN
CVS Tags: cjep_sun2x-base,
cjep_sun2x,
cjep_staticlib_x-base1,
cjep_staticlib_x-base,
cjep_staticlib_x
Changes since 1.2: +1 -1
lines
FILE REMOVED
remove getentropy bits
Revision 1.2 / (download) - annotate - [select for diffs], Thu May 7 12:55:06 2020 UTC (3 years, 11 months ago) by wiz
Branch: MAIN
Changes since 1.1: +6 -6
lines
Diff to previous 1.1 (unified)
Fix macro usage. Fix typo. New sentence, new line.
Revision 1.1 / (download) - annotate - [select for diffs], Wed May 6 16:17:36 2020 UTC (3 years, 11 months ago) by nia
Branch: MAIN
Add getentropy() to libc - a simple wrapper to access the kernel CSPRNG. Posted to tech-userlevel@ a week ago and reviewed by riastradh@. GETENTROPY(3) Library Functions Manual GETENTROPY(3) NAME getentropy - fill a buffer with high quality random data LIBRARY Standard C Library (libc, -lc) SYNOPSIS #include <unistd.h> int getentropy(void *buf, size_t buflen); DESCRIPTION The getentropy() function fills a buffer with high quality random data, suitable for seeding cryptographically secure psuedorandom number generators. getentropy() is only intended for seeding random number generators and is not intended for use by regular code which simply needs secure random data. For this purpose, please use arc4random(3). The maximum value for buflen is 256 bytes. IMPLEMENTATION NOTES getentropy() reads from the sysctl(7) variable kern.arandom. RETURN VALUES The getentropy() function returns 0 on success, and -1 if an error occurred. ERRORS getentropy() will succeed unless: [EFAULT] The buf argument points to an invalid memory address. [EIO] Too many bytes were requested. SEE ALSO arc4random(3), rnd(4) STANDARDS The getentropy() function is non-standard. HISTORY The getentropy() function first appeared in OpenBSD 5.6, then in FreeBSD 12.0, and NetBSD 10.