The NetBSD Project

CVS log for src/lib/libc/gen/arc4random.c

[BACK] Up to [cvs.NetBSD.org] / src / lib / libc / gen

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.25 / (download) - annotate - [select for diffs], Sat Jul 19 14:53:22 2014 UTC (4 days, 17 hours ago) by roy
Branch: MAIN
CVS Tags: HEAD
Changes since 1.24: +8 -2 lines
Diff to previous 1.24 (colored)

Document that our use of pthread_mutex_unlock(3) is async-signal-safe
and as such can be used in a phtread_atfork(3) child handler.

Revision 1.24 / (download) - annotate - [select for diffs], Thu Jun 12 19:12:19 2014 UTC (5 weeks, 6 days ago) by apb
Branch: MAIN
Changes since 1.23: +3 -3 lines
Diff to previous 1.23 (colored)

fix missing backslash in previous

Revision 1.23 / (download) - annotate - [select for diffs], Thu Jun 12 19:05:37 2014 UTC (5 weeks, 6 days ago) by apb
Branch: MAIN
Changes since 1.22: +12 -6 lines
Diff to previous 1.22 (colored)

Wrap complex macros in do { ... } while (0).  Also replace the magic
number 1600000 with a macro.

Revision 1.22 / (download) - annotate - [select for diffs], Sat Jun 7 20:55:47 2014 UTC (6 weeks, 4 days ago) by roy
Branch: MAIN
Changes since 1.21: +69 -26 lines
Diff to previous 1.21 (colored)

Re-stir after forking, fixes PR lib/25367.
Re-stir after consuming 1600000 bytes, fixes PR lib/45952.

Revision 1.10.4.3 / (download) - annotate - [select for diffs], Thu May 22 11:36:52 2014 UTC (2 months ago) by yamt
Branch: yamt-pagecache
Changes since 1.10.4.2: +3 -3 lines
Diff to previous 1.10.4.2 (colored) to branchpoint 1.10 (colored) next main 1.11 (colored)

sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs.  ("Protocol error: too many arguments")

Revision 1.21 / (download) - annotate - [select for diffs], Thu Oct 17 23:56:17 2013 UTC (9 months ago) by christos
Branch: MAIN
CVS Tags: yamt-pagecache-base9, tls-earlyentropy-base, tls-earlyentropy, riastradh-xf86-video-intel-2-7-1-pre-2-21-15, riastradh-drm2-base3
Changes since 1.20: +3 -3 lines
Diff to previous 1.20 (colored)

remove always inline because new gcc bitches.

Revision 1.10.4.2 / (download) - annotate - [select for diffs], Tue Oct 30 18:58:44 2012 UTC (20 months, 3 weeks ago) by yamt
Branch: yamt-pagecache
CVS Tags: yamt-pagecache-tag8
Changes since 1.10.4.1: +99 -142 lines
Diff to previous 1.10.4.1 (colored) to branchpoint 1.10 (colored)

sync with head

Revision 1.20 / (download) - annotate - [select for diffs], Mon Aug 20 21:38:09 2012 UTC (23 months ago) by dsl
Branch: MAIN
CVS Tags: yamt-pagecache-base8, yamt-pagecache-base7, yamt-pagecache-base6, tls-maxphys-base, tls-maxphys, riastradh-drm2-base2, riastradh-drm2-base1, riastradh-drm2-base, riastradh-drm2, agc-symver-base, agc-symver
Changes since 1.19: +6 -2 lines
Diff to previous 1.19 (colored)

I'm fairly sure the libc rules require that arc4random_addrandom,
arc4random_buf, arc4random_stir and arc4random_uniform be weak.

Revision 1.19 / (download) - annotate - [select for diffs], Mon Aug 20 20:32:09 2012 UTC (23 months ago) by dsl
Branch: MAIN
Changes since 1.18: +2 -10 lines
Diff to previous 1.18 (colored)

arc4 is a random number sequence, there is no point using its own
output values to determine a number of output values to skip.
Skipping values on any possibly random event might be worth while, as
  might using the keying algorithm to stir in a possibly random value.

