diff options
author | Justus Winter <[email protected]> | 2016-11-07 11:21:26 +0000 |
---|---|---|
committer | Justus Winter <[email protected]> | 2016-11-07 12:00:15 +0000 |
commit | 6e677f9b55fdb610e93134042ee41ee5c641cbdf (patch) | |
tree | e8f1f620fc19f6584d7fbf38f342d9686cefc0c9 /tests/gpgscm/lib.scm | |
parent | g10: Fix crash. (diff) | |
download | gnupg-6e677f9b55fdb610e93134042ee41ee5c641cbdf.tar.gz gnupg-6e677f9b55fdb610e93134042ee41ee5c641cbdf.zip |
gpgscm: Add support for pseudo-random numbers.
* tests/gpgscm/ffi.c (do_getpid): New function.
(do_srandom): Likewise.
(random_scaled): Likewise.
(do_random): Likewise.
(do_make_random_string): Likewise.
(ffi_init): Expose the new functions.
* tests/gpgscm/lib.scm: Document the new functions.
Signed-off-by: Justus Winter <[email protected]>
Diffstat (limited to 'tests/gpgscm/lib.scm')
-rw-r--r-- | tests/gpgscm/lib.scm | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/gpgscm/lib.scm b/tests/gpgscm/lib.scm index 316eacf87..270189dcd 100644 --- a/tests/gpgscm/lib.scm +++ b/tests/gpgscm/lib.scm @@ -185,3 +185,24 @@ (else (write-char (apply read-char p) acc) (loop acc)))))) + +;; +;; Libc functions. +;; + +;; Get our process id. +(ffi-define (getpid)) + +;; +;; Random numbers. +;; + +;; Seed the random number generator. +(ffi-define (srandom seed)) + +;; Get a pseudo-random number between 0 (inclusive) and SCALE +;; (exclusive). +(ffi-define (random scale)) + +;; Create a string of the given SIZE containing pseudo-random data. +(ffi-define (make-random-string size)) |