Skip to content

Commit fbe7b2d

Browse files
denizzzkaGeod24
authored andcommitted
Refreshed bindings
randombytes_salsa20_random replaced by randombytes_internal_implementation Forgot to update package.d
1 parent 5b4d8f3 commit fbe7b2d

8 files changed

+121
-7
lines changed

source/libsodium/crypto_core_ed25519.d

+12
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ size_t crypto_core_ed25519_bytes ();
2020
enum crypto_core_ed25519_UNIFORMBYTES = 32;
2121
size_t crypto_core_ed25519_uniformbytes ();
2222

23+
enum crypto_core_ed25519_HASHBYTES = 64;
24+
size_t crypto_core_ed25519_hashbytes ();
25+
2326
enum crypto_core_ed25519_SCALARBYTES = 32;
2427
size_t crypto_core_ed25519_scalarbytes ();
2528

@@ -34,6 +37,10 @@ int crypto_core_ed25519_sub (ubyte* r, const(ubyte)* p, const(ubyte)* q);
3437

3538
int crypto_core_ed25519_from_uniform (ubyte* p, const(ubyte)* r);
3639

40+
int crypto_core_ed25519_from_hash (ubyte* p, const(ubyte)* h);
41+
42+
void crypto_core_ed25519_random (ubyte* p);
43+
3744
void crypto_core_ed25519_scalar_random (ubyte* r);
3845

3946
int crypto_core_ed25519_scalar_invert (ubyte* recip, const(ubyte)* s);
@@ -52,6 +59,11 @@ void crypto_core_ed25519_scalar_sub (
5259
const(ubyte)* x,
5360
const(ubyte)* y);
5461

62+
void crypto_core_ed25519_scalar_mul (
63+
ubyte* z,
64+
const(ubyte)* x,
65+
const(ubyte)* y);
66+
5567
/*
5668
* The interval `s` is sampled from should be at least 317 bits to ensure almost
5769
* uniformity of `r` over `L`.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
/*******************************************************************************
2+
3+
D language bindings for libsodium's crypto_core_ristretto255.h
4+
5+
License: ISC (see LICENSE.txt)
6+
7+
*******************************************************************************/
8+
9+
module libsodium.crypto_core_ristretto255;
10+
11+
@nogc nothrow:
12+
13+
import libsodium.export_;
14+
15+
extern (C):
16+
17+
enum crypto_core_ristretto255_BYTES = 32;
18+
size_t crypto_core_ristretto255_bytes ();
19+
20+
enum crypto_core_ristretto255_HASHBYTES = 64;
21+
size_t crypto_core_ristretto255_hashbytes ();
22+
23+
enum crypto_core_ristretto255_SCALARBYTES = 32;
24+
size_t crypto_core_ristretto255_scalarbytes ();
25+
26+
enum crypto_core_ristretto255_NONREDUCEDSCALARBYTES = 64;
27+
size_t crypto_core_ristretto255_nonreducedscalarbytes ();
28+
29+
int crypto_core_ristretto255_is_valid_point (const(ubyte)* p);
30+
31+
int crypto_core_ristretto255_add (ubyte* r, const(ubyte)* p, const(ubyte)* q);
32+
33+
int crypto_core_ristretto255_sub (ubyte* r, const(ubyte)* p, const(ubyte)* q);
34+
35+
int crypto_core_ristretto255_from_hash (ubyte* p, const(ubyte)* r);
36+
37+
void crypto_core_ristretto255_random (ubyte* p);
38+
39+
void crypto_core_ristretto255_scalar_random (ubyte* r);
40+
41+
int crypto_core_ristretto255_scalar_invert (ubyte* recip, const(ubyte)* s);
42+
43+
void crypto_core_ristretto255_scalar_negate (ubyte* neg, const(ubyte)* s);
44+
45+
void crypto_core_ristretto255_scalar_complement (ubyte* comp, const(ubyte)* s);
46+
47+
void crypto_core_ristretto255_scalar_add (
48+
ubyte* z,
49+
const(ubyte)* x,
50+
const(ubyte)* y);
51+
52+
void crypto_core_ristretto255_scalar_sub (
53+
ubyte* z,
54+
const(ubyte)* x,
55+
const(ubyte)* y);
56+
57+
void crypto_core_ristretto255_scalar_mul (
58+
ubyte* z,
59+
const(ubyte)* x,
60+
const(ubyte)* y);
61+
62+
/*
63+
* The interval `s` is sampled from should be at least 317 bits to ensure almost
64+
* uniformity of `r` over `L`.
65+
*/
66+
void crypto_core_ristretto255_scalar_reduce (ubyte* r, const(ubyte)* s);
67+

source/libsodium/crypto_scalarmult.d

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const(char)* crypto_scalarmult_primitive ();
2727
int crypto_scalarmult_base (ubyte* q, const(ubyte)* n);
2828