Revision 1.18 / (download) - annotate - [select for diffs], Mon Aug 20 20:27:46 2012 UTC (23 months ago) by dsl
Branch: MAIN
Changes since 1.17: +30 -33 lines
Diff to previous 1.17 (colored)

Since 'rs' is statically initialised (not bss) its s[] might as well be
  compile-time initialised as well.
arc4_init) is the same as arc4_stir().
Initialise rs.i to 0xff (not 0) so that the first key byte is processed
  with rs.i == 0 without the splurios rs.i-- in arc4_addrandom().
Remove the assignment rs.j = rs.i at the end of arc4_addrandom(), it isn't
  necessary and I can see no justificationm for it.
Replace RSIZE with __arraycount(as->s), however it is manifestly 256 (more
  correctly the number of values in rs.i and rs.j).

Revision 1.17 / (download) - annotate - [select for diffs], Sat Aug 18 15:55:07 2012 UTC (23 months ago) by dsl
Branch: MAIN
Changes since 1.16: +27 -13 lines
Diff to previous 1.16 (colored)

cache rs.i and rs.j in arc4random_buf() since the compiler can't be
  told that buf[] dosn't alias them.
Reduces the number of instructions inside the loop.
All the other functions are ok.

Revision 1.16 / (download) - annotate - [select for diffs], Sat Aug 18 15:04:53 2012 UTC (23 months ago) by dsl
Branch: MAIN
Changes since 1.15: +47 -98 lines
Diff to previous 1.15 (colored)

Change the logic used for thread locking to make the code more readable.
The effect on the object code is to replace a function call with a
  branch that will predict correctly in the non-threaded case.
Minor optimise of some other paths.

Revision 1.15 / (download) - annotate - [select for diffs], Sat Aug 18 14:42:46 2012 UTC (23 months ago) by dsl
Branch: MAIN
Changes since 1.14: +18 -20 lines
Diff to previous 1.14 (colored)

Use an inline function to check for initialisation, and an non-inlined
  one to do the actual initialise.
Fixes lib/46751 by removing all the replicated tests in each function.

Revision 1.14 / (download) - annotate - [select for diffs], Sun Jul 29 14:44:13 2012 UTC (23 months, 3 weeks ago) by dsl
Branch: MAIN
Changes since 1.13: +10 -7 lines
Diff to previous 1.13 (colored)

Make this compile with the compiler I'm using.
Move variable defs to top of function.
Don't use const static mib[] - run time initialisation won't matter,
and not using static data may actually help in a .so.

Revision 1.10.4.1 / (download) - annotate - [select for diffs], Tue Apr 17 00:05:18 2012 UTC (2 years, 3 months ago) by yamt
Branch: yamt-pagecache
Changes since 1.10: +128 -81 lines
Diff to previous 1.10 (colored)

sync with head

Revision 1.10.6.1 / (download) - annotate - [select for diffs], Thu Mar 8 17:23:35 2012 UTC (2 years, 4 months ago) by riz
Branch: netbsd-6
CVS Tags: netbsd-6-1-RELEASE, netbsd-6-1-RC4, netbsd-6-1-RC3, netbsd-6-1-RC2, netbsd-6-1-RC1, netbsd-6-1-4-RELEASE, netbsd-6-1-3-RELEASE, netbsd-6-1-2-RELEASE, netbsd-6-1-1-RELEASE, netbsd-6-1, netbsd-6-0-RELEASE, netbsd-6-0-RC2, netbsd-6-0-RC1, netbsd-6-0-5-RELEASE, netbsd-6-0-4-RELEASE, netbsd-6-0-3-RELEASE, netbsd-6-0-2-RELEASE, netbsd-6-0-1-RELEASE, netbsd-6-0, matt-nb6-plus-nbase, matt-nb6-plus-base, matt-nb6-plus
Changes since 1.10: +124 -70 lines
Diff to previous 1.10 (colored) next main 1.11 (colored)

