* ext/openssl/ossl_rand.c: [DOC] Add call signature for pseudo_bytes
and random_bytes, wrap lines at 80 chars, and remove useless comments. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47782 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
27886620d8
commit
165625e8e1
@ -1,3 +1,9 @@
|
|||||||
|
Sat Oct 4 08:59:45 2014 Zachary Scott <e@zzak.io>
|
||||||
|
|
||||||
|
* ext/openssl/ossl_rand.c: [DOC] Add call signature for pseudo_bytes
|
||||||
|
and random_bytes, wrap lines at 80 chars, and remove useless
|
||||||
|
comments.
|
||||||
|
|
||||||
Sat Oct 4 08:49:34 2014 Zachary Scott <e@zzak.io>
|
Sat Oct 4 08:49:34 2014 Zachary Scott <e@zzak.io>
|
||||||
|
|
||||||
* ext/openssl/ossl_rand.c: [DOC] Add rdoc for method descriptions
|
* ext/openssl/ossl_rand.c: [DOC] Add rdoc for method descriptions
|
||||||
|
@ -2,32 +2,17 @@
|
|||||||
* $Id$
|
* $Id$
|
||||||
* 'OpenSSL for Ruby' project
|
* 'OpenSSL for Ruby' project
|
||||||
* Copyright (C) 2001-2002 Michal Rokos <m.rokos@sh.cvut.cz>
|
* Copyright (C) 2001-2002 Michal Rokos <m.rokos@sh.cvut.cz>
|
||||||
|
*
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*/
|
*
|
||||||
/*
|
|
||||||
* This program is licenced under the same licence as Ruby.
|
* This program is licenced under the same licence as Ruby.
|
||||||
* (See the file 'LICENCE'.)
|
* (See the file 'LICENCE'.)
|
||||||
*/
|
*/
|
||||||
#include "ossl.h"
|
#include "ossl.h"
|
||||||
|
|
||||||
/*
|
|
||||||
* Classes
|
|
||||||
*/
|
|
||||||
VALUE mRandom;
|
VALUE mRandom;
|
||||||
VALUE eRandomError;
|
VALUE eRandomError;
|
||||||
|
|
||||||
/*
|
|
||||||
* Struct
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Public
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Private
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* call-seq:
|
* call-seq:
|
||||||
* seed(str) -> str
|
* seed(str) -> str
|
||||||
@ -47,11 +32,15 @@ ossl_rand_seed(VALUE self, VALUE str)
|
|||||||
* call-seq:
|
* call-seq:
|
||||||
* add(str, entropy) -> self
|
* add(str, entropy) -> self
|
||||||
*
|
*
|
||||||
* Mixes the bytes from +str+ into the Pseudo Random Number Generator(PRNG) state.
|
* Mixes the bytes from +str+ into the Pseudo Random Number Generator(PRNG)
|
||||||
* Thus, if the data from +str+ are unpredictable to an adversary, this increases the uncertainty about the state
|
* state.
|
||||||
* and makes the PRNG output less predictable.
|
*
|
||||||
* The +entropy+ argument is (the lower bound of) an estimate of how much randomness is contained in +str+,
|
* Thus, if the data from +str+ are unpredictable to an adversary, this
|
||||||
* measured in bytes.
|
* increases the uncertainty about the state and makes the PRNG output less
|
||||||
|
* predictable.
|
||||||
|
*
|
||||||
|
* The +entropy+ argument is (the lower bound of) an estimate of how much
|
||||||
|
* randomness is contained in +str+, measured in bytes.
|
||||||
*
|
*
|
||||||
* Example:
|
* Example:
|
||||||
*
|
*
|
||||||
@ -91,8 +80,9 @@ ossl_rand_load_file(VALUE self, VALUE filename)
|
|||||||
* call-seq:
|
* call-seq:
|
||||||
* write_random_file(filename) -> true
|
* write_random_file(filename) -> true
|
||||||
*
|
*
|
||||||
* Writes a number of random generated bytes (currently 1024) to +filename+ which can be used to initialize the PRNG by
|
* Writes a number of random generated bytes (currently 1024) to +filename+
|
||||||
* calling ::load_random_file in a later session.
|
* which can be used to initialize the PRNG by calling ::load_random_file in a
|
||||||
|
* later session.
|
||||||
*/
|
*/
|
||||||
static VALUE
|
static VALUE
|
||||||
ossl_rand_write_file(VALUE self, VALUE filename)
|
ossl_rand_write_file(VALUE self, VALUE filename)
|
||||||
@ -106,9 +96,10 @@ ossl_rand_write_file(VALUE self, VALUE filename)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* call-seq:
|
* call-seq:
|
||||||
* -> string
|
* random_bytes(length) -> string
|
||||||
*
|
*
|
||||||
* Generates +string+ with +length+ number of cryptographically strong pseudo-random bytes.
|
* Generates +string+ with +length+ number of cryptographically strong
|
||||||
|
* pseudo-random bytes.
|
||||||
*
|
*
|
||||||
* Example:
|
* Example:
|
||||||
*
|
*
|
||||||
@ -131,12 +122,12 @@ ossl_rand_bytes(VALUE self, VALUE len)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* call-seq:
|
* call-seq:
|
||||||
* -> string
|
* pseudo_bytes(length) -> string
|
||||||
*
|
*
|
||||||
* Generates +string+ with +length+ number of pseudo-random bytes.
|
* Generates +string+ with +length+ number of pseudo-random bytes.
|
||||||
*
|
*
|
||||||
* Pseudo-random byte sequences generated by ::pseudo_bytes will be unique if they are of sufficient length,
|
* Pseudo-random byte sequences generated by ::pseudo_bytes will be unique if
|
||||||
* but are not necessarily unpredictable.
|
* they are of sufficient length, but are not necessarily unpredictable.
|
||||||
*
|
*
|
||||||
* Example:
|
* Example:
|
||||||
*
|
*
|
||||||
@ -179,7 +170,9 @@ ossl_rand_egd(VALUE self, VALUE filename)
|
|||||||
* egd_bytes(filename, length) -> true
|
* egd_bytes(filename, length) -> true
|
||||||
*
|
*
|
||||||
* Queries the entropy gathering daemon EGD on socket path given by +filename+.
|
* Queries the entropy gathering daemon EGD on socket path given by +filename+.
|
||||||
* Fetches +length+ number of bytes and uses ::add to seed the OpenSSL built-in PRNG.
|
*
|
||||||
|
* Fetches +length+ number of bytes and uses ::add to seed the OpenSSL built-in
|
||||||
|
* PRNG.
|
||||||
*/
|
*/
|
||||||
static VALUE
|
static VALUE
|
||||||
ossl_rand_egd_bytes(VALUE self, VALUE filename, VALUE len)
|
ossl_rand_egd_bytes(VALUE self, VALUE filename, VALUE len)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user