2929
/*
30-
* NOTE: Do not use the result of this function directly.
30+
* NOTE: Do not use the result of this function directly for key exchange.
3131
*
3232
* Hash the result with the public keys in order to compute a shared
3333
* secret key: H(q || client_pk || server_pk)

source/libsodium/crypto_scalarmult_curve25519.d

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ enum crypto_scalarmult_curve25519_SCALARBYTES = 32U;
2121
size_t crypto_scalarmult_curve25519_scalarbytes ();
2222

2323
/*
24-
* NOTE: Do not use the result of this function directly.
24+
* NOTE: Do not use the result of this function directly for key exchange.
2525
*
2626
* Hash the result with the public keys in order to compute a shared
2727
* secret key: H(q || client_pk || server_pk)

source/libsodium/crypto_scalarmult_ed25519.d

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ enum crypto_scalarmult_ed25519_SCALARBYTES = 32U;
2121
size_t crypto_scalarmult_ed25519_scalarbytes ();
2222

2323
/*
24-
* NOTE: Do not use the result of this function directly.
24+
* NOTE: Do not use the result of this function directly for key exchange.
2525
*
2626
* Hash the result with the public keys in order to compute a shared
2727
* secret key: H(q || client_pk || server_pk)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*******************************************************************************
2+
3+
D language bindings for libsodium's crypto_scalarmult_ristretto255.h
4+
5+
License: ISC (see LICENSE.txt)
6+
7+
*******************************************************************************/
8+
9+
module libsodium.crypto_scalarmult_ristretto255;
10+
11+
@nogc nothrow:
12+
13+
import libsodium.export_;
14+
15+
extern (C):
16+
17+
enum crypto_scalarmult_ristretto255_BYTES = 32U;
18+
size_t crypto_scalarmult_ristretto255_bytes ();
19+
20+
enum crypto_scalarmult_ristretto255_SCALARBYTES = 32U;
21+
size_t crypto_scalarmult_ristretto255_scalarbytes ();
22+
23+
/*
24+
* NOTE: Do not use the result of this function directly for key exchange.
25+
*
26+
* Hash the result with the public keys in order to compute a shared
27+
* secret key: H(q || client_pk || server_pk)
28+
*
29+
* Or unless this is not an option, use the crypto_kx() API instead.
30+
*/
31+
int crypto_scalarmult_ristretto255 (ubyte* q, const(ubyte)* n, const(ubyte)* p);
32+
33+
int crypto_scalarmult_ristretto255_base (ubyte* q, const(ubyte)* n);

source/libsodium/package.d

+3-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ public import libsodium.crypto_box_curve25519xsalsa20poly1305;
2222
public import libsodium.crypto_core_ed25519;
2323
public import libsodium.crypto_core_hchacha20;
2424
public import libsodium.crypto_core_hsalsa20;
25+
public import libsodium.crypto_core_ristretto255;
2526
public import libsodium.crypto_core_salsa2012;
2627
public import libsodium.crypto_core_salsa208;
2728
public import libsodium.crypto_core_salsa20;
@@ -42,6 +43,7 @@ public import libsodium.crypto_pwhash_scryptsalsa208sha256;
4243
public import libsodium.crypto_scalarmult;
4344
public import libsodium.crypto_scalarmult_curve25519;
4445
public import libsodium.crypto_scalarmult_ed25519;
46+
public import libsodium.crypto_scalarmult_ristretto255;
4547
public import libsodium.crypto_secretbox;
4648
public import libsodium.crypto_secretbox_xchacha20poly1305;
4749
public import libsodium.crypto_secretbox_xsalsa20poly1305;
@@ -63,8 +65,8 @@ public import libsodium.crypto_verify_32;
6365
public import libsodium.crypto_verify_64;
6466
public import libsodium.export_;
6567
public import libsodium.randombytes;
68+
public import libsodium.randombytes_internal_random;
6669
public import libsodium.randombytes_nativeclient;
67-
public import libsodium.randombytes_salsa20_random;
6870
public import libsodium.randombytes_sysrandom;
6971
public import libsodium.runtime;
7072
public import libsodium.utils;
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
/*******************************************************************************
22
3-
D language bindings for libsodium's randombytes_salsa20_random.h
3+
D language bindings for libsodium's randombytes_internal_random.h
44
55
License: ISC (see LICENSE.txt)
66
77
*******************************************************************************/
88

9-
module libsodium.randombytes_salsa20_random;
9+
module libsodium.randombytes_internal_random;
1010

1111
@nogc nothrow:
1212

@@ -15,4 +15,4 @@ import libsodium.randombytes;
1515

1616
extern (C):
1717

18-
extern __gshared randombytes_implementation randombytes_salsa20_implementation;
18+
extern __gshared randombytes_implementation randombytes_internal_implementation;

0 commit comments

Comments
 (0)