summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/auth_rsa.c11
-rw-r--r--lib/auth_srp_passwd.c8
-rw-r--r--lib/gnutls_pk.c4
-rw-r--r--lib/random.c6
-rw-r--r--lib/random.h6
-rw-r--r--lib/x509/privkey_pkcs8.c5
-rw-r--r--src/psk.c2
7 files changed, 19 insertions, 23 deletions
diff --git a/lib/auth_rsa.c b/lib/auth_rsa.c
index bc89d1ecee..7113b04650 100644
--- a/lib/auth_rsa.c
+++ b/lib/auth_rsa.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2007 Free Software Foundation
+ * Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008 Free Software Foundation
*
* Author: Nikos Mavrogiannopoulos
*
@@ -291,9 +291,8 @@ _gnutls_proc_rsa_client_kx (gnutls_session_t session, opaque * data,
/* we do not need strong random numbers here.
*/
- ret =
- _gnutls_rnd (RND_NONCE, session->key->key.data,
- session->key->key.size);
+ ret = _gnutls_rnd (GNUTLS_RND_NONCE, session->key->key.data,
+ session->key->key.size);
if (ret < 0)
{
gnutls_assert ();
@@ -348,8 +347,8 @@ _gnutls_gen_rsa_client_kx (gnutls_session_t session, opaque ** data)
return GNUTLS_E_MEMORY_ERROR;
}
- ret =
- _gnutls_rnd (RND_RANDOM, session->key->key.data, session->key->key.size);
+ ret = _gnutls_rnd (GNUTLS_RND_RANDOM, session->key->key.data,
+ session->key->key.size);
if (ret < 0)
{
gnutls_assert ();
diff --git a/lib/auth_srp_passwd.c b/lib/auth_srp_passwd.c
index 51b703a44d..fe8e3297b2 100644
--- a/lib/auth_srp_passwd.c
+++ b/lib/auth_srp_passwd.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation
+ * Copyright (C) 2001, 2002, 2003, 2004, 2005, 2008 Free Software Foundation
*
* Author: Nikos Mavrogiannopoulos
*
@@ -405,7 +405,7 @@ _randomize_pwd_entry (SRP_PWD_ENTRY * entry)
return GNUTLS_E_INTERNAL_ERROR;
}
- ret = _gnutls_rnd (RND_NONCE, &rnd, 1);
+ ret = _gnutls_rnd (GNUTLS_RND_NONCE, &rnd, 1);
if (ret < 0)
{
gnutls_assert ();
@@ -422,7 +422,7 @@ _randomize_pwd_entry (SRP_PWD_ENTRY * entry)
return GNUTLS_E_MEMORY_ERROR;
}
- ret = _gnutls_rnd (RND_RANDOM, entry->v.data, 20);
+ ret = _gnutls_rnd (GNUTLS_RND_RANDOM, entry->v.data, 20);
if (ret < 0)
{
gnutls_assert ();
@@ -436,7 +436,7 @@ _randomize_pwd_entry (SRP_PWD_ENTRY * entry)
return GNUTLS_E_MEMORY_ERROR;
}
- ret = _gnutls_rnd (RND_NONCE, entry->salt.data, entry->salt.size);
+ ret = _gnutls_rnd (GNUTLS_RND_NONCE, entry->salt.data, entry->salt.size);
if (ret < 0)
{
gnutls_assert ();
diff --git a/lib/gnutls_pk.c b/lib/gnutls_pk.c
index b97bc4d02c..d03f9b38a2 100644
--- a/lib/gnutls_pk.c
+++ b/lib/gnutls_pk.c
@@ -96,7 +96,7 @@ _gnutls_pkcs1_rsa_encrypt (gnutls_datum_t * ciphertext,
return GNUTLS_E_INTERNAL_ERROR;
}
- ret = _gnutls_rnd (RND_RANDOM, ps, psize);
+ ret = _gnutls_rnd (GNUTLS_RND_RANDOM, ps, psize);
if (ret < 0)
{
gnutls_assert ();
@@ -106,7 +106,7 @@ _gnutls_pkcs1_rsa_encrypt (gnutls_datum_t * ciphertext,
for (i = 0; i < psize; i++)
while (ps[i] == 0)
{
- ret = _gnutls_rnd (RND_RANDOM, &ps[i], 1);
+ ret = _gnutls_rnd (GNUTLS_RND_RANDOM, &ps[i], 1);
if (ret < 0)
{
gnutls_assert ();
diff --git a/lib/random.c b/lib/random.c
index 71174fa5d5..9799869f3b 100644
--- a/lib/random.c
+++ b/lib/random.c
@@ -32,7 +32,7 @@
static void *rnd_ctx;
int
-_gnutls_rnd_init ()
+_gnutls_rnd_init (void)
{
if (_gnutls_rnd_ops.init != NULL)
{
@@ -47,7 +47,7 @@ _gnutls_rnd_init ()
}
void
-_gnutls_rnd_deinit ()
+_gnutls_rnd_deinit (void)
{
if (_gnutls_rnd_ops.deinit != NULL)
{
@@ -58,7 +58,7 @@ _gnutls_rnd_deinit ()
}
int
-_gnutls_rnd (int level, void *data, int len)
+_gnutls_rnd (int level, void *data, size_t len)
{
if (len > 0)
{
diff --git a/lib/random.h b/lib/random.h
index 02d06f63d2..b91cc96e7b 100644
--- a/lib/random.h
+++ b/lib/random.h
@@ -6,11 +6,7 @@
extern int crypto_rnd_prio;
extern gnutls_crypto_rnd_st _gnutls_rnd_ops;
-#define RND_RANDOM GNUTLS_RND_RANDOM
-#define RND_NONCE GNUTLS_RND_NONCE
-#define RND_KEY GNUTLS_RND_KEY
-
-int _gnutls_rnd (int level, void *data, int len);
+int _gnutls_rnd (int level, void *data, size_t len);
void _gnutls_rnd_deinit (void);
int _gnutls_rnd_init (void);
diff --git a/lib/x509/privkey_pkcs8.c b/lib/x509/privkey_pkcs8.c
index d424ce266b..f65229051b 100644
--- a/lib/x509/privkey_pkcs8.c
+++ b/lib/x509/privkey_pkcs8.c
@@ -1753,7 +1753,7 @@ generate_key (schema_id schema,
else if (schema == PKCS12_RC2_40_SHA1)
enc_params->cipher = GNUTLS_CIPHER_RC2_40_CBC;
- ret = _gnutls_rnd (RND_RANDOM, rnd, 2);
+ ret = _gnutls_rnd (GNUTLS_RND_RANDOM, rnd, 2);
if (ret < 0)
{
gnutls_assert ();
@@ -1768,7 +1768,8 @@ generate_key (schema_id schema,
else
kdf_params->salt_size = 8;
- ret = _gnutls_rnd (RND_RANDOM, kdf_params->salt, kdf_params->salt_size);
+ ret = _gnutls_rnd (GNUTLS_RND_RANDOM, kdf_params->salt,
+ kdf_params->salt_size);
if (ret < 0)
{
gnutls_assert ();
diff --git a/src/psk.c b/src/psk.c
index 928ca62f08..ff5f2ee66f 100644
--- a/src/psk.c
+++ b/src/psk.c
@@ -157,7 +157,7 @@ main (int argc, char **argv)
printf ("Generating a random key for user '%s'\n", info.username);
- ret = _gnutls_rnd (RND_RANDOM, (char *) key, info.key_size);
+ ret = _gnutls_rnd (GNUTLS_RND_RANDOM, (char *) key, info.key_size);
if (ret < 0)
{
fprintf (stderr, "Not enough randomness\n");