crypto: Refactor (P)RNG functionality into new crypto_rand module.

* ADD new /src/common/crypto_rand.[ch] module.
 * ADD new /src/common/crypto_util.[ch] module (contains the memwipe()
   function, since all crypto_* modules need this).
 * FIXES part of #24658: https://bugs.torproject.org/24658
This commit is contained in:
Isis Lovecruft
2018-04-06 21:23:29 +00:00
parent 21c81348a3
commit fe3aca1491
109 changed files with 939 additions and 657 deletions
@@ -8,7 +8,7 @@
*/
/* Tor: Instead of calling OpenSSL's CSPRNG directly, call the wrapper. */
#include "crypto.h"
#include "crypto_rand.h"
static void
ED25519_FN(ed25519_randombytes_unsafe) (void *p, size_t len)
+2
View File
@@ -40,6 +40,8 @@
#include "ed25519-randombytes.h"
#include "ed25519-hash.h"
#include "crypto_util.h"
typedef unsigned char ed25519_signature[64];
typedef unsigned char ed25519_public_key[32];
typedef unsigned char ed25519_secret_key[32];
+1 -1
View File
@@ -7,7 +7,7 @@
#include "ed25519_ref10.h"
#include <string.h>
#include "crypto.h"
#include "crypto_util.h"
static void
ed25519_ref10_gettweak(unsigned char *out, const unsigned char *param)
+3
View File
@@ -6,6 +6,9 @@
#include "crypto_hash_sha512.h"
#include "ge.h"
#include "crypto_rand.h"
#include "crypto_util.h"
int
crypto_sign_seckey(unsigned char *sk)
{
+1 -1
View File
@@ -9,7 +9,7 @@
#include "keccak-tiny.h"
#include <string.h>
#include "crypto.h"
#include "crypto_util.h"
#include "byteorder.h"
/******** Endianness conversion helpers ********/