Skip to content

Commit

Permalink
Refreshed bindings
Browse files Browse the repository at this point in the history
randombytes_salsa20_random replaced by randombytes_internal_implementation

Forgot to update package.d
  • Loading branch information
denizzzka authored and Geod24 committed Aug 9, 2019
1 parent 5b4d8f3 commit fbe7b2d
Show file tree
Hide file tree
Showing 8 changed files with 121 additions and 7 deletions.
12 changes: 12 additions & 0 deletions source/libsodium/crypto_core_ed25519.d
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ size_t crypto_core_ed25519_bytes ();
enum crypto_core_ed25519_UNIFORMBYTES = 32;
size_t crypto_core_ed25519_uniformbytes ();

enum crypto_core_ed25519_HASHBYTES = 64;
size_t crypto_core_ed25519_hashbytes ();

enum crypto_core_ed25519_SCALARBYTES = 32;
size_t crypto_core_ed25519_scalarbytes ();

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

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

int crypto_core_ed25519_from_hash (ubyte* p, const(ubyte)* h);

void crypto_core_ed25519_random (ubyte* p);

void crypto_core_ed25519_scalar_random (ubyte* r);

int crypto_core_ed25519_scalar_invert (ubyte* recip, const(ubyte)* s);
Expand All @@ -52,6 +59,11 @@ void crypto_core_ed25519_scalar_sub (
const(ubyte)* x,
const(ubyte)* y);

void crypto_core_ed25519_scalar_mul (
ubyte* z,
const(ubyte)* x,
const(ubyte)* y);

/*
* The interval `s` is sampled from should be at least 317 bits to ensure almost
* uniformity of `r` over `L`.
Expand Down
67 changes: 67 additions & 0 deletions source/libsodium/crypto_core_ristretto255.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/*******************************************************************************
D language bindings for libsodium's crypto_core_ristretto255.h
License: ISC (see LICENSE.txt)
*******************************************************************************/

module libsodium.crypto_core_ristretto255;

@nogc nothrow:

import libsodium.export_;

extern (C):

enum crypto_core_ristretto255_BYTES = 32;
size_t crypto_core_ristretto255_bytes ();

enum crypto_core_ristretto255_HASHBYTES = 64;
size_t crypto_core_ristretto255_hashbytes ();

enum crypto_core_ristretto255_SCALARBYTES = 32;
size_t crypto_core_ristretto255_scalarbytes ();

enum crypto_core_ristretto255_NONREDUCEDSCALARBYTES = 64;
size_t crypto_core_ristretto255_nonreducedscalarbytes ();

int crypto_core_ristretto255_is_valid_point (const(ubyte)* p);

int crypto_core_ristretto255_add (ubyte* r, const(ubyte)* p, const(ubyte)* q);

int crypto_core_ristretto255_sub (ubyte* r, const(ubyte)* p, const(ubyte)* q);

int crypto_core_ristretto255_from_hash (ubyte* p, const(ubyte)* r);

void crypto_core_ristretto255_random (ubyte* p);

void crypto_core_ristretto255_scalar_random (ubyte* r);

int crypto_core_ristretto255_scalar_invert (ubyte* recip, const(ubyte)* s);

void crypto_core_ristretto255_scalar_negate (ubyte* neg, const(ubyte)* s);

void crypto_core_ristretto255_scalar_complement (ubyte* comp, const(ubyte)* s);

void crypto_core_ristretto255_scalar_add (
ubyte* z,
const(ubyte)* x,
const(ubyte)* y);

void crypto_core_ristretto255_scalar_sub (
ubyte* z,
const(ubyte)* x,
const(ubyte)* y);

void crypto_core_ristretto255_scalar_mul (
ubyte* z,
const(ubyte)* x,
const(ubyte)* y);

/*
* The interval `s` is sampled from should be at least 317 bits to ensure almost
* uniformity of `r` over `L`.
*/
void crypto_core_ristretto255_scalar_reduce (ubyte* r, const(ubyte)* s);

2 changes: 1 addition & 1 deletion source/libsodium/crypto_scalarmult.d
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const(char)* crypto_scalarmult_primitive ();
int crypto_scalarmult_base (ubyte* q, const(ubyte)* n);

