Add crypto_box_seed_keypair like crypto_sign_seed_keypair
Uses sk = seed.
This commit is contained in:
parent
2270e4dc02
commit
c565993885
@ -1,6 +1,12 @@
|
|||||||
|
|
||||||
#include "crypto_box.h"
|
#include "crypto_box.h"
|
||||||
|
|
||||||
|
size_t
|
||||||
|
crypto_box_seedbytes(void)
|
||||||
|
{
|
||||||
|
return crypto_box_SEEDBYTES;
|
||||||
|
}
|
||||||
|
|
||||||
size_t
|
size_t
|
||||||
crypto_box_publickeybytes(void)
|
crypto_box_publickeybytes(void)
|
||||||
{
|
{
|
||||||
@ -49,6 +55,13 @@ crypto_box_primitive(void)
|
|||||||
return crypto_box_PRIMITIVE;
|
return crypto_box_PRIMITIVE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
crypto_box_seed_keypair(unsigned char *pk, unsigned char *sk,
|
||||||
|
const unsigned char *seed)
|
||||||
|
{
|
||||||
|
return crypto_box_curve25519xsalsa20poly1305_seed_keypair(pk, sk, seed);
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
crypto_box_keypair(unsigned char *pk, unsigned char *sk)
|
crypto_box_keypair(unsigned char *pk, unsigned char *sk)
|
||||||
{
|
{
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
#include "crypto_box_curve25519xsalsa20poly1305.h"
|
#include "crypto_box_curve25519xsalsa20poly1305.h"
|
||||||
|
|
||||||
|
size_t
|
||||||
|
crypto_box_curve25519xsalsa20poly1305_seedbytes(void) {
|
||||||
|
return crypto_box_curve25519xsalsa20poly1305_SEEDBYTES;
|
||||||
|
}
|
||||||
|
|
||||||
size_t
|
size_t
|
||||||
crypto_box_curve25519xsalsa20poly1305_publickeybytes(void) {
|
crypto_box_curve25519xsalsa20poly1305_publickeybytes(void) {
|
||||||
return crypto_box_curve25519xsalsa20poly1305_PUBLICKEYBYTES;
|
return crypto_box_curve25519xsalsa20poly1305_PUBLICKEYBYTES;
|
||||||
|
@ -3,10 +3,12 @@
|
|||||||
|
|
||||||
#define crypto_box crypto_box_curve25519xsalsa20poly1305
|
#define crypto_box crypto_box_curve25519xsalsa20poly1305
|
||||||
#define crypto_box_open crypto_box_curve25519xsalsa20poly1305_open
|
#define crypto_box_open crypto_box_curve25519xsalsa20poly1305_open
|
||||||
|
#define crypto_box_seed_keypair crypto_box_curve25519xsalsa20poly1305_seed_keypair
|
||||||
#define crypto_box_keypair crypto_box_curve25519xsalsa20poly1305_keypair
|
#define crypto_box_keypair crypto_box_curve25519xsalsa20poly1305_keypair
|
||||||
#define crypto_box_beforenm crypto_box_curve25519xsalsa20poly1305_beforenm
|
#define crypto_box_beforenm crypto_box_curve25519xsalsa20poly1305_beforenm
|
||||||
#define crypto_box_afternm crypto_box_curve25519xsalsa20poly1305_afternm
|
#define crypto_box_afternm crypto_box_curve25519xsalsa20poly1305_afternm
|
||||||
#define crypto_box_open_afternm crypto_box_curve25519xsalsa20poly1305_open_afternm
|
#define crypto_box_open_afternm crypto_box_curve25519xsalsa20poly1305_open_afternm
|
||||||
|
#define crypto_box_SEEDBYTES crypto_box_curve25519xsalsa20poly1305_SEEDBYTES
|
||||||
#define crypto_box_PUBLICKEYBYTES crypto_box_curve25519xsalsa20poly1305_PUBLICKEYBYTES
|
#define crypto_box_PUBLICKEYBYTES crypto_box_curve25519xsalsa20poly1305_PUBLICKEYBYTES
|
||||||
#define crypto_box_SECRETKEYBYTES crypto_box_curve25519xsalsa20poly1305_SECRETKEYBYTES
|
#define crypto_box_SECRETKEYBYTES crypto_box_curve25519xsalsa20poly1305_SECRETKEYBYTES
|
||||||
#define crypto_box_BEFORENMBYTES crypto_box_curve25519xsalsa20poly1305_BEFORENMBYTES
|
#define crypto_box_BEFORENMBYTES crypto_box_curve25519xsalsa20poly1305_BEFORENMBYTES
|
||||||
|
@ -1,7 +1,19 @@
|
|||||||
|
#include <string.h>
|
||||||
|
|
||||||
#include "crypto_scalarmult_curve25519.h"
|
#include "crypto_scalarmult_curve25519.h"
|
||||||
#include "api.h"
|
#include "api.h"
|
||||||
#include "randombytes.h"
|
#include "randombytes.h"
|
||||||
|
|
||||||
|
int crypto_box_seed_keypair(
|
||||||
|
unsigned char *pk,
|
||||||
|
unsigned char *sk,
|
||||||
|
const unsigned char *seed
|
||||||
|
)
|
||||||
|
{
|
||||||
|
memmove(sk, seed, 32);
|
||||||
|
return crypto_scalarmult_curve25519_base(pk,sk);
|
||||||
|
}
|
||||||
|
|
||||||
int crypto_box_keypair(
|
int crypto_box_keypair(
|
||||||
unsigned char *pk,
|
unsigned char *pk,
|
||||||
unsigned char *sk
|
unsigned char *sk
|
||||||
|
@ -20,6 +20,10 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define crypto_box_SEEDBYTES crypto_box_curve25519xsalsa20poly1305_SEEDBYTES
|
||||||
|
SODIUM_EXPORT
|
||||||
|
size_t crypto_box_seedbytes(void);
|
||||||
|
|
||||||
#define crypto_box_PUBLICKEYBYTES crypto_box_curve25519xsalsa20poly1305_PUBLICKEYBYTES
|
#define crypto_box_PUBLICKEYBYTES crypto_box_curve25519xsalsa20poly1305_PUBLICKEYBYTES
|
||||||
SODIUM_EXPORT
|
SODIUM_EXPORT
|
||||||
size_t crypto_box_publickeybytes(void);
|
size_t crypto_box_publickeybytes(void);
|
||||||
@ -52,6 +56,10 @@ size_t crypto_box_macbytes(void);
|
|||||||
SODIUM_EXPORT
|
SODIUM_EXPORT
|
||||||
const char *crypto_box_primitive(void);
|
const char *crypto_box_primitive(void);
|
||||||
|
|
||||||
|
SODIUM_EXPORT
|
||||||
|
int crypto_box_seed_keypair(unsigned char *pk, unsigned char *sk,
|
||||||
|
const unsigned char *seed);
|
||||||
|
|
||||||
SODIUM_EXPORT
|
SODIUM_EXPORT
|
||||||
int crypto_box_keypair(unsigned char *pk, unsigned char *sk);
|
int crypto_box_keypair(unsigned char *pk, unsigned char *sk);
|
||||||
|
|
||||||
|
@ -11,6 +11,10 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define crypto_box_curve25519xsalsa20poly1305_SEEDBYTES 32U
|
||||||
|
SODIUM_EXPORT
|
||||||
|
size_t crypto_box_curve25519xsalsa20poly1305_seedbytes(void);
|
||||||
|
|
||||||
#define crypto_box_curve25519xsalsa20poly1305_PUBLICKEYBYTES 32U
|
#define crypto_box_curve25519xsalsa20poly1305_PUBLICKEYBYTES 32U
|
||||||
SODIUM_EXPORT
|
SODIUM_EXPORT
|
||||||
size_t crypto_box_curve25519xsalsa20poly1305_publickeybytes(void);
|
size_t crypto_box_curve25519xsalsa20poly1305_publickeybytes(void);
|
||||||
@ -58,7 +62,13 @@ int crypto_box_curve25519xsalsa20poly1305_open(unsigned char *m,
|
|||||||
const unsigned char *sk);
|
const unsigned char *sk);
|
||||||
|
|
||||||
SODIUM_EXPORT
|
SODIUM_EXPORT
|
||||||
int crypto_box_curve25519xsalsa20poly1305_keypair(unsigned char *pk, unsigned char *sk);
|
int crypto_box_curve25519xsalsa20poly1305_seed_keypair(unsigned char *pk,
|
||||||
|
unsigned char *sk,
|
||||||
|
const unsigned char *seed);
|
||||||
|
|
||||||
|
SODIUM_EXPORT
|
||||||
|
int crypto_box_curve25519xsalsa20poly1305_keypair(unsigned char *pk,
|
||||||
|
unsigned char *sk);
|
||||||
|
|
||||||
SODIUM_EXPORT
|
SODIUM_EXPORT
|
||||||
int crypto_box_curve25519xsalsa20poly1305_beforenm(unsigned char *k,
|
int crypto_box_curve25519xsalsa20poly1305_beforenm(unsigned char *k,
|
||||||
|
Loading…
Reference in New Issue
Block a user