diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/ncrypto_local.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/ncrypto_local.c b/lib/ncrypto_local.c index 8c65789..366963a 100644 --- a/lib/ncrypto_local.c +++ b/lib/ncrypto_local.c @@ -32,6 +32,7 @@ Red Hat author: Miloslav Trmač <mitr@redhat.com> */ #include <glib.h> #include <openssl/evp.h> +#include <openssl/rand.h> #include <ncrypto/ncrypto.h> @@ -44,6 +45,16 @@ ckr_openssl (void) return CKR_GENERAL_ERROR; } + /* Random numbers */ + +CK_RV +ncr_get_random_bytes (void *dest, size_t size) +{ + /* This is not strong enough, we need cryptographically strong random + numbers! */ + return RAND_pseudo_bytes (dest, size) != 0 ? CKR_OK : ckr_openssl (); +} + /* Symmetric keys */ struct ncr_symm_key |