Pull up following revision(s) (requested by tls in ticket #92):
	lib/libc/gen/arc4random.c: revision 1.11
	lib/libc/gen/arc4random.c: revision 1.12
Make arc4random far less greedy for entropy.  Make arc4random actually
implement arc4 when used by threaded programs.
Fix bug in previous: don't reinitialize on every call!  Fix arc4random_buf so it actually ever initializes -- a security problem with revisions 1.9 and 1.10.

Revision 1.13 / (download) - annotate - [select for diffs], Mon Mar 5 19:40:08 2012 UTC (2 years, 4 months ago) by christos
Branch: MAIN
CVS Tags: yamt-pagecache-base5, yamt-pagecache-base4
Changes since 1.12: +12 -19 lines
Diff to previous 1.12 (colored)

misc cleanups:
- const for mibs
- #define for magic constants
- casts

Revision 1.12 / (download) - annotate - [select for diffs], Sun Mar 4 00:36:43 2012 UTC (2 years, 4 months ago) by tls
Branch: MAIN
Changes since 1.11: +23 -13 lines
Diff to previous 1.11 (colored)

Fix bug in previous: don't reinitialize on every call!  Fix arc4random_buf so it actually ever initializes -- a security problem with revisions 1.9 and 1.10.

Revision 1.11 / (download) - annotate - [select for diffs], Mon Feb 27 04:25:12 2012 UTC (2 years, 4 months ago) by tls
Branch: MAIN
Changes since 1.10: +110 -66 lines
Diff to previous 1.10 (colored)

Make arc4random far less greedy for entropy.  Make arc4random actually
implement arc4 when used by threaded programs.

Revision 1.9.40.1 / (download) - annotate - [select for diffs], Tue Feb 8 16:18:59 2011 UTC (3 years, 5 months ago) by bouyer
Branch: bouyer-quota2
Changes since 1.9: +89 -30 lines
Diff to previous 1.9 (colored) next main 1.10 (colored)

Sync with HEAD

Revision 1.10 / (download) - annotate - [select for diffs], Fri Feb 4 22:07:07 2011 UTC (3 years, 5 months ago) by christos
Branch: MAIN
CVS Tags: yamt-pagecache-base3, yamt-pagecache-base2, yamt-pagecache-base, netbsd-6-base, cherry-xenmp-base, cherry-xenmp, bouyer-quota2-nbase, bouyer-quota2-base
Branch point for: yamt-pagecache, netbsd-6
Changes since 1.9: +89 -30 lines
Diff to previous 1.9 (colored)

add arc4random_{buf,uniform}, from OpenBSD.

Revision 1.9 / (download) - annotate - [select for diffs], Sat Dec 24 21:11:16 2005 UTC (8 years, 7 months ago) by perry
Branch: MAIN
CVS Tags: yamt-pf42-baseX, yamt-pf42-base4, yamt-pf42-base3, yamt-pf42-base2, yamt-pf42-base, yamt-pf42, wrstuden-revivesa-base-3, wrstuden-revivesa-base-2, wrstuden-revivesa-base-1, wrstuden-revivesa-base, wrstuden-revivesa, wrstuden-fixsa-newbase, wrstuden-fixsa-base-1, wrstuden-fixsa-base, wrstuden-fixsa, netbsd-5-base, netbsd-5-2-RELEASE, netbsd-5-2-RC1, netbsd-5-2-2-RELEASE, netbsd-5-2-1-RELEASE, netbsd-5-2, netbsd-5-1-RELEASE, netbsd-5-1-RC4, netbsd-5-1-RC3, netbsd-5-1-RC2, netbsd-5-1-RC1, netbsd-5-1-4-RELEASE, netbsd-5-1-3-RELEASE, netbsd-5-1-2-RELEASE, netbsd-5-1-1-RELEASE, netbsd-5-1, netbsd-5-0-RELEASE, netbsd-5-0-RC4, netbsd-5-0-RC3, netbsd-5-0-RC2, netbsd-5-0-RC1, netbsd-5-0-2-RELEASE, netbsd-5-0-1-RELEASE, netbsd-5-0, netbsd-5, netbsd-4-base, netbsd-4-0-RELEASE, netbsd-4-0-RC5, netbsd-4-0-RC4, netbsd-4-0-RC3, netbsd-4-0-RC2, netbsd-4-0-RC1, netbsd-4-0-1-RELEASE, netbsd-4-0, netbsd-4, mjf-devfs2-base, mjf-devfs2, matt-premerge-20091211, matt-nb5-pq3-base, matt-nb5-pq3, matt-nb5-mips64-u2-k2-k4-k7-k8-k9, matt-nb5-mips64-u1-k1-k5, matt-nb5-mips64-premerge-20101231, matt-nb5-mips64-premerge-20091211, matt-nb5-mips64-k15, matt-nb5-mips64, matt-nb4-mips64-k7-u2a-k9b, matt-mips64-premerge-20101231, matt-mips64-base2, matt-mips64-base, matt-mips64, matt-armv6-prevmlocking, matt-armv6-nbase, matt-armv6-base, matt-armv6, keiichi-mipv6-base, keiichi-mipv6, jym-xensuspend-nbase, jym-xensuspend-base, jym-xensuspend, hpcarm-cleanup-nbase, hpcarm-cleanup-base, hpcarm-cleanup, cube-autoconf-base, cube-autoconf, christos-time_t-nbase, christos-time_t-base, christos-time_t, abandoned-netbsd-4-base, abandoned-netbsd-4
Branch point for: bouyer-quota2
Changes since 1.8: +2 -8 lines
Diff to previous 1.8 (colored)

Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.

Revision 1.8 / (download) - annotate - [select for diffs], Sun Jun 12 05:21:27 2005 UTC (9 years, 1 month ago) by lukem
Branch: MAIN
Changes since 1.7: +6 -1 lines
Diff to previous 1.7 (colored)

Add missing __RCSID()

Revision 1.7 / (download) - annotate - [select for diffs], Wed Feb 9 21:35:46 2005 UTC (9 years, 5 months ago) by kleink
Branch: MAIN
CVS Tags: netbsd-3-base, netbsd-3-1-RELEASE, netbsd-3-1-RC4, netbsd-3-1-RC3, netbsd-3-1-RC2, netbsd-3-1-RC1, netbsd-3-1-1-RELEASE, netbsd-3-1, netbsd-3-0-RELEASE, netbsd-3-0-RC6, netbsd-3-0-RC5, netbsd-3-0-RC4, netbsd-3-0-RC3, netbsd-3-0-RC2, netbsd-3-0-RC1, netbsd-3-0-3-RELEASE, netbsd-3-0-2-RELEASE, netbsd-3-0-1-RELEASE, netbsd-3-0, netbsd-3
Changes since 1.6: +6 -1 lines
Diff to previous 1.6 (colored)

A little libc namespace housekeeping exercise:
* Make vfprintf_unlocked() an internal function, c.f. __svfscanf_unlocked().
* Add internal names for arc4random(), endnetpath(), fhstatvfs(),
  fstatvfs(), mkstemp(), shquote(), statvfs(), taddr2uaddr(), uaddr2taddr(),
  uuid_create_nil(), uuid_is_nil(), and wcwidth().
* Include namespace.h where supposed to.

Revision 1.6 / (download) - annotate - [select for diffs], Wed Feb 9 12:09:08 2005 UTC (9 years, 5 months ago) by kleink
Branch: MAIN
Changes since 1.5: +2 -2 lines
Diff to previous 1.5 (colored)

Declare rs_initialized static.

Revision 1.5.2.2 / (download) - annotate - [select for diffs], Fri Mar 26 22:52:50 2004 UTC (10 years, 3 months ago) by jmc
Branch: netbsd-1-6
CVS Tags: netbsd-1-6-base
Changes since 1.5.2.1: +213 -0 lines
Diff to previous 1.5.2.1 (colored) to branchpoint 1.5 (colored) next main 1.6 (colored)

Pullup rev 1.1-1.5 (requested by provos in ticket #1386)

Introduce bcrypt password scheme. Adds the arc4random API for creating
cryptographically strong random numbers.

Revision 1.3.2.4 / (download) - annotate - [select for diffs], Mon Nov 11 22:22:01 2002 UTC (11 years, 8 months ago) by nathanw
Branch: nathanw_sa
CVS Tags: nathanw_sa_end
Changes since 1.3.2.3: +4 -3 lines
Diff to previous 1.3.2.3 (colored) next main 1.4 (colored)

Catch up to -current

Revision 1.5.2.1, Mon Nov 11 01:13:07 2002 UTC (11 years, 8 months ago) by jmc
Branch: netbsd-1-6
Changes since 1.5: +0 -213 lines
FILE REMOVED

file arc4random.c was added on branch netbsd-1-6 on 2004-03-26 22:52:50 +0000

Revision 1.5 / (download) - annotate - [select for diffs], Mon Nov 11 01:13:07 2002 UTC (11 years, 8 months ago) by thorpej
Branch: MAIN
CVS Tags: netbsd-2-base, netbsd-2-1-RELEASE, netbsd-2-1-RC6, netbsd-2-1-RC5, netbsd-2-1-RC4, netbsd-2-1-RC3, netbsd-2-1-RC2, netbsd-2-1-RC1, netbsd-2-1, netbsd-2-0-base, netbsd-2-0-RELEASE, netbsd-2-0-RC5, netbsd-2-0-RC4, netbsd-2-0-RC3, netbsd-2-0-RC2, netbsd-2-0-RC1, netbsd-2-0-3-RELEASE, netbsd-2-0-2-RELEASE, netbsd-2-0-1-RELEASE, netbsd-2-0, netbsd-2, nathanw_sa_before_merge, nathanw_sa_base, fvdl_fs64_base
Branch point for: netbsd-1-6
Changes since 1.4: +4 -3 lines
Diff to previous 1.4 (colored)

Fix signed/unsigned comparison warnings.

Revision 1.3.2.3 / (download) - annotate - [select for diffs], Thu Aug 1 03:28:09 2002 UTC (11 years, 11 months ago) by nathanw
Branch: nathanw_sa
Changes since 1.3.2.2: +3 -3 lines
Diff to previous 1.3.2.2 (colored)

Catch up to -current.

Revision 1.4 / (download) - annotate - [select for diffs], Tue Jul 2 17:10:19 2002 UTC (12 years ago) by itojun
Branch: MAIN
Changes since 1.3: +3 -3 lines
Diff to previous 1.3 (colored)

use sysctl(kern.urandom) if /dev/urandom is not present (like chroot jail)

Revision 1.3.2.2 / (download) - annotate - [select for diffs], Fri Jun 21 18:18:07 2002 UTC (12 years, 1 month ago) by nathanw
Branch: nathanw_sa
Changes since 1.3.2.1: +212 -0 lines
Diff to previous 1.3.2.1 (colored)

Catch up to -current.

Revision 1.3.2.1, Fri Jun 14 03:11:24 2002 UTC (12 years, 1 month ago) by nathanw
Branch: nathanw_sa
Changes since 1.3: +0 -212 lines
FILE REMOVED

file arc4random.c was added on branch nathanw_sa on 2002-06-21 18:18:07 +0000

Revision 1.3 / (download) - annotate - [select for diffs], Fri Jun 14 03:11:24 2002 UTC (12 years, 1 month ago) by itojun
Branch: MAIN
Branch point for: nathanw_sa
Changes since 1.2: +10 -1 lines
Diff to previous 1.2 (colored)

discard first 256 words when we stir.

Revision 1.2 / (download) - annotate - [select for diffs], Fri May 24 04:53:07 2002 UTC (12 years, 2 months ago) by itojun
Branch: MAIN
Changes since 1.1: +2 -2 lines
Diff to previous 1.1 (colored)

/dev/arandom does not exist in netbsd.  use /dev/urandom.

Revision 1.1 / (download) - annotate - [select for diffs], Fri May 24 04:01:44 2002 UTC (12 years, 2 months ago) by itojun
Branch: MAIN

add arc4random(3).  from openbsd

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.




CVSweb <webmaster@jp.NetBSD.org>