mirror of
https://salsa.debian.org/gnuk-team/gnuk/gnuk.git
synced 2024-09-21 03:10:08 +00:00
use NeuG for bn256_random
This commit is contained in:
parent
8b6713bc52
commit
e929963d30
22
src/bn.c
22
src/bn.c
@ -307,14 +307,16 @@ bn256_is_ge (const bn256 *A, const bn256 *B)
|
|||||||
void
|
void
|
||||||
bn256_random (bn256 *X)
|
bn256_random (bn256 *X)
|
||||||
{
|
{
|
||||||
#if 1
|
const uint8_t *rand = random_bytes_get ();
|
||||||
X->words[7] = 0x01234567;
|
|
||||||
X->words[6] = 0x89abcdef;
|
X->words[7] = ((uint32_t *)rand)[7];
|
||||||
X->words[5] = 0xff00ff00;
|
X->words[6] = ((uint32_t *)rand)[6];
|
||||||
X->words[4] = 0x00ff00ff;
|
X->words[5] = ((uint32_t *)rand)[5];
|
||||||
X->words[3] = 0xee55ee55;
|
X->words[4] = ((uint32_t *)rand)[4];
|
||||||
X->words[2] = 0x55ee55ee;
|
X->words[3] = ((uint32_t *)rand)[3];
|
||||||
X->words[1] = 0x01234567;
|
X->words[2] = ((uint32_t *)rand)[2];
|
||||||
X->words[0] = 0x89abcdef;
|
X->words[1] = ((uint32_t *)rand)[1];
|
||||||
#endif
|
X->words[0] = ((uint32_t *)rand)[0];
|
||||||
|
|
||||||
|
random_bytes_free (rand);
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
#include "gnuk.h"
|
#include "gnuk.h"
|
||||||
#include "neug.h"
|
#include "neug.h"
|
||||||
|
|
||||||
#define RANDOM_BYTES_LENGTH 16
|
#define RANDOM_BYTES_LENGTH 32
|
||||||
static uint32_t random_word[RANDOM_BYTES_LENGTH/sizeof (uint32_t)];
|
static uint32_t random_word[RANDOM_BYTES_LENGTH/sizeof (uint32_t)];
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -43,7 +43,7 @@ random_init (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Return pointer to random 16-byte
|
* Return pointer to random 32-byte
|
||||||
*/
|
*/
|
||||||
const uint8_t *
|
const uint8_t *
|
||||||
random_bytes_get (void)
|
random_bytes_get (void)
|
||||||
@ -53,7 +53,7 @@ random_bytes_get (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Free pointer to random 16-byte
|
* Free pointer to random 32-byte
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
random_bytes_free (const uint8_t *p)
|
random_bytes_free (const uint8_t *p)
|
||||||
|
Loading…
Reference in New Issue
Block a user