Remove unintentional formatting changes and add .editorconfig
This commit is contained in:
parent
989d671c41
commit
2887ae2535
9
.editorconfig
Normal file
9
.editorconfig
Normal file
@ -0,0 +1,9 @@
|
||||
# EditorConfig is awesome: https://editorconfig.org
|
||||
|
||||
# top-most EditorConfig file
|
||||
root = true
|
||||
|
||||
[*.{kt,kts}]
|
||||
indent_size = 4
|
||||
indent_style = space
|
||||
max_line_length = 120
|
@ -158,7 +158,8 @@ object Ristretto255 : Ristretto255LowLevel() {
|
||||
}
|
||||
|
||||
if (hex.length > 2 * crypto_core_ristretto255_SCALARBYTES) {
|
||||
val encoded = LibsodiumUtil.fromHex(hex.padEnd(2 * crypto_core_ristretto255_NONREDUCEDSCALARBYTES, '0'))
|
||||
val encoded =
|
||||
LibsodiumUtil.fromHex(hex.padEnd(2 * crypto_core_ristretto255_NONREDUCEDSCALARBYTES, '0'))
|
||||
// Scalars are encoded in little-endian order, so the end can be padded with zeroes up to the size of a
|
||||
// non-reduced scalar. After decoding, it is reduced, to obtain a scalar in the canonical range
|
||||
return Scalar(reduceScalar(encoded))
|
||||
|
@ -91,7 +91,7 @@ interface JnaLibsodiumInterface : Library {
|
||||
fun randombytes_buf_deterministic(
|
||||
buffer: ByteArray,
|
||||
size: Int,
|
||||
seed: ByteArray,
|
||||
seed: ByteArray
|
||||
)
|
||||
|
||||
// uint32_t randombytes_random(void)
|
||||
@ -99,7 +99,7 @@ interface JnaLibsodiumInterface : Library {
|
||||
|
||||
// uint32_t randombytes_uniform(const uint32_t upper_bound);
|
||||
fun randombytes_uniform(
|
||||
upperBound: Long,
|
||||
upperBound: Long
|
||||
) : Long
|
||||
|
||||
// void sodium_memzero(void * const pnt, const size_t len);
|
||||
@ -114,7 +114,7 @@ interface JnaLibsodiumInterface : Library {
|
||||
hex: ByteArray,
|
||||
hexMaxlen: Int,
|
||||
bin: ByteArray,
|
||||
binLen: Int,
|
||||
binLen: Int
|
||||
): String
|
||||
|
||||
// int sodium_hex2bin(
|
||||
@ -129,7 +129,7 @@ interface JnaLibsodiumInterface : Library {
|
||||
hexLen: Int,
|
||||
ignore: ByteArray?,
|
||||
binLen: Pointer,
|
||||
hexEnd: Pointer?,
|
||||
hexEnd: Pointer?
|
||||
): Int
|
||||
|
||||
// int sodium_pad(size_t *padded_buflen_p, unsigned char *buf,
|
||||
@ -139,7 +139,7 @@ interface JnaLibsodiumInterface : Library {
|
||||
buffer: ByteArray,
|
||||
unpaddedBufferLength: Int,
|
||||
blockSize: Int,
|
||||
maxBufferLength: Int,
|
||||
maxBufferLength: Int
|
||||
): Int
|
||||
|
||||
// int sodium_unpad(size_t *unpadded_buflen_p, const unsigned char *buf,
|
||||
@ -148,7 +148,7 @@ interface JnaLibsodiumInterface : Library {
|
||||
unpaddedBufferLength: Pointer,
|
||||
buffer: ByteArray,
|
||||
paddedBufferLength: Int,
|
||||
blockSize: Int,
|
||||
blockSize: Int
|
||||
) : Int
|
||||
|
||||
|
||||
@ -160,7 +160,7 @@ interface JnaLibsodiumInterface : Library {
|
||||
base64MaxLength: Int,
|
||||
bin: ByteArray,
|
||||
binLength: Int,
|
||||
variant: Int,
|
||||
variant: Int
|
||||
)
|
||||
|
||||
// int sodium_base642bin(
|
||||
@ -176,7 +176,7 @@ interface JnaLibsodiumInterface : Library {
|
||||
ignore: ByteArray?,
|
||||
binLength: Pointer,
|
||||
base64End: Pointer?,
|
||||
variant: Int,
|
||||
variant: Int
|
||||
): Int
|
||||
|
||||
// size_t sodium_base64_encoded_len(const size_t bin_len, const int variant)
|
||||
@ -193,7 +193,7 @@ interface JnaLibsodiumInterface : Library {
|
||||
input: ByteArray,
|
||||
inputLength: Long,
|
||||
key: ByteArray,
|
||||
keylen: Int,
|
||||
keylen: Int
|
||||
): Int
|
||||
|
||||
// int crypto_hash_sha256(unsigned char *out, const unsigned char *in,
|
||||
@ -243,7 +243,7 @@ interface JnaLibsodiumInterface : Library {
|
||||
input: ByteArray,
|
||||
inputLength: Long,
|
||||
key: ByteArray,
|
||||
keylen: Int,
|
||||
keylen: Int
|
||||
): Int
|
||||
|
||||
// int crypto_generichash_blake2b_init(crypto_generichash_blake2b_state *state,
|
||||
@ -334,7 +334,7 @@ interface JnaLibsodiumInterface : Library {
|
||||
additionalDataLength: Long,
|
||||
nsec: ByteArray?,
|
||||
npub: ByteArray,
|
||||
key: ByteArray,
|
||||
key: ByteArray
|
||||
): Int
|
||||
|
||||
// int crypto_aead_xchacha20poly1305_ietf_decrypt(
|
||||
@ -356,7 +356,7 @@ interface JnaLibsodiumInterface : Library {
|
||||
additionalData: ByteArray,
|
||||
additionalDataLength: Long,
|
||||
npub: ByteArray,
|
||||
key: ByteArray,
|
||||
key: ByteArray
|
||||
): Int
|
||||
|
||||
// int crypto_aead_xchacha20poly1305_ietf_encrypt_detached(
|
||||
@ -380,7 +380,7 @@ interface JnaLibsodiumInterface : Library {
|
||||
additionalDataLength: Long,
|
||||
nsec: ByteArray?,
|
||||
npub: ByteArray,
|
||||
key: ByteArray,
|
||||
key: ByteArray
|
||||
): Int
|
||||
|
||||
// int crypto_aead_xchacha20poly1305_ietf_decrypt_detached(
|
||||
@ -402,7 +402,7 @@ interface JnaLibsodiumInterface : Library {
|
||||
additionalData: ByteArray,
|
||||
additionalDataLength: Long,
|
||||
npub: ByteArray,
|
||||
key: ByteArray,
|
||||
key: ByteArray
|
||||
): Int
|
||||
|
||||
// void crypto_aead_xchacha20poly1305_ietf_keygen(unsigned char k[crypto_aead_xchacha20poly1305_ietf_KEYBYTES])
|
||||
@ -432,7 +432,7 @@ interface JnaLibsodiumInterface : Library {
|
||||
additionalDataLength: Long,
|
||||
nsec: ByteArray?,
|
||||
npub: ByteArray,
|
||||
key: ByteArray,
|
||||
key: ByteArray
|
||||
) : Int
|
||||
|
||||
// int crypto_aead_chacha20poly1305_ietf_decrypt(
|
||||
@ -454,7 +454,7 @@ interface JnaLibsodiumInterface : Library {
|
||||
additionalData: ByteArray,
|
||||
additionalDataLength: Long,
|
||||
npub: ByteArray,
|
||||
key: ByteArray,
|
||||
key: ByteArray
|
||||
): Int
|
||||
|
||||
// int crypto_aead_chacha20poly1305_ietf_encrypt_detached(
|
||||
@ -478,7 +478,7 @@ interface JnaLibsodiumInterface : Library {
|
||||
additionalDataLength: Long,
|
||||
nsec: ByteArray?,
|
||||
npub: ByteArray,
|
||||
key: ByteArray,
|
||||
key: ByteArray
|
||||
): Int
|
||||
|
||||
// int crypto_aead_chacha20poly1305_ietf_decrypt_detached(
|
||||
@ -500,7 +500,7 @@ interface JnaLibsodiumInterface : Library {
|
||||
additionalData: ByteArray,
|
||||
additionalDataLength: Long,
|
||||
npub: ByteArray,
|
||||
key: ByteArray,
|
||||
key: ByteArray
|
||||
): Int
|
||||
|
||||
// void crypto_aead_chacha20poly1305_ietf_keygen(unsigned char k[crypto_aead_xchacha20poly1305_ietf_KEYBYTES])
|
||||
@ -532,7 +532,7 @@ interface JnaLibsodiumInterface : Library {
|
||||
additionalDataLength: Long,
|
||||
nsec: ByteArray?,
|
||||
npub: ByteArray,
|
||||
key: ByteArray,
|
||||
key: ByteArray
|
||||
): Int
|
||||
|
||||
// int crypto_aead_xchacha20poly1305_decrypt(unsigned char *m,
|
||||
@ -553,7 +553,7 @@ interface JnaLibsodiumInterface : Library {
|
||||
additionalData: ByteArray,
|
||||
additionalDataLength: Long,
|
||||
npub: ByteArray,
|
||||
key: ByteArray,
|
||||
key: ByteArray
|
||||
): Int
|
||||
|
||||
// int crypto_aead_chacha20poly1305_encrypt_detached(
|
||||
@ -577,7 +577,7 @@ interface JnaLibsodiumInterface : Library {
|
||||
additionalDataLength: Long,
|
||||
nsec: ByteArray?,
|
||||
npub: ByteArray,
|
||||
key: ByteArray,
|
||||
key: ByteArray
|
||||
): Int
|
||||
|
||||
// int crypto_aead_chacha20poly1305_decrypt_detached(
|
||||
@ -599,7 +599,7 @@ interface JnaLibsodiumInterface : Library {
|
||||
additionalData: ByteArray,
|
||||
additionalDataLength: Long,
|
||||
npub: ByteArray,
|
||||
key: ByteArray,
|
||||
key: ByteArray
|
||||
): Int
|
||||
|
||||
// void crypto_aead_chacha20poly1305_keygen(unsigned char k[crypto_aead_xchacha20poly1305_ietf_KEYBYTES])
|
||||
@ -622,7 +622,7 @@ interface JnaLibsodiumInterface : Library {
|
||||
fun crypto_secretstream_xchacha20poly1305_init_push(
|
||||
state: SecretStreamXChaCha20Poly1305State,
|
||||
header: ByteArray,
|
||||
key: ByteArray,
|
||||
key: ByteArray
|
||||
): Int
|
||||
|
||||
// int crypto_secretstream_xchacha20poly1305_push
|
||||
@ -638,7 +638,7 @@ interface JnaLibsodiumInterface : Library {
|
||||
messageLength: Long,
|
||||
additionalData: ByteArray,
|
||||
additionalDataLength: Long,
|
||||
tag: Byte,
|
||||
tag: Byte
|
||||
): Int
|
||||
|
||||
// decrypt
|
||||
@ -650,7 +650,7 @@ interface JnaLibsodiumInterface : Library {
|
||||
fun crypto_secretstream_xchacha20poly1305_init_pull(
|
||||
state: SecretStreamXChaCha20Poly1305State,
|
||||
header: ByteArray,
|
||||
key: ByteArray,
|
||||
key: ByteArray
|
||||
): Int
|
||||
|
||||
// int crypto_secretstream_xchacha20poly1305_pull
|
||||
@ -666,7 +666,7 @@ interface JnaLibsodiumInterface : Library {
|
||||
ciphertext: ByteArray,
|
||||
ciphertextLength: Long,
|
||||
additionalData: ByteArray,
|
||||
additionalDataLength: Long,
|
||||
additionalDataLength: Long
|
||||
): Int
|
||||
|
||||
//keygen and rekey
|
||||
@ -696,7 +696,7 @@ interface JnaLibsodiumInterface : Library {
|
||||
message: ByteArray,
|
||||
messageLength: Long,
|
||||
nonce: ByteArray,
|
||||
key: ByteArray,
|
||||
key: ByteArray
|
||||
): Int
|
||||
|
||||
// int crypto_secretbox_easy(
|
||||
@ -708,7 +708,7 @@ interface JnaLibsodiumInterface : Library {
|
||||
message: ByteArray,
|
||||
messageLength: Long,
|
||||
nonce: ByteArray,
|
||||
key: ByteArray,
|
||||
key: ByteArray
|
||||
): Int
|
||||
|
||||
// void crypto_secretbox_keygen(unsigned char k[crypto_secretbox_KEYBYTES])
|
||||
@ -727,7 +727,7 @@ interface JnaLibsodiumInterface : Library {
|
||||
mac: ByteArray,
|
||||
ciphertextLength: Long,
|
||||
nonce: ByteArray,
|
||||
key: ByteArray,
|
||||
key: ByteArray
|
||||
): Int
|
||||
|
||||
// int crypto_secretbox_open_easy(
|
||||
@ -739,7 +739,7 @@ interface JnaLibsodiumInterface : Library {
|
||||
ciphertext: ByteArray,
|
||||
ciphertextLength: Long,
|
||||
nonce: ByteArray,
|
||||
key: ByteArray,
|
||||
key: ByteArray
|
||||
): Int
|
||||
|
||||
// ---- SecretBox End ----
|
||||
@ -752,7 +752,7 @@ interface JnaLibsodiumInterface : Library {
|
||||
out: ByteArray,
|
||||
input: ByteArray,
|
||||
inputLength: Long,
|
||||
key: ByteArray,
|
||||
key: ByteArray
|
||||
): Int
|
||||
|
||||
// void crypto_auth_keygen(unsigned char k[crypto_auth_KEYBYTES])
|
||||
@ -764,7 +764,7 @@ interface JnaLibsodiumInterface : Library {
|
||||
hash: ByteArray,
|
||||
input: ByteArray,
|
||||
inputLength: Long,
|
||||
key: ByteArray,
|
||||
key: ByteArray
|
||||
): Int
|
||||
|
||||
//Same params as general variant
|
||||
@ -772,7 +772,7 @@ interface JnaLibsodiumInterface : Library {
|
||||
out: ByteArray,
|
||||
input: ByteArray,
|
||||
inputLength: Long,
|
||||
key: ByteArray,
|
||||
key: ByteArray
|
||||
): Int
|
||||
|
||||
//Same params as general variant
|
||||
@ -783,7 +783,7 @@ interface JnaLibsodiumInterface : Library {
|
||||
hash: ByteArray,
|
||||
input: ByteArray,
|
||||
inputLength: Long,
|
||||
key: ByteArray,
|
||||
key: ByteArray
|
||||
): Int
|
||||
|
||||
//Same params as general variant
|
||||
@ -791,7 +791,7 @@ interface JnaLibsodiumInterface : Library {
|
||||
out: ByteArray,
|
||||
input: ByteArray,
|
||||
inputLength: Long,
|
||||
key: ByteArray,
|
||||
key: ByteArray
|
||||
): Int
|
||||
|
||||
//Same params as general variant
|
||||
@ -802,7 +802,7 @@ interface JnaLibsodiumInterface : Library {
|
||||
hash: ByteArray,
|
||||
input: ByteArray,
|
||||
inputLength: Long,
|
||||
key: ByteArray,
|
||||
key: ByteArray
|
||||
): Int
|
||||
|
||||
//
|
||||
@ -818,7 +818,7 @@ interface JnaLibsodiumInterface : Library {
|
||||
fun crypto_box_seed_keypair(
|
||||
publicKey: ByteArray,
|
||||
secretKey: ByteArray,
|
||||
seed: ByteArray,
|
||||
seed: ByteArray
|
||||
): Int
|
||||
|
||||
// int crypto_box_easy(unsigned char *c, const unsigned char *m,
|
||||
@ -830,7 +830,7 @@ interface JnaLibsodiumInterface : Library {
|
||||
messageLength: Long,
|
||||
nonce: ByteArray,
|
||||
recipientPublicKey: ByteArray,
|
||||
senderSecretKey: ByteArray,
|
||||
senderSecretKey: ByteArray
|
||||
): Int
|
||||
|
||||
// int crypto_box_open_easy(unsigned char *m, const unsigned char *c,
|
||||
@ -842,7 +842,7 @@ interface JnaLibsodiumInterface : Library {
|
||||
ciphertextLength: Long,
|
||||
nonce: ByteArray,
|
||||
senderPublickKey: ByteArray,
|
||||
recipientSecretKey: ByteArray,
|
||||
recipientSecretKey: ByteArray
|
||||
): Int
|
||||
|
||||
// int crypto_box_detached(unsigned char *c, unsigned char *mac,
|
||||
@ -856,7 +856,7 @@ interface JnaLibsodiumInterface : Library {
|
||||
messageLength: Long,
|
||||
nonce: ByteArray,
|
||||
recipientPublicKey: ByteArray,
|
||||
senderSecretKey: ByteArray,
|
||||
senderSecretKey: ByteArray
|
||||
): Int
|
||||
|
||||
// int crypto_box_open_detached(
|
||||
@ -873,7 +873,7 @@ interface JnaLibsodiumInterface : Library {
|
||||
ciphertextLength: Long,
|
||||
nonce: ByteArray,
|
||||
senderPublickKey: ByteArray,
|
||||
recipientSecretKey: ByteArray,
|
||||
recipientSecretKey: ByteArray
|
||||
): Int
|
||||
|
||||
// int crypto_box_beforenm(unsigned char *k, const unsigned char *pk,
|
||||
@ -881,7 +881,7 @@ interface JnaLibsodiumInterface : Library {
|
||||
fun crypto_box_beforenm(
|
||||
sessionKey: ByteArray,
|
||||
publicKey: ByteArray,
|
||||
secretKey: ByteArray,
|
||||
secretKey: ByteArray
|
||||
): Int
|
||||
|
||||
// int crypto_box_easy_afternm(unsigned char *c, const unsigned char *m,
|
||||
@ -892,7 +892,7 @@ interface JnaLibsodiumInterface : Library {
|
||||
message: ByteArray,
|
||||
messageLength: Long,
|
||||
nonce: ByteArray,
|
||||
sessionKey: ByteArray,
|
||||
sessionKey: ByteArray
|
||||
): Int
|
||||
|
||||
// int crypto_box_open_easy_afternm(unsigned char *m, const unsigned char *c,
|
||||
@ -903,7 +903,7 @@ interface JnaLibsodiumInterface : Library {
|
||||
ciphertext: ByteArray,
|
||||
ciphertextLength: Long,
|
||||
nonce: ByteArray,
|
||||
sessionKey: ByteArray,
|
||||
sessionKey: ByteArray
|
||||
): Int
|
||||
|
||||
// int crypto_box_seal(unsigned char *c, const unsigned char *m,
|
||||
@ -912,7 +912,7 @@ interface JnaLibsodiumInterface : Library {
|
||||
ciphertext: ByteArray,
|
||||
message: ByteArray,
|
||||
messageLength: Long,
|
||||
recipientPublicKey: ByteArray,
|
||||
recipientPublicKey: ByteArray
|
||||
): Int
|
||||
|
||||
|
||||
@ -924,7 +924,7 @@ interface JnaLibsodiumInterface : Library {
|
||||
ciphertext: ByteArray,
|
||||
ciphertextLength: Long,
|
||||
senderPublickKey: ByteArray,
|
||||
recipientSecretKey: ByteArray,
|
||||
recipientSecretKey: ByteArray
|
||||
): Int
|
||||
//
|
||||
// // ---- Box end ----
|
||||
@ -940,7 +940,7 @@ interface JnaLibsodiumInterface : Library {
|
||||
signedMessageLength: LongArray?,
|
||||
message: ByteArray,
|
||||
messageLength: Long,
|
||||
secretKey: ByteArray,
|
||||
secretKey: ByteArray
|
||||
): Int
|
||||
|
||||
// int crypto_sign_open(
|
||||
@ -952,7 +952,7 @@ interface JnaLibsodiumInterface : Library {
|
||||
messageLength: LongArray?,
|
||||
signedMessage: ByteArray,
|
||||
signedMessageLength: Long,
|
||||
publicKey: ByteArray,
|
||||
publicKey: ByteArray
|
||||
): Int
|
||||
|
||||
// int crypto_sign_detached(
|
||||
@ -964,7 +964,7 @@ interface JnaLibsodiumInterface : Library {
|
||||
signatureLength: LongArray?,
|
||||
message: ByteArray,
|
||||
messageLength: Long,
|
||||
secretKey: ByteArray,
|
||||
secretKey: ByteArray
|
||||
): Int
|
||||
|
||||
// int crypto_sign_verify_detached(
|
||||
@ -976,7 +976,7 @@ interface JnaLibsodiumInterface : Library {
|
||||
signature: ByteArray,
|
||||
message: ByteArray,
|
||||
messageLength: Long,
|
||||
publicKey: ByteArray,
|
||||
publicKey: ByteArray
|
||||
): Int
|
||||
|
||||
// int crypto_sign_ed25519_pk_to_curve25519(
|
||||
@ -984,27 +984,27 @@ interface JnaLibsodiumInterface : Library {
|
||||
// const unsigned char *ed25519_pk)
|
||||
fun crypto_sign_ed25519_pk_to_curve25519(
|
||||
curve25519PublicKey: ByteArray,
|
||||
ed25519PublicKey: ByteArray,
|
||||
ed25519PublicKey: ByteArray
|
||||
): Int
|
||||
|
||||
// int crypto_sign_ed25519_sk_to_curve25519(unsigned char *curve25519_sk,
|
||||
// const unsigned char *ed25519_sk)
|
||||
fun crypto_sign_ed25519_sk_to_curve25519(
|
||||
curve25519SecretKey: ByteArray,
|
||||
ed25519SecretKey: ByteArray,
|
||||
ed25519SecretKey: ByteArray
|
||||
): Int
|
||||
|
||||
// int crypto_sign_ed25519_sk_to_pk(unsigned char *pk, const unsigned char *sk)
|
||||
fun crypto_sign_ed25519_sk_to_pk(
|
||||
ed25519PublicKey: ByteArray,
|
||||
ed25519SecretKey: ByteArray,
|
||||
ed25519SecretKey: ByteArray
|
||||
): Int
|
||||
|
||||
// int crypto_sign_ed25519_sk_to_seed(unsigned char *seed,
|
||||
// const unsigned char *sk)
|
||||
fun crypto_sign_ed25519_sk_to_seed(
|
||||
seed: ByteArray,
|
||||
ed25519SecretKey: ByteArray,
|
||||
ed25519SecretKey: ByteArray
|
||||
): Int
|
||||
|
||||
// int crypto_sign_init(crypto_sign_state *state);
|
||||
@ -1015,7 +1015,7 @@ interface JnaLibsodiumInterface : Library {
|
||||
fun crypto_sign_update(
|
||||
state: Ed25519SignatureState,
|
||||
message: ByteArray,
|
||||
messageLength: Long,
|
||||
messageLength: Long
|
||||
): Int
|
||||
|
||||
// int crypto_sign_final_create(crypto_sign_state *state, unsigned char *sig,
|
||||
@ -1025,7 +1025,7 @@ interface JnaLibsodiumInterface : Library {
|
||||
state: Ed25519SignatureState,
|
||||
signature: ByteArray,
|
||||
signatureLength: LongArray?,
|
||||
secretKey: ByteArray,
|
||||
secretKey: ByteArray
|
||||
): Int
|
||||
|
||||
// int crypto_sign_final_verify(crypto_sign_state *state, const unsigned char *sig,
|
||||
@ -1033,12 +1033,12 @@ interface JnaLibsodiumInterface : Library {
|
||||
fun crypto_sign_final_verify(
|
||||
state: Ed25519SignatureState,
|
||||
signature: ByteArray,
|
||||
publicKey: ByteArray,
|
||||
publicKey: ByteArray
|
||||
): Int
|
||||
|
||||
// int crypto_sign_keypair(unsigned char *pk, unsigned char *sk)
|
||||
fun crypto_sign_keypair(
|
||||
publicKey: ByteArray, secretKey: ByteArray,
|
||||
publicKey: ByteArray, secretKey: ByteArray
|
||||
): Int
|
||||
|
||||
// int crypto_sign_seed_keypair(unsigned char *pk, unsigned char *sk,
|
||||
@ -1046,7 +1046,7 @@ interface JnaLibsodiumInterface : Library {
|
||||
fun crypto_sign_seed_keypair(
|
||||
publicKey: ByteArray,
|
||||
secretKey: ByteArray,
|
||||
seed: ByteArray,
|
||||
seed: ByteArray
|
||||
): Int
|
||||
|
||||
|
||||
@ -1067,12 +1067,12 @@ interface JnaLibsodiumInterface : Library {
|
||||
subkeyLength: Int,
|
||||
subkeyId: Long,
|
||||
context: ByteArray,
|
||||
key: ByteArray,
|
||||
key: ByteArray
|
||||
): Int
|
||||
|
||||
// void crypto_kdf_keygen(unsigned char k[crypto_kdf_KEYBYTES])
|
||||
fun crypto_kdf_keygen(
|
||||
key: ByteArray,
|
||||
key: ByteArray
|
||||
)
|
||||
//
|
||||
// // ---- KDF end -----
|
||||
@ -1093,7 +1093,7 @@ interface JnaLibsodiumInterface : Library {
|
||||
salt: ByteArray,
|
||||
opslimit: Long,
|
||||
memlimit: Long,
|
||||
algorithm: Int,
|
||||
algorithm : Int
|
||||
) : Int
|
||||
|
||||
// int crypto_pwhash_str(char out[crypto_pwhash_STRBYTES],
|
||||
@ -1104,7 +1104,7 @@ interface JnaLibsodiumInterface : Library {
|
||||
password: String,
|
||||
passwordLength: Long,
|
||||
opslimit: Long,
|
||||
memlimit: Long,
|
||||
memlimit: Long
|
||||
) : Int
|
||||
|
||||
// int crypto_pwhash_str_needs_rehash(const char str[crypto_pwhash_STRBYTES],
|
||||
@ -1112,16 +1112,15 @@ interface JnaLibsodiumInterface : Library {
|
||||
fun crypto_pwhash_str_needs_rehash(
|
||||
output: String,
|
||||
opslimit: Long,
|
||||
memlimit: Long,
|
||||
memlimit: Long
|
||||
) : Int
|
||||
|
||||
// int crypto_pwhash_str_verify(const char str[crypto_pwhash_STRBYTES],
|
||||
// const char * const passwd,
|
||||
// unsigned long long passwdlen)
|
||||
fun crypto_pwhash_str_verify(
|
||||
hash: String,
|
||||
password: String,
|
||||
passwordLength: Long,
|
||||
passwordLength: Long
|
||||
) : Int
|
||||
|
||||
//
|
||||
@ -1129,6 +1128,7 @@ interface JnaLibsodiumInterface : Library {
|
||||
//
|
||||
|
||||
|
||||
|
||||
// // ---- Key exchange ----
|
||||
|
||||
|
||||
@ -1136,7 +1136,7 @@ interface JnaLibsodiumInterface : Library {
|
||||
// unsigned char sk[crypto_kx_SECRETKEYBYTES])
|
||||
fun crypto_kx_keypair(
|
||||
publicKey: ByteArray,
|
||||
secretKey: ByteArray,
|
||||
secretKey: ByteArray
|
||||
): Int
|
||||
|
||||
|
||||
@ -1146,9 +1146,8 @@ interface JnaLibsodiumInterface : Library {
|
||||
fun crypto_kx_seed_keypair(
|
||||
publicKey: ByteArray,
|
||||
secretKey: ByteArray,
|
||||
seed: ByteArray,
|
||||
seed: ByteArray
|
||||
): Int
|
||||
|
||||
// int crypto_kx_client_session_keys(unsigned char rx[crypto_kx_SESSIONKEYBYTES],
|
||||
// unsigned char tx[crypto_kx_SESSIONKEYBYTES],
|
||||
// const unsigned char client_pk[crypto_kx_PUBLICKEYBYTES],
|
||||
@ -1159,9 +1158,8 @@ interface JnaLibsodiumInterface : Library {
|
||||
sendKey: ByteArray,
|
||||
clientPublicKey: ByteArray,
|
||||
clientSecretKey: ByteArray,
|
||||
serverPublicKey: ByteArray,
|
||||
serverPublicKey: ByteArray
|
||||
): Int
|
||||
|
||||
// int crypto_kx_server_session_keys(unsigned char rx[crypto_kx_SESSIONKEYBYTES],
|
||||
// unsigned char tx[crypto_kx_SESSIONKEYBYTES],
|
||||
// const unsigned char server_pk[crypto_kx_PUBLICKEYBYTES],
|
||||
@ -1172,7 +1170,7 @@ interface JnaLibsodiumInterface : Library {
|
||||
sendKey: ByteArray,
|
||||
serverPublicKey: ByteArray,
|
||||
serverSecretKey: ByteArray,
|
||||
clientPublicKey: ByteArray,
|
||||
clientPublicKey: ByteArray
|
||||
): Int
|
||||
|
||||
//
|
||||
@ -1186,9 +1184,8 @@ interface JnaLibsodiumInterface : Library {
|
||||
stream: ByteArray,
|
||||
streamLength: Long,
|
||||
nonce: ByteArray,
|
||||
key: ByteArray,
|
||||
key: ByteArray
|
||||
) : Int
|
||||
|
||||
// int crypto_stream_chacha20_xor(unsigned char *c, const unsigned char *m,
|
||||
// unsigned long long mlen, const unsigned char *n,
|
||||
// const unsigned char *k)
|
||||
@ -1197,9 +1194,8 @@ interface JnaLibsodiumInterface : Library {
|
||||
message: ByteArray,
|
||||
messageLength: Long,
|
||||
nonce: ByteArray,
|
||||
key: ByteArray,
|
||||
key: ByteArray
|
||||
) : Int
|
||||
|
||||
// int crypto_stream_chacha20_xor_ic(unsigned char *c, const unsigned char *m,
|
||||
// unsigned long long mlen,
|
||||
// const unsigned char *n, uint64_t ic,
|
||||
@ -1210,7 +1206,7 @@ interface JnaLibsodiumInterface : Library {
|
||||
messageLength: Long,
|
||||
nonce: ByteArray,
|
||||
initialCounter : Long,
|
||||
key: ByteArray,
|
||||
key: ByteArray
|
||||
) : Int
|
||||
|
||||
// int crypto_stream_chacha20_ietf(unsigned char *c, unsigned long long clen,
|
||||
@ -1219,7 +1215,7 @@ interface JnaLibsodiumInterface : Library {
|
||||
stream: ByteArray,
|
||||
streamLength: Long,
|
||||
nonce: ByteArray,
|
||||
key: ByteArray,
|
||||
key: ByteArray
|
||||
) : Int
|
||||
|
||||
// int crypto_stream_chacha20_ietf_xor(unsigned char *c, const unsigned char *m,
|
||||
@ -1230,7 +1226,7 @@ interface JnaLibsodiumInterface : Library {
|
||||
message: ByteArray,
|
||||
messageLength: Long,
|
||||
nonce: ByteArray,
|
||||
key: ByteArray,
|
||||
key: ByteArray
|
||||
) : Int
|
||||
|
||||
// int crypto_stream_chacha20_ietf_xor_ic(unsigned char *c, const unsigned char *m,
|
||||
@ -1243,7 +1239,7 @@ interface JnaLibsodiumInterface : Library {
|
||||
messageLength: Long,
|
||||
nonce: ByteArray,
|
||||
initialCounter : Int,
|
||||
key: ByteArray,
|
||||
key: ByteArray
|
||||
) : Int
|
||||
|
||||
// void crypto_stream_chacha20_keygen(unsigned char k[crypto_stream_chacha20_KEYBYTES])
|
||||
@ -1255,7 +1251,7 @@ interface JnaLibsodiumInterface : Library {
|
||||
stream: ByteArray,
|
||||
streamLength: Long,
|
||||
nonce: ByteArray,
|
||||
key: ByteArray,
|
||||
key: ByteArray
|
||||
) : Int
|
||||
|
||||
// int crypto_stream_xchacha20_xor(unsigned char *c, const unsigned char *m,
|
||||
@ -1266,7 +1262,7 @@ interface JnaLibsodiumInterface : Library {
|
||||
message: ByteArray,
|
||||
messageLength: Long,
|
||||
nonce: ByteArray,
|
||||
key: ByteArray,
|
||||
key: ByteArray
|
||||
) : Int
|
||||
|
||||
// int crypto_stream_xchacha20_xor_ic(unsigned char *c, const unsigned char *m,
|
||||
@ -1279,9 +1275,8 @@ interface JnaLibsodiumInterface : Library {
|
||||
messageLength: Long,
|
||||
nonce: ByteArray,
|
||||
initialCounter : Long,
|
||||
key: ByteArray,
|
||||
key: ByteArray
|
||||
) : Int
|
||||
|
||||
// void crypto_stream_xchacha20_keygen(unsigned char k[crypto_stream_xchacha20_KEYBYTES])
|
||||
fun crypto_stream_xchacha20_keygen(key: ByteArray)
|
||||
|
||||
@ -1294,7 +1289,6 @@ interface JnaLibsodiumInterface : Library {
|
||||
// int crypto_scalarmult(unsigned char *q, const unsigned char *n,
|
||||
// const unsigned char *p)
|
||||
fun crypto_scalarmult(q: ByteArray, n: ByteArray, p: ByteArray): Int
|
||||
|
||||
// int crypto_scalarmult_base(unsigned char *q, const unsigned char *n)
|
||||
fun crypto_scalarmult_base(q: ByteArray, b: ByteArray): Int
|
||||
//
|
||||
|
@ -44,7 +44,8 @@ actual abstract class Ristretto255LowLevel actual constructor() {
|
||||
actual fun invertScalar(scalar: UByteArray): UByteArray {
|
||||
val result = UByteArray(crypto_core_ristretto255_SCALARBYTES)
|
||||
|
||||
sodiumJna.crypto_core_ristretto255_scalar_invert(result.asByteArray(), scalar.asByteArray()).ensureLibsodiumSuccess()
|
||||
sodiumJna.crypto_core_ristretto255_scalar_invert(result.asByteArray(), scalar.asByteArray())
|
||||
.ensureLibsodiumSuccess()
|
||||
|
||||
return result
|
||||
}
|
||||
|
@ -80,7 +80,10 @@ actual abstract class Ristretto255LowLevel actual constructor() {
|
||||
|
||||
result.usePinned { resultPinned ->
|
||||
scalar.usePinned { scalarPinned ->
|
||||
crypto_core_ristretto255_scalar_invert(resultPinned.toPtr(), scalarPinned.toPtr()).ensureLibsodiumSuccess()
|
||||
crypto_core_ristretto255_scalar_invert(
|
||||
resultPinned.toPtr(),
|
||||
scalarPinned.toPtr()
|
||||
).ensureLibsodiumSuccess()
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user