[前][次][番号順一覧][スレッド一覧]

ruby-changes:42839

From: nobu <ko1@a...>
Date: Thu, 5 May 2016 09:53:02 +0900 (JST)
Subject: [ruby-changes:42839] nobu:r54912 (trunk): random.c: use arc4random_buf

nobu	2016-05-05 10:49:35 +0900 (Thu, 05 May 2016)

  New Revision: 54912

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=54912

  Log:
    random.c: use arc4random_buf
    
    * random.c (fill_random_bytes_syscall): use arc4random_buf if
      available.

  Modified files:
    trunk/ChangeLog
    trunk/configure.in
    trunk/random.c
Index: configure.in
===================================================================
--- configure.in	(revision 54911)
+++ configure.in	(revision 54912)
@@ -2270,6 +2270,7 @@ AC_CHECK_FUNCS(_longjmp)		# used for AC_ https://github.com/ruby/ruby/blob/trunk/configure.in#L2270
 test x$ac_cv_func__longjmp = xno && ac_cv_func__setjmp=no
 AC_CHECK_FUNCS(_setjmp)			# used for AC_ARG_WITH(setjmp-type)
 AC_CHECK_FUNCS(_setjmpex)		# used for AC_ARG_WITH(setjmp-type)
+AC_CHECK_FUNCS(arc4random_buf)
 AC_CHECK_FUNCS(atan2l atan2f)
 AC_CHECK_FUNCS(chroot)
 AC_CHECK_FUNCS(chsize)
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 54911)
+++ ChangeLog	(revision 54912)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Thu May  5 10:49:33 2016  Nobuyoshi Nakada  <nobu@r...>
+
+	* random.c (fill_random_bytes_syscall): use arc4random_buf if
+	  available.
+
 Wed May  4 23:13:58 2016  Yuichiro Kaneko  <yui-knk@r...>
 
 	* numeric.c (fix_plus): Remove rb_nucomp_add prototype
Index: random.c
===================================================================
--- random.c	(revision 54911)
+++ random.c	(revision 54912)
@@ -480,7 +480,10 @@ fill_random_bytes_urandom(void *seed, si https://github.com/ruby/ruby/blob/trunk/random.c#L480
 # define fill_random_bytes_urandom(seed, size) -1
 #endif
 
-#if defined(_WIN32)
+#if 0
+#elif defined(HAVE_ARC4RANDOM_BUF)
+#define fill_random_bytes_syscall(buf, size, unused) (arc4random_buf(buf, size), 0)
+#elif defined(_WIN32)
 static void
 release_crypt(void *p)
 {

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]