Skip to content

Commit

Permalink
Missing imports
Browse files Browse the repository at this point in the history
  • Loading branch information
iquerejeta committed Nov 29, 2022
1 parent 6797135 commit 2931e31
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
23 changes: 16 additions & 7 deletions cardano-crypto-praos/cbits/crypto_vrf.c
@@ -1,4 +1,6 @@

#include "sodium/crypto_hash_sha512.h"
#include "private/ed25519_ref10.h"
#include "sodium/randombytes.h"
#include "crypto_vrf.h"

size_t
Expand Down Expand Up @@ -37,12 +39,6 @@ crypto_vrf_primitive(void)
return crypto_vrf_PRIMITIVE;
}

int
crypto_vrf_keypair(unsigned char *pk, unsigned char *sk)
{
return crypto_vrf_ietfdraft03_keypair(pk, sk);
}

int
crypto_vrf_seed_keypair(unsigned char *pk, unsigned char *sk,
const unsigned char *seed)
Expand All @@ -63,6 +59,19 @@ crypto_vrf_seed_keypair(unsigned char *pk, unsigned char *sk,
return 0;
}

int
crypto_vrf_keypair(unsigned char *pk, unsigned char *sk)
{
unsigned char seed[32];
int ret;

randombytes_buf(seed, sizeof seed);
ret = crypto_vrf_seed_keypair(pk, sk, seed);
sodium_memzero(seed, sizeof seed);

return ret;
}

int
crypto_vrf_prove(unsigned char *proof, const unsigned char *skpk,
const unsigned char *m, const unsigned long long mlen)
Expand Down
4 changes: 2 additions & 2 deletions cardano-crypto-praos/cbits/crypto_vrf.h
Expand Up @@ -11,7 +11,7 @@

#include <stddef.h>

#include "vrf03/crypto_vrf_ietfdraft03.h"
#include "vrf13_batchcompat/crypto_vrf_ietfdraft13.h"
#include "sodium/export.h"

#ifdef __cplusplus
Expand Down Expand Up @@ -50,7 +50,7 @@ int crypto_vrf_keypair(unsigned char *pk, unsigned char *sk)
__attribute__ ((nonnull));

SODIUM_EXPORT
int crypto_vrf_keypair_from_seed(unsigned char *pk, unsigned char *sk,
int crypto_vrf_seed_keypair(unsigned char *pk, unsigned char *sk,
const unsigned char *seed)
__attribute__ ((nonnull));

Expand Down

0 comments on commit 2931e31

Please sign in to comment.