mirror of
https://github.com/jedisct1/libsodium.git
synced 2026-08-25 08:37:13 +09:00
api.h removal
This commit is contained in:
@@ -17,7 +17,6 @@ libsodium_la_SOURCES = \
|
||||
crypto_box/crypto_box_easy.c \
|
||||
crypto_box/crypto_box_seal.c \
|
||||
crypto_box/curve25519xsalsa20poly1305/box_curve25519xsalsa20poly1305_api.c \
|
||||
crypto_box/curve25519xsalsa20poly1305/ref/api.h \
|
||||
crypto_box/curve25519xsalsa20poly1305/ref/after_curve25519xsalsa20poly1305.c \
|
||||
crypto_box/curve25519xsalsa20poly1305/ref/before_curve25519xsalsa20poly1305.c \
|
||||
crypto_box/curve25519xsalsa20poly1305/ref/box_curve25519xsalsa20poly1305.c \
|
||||
@@ -70,7 +69,6 @@ libsodium_la_SOURCES = \
|
||||
crypto_sign/ed25519/ref10/base.h \
|
||||
crypto_sign/ed25519/ref10/base2.h \
|
||||
crypto_sign/ed25519/sign_ed25519_api.c \
|
||||
crypto_sign/ed25519/ref10/api.h \
|
||||
crypto_sign/ed25519/ref10/d.h \
|
||||
crypto_sign/ed25519/ref10/d2.h \
|
||||
crypto_sign/ed25519/ref10/fe.h \
|
||||
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
#include "api.h"
|
||||
#include "crypto_box_curve25519xsalsa20poly1305.h"
|
||||
#include "crypto_secretbox_xsalsa20poly1305.h"
|
||||
|
||||
int crypto_box_afternm(
|
||||
int crypto_box_curve25519xsalsa20poly1305_afternm(
|
||||
unsigned char *c,
|
||||
const unsigned char *m,unsigned long long mlen,
|
||||
const unsigned char *n,
|
||||
@@ -11,7 +11,7 @@ int crypto_box_afternm(
|
||||
return crypto_secretbox_xsalsa20poly1305(c,m,mlen,n,k);
|
||||
}
|
||||
|
||||
int crypto_box_open_afternm(
|
||||
int crypto_box_curve25519xsalsa20poly1305_open_afternm(
|
||||
unsigned char *m,
|
||||
const unsigned char *c,unsigned long long clen,
|
||||
const unsigned char *n,
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
|
||||
#include "crypto_box_curve25519xsalsa20poly1305.h"
|
||||
|
||||
#define crypto_box crypto_box_curve25519xsalsa20poly1305
|
||||
#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_beforenm crypto_box_curve25519xsalsa20poly1305_beforenm
|
||||
#define crypto_box_afternm crypto_box_curve25519xsalsa20poly1305_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_SECRETKEYBYTES crypto_box_curve25519xsalsa20poly1305_SECRETKEYBYTES
|
||||
#define crypto_box_BEFORENMBYTES crypto_box_curve25519xsalsa20poly1305_BEFORENMBYTES
|
||||
#define crypto_box_NONCEBYTES crypto_box_curve25519xsalsa20poly1305_NONCEBYTES
|
||||
#define crypto_box_ZEROBYTES crypto_box_curve25519xsalsa20poly1305_ZEROBYTES
|
||||
#define crypto_box_BOXZEROBYTES crypto_box_curve25519xsalsa20poly1305_BOXZEROBYTES
|
||||
#define crypto_box_MACBYTES (crypto_box_ZEROBYTES - crypto_box_BOXZEROBYTES)
|
||||
#define crypto_box_IMPLEMENTATION crypto_box_curve25519xsalsa20poly1305_IMPLEMENTATION
|
||||
#define crypto_box_VERSION crypto_box_curve25519xsalsa20poly1305_VERSION
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
#include "api.h"
|
||||
#include "crypto_box_curve25519xsalsa20poly1305.h"
|
||||
#include "crypto_core_hsalsa20.h"
|
||||
#include "crypto_scalarmult_curve25519.h"
|
||||
|
||||
@@ -7,7 +7,7 @@ static const unsigned char sigma[16] = {
|
||||
};
|
||||
static const unsigned char n[16] = {0};
|
||||
|
||||
int crypto_box_beforenm(
|
||||
int crypto_box_curve25519xsalsa20poly1305_beforenm(
|
||||
unsigned char *k,
|
||||
const unsigned char *pk,
|
||||
const unsigned char *sk
|
||||
|
||||
+9
-9
@@ -1,7 +1,7 @@
|
||||
#include "api.h"
|
||||
#include "crypto_box_curve25519xsalsa20poly1305.h"
|
||||
#include "utils.h"
|
||||
|
||||
int crypto_box(
|
||||
int crypto_box_curve25519xsalsa20poly1305(
|
||||
unsigned char *c,
|
||||
const unsigned char *m,unsigned long long mlen,
|
||||
const unsigned char *n,
|
||||
@@ -9,19 +9,19 @@ int crypto_box(
|
||||
const unsigned char *sk
|
||||
)
|
||||
{
|
||||
unsigned char k[crypto_box_BEFORENMBYTES];
|
||||
unsigned char k[crypto_box_curve25519xsalsa20poly1305_BEFORENMBYTES];
|
||||
int ret;
|
||||
|
||||
if (crypto_box_beforenm(k,pk,sk) != 0) {
|
||||
if (crypto_box_curve25519xsalsa20poly1305_beforenm(k,pk,sk) != 0) {
|
||||
return -1;
|
||||
}
|
||||
ret = crypto_box_afternm(c,m,mlen,n,k);
|
||||
ret = crypto_box_curve25519xsalsa20poly1305_afternm(c,m,mlen,n,k);
|
||||
sodium_memzero(k, sizeof k);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int crypto_box_open(
|
||||
int crypto_box_curve25519xsalsa20poly1305_open(
|
||||
unsigned char *m,
|
||||
const unsigned char *c,unsigned long long clen,
|
||||
const unsigned char *n,
|
||||
@@ -29,13 +29,13 @@ int crypto_box_open(
|
||||
const unsigned char *sk
|
||||
)
|
||||
{
|
||||
unsigned char k[crypto_box_BEFORENMBYTES];
|
||||
unsigned char k[crypto_box_curve25519xsalsa20poly1305_BEFORENMBYTES];
|
||||
int ret;
|
||||
|
||||
if (crypto_box_beforenm(k,pk,sk) != 0) {
|
||||
if (crypto_box_curve25519xsalsa20poly1305_beforenm(k,pk,sk) != 0) {
|
||||
return -1;
|
||||
}
|
||||
ret = crypto_box_open_afternm(m,c,clen,n,k);
|
||||
ret = crypto_box_curve25519xsalsa20poly1305_open_afternm(m,c,clen,n,k);
|
||||
sodium_memzero(k, sizeof k);
|
||||
|
||||
return ret;
|
||||
|
||||
+3
-3
@@ -1,12 +1,12 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "crypto_box_curve25519xsalsa20poly1305.h"
|
||||
#include "crypto_hash_sha512.h"
|
||||
#include "crypto_scalarmult_curve25519.h"
|
||||
#include "api.h"
|
||||
#include "randombytes.h"
|
||||
#include "utils.h"
|
||||
|
||||
int crypto_box_seed_keypair(
|
||||
int crypto_box_curve25519xsalsa20poly1305_seed_keypair(
|
||||
unsigned char *pk,
|
||||
unsigned char *sk,
|
||||
const unsigned char *seed
|
||||
@@ -19,7 +19,7 @@ int crypto_box_seed_keypair(
|
||||
return crypto_scalarmult_curve25519_base(pk,sk);
|
||||
}
|
||||
|
||||
int crypto_box_keypair(
|
||||
int crypto_box_curve25519xsalsa20poly1305_keypair(
|
||||
unsigned char *pk,
|
||||
unsigned char *sk
|
||||
)
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
|
||||
#include "crypto_sign_ed25519.h"
|
||||
|
||||
#define crypto_sign crypto_sign_ed25519
|
||||
#define crypto_sign_detached crypto_sign_ed25519_detached
|
||||
#define crypto_sign_open crypto_sign_ed25519_open
|
||||
#define crypto_sign_verify_detached crypto_sign_ed25519_verify_detached
|
||||
#define crypto_sign_keypair crypto_sign_ed25519_keypair
|
||||
#define crypto_sign_seed_keypair crypto_sign_ed25519_seed_keypair
|
||||
#define crypto_sign_BYTES crypto_sign_ed25519_BYTES
|
||||
#define crypto_sign_SEEDBYTES crypto_sign_ed25519_SEEDBYTES
|
||||
#define crypto_sign_PUBLICKEYBYTES crypto_sign_ed25519_PUBLICKEYBYTES
|
||||
#define crypto_sign_SECRETKEYBYTES crypto_sign_ed25519_SECRETKEYBYTES
|
||||
#define crypto_sign_IMPLEMENTATION crypto_sign_ed25519_IMPLEMENTATION
|
||||
#define crypto_sign_VERSION crypto_sign_ed25519_VERSION
|
||||
@@ -1,16 +1,16 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "api.h"
|
||||
#include "crypto_sign_ed25519.h"
|
||||
#include "crypto_hash_sha512.h"
|
||||
#include "crypto_scalarmult_curve25519.h"
|
||||
#include "randombytes.h"
|
||||
#include "utils.h"
|
||||
#include "fe.h"
|
||||
#include "ge.h"
|
||||
#include "randombytes.h"
|
||||
#include "utils.h"
|
||||
|
||||
int crypto_sign_seed_keypair(unsigned char *pk, unsigned char *sk,
|
||||
const unsigned char *seed)
|
||||
int crypto_sign_ed25519_seed_keypair(unsigned char *pk, unsigned char *sk,
|
||||
const unsigned char *seed)
|
||||
{
|
||||
ge_p3 A;
|
||||
|
||||
@@ -27,13 +27,13 @@ int crypto_sign_seed_keypair(unsigned char *pk, unsigned char *sk,
|
||||
return 0;
|
||||
}
|
||||
|
||||
int crypto_sign_keypair(unsigned char *pk, unsigned char *sk)
|
||||
int crypto_sign_ed25519_keypair(unsigned char *pk, unsigned char *sk)
|
||||
{
|
||||
unsigned char seed[32];
|
||||
int ret;
|
||||
|
||||
randombytes_buf(seed, sizeof seed);
|
||||
ret = crypto_sign_seed_keypair(pk, sk, seed);
|
||||
ret = crypto_sign_ed25519_seed_keypair(pk, sk, seed);
|
||||
sodium_memzero(seed, sizeof seed);
|
||||
|
||||
return ret;
|
||||
|
||||
@@ -3,16 +3,18 @@
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "api.h"
|
||||
#include "crypto_hash_sha512.h"
|
||||
#include "crypto_sign_ed25519.h"
|
||||
#include "crypto_verify_32.h"
|
||||
#include "ge.h"
|
||||
#include "sc.h"
|
||||
#include "utils.h"
|
||||
|
||||
int
|
||||
crypto_sign_verify_detached(const unsigned char *sig, const unsigned char *m,
|
||||
unsigned long long mlen, const unsigned char *pk)
|
||||
crypto_sign_ed25519_verify_detached(const unsigned char *sig,
|
||||
const unsigned char *m,
|
||||
unsigned long long mlen,
|
||||
const unsigned char *pk)
|
||||
{
|
||||
crypto_hash_sha512_state hs;
|
||||
unsigned char h[64];
|
||||
@@ -49,9 +51,9 @@ crypto_sign_verify_detached(const unsigned char *sig, const unsigned char *m,
|
||||
}
|
||||
|
||||
int
|
||||
crypto_sign_open(unsigned char *m, unsigned long long *mlen_p,
|
||||
const unsigned char *sm, unsigned long long smlen,
|
||||
const unsigned char *pk)
|
||||
crypto_sign_ed25519_open(unsigned char *m, unsigned long long *mlen_p,
|
||||
const unsigned char *sm, unsigned long long smlen,
|
||||
const unsigned char *pk)
|
||||
{
|
||||
unsigned long long mlen;
|
||||
|
||||
@@ -59,7 +61,7 @@ crypto_sign_open(unsigned char *m, unsigned long long *mlen_p,
|
||||
goto badsig;
|
||||
}
|
||||
mlen = smlen - 64;
|
||||
if (crypto_sign_verify_detached(sm, sm + 64, mlen, pk) != 0) {
|
||||
if (crypto_sign_ed25519_verify_detached(sm, sm + 64, mlen, pk) != 0) {
|
||||
memset(m, 0, mlen);
|
||||
goto badsig;
|
||||
}
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "api.h"
|
||||
#include "crypto_hash_sha512.h"
|
||||
#include "crypto_sign_ed25519.h"
|
||||
#include "ge.h"
|
||||
#include "sc.h"
|
||||
#include "utils.h"
|
||||
|
||||
int
|
||||
crypto_sign_detached(unsigned char *sig, unsigned long long *siglen_p,
|
||||
const unsigned char *m, unsigned long long mlen,
|
||||
const unsigned char *sk)
|
||||
crypto_sign_ed25519_detached(unsigned char *sig, unsigned long long *siglen_p,
|
||||
const unsigned char *m, unsigned long long mlen,
|
||||
const unsigned char *sk)
|
||||
{
|
||||
crypto_hash_sha512_state hs;
|
||||
unsigned char az[64];
|
||||
@@ -51,16 +51,17 @@ crypto_sign_detached(unsigned char *sig, unsigned long long *siglen_p,
|
||||
}
|
||||
|
||||
int
|
||||
crypto_sign(unsigned char *sm, unsigned long long *smlen_p,
|
||||
const unsigned char *m, unsigned long long mlen,
|
||||
const unsigned char *sk)
|
||||
crypto_sign_ed25519(unsigned char *sm, unsigned long long *smlen_p,
|
||||
const unsigned char *m, unsigned long long mlen,
|
||||
const unsigned char *sk)
|
||||
{
|
||||
unsigned long long siglen;
|
||||
|
||||
memmove(sm + crypto_sign_ed25519_BYTES, m, mlen);
|
||||
/* LCOV_EXCL_START */
|
||||
if (crypto_sign_detached(sm, &siglen, sm + crypto_sign_ed25519_BYTES,
|
||||
mlen, sk) != 0 ||
|
||||
if (crypto_sign_ed25519_detached(sm, &siglen,
|
||||
sm + crypto_sign_ed25519_BYTES,
|
||||
mlen, sk) != 0 ||
|
||||
siglen != crypto_sign_ed25519_BYTES) {
|
||||
if (smlen_p != NULL) {
|
||||
*smlen_p = 0;
|
||||
|
||||
Reference in New Issue
Block a user