summaryrefslogtreecommitdiffstats
path: root/crypto/rand
diff options
context:
space:
mode:
authorRich Salz <rsalz@akamai.com>2015-10-27 15:11:48 -0400
committerRich Salz <rsalz@openssl.org>2015-10-30 17:21:42 -0400
commitb0700d2c8de79252ba605748a075cf2e5d670da1 (patch)
tree80d8b70286dfab4ef907cf1ac388f691821b0f2e /crypto/rand
parent87d9cafa332bd006086b56dc645c03fe7cfed654 (diff)
Replace "SSLeay" in API with OpenSSL
All instances of SSLeay (any combination of case) were replaced with the case-equivalent OpenSSL. Reviewed-by: Richard Levitte <levitte@openssl.org>
Diffstat (limited to 'crypto/rand')
-rw-r--r--crypto/rand/md_rand.c66
-rw-r--r--crypto/rand/rand_err.c4
-rw-r--r--crypto/rand/rand_lib.c8
3 files changed, 39 insertions, 39 deletions
diff --git a/crypto/rand/md_rand.c b/crypto/rand/md_rand.c
index c7d54ed7ef..0eaaf62863 100644
--- a/crypto/rand/md_rand.c
+++ b/crypto/rand/md_rand.c
@@ -166,35 +166,35 @@ int rand_predictable = 0;
static void rand_hw_seed(EVP_MD_CTX *ctx);
-static void ssleay_rand_cleanup(void);
-static int ssleay_rand_seed(const void *buf, int num);
-static int ssleay_rand_add(const void *buf, int num, double add_entropy);
-static int ssleay_rand_bytes(unsigned char *buf, int num, int pseudo);
-static int ssleay_rand_nopseudo_bytes(unsigned char *buf, int num);
+static void rand_cleanup(void);
+static int rand_seed(const void *buf, int num);
+static int rand_add(const void *buf, int num, double add_entropy);
+static int rand_bytes(unsigned char *buf, int num, int pseudo);
+static int rand_nopseudo_bytes(unsigned char *buf, int num);
#ifndef OPENSSL_NO_DEPRECATED
-static int ssleay_rand_pseudo_bytes(unsigned char *buf, int num);
+static int rand_pseudo_bytes(unsigned char *buf, int num);
#endif
-static int ssleay_rand_status(void);
+static int rand_status(void);
-static RAND_METHOD rand_ssleay_meth = {
- ssleay_rand_seed,
- ssleay_rand_nopseudo_bytes,
- ssleay_rand_cleanup,
- ssleay_rand_add,
+static RAND_METHOD rand_meth = {
+ rand_seed,
+ rand_nopseudo_bytes,
+ rand_cleanup,
+ rand_add,
#ifndef OPENSSL_NO_DEPRECATED
- ssleay_rand_pseudo_bytes,
+ rand_pseudo_bytes,
#else
NULL,
#endif
- ssleay_rand_status
+ rand_status
};
-RAND_METHOD *RAND_SSLeay(void)
+RAND_METHOD *RAND_OpenSSL(void)
{
- return (&rand_ssleay_meth);
+ return (&rand_meth);
}
-static void ssleay_rand_cleanup(void)
+static void rand_cleanup(void)
{
OPENSSL_cleanse(state, sizeof(state));
state_num = 0;
@@ -206,7 +206,7 @@ static void ssleay_rand_cleanup(void)
initialized = 0;
}
-static int ssleay_rand_add(const void *buf, int num, double add)
+static int rand_add(const void *buf, int num, double add)
{
int i, j, k, st_idx;
long md_c[2];
@@ -355,12 +355,12 @@ static int ssleay_rand_add(const void *buf, int num, double add)
return rv;
}
-static int ssleay_rand_seed(const void *buf, int num)
+static int rand_seed(const void *buf, int num)
{
- return ssleay_rand_add(buf, num, (double)num);
+ return rand_add(buf, num, (double)num);
}
-static int ssleay_rand_bytes(unsigned char *buf, int num, int pseudo)
+static int rand_bytes(unsigned char *buf, int num, int pseudo)
{
static volatile int stirred_pool = 0;
int i, j, k, st_num, st_idx;
@@ -433,7 +433,7 @@ static int ssleay_rand_bytes(unsigned char *buf, int num, int pseudo)
CRYPTO_w_lock(CRYPTO_LOCK_RAND);
- /* prevent ssleay_rand_bytes() from trying to obtain the lock again */
+ /* prevent rand_bytes() from trying to obtain the lock again */
CRYPTO_w_lock(CRYPTO_LOCK_RAND2);
CRYPTO_THREADID_current(&locking_threadid);
CRYPTO_w_unlock(CRYPTO_LOCK_RAND2);
@@ -470,7 +470,7 @@ static int ssleay_rand_bytes(unsigned char *buf, int num, int pseudo)
* In the output function only half of 'md' remains secret, so we
* better make sure that the required entropy gets 'evenly
* distributed' through 'state', our randomness pool. The input
- * function (ssleay_rand_add) chains all of 'md', which makes it more
+ * function (rand_add) chains all of 'md', which makes it more
* suitable for this purpose.
*/
@@ -482,9 +482,9 @@ static int ssleay_rand_bytes(unsigned char *buf, int num, int pseudo)
#define DUMMY_SEED "...................." /* at least MD_DIGEST_LENGTH */
/*
* Note that the seed does not matter, it's just that
- * ssleay_rand_add expects to have something to hash.
+ * rand_add expects to have something to hash.
*/
- ssleay_rand_add(DUMMY_SEED, MD_DIGEST_LENGTH, 0.0);
+ rand_add(DUMMY_SEED, MD_DIGEST_LENGTH, 0.0);
n -= MD_DIGEST_LENGTH;
}
if (ok)
@@ -588,34 +588,34 @@ static int ssleay_rand_bytes(unsigned char *buf, int num, int pseudo)
else if (pseudo)
return 0;
else {
- RANDerr(RAND_F_SSLEAY_RAND_BYTES, RAND_R_PRNG_NOT_SEEDED);
+ RANDerr(RAND_F_RAND_BYTES, RAND_R_PRNG_NOT_SEEDED);
ERR_add_error_data(1, "You need to read the OpenSSL FAQ, "
"http://www.openssl.org/support/faq.html");
return (0);
}
err:
EVP_MD_CTX_cleanup(&m);
- RANDerr(RAND_F_SSLEAY_RAND_BYTES, ERR_R_EVP_LIB);
+ RANDerr(RAND_F_RAND_BYTES, ERR_R_EVP_LIB);
return 0;
}
-static int ssleay_rand_nopseudo_bytes(unsigned char *buf, int num)
+static int rand_nopseudo_bytes(unsigned char *buf, int num)
{
- return ssleay_rand_bytes(buf, num, 0);
+ return rand_bytes(buf, num, 0);
}
#ifndef OPENSSL_NO_DEPRECATED
/*
* pseudo-random bytes that are guaranteed to be unique but not unpredictable
*/
-static int ssleay_rand_pseudo_bytes(unsigned char *buf, int num)
+static int rand_pseudo_bytes(unsigned char *buf, int num)
{
- return ssleay_rand_bytes(buf, num, 1);
+ return rand_bytes(buf, num, 1);
}
#endif
-static int ssleay_rand_status(void)
+static int rand_status(void)
{
CRYPTO_THREADID cur;
int ret;
@@ -637,7 +637,7 @@ static int ssleay_rand_status(void)
CRYPTO_w_lock(CRYPTO_LOCK_RAND);
/*
- * prevent ssleay_rand_bytes() from trying to obtain the lock again
+ * prevent rand_bytes() from trying to obtain the lock again
*/
CRYPTO_w_lock(CRYPTO_LOCK_RAND2);
CRYPTO_THREADID_cpy(&locking_threadid, &cur);
diff --git a/crypto/rand/rand_err.c b/crypto/rand/rand_err.c
index 6ab904d981..c22677e207 100644
--- a/crypto/rand/rand_err.c
+++ b/crypto/rand/rand_err.c
@@ -1,6 +1,6 @@
/* crypto/rand/rand_err.c */
/* ====================================================================
- * Copyright (c) 1999-2010 The OpenSSL Project. All rights reserved.
+ * Copyright (c) 1999-2015 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -75,8 +75,8 @@ static ERR_STRING_DATA RAND_str_functs[] = {
{ERR_FUNC(RAND_F_FIPS_SET_PRNG_SEED), "FIPS_SET_PRNG_SEED"},
{ERR_FUNC(RAND_F_FIPS_SET_TEST_MODE), "FIPS_SET_TEST_MODE"},
{ERR_FUNC(RAND_F_FIPS_X931_SET_DT), "FIPS_x931_set_dt"},
+ {ERR_FUNC(RAND_F_RAND_BYTES), "RAND_bytes"},
{ERR_FUNC(RAND_F_RAND_GET_RAND_METHOD), "RAND_get_rand_method"},
- {ERR_FUNC(RAND_F_SSLEAY_RAND_BYTES), "SSLEAY_RAND_BYTES"},
{0, NULL}
};
diff --git a/crypto/rand/rand_lib.c b/crypto/rand/rand_lib.c
index 102ed05f69..55c90cc4bf 100644
--- a/crypto/rand/rand_lib.c
+++ b/crypto/rand/rand_lib.c
@@ -104,7 +104,7 @@ const RAND_METHOD *RAND_get_rand_method(void)
funct_ref = e;
else
#endif
- default_RAND_meth = RAND_SSLeay();
+ default_RAND_meth = RAND_OpenSSL();
}
return default_RAND_meth;
}
@@ -197,7 +197,7 @@ static size_t drbg_get_entropy(DRBG_CTX *ctx, unsigned char **pout,
*pout = OPENSSL_malloc(min_len);
if (!*pout)
return 0;
- if (RAND_SSLeay()->bytes(*pout, min_len) <= 0) {
+ if (RAND_OpenSSL()->bytes(*pout, min_len) <= 0) {
OPENSSL_free(*pout);
*pout = NULL;
return 0;
@@ -234,12 +234,12 @@ static size_t drbg_get_adin(DRBG_CTX *ctx, unsigned char **pout)
static int drbg_rand_add(DRBG_CTX *ctx, const void *in, int inlen,
double entropy)
{
- return RAND_SSLeay()->add(in, inlen, entropy);
+ return RAND_OpenSSL()->add(in, inlen, entropy);
}
static int drbg_rand_seed(DRBG_CTX *ctx, const void *in, int inlen)
{
- return RAND_SSLeay()->seed(in, inlen);
+ return RAND_OpenSSL()->seed(in, inlen);
}
int RAND_init_fips(void)