projects
/
openssl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Extensive reorganisation of PRNG handling in FIPS module: all calls
[openssl.git]
/
fips
/
rand
/
fips_rand.c
diff --git
a/fips/rand/fips_rand.c
b/fips/rand/fips_rand.c
index b0505782d3985e5dba37ce85958507b494dcfdad..a8ebdb85c0c1581437fe5e0592f5f1f4cf148cd7 100644
(file)
--- a/
fips/rand/fips_rand.c
+++ b/
fips/rand/fips_rand.c
@@
-47,12
+47,12
@@
*
*/
*
*/
-#define OPENSSL_FIPS
EVP
+#define OPENSSL_FIPS
API
/*
* This is a FIPS approved AES PRNG based on ANSI X9.31 A.2.4.
*/
/*
* This is a FIPS approved AES PRNG based on ANSI X9.31 A.2.4.
*/
-
+#include <openssl/crypto.h>
#include "e_os.h"
/* If we don't define _XOPEN_SOURCE_EXTENDED, struct timeval won't
#include "e_os.h"
/* If we don't define _XOPEN_SOURCE_EXTENDED, struct timeval won't
@@
-111,7
+111,7
@@
static FIPS_PRNG_CTX sctx;
static int fips_prng_fail = 0;
static int fips_prng_fail = 0;
-void FIPS_
rng
_stick(void)
+void FIPS_
x931
_stick(void)
{
fips_prng_fail = 1;
}
{
fips_prng_fail = 1;
}
@@
-205,16
+205,16
@@
static int fips_set_test_mode(FIPS_PRNG_CTX *ctx)
return 1;
}
return 1;
}
-int FIPS_
rand
_test_mode(void)
+int FIPS_
x931
_test_mode(void)
{
return fips_set_test_mode(&sctx);
}
{
return fips_set_test_mode(&sctx);
}
-int FIPS_
rand
_set_dt(unsigned char *dt)
+int FIPS_
x931
_set_dt(unsigned char *dt)
{
if (!sctx.test_mode)
{
{
if (!sctx.test_mode)
{
- RANDerr(RAND_F_FIPS_
RAND
_SET_DT,RAND_R_NOT_IN_TEST_MODE);
+ RANDerr(RAND_F_FIPS_
X931
_SET_DT,RAND_R_NOT_IN_TEST_MODE);
return 0;
}
memcpy(sctx.DT, dt, AES_BLOCK_LENGTH);
return 0;
}
memcpy(sctx.DT, dt, AES_BLOCK_LENGTH);
@@
-339,7
+339,7
@@
static int fips_rand(FIPS_PRNG_CTX *ctx,
}
}
-int FIPS_
rand
_set_key(const unsigned char *key, int keylen)
+int FIPS_
x931
_set_key(const unsigned char *key, int keylen)
{
int ret;
CRYPTO_w_lock(CRYPTO_LOCK_RAND);
{
int ret;
CRYPTO_w_lock(CRYPTO_LOCK_RAND);
@@
-348,7
+348,7
@@
int FIPS_rand_set_key(const unsigned char *key, int keylen)
return ret;
}
return ret;
}
-int FIPS_
rand
_seed(const void *seed, int seedlen)
+int FIPS_
x931
_seed(const void *seed, int seedlen)
{
int ret;
CRYPTO_w_lock(CRYPTO_LOCK_RAND);
{
int ret;
CRYPTO_w_lock(CRYPTO_LOCK_RAND);
@@
-358,7
+358,7
@@
int FIPS_rand_seed(const void *seed, int seedlen)
}
}
-int FIPS_
rand
_bytes(unsigned char *out, int count)
+int FIPS_
x931
_bytes(unsigned char *out, int count)
{
int ret;
CRYPTO_w_lock(CRYPTO_LOCK_RAND);
{
int ret;
CRYPTO_w_lock(CRYPTO_LOCK_RAND);
@@
-367,7
+367,7
@@
int FIPS_rand_bytes(unsigned char *out, int count)
return ret;
}
return ret;
}
-int FIPS_
rand
_status(void)
+int FIPS_
x931
_status(void)
{
int ret;
CRYPTO_r_lock(CRYPTO_LOCK_RAND);
{
int ret;
CRYPTO_r_lock(CRYPTO_LOCK_RAND);
@@
-376,7
+376,7
@@
int FIPS_rand_status(void)
return ret;
}
return ret;
}
-void FIPS_
rand
_reset(void)
+void FIPS_
x931
_reset(void)
{
CRYPTO_w_lock(CRYPTO_LOCK_RAND);
fips_rand_prng_reset(&sctx);
{
CRYPTO_w_lock(CRYPTO_LOCK_RAND);
fips_rand_prng_reset(&sctx);
@@
-385,30
+385,30
@@
void FIPS_rand_reset(void)
static int fips_do_rand_seed(const void *seed, int seedlen)
{
static int fips_do_rand_seed(const void *seed, int seedlen)
{
- FIPS_
rand
_seed(seed, seedlen);
+ FIPS_
x931
_seed(seed, seedlen);
return 1;
}
static int fips_do_rand_add(const void *seed, int seedlen,
double add_entropy)
{
return 1;
}
static int fips_do_rand_add(const void *seed, int seedlen,
double add_entropy)
{
- FIPS_
rand
_seed(seed, seedlen);
+ FIPS_
x931
_seed(seed, seedlen);
return 1;
}
return 1;
}
-static const RAND_METHOD rand_
fips
_meth=
+static const RAND_METHOD rand_
x931
_meth=
{
fips_do_rand_seed,
{
fips_do_rand_seed,
- FIPS_
rand
_bytes,
- FIPS_
rand
_reset,
+ FIPS_
x931
_bytes,
+ FIPS_
x931
_reset,
fips_do_rand_add,
fips_do_rand_add,
- FIPS_
rand
_bytes,
- FIPS_
rand
_status
+ FIPS_
x931
_bytes,
+ FIPS_
x931
_status
};
};
-const RAND_METHOD *FIPS_
rand
_method(void)
+const RAND_METHOD *FIPS_
x931
_method(void)
{
{
- return &rand_
fips
_meth;
+ return &rand_
x931
_meth;
}
#endif
}
#endif