Export randombytes implementation structs

This commit is contained in:
Frank Denis 2013-04-18 13:18:59 +02:00
parent 05eefa306e
commit 5ba6aef1da
5 changed files with 40 additions and 6 deletions

View File

@ -9,7 +9,10 @@
extern "C" {
#endif
const char *salsa20_random_implementation_name(void);
struct randombytes_implementation
randombytes_salsa20_implementation(void);
const char *randombytes_salsa20_implementation_name(void);
uint32_t salsa20_random(void);
void salsa20_random_stir(void);

View File

@ -9,7 +9,10 @@
extern "C" {
#endif
const char *sysrandom_implementation_name(void);
struct randombytes_implementation
randombytes_sysrandom_implementation(void);
const char *randombytes_sysrandom_implementation_name(void);
uint32_t sysrandom(void);
void sysrandom_stir(void);

View File

@ -9,7 +9,7 @@
#include "randombytes_sysrandom.h"
static randombytes_implementation implementation = {
.implementation_name = sysrandom_implementation_name,
.implementation_name = randombytes_sysrandom_implementation_name,
.random = sysrandom,
.stir = sysrandom_stir,
.uniform = sysrandom_uniform,

View File

@ -15,6 +15,7 @@
#include "crypto_core_salsa20.h"
#include "crypto_hash_sha256.h"
#include "crypto_stream_salsa20.h"
#include "randombytes.h"
#include "randombytes_salsa20_random.h"
#include "utils.h"
@ -293,7 +294,20 @@ salsa20_random_uniform(const uint32_t upper_bound)
}
const char *
salsa20_random_implementation_name(void)
randombytes_salsa20_implementation_name(void)
{
return "salsa20_random";
return "salsa20";
}
struct randombytes_implementation
randombytes_salsa20_implementation(void)
{
return (randombytes_implementation) {
.implementation_name = randombytes_salsa20_implementation_name,
.random = salsa20_random,
.stir = salsa20_random_stir,
.uniform = salsa20_random_uniform,
.buf = salsa20_random_buf,
.close = salsa20_random_close
};
}

View File

@ -15,6 +15,7 @@
#include <string.h>
#include <unistd.h>
#include "randombytes.h"
#include "randombytes_sysrandom.h"
#ifdef _WIN32
@ -195,7 +196,20 @@ sysrandom_uniform(const uint32_t upper_bound)
}
const char *
sysrandom_implementation_name(void)
randombytes_sysrandom_implementation_name(void)
{
return "sysrandom";
}
struct randombytes_implementation
randombytes_sysrandom_implementation(void)
{
return (randombytes_implementation) {
.implementation_name = randombytes_sysrandom_implementation_name,
.random = sysrandom,
.stir = sysrandom_stir,
.uniform = sysrandom_uniform,
.buf = sysrandom_buf,
.close = sysrandom_close
};
}