/*
* NOTE: Do not use the result of this function directly.
* NOTE: Do not use the result of this function directly for key exchange.
*
* Hash the result with the public keys in order to compute a shared
* secret key: H(q || client_pk || server_pk)
Expand Down
2 changes: 1 addition & 1 deletion source/libsodium/crypto_scalarmult_curve25519.d
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ enum crypto_scalarmult_curve25519_SCALARBYTES = 32U;
size_t crypto_scalarmult_curve25519_scalarbytes ();

/*
* NOTE: Do not use the result of this function directly.
* NOTE: Do not use the result of this function directly for key exchange.
*
* Hash the result with the public keys in order to compute a shared
* secret key: H(q || client_pk || server_pk)
Expand Down
2 changes: 1 addition & 1 deletion source/libsodium/crypto_scalarmult_ed25519.d
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ enum crypto_scalarmult_ed25519_SCALARBYTES = 32U;
size_t crypto_scalarmult_ed25519_scalarbytes ();

/*
* NOTE: Do not use the result of this function directly.
* NOTE: Do not use the result of this function directly for key exchange.
*
* Hash the result with the public keys in order to compute a shared
* secret key: H(q || client_pk || server_pk)
Expand Down
33 changes: 33 additions & 0 deletions source/libsodium/crypto_scalarmult_ristretto255.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*******************************************************************************
D language bindings for libsodium's crypto_scalarmult_ristretto255.h
License: ISC (see LICENSE.txt)
*******************************************************************************/

module libsodium.crypto_scalarmult_ristretto255;

@nogc nothrow:

import libsodium.export_;

extern (C):

enum crypto_scalarmult_ristretto255_BYTES = 32U;
size_t crypto_scalarmult_ristretto255_bytes ();

enum crypto_scalarmult_ristretto255_SCALARBYTES = 32U;
size_t crypto_scalarmult_ristretto255_scalarbytes ();

/*
* NOTE: Do not use the result of this function directly for key exchange.
*
* Hash the result with the public keys in order to compute a shared
* secret key: H(q || client_pk || server_pk)
*
* Or unless this is not an option, use the crypto_kx() API instead.
*/
int crypto_scalarmult_ristretto255 (ubyte* q, const(ubyte)* n, const(ubyte)* p);

int crypto_scalarmult_ristretto255_base (ubyte* q, const(ubyte)* n);
4 changes: 3 additions & 1 deletion source/libsodium/package.d
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public import libsodium.crypto_box_curve25519xsalsa20poly1305;
public import libsodium.crypto_core_ed25519;
public import libsodium.crypto_core_hchacha20;
public import libsodium.crypto_core_hsalsa20;
public import libsodium.crypto_core_ristretto255;
public import libsodium.crypto_core_salsa2012;
public import libsodium.crypto_core_salsa208;
public import libsodium.crypto_core_salsa20;
Expand All @@ -42,6 +43,7 @@ public import libsodium.crypto_pwhash_scryptsalsa208sha256;
public import libsodium.crypto_scalarmult;
public import libsodium.crypto_scalarmult_curve25519;
public import libsodium.crypto_scalarmult_ed25519;
public import libsodium.crypto_scalarmult_ristretto255;
public import libsodium.crypto_secretbox;
public import libsodium.crypto_secretbox_xchacha20poly1305;
public import libsodium.crypto_secretbox_xsalsa20poly1305;
Expand All @@ -63,8 +65,8 @@ public import libsodium.crypto_verify_32;
public import libsodium.crypto_verify_64;
public import libsodium.export_;
public import libsodium.randombytes;
public import libsodium.randombytes_internal_random;
public import libsodium.randombytes_nativeclient;
public import libsodium.randombytes_salsa20_random;
public import libsodium.randombytes_sysrandom;
public import libsodium.runtime;
public import libsodium.utils;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/*******************************************************************************
D language bindings for libsodium's randombytes_salsa20_random.h
D language bindings for libsodium's randombytes_internal_random.h
License: ISC (see LICENSE.txt)
*******************************************************************************/

module libsodium.randombytes_salsa20_random;
module libsodium.randombytes_internal_random;

@nogc nothrow:

Expand All @@ -15,4 +15,4 @@ import libsodium.randombytes;

extern (C):

extern __gshared randombytes_implementation randombytes_salsa20_implementation;
extern __gshared randombytes_implementation randombytes_internal_implementation;

0 comments on commit fbe7b2d

Please sign in to comment.