summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@redhat.com>2016-10-17 14:10:08 +0200
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2016-11-04 02:54:06 +0100
commit34d25befa62ceba5af915f25393c5f62093d4591 (patch)
treed668fb3891ec725134cc86a540950b0cda814691
parente4c739fe0b9e568333bf43358fbc3db6b96fe1a1 (diff)
downloadgnutls-34d25befa62ceba5af915f25393c5f62093d4591.tar.gz
deprecated _gnutls_rnd() in favor of exported gnutls_rnd()
-rw-r--r--lib/auth/psk_passwd.c2
-rw-r--r--lib/auth/rsa.c4
-rw-r--r--lib/auth/rsa_psk.c4
-rw-r--r--lib/auth/srp_passwd.c2
-rw-r--r--lib/cipher.c4
-rw-r--r--lib/crypto-api.c2
-rw-r--r--lib/ext/heartbeat.c2
-rw-r--r--lib/ext/session_ticket.c2
-rw-r--r--lib/handshake.c4
-rw-r--r--lib/mpi.c2
-rw-r--r--lib/nettle/pk.c4
-rw-r--r--lib/opencdk/misc.c2
-rw-r--r--lib/pkcs11_secret.c2
-rw-r--r--lib/random.h3
-rw-r--r--lib/srp.c2
-rw-r--r--lib/tpm.c4
-rw-r--r--lib/x509/pkcs12.c2
-rw-r--r--lib/x509/pkcs7-crypt.c6
18 files changed, 25 insertions, 28 deletions
diff --git a/lib/auth/psk_passwd.c b/lib/auth/psk_passwd.c
index 72aadb83f8..1e1898cb8d 100644
--- a/lib/auth/psk_passwd.c
+++ b/lib/auth/psk_passwd.c
@@ -94,7 +94,7 @@ static int _randomize_psk(gnutls_datum_t * psk)
psk->size = 16;
- ret = _gnutls_rnd(GNUTLS_RND_NONCE, (char *) psk->data, 16);
+ ret = gnutls_rnd(GNUTLS_RND_NONCE, (char *) psk->data, 16);
if (ret < 0) {
gnutls_assert();
return ret;
diff --git a/lib/auth/rsa.c b/lib/auth/rsa.c
index 505fbee1dd..b54d415f6f 100644
--- a/lib/auth/rsa.c
+++ b/lib/auth/rsa.c
@@ -178,7 +178,7 @@ proc_rsa_client_kx(gnutls_session_t session, uint8_t * data,
/* we do not need strong random numbers here.
*/
- ret = _gnutls_rnd(GNUTLS_RND_NONCE, rndkey.data,
+ ret = gnutls_rnd(GNUTLS_RND_NONCE, rndkey.data,
rndkey.size);
if (ret < 0) {
gnutls_assert();
@@ -265,7 +265,7 @@ _gnutls_gen_rsa_client_kx(gnutls_session_t session,
return GNUTLS_E_MEMORY_ERROR;
}
- ret = _gnutls_rnd(GNUTLS_RND_RANDOM, session->key.key.data,
+ ret = gnutls_rnd(GNUTLS_RND_RANDOM, session->key.key.data,
session->key.key.size);
if (ret < 0) {
gnutls_assert();
diff --git a/lib/auth/rsa_psk.c b/lib/auth/rsa_psk.c
index a14baa1eaa..151e88da7f 100644
--- a/lib/auth/rsa_psk.c
+++ b/lib/auth/rsa_psk.c
@@ -156,7 +156,7 @@ _gnutls_gen_rsa_psk_client_kx(gnutls_session_t session,
}
/* Generate random */
- ret = _gnutls_rnd(GNUTLS_RND_RANDOM, premaster_secret.data,
+ ret = gnutls_rnd(GNUTLS_RND_RANDOM, premaster_secret.data,
premaster_secret.size);
if (ret < 0) {
gnutls_assert();
@@ -370,7 +370,7 @@ _gnutls_proc_rsa_psk_client_kx(gnutls_session_t session, uint8_t * data,
/* we do not need strong random numbers here.
*/
- ret = _gnutls_rnd(GNUTLS_RND_NONCE, premaster_secret.data,
+ ret = gnutls_rnd(GNUTLS_RND_NONCE, premaster_secret.data,
premaster_secret.size);
if (ret < 0) {
gnutls_assert();
diff --git a/lib/auth/srp_passwd.c b/lib/auth/srp_passwd.c
index b911282567..f68c030b60 100644
--- a/lib/auth/srp_passwd.c
+++ b/lib/auth/srp_passwd.c
@@ -400,7 +400,7 @@ static int _randomize_pwd_entry(SRP_PWD_ENTRY * entry,
return GNUTLS_E_MEMORY_ERROR;
}
- ret = _gnutls_rnd(GNUTLS_RND_RANDOM, entry->v.data, 20);
+ ret = gnutls_rnd(GNUTLS_RND_RANDOM, entry->v.data, 20);
if (ret < 0) {
gnutls_assert();
return ret;
diff --git a/lib/cipher.c b/lib/cipher.c
index b25ba90997..6f92333d94 100644
--- a/lib/cipher.c
+++ b/lib/cipher.c
@@ -323,9 +323,9 @@ compressed_to_ciphertext(gnutls_session_t session,
/* Calculate the encrypted length (padding etc.)
*/
if (algo_type == CIPHER_BLOCK) {
- /* Call _gnutls_rnd() once. Get data used for the IV
+ /* Call gnutls_rnd() once. Get data used for the IV
*/
- ret = _gnutls_rnd(GNUTLS_RND_NONCE, nonce, blocksize);
+ ret = gnutls_rnd(GNUTLS_RND_NONCE, nonce, blocksize);
if (ret < 0)
return gnutls_assert_val(ret);
diff --git a/lib/crypto-api.c b/lib/crypto-api.c
index 9b2bafa66a..6b3b065f08 100644
--- a/lib/crypto-api.c
+++ b/lib/crypto-api.c
@@ -611,7 +611,7 @@ int gnutls_key_generate(gnutls_datum_t * key, unsigned int key_size)
return GNUTLS_E_MEMORY_ERROR;
}
- ret = _gnutls_rnd(GNUTLS_RND_RANDOM, key->data, key->size);
+ ret = gnutls_rnd(GNUTLS_RND_RANDOM, key->data, key->size);
if (ret < 0) {
gnutls_assert();
_gnutls_free_datum(key);
diff --git a/lib/ext/heartbeat.c b/lib/ext/heartbeat.c
index 180d59ad66..26a0928d9c 100644
--- a/lib/ext/heartbeat.c
+++ b/lib/ext/heartbeat.c
@@ -194,7 +194,7 @@ gnutls_heartbeat_ping(gnutls_session_t session, size_t data_size,
return gnutls_assert_val(ret);
ret =
- _gnutls_rnd(GNUTLS_RND_NONCE,
+ gnutls_rnd(GNUTLS_RND_NONCE,
session->internals.hb_local_data.data,
data_size);
if (ret < 0)
diff --git a/lib/ext/session_ticket.c b/lib/ext/session_ticket.c
index 5a957f021d..feb650706f 100644
--- a/lib/ext/session_ticket.c
+++ b/lib/ext/session_ticket.c
@@ -234,7 +234,7 @@ encrypt_ticket(gnutls_session_t session, session_ticket_ext_st * priv,
t = gnutls_time(0);
memcpy(iv, &t, 4);
- ret = _gnutls_rnd(GNUTLS_RND_NONCE, iv+4, IV_SIZE-4);
+ ret = gnutls_rnd(GNUTLS_RND_NONCE, iv+4, IV_SIZE-4);
if (ret < 0) {
gnutls_assert();
goto cleanup;
diff --git a/lib/handshake.c b/lib/handshake.c
index d8eaf6e06a..c716d372b0 100644
--- a/lib/handshake.c
+++ b/lib/handshake.c
@@ -204,7 +204,7 @@ static int create_tls_random(uint8_t * dst)
_gnutls_write_uint32(tim, dst);
ret =
- _gnutls_rnd(GNUTLS_RND_NONCE, &dst[3], GNUTLS_RANDOM_SIZE - 3);
+ gnutls_rnd(GNUTLS_RND_NONCE, &dst[3], GNUTLS_RANDOM_SIZE - 3);
if (ret < 0) {
gnutls_assert();
return ret;
@@ -3367,7 +3367,7 @@ int _gnutls_generate_session_id(uint8_t * session_id, uint8_t * len)
*len = GNUTLS_MAX_SESSION_ID_SIZE;
ret =
- _gnutls_rnd(GNUTLS_RND_NONCE, session_id,
+ gnutls_rnd(GNUTLS_RND_NONCE, session_id,
GNUTLS_MAX_SESSION_ID_SIZE);
if (ret < 0) {
gnutls_assert();
diff --git a/lib/mpi.c b/lib/mpi.c
index 8f39516785..aa81753781 100644
--- a/lib/mpi.c
+++ b/lib/mpi.c
@@ -60,7 +60,7 @@ _gnutls_mpi_random_modp(bigint_t r, bigint_t p,
buf_release = 1;
}
- ret = _gnutls_rnd(level, buf, size);
+ ret = gnutls_rnd(level, buf, size);
if (ret < 0) {
gnutls_assert();
goto cleanup;
diff --git a/lib/nettle/pk.c b/lib/nettle/pk.c
index ffa6476e4a..851bda7102 100644
--- a/lib/nettle/pk.c
+++ b/lib/nettle/pk.c
@@ -54,7 +54,7 @@ static inline const struct ecc_curve *get_supported_nist_curve(int curve);
static void rnd_func(void *_ctx, size_t length, uint8_t * data)
{
- if (_gnutls_rnd(GNUTLS_RND_RANDOM, data, length) < 0) {
+ if (gnutls_rnd(GNUTLS_RND_RANDOM, data, length) < 0) {
#ifdef ENABLE_FIPS140
_gnutls_switch_lib_state(LIB_STATE_ERROR);
#else
@@ -1444,7 +1444,7 @@ wrap_nettle_pk_generate_keys(gnutls_pk_algorithm_t algo,
goto fail;
}
- ret = _gnutls_rnd(GNUTLS_RND_RANDOM, params->raw_priv.data, size);
+ ret = gnutls_rnd(GNUTLS_RND_RANDOM, params->raw_priv.data, size);
if (ret < 0) {
ret = gnutls_assert_val(GNUTLS_E_MEMORY_ERROR);
goto fail;
diff --git a/lib/opencdk/misc.c b/lib/opencdk/misc.c
index 391bd09e93..7c411688a1 100644
--- a/lib/opencdk/misc.c
+++ b/lib/opencdk/misc.c
@@ -161,7 +161,7 @@ FILE *_cdk_tmpfile(void)
FILE *fp;
int fd, i;
- _gnutls_rnd(GNUTLS_RND_NONCE, rnd, DIM(rnd));
+ gnutls_rnd(GNUTLS_RND_NONCE, rnd, DIM(rnd));
for (i = 0; i < DIM(rnd) - 1; i++) {
char c = letters[(unsigned char) rnd[i] % 26];
rnd[i] = c;
diff --git a/lib/pkcs11_secret.c b/lib/pkcs11_secret.c
index aa3e5ce7cd..b9a88549ee 100644
--- a/lib/pkcs11_secret.c
+++ b/lib/pkcs11_secret.c
@@ -72,7 +72,7 @@ gnutls_pkcs11_copy_secret_key(const char *token_url, gnutls_datum_t * key,
}
/* generate a unique ID */
- ret = _gnutls_rnd(GNUTLS_RND_NONCE, id, sizeof(id));
+ ret = gnutls_rnd(GNUTLS_RND_NONCE, id, sizeof(id));
if (ret < 0) {
gnutls_assert();
return ret;
diff --git a/lib/random.h b/lib/random.h
index 2ef7bc4684..e89efb9c34 100644
--- a/lib/random.h
+++ b/lib/random.h
@@ -31,9 +31,6 @@ extern int crypto_rnd_prio;
extern void *gnutls_rnd_ctx;
extern gnutls_crypto_rnd_st _gnutls_rnd_ops;
-#define _gnutls_rnd gnutls_rnd
-#define _gnutls_rnd_refresh gnutls_rnd_refresh
-
void _gnutls_rnd_deinit(void);
int _gnutls_rnd_preinit(void);
diff --git a/lib/srp.c b/lib/srp.c
index 655b4a38d1..6d111e5b39 100644
--- a/lib/srp.c
+++ b/lib/srp.c
@@ -532,7 +532,7 @@ gnutls_srp_allocate_server_credentials(gnutls_srp_server_credentials_t *
goto cleanup;
}
- ret = _gnutls_rnd(GNUTLS_RND_RANDOM, (*sc)->fake_salt_seed.data,
+ ret = gnutls_rnd(GNUTLS_RND_RANDOM, (*sc)->fake_salt_seed.data,
DEFAULT_FAKE_SALT_SEED_SIZE);
if (ret < 0) {
diff --git a/lib/tpm.c b/lib/tpm.c
index 4ec9a95927..5f4c85134b 100644
--- a/lib/tpm.c
+++ b/lib/tpm.c
@@ -768,7 +768,7 @@ static int randomize_uuid(TSS_UUID * uuid)
uint8_t raw_uuid[16];
int ret;
- ret = _gnutls_rnd(GNUTLS_RND_NONCE, raw_uuid, sizeof(raw_uuid));
+ ret = gnutls_rnd(GNUTLS_RND_NONCE, raw_uuid, sizeof(raw_uuid));
if (ret < 0)
return gnutls_assert_val(ret);
@@ -1391,7 +1391,7 @@ gnutls_tpm_privkey_generate(gnutls_pk_algorithm_t pk, unsigned int bits,
}
- ret = _gnutls_rnd(GNUTLS_RND_RANDOM, buf, sizeof(buf));
+ ret = gnutls_rnd(GNUTLS_RND_RANDOM, buf, sizeof(buf));
if (ret < 0) {
gnutls_assert();
goto err_cc;
diff --git a/lib/x509/pkcs12.c b/lib/x509/pkcs12.c
index 9b280ba857..1690be323f 100644
--- a/lib/x509/pkcs12.c
+++ b/lib/x509/pkcs12.c
@@ -881,7 +881,7 @@ int gnutls_pkcs12_generate_mac2(gnutls_pkcs12_t pkcs12, gnutls_mac_algorithm_t m
/* Generate the salt.
*/
- result = _gnutls_rnd(GNUTLS_RND_NONCE, salt, sizeof(salt));
+ result = gnutls_rnd(GNUTLS_RND_NONCE, salt, sizeof(salt));
if (result < 0) {
gnutls_assert();
return result;
diff --git a/lib/x509/pkcs7-crypt.c b/lib/x509/pkcs7-crypt.c
index 7f67376ce0..4eecc29146 100644
--- a/lib/x509/pkcs7-crypt.c
+++ b/lib/x509/pkcs7-crypt.c
@@ -1279,7 +1279,7 @@ _gnutls_pkcs_generate_key(schema_id schema,
if (password)
pass_len = strlen(password);
- ret = _gnutls_rnd(GNUTLS_RND_RANDOM, rnd, 2);
+ ret = gnutls_rnd(GNUTLS_RND_RANDOM, rnd, 2);
if (ret < 0) {
gnutls_assert();
return ret;
@@ -1301,7 +1301,7 @@ _gnutls_pkcs_generate_key(schema_id schema,
return GNUTLS_E_INVALID_REQUEST;
}
- ret = _gnutls_rnd(GNUTLS_RND_RANDOM, kdf_params->salt,
+ ret = gnutls_rnd(GNUTLS_RND_RANDOM, kdf_params->salt,
kdf_params->salt_size);
if (ret < 0) {
gnutls_assert();
@@ -1329,7 +1329,7 @@ _gnutls_pkcs_generate_key(schema_id schema,
kdf_params->key_size, key->data);
if (enc_params->iv_size) {
- ret = _gnutls_rnd(GNUTLS_RND_NONCE,
+ ret = gnutls_rnd(GNUTLS_RND_NONCE,
enc_params->iv, enc_params->iv_size);
if (ret < 0) {
gnutls_assert();