diff --git a/crypto_aead.js b/crypto_aead.js index 60e8679..2aa04c7 100644 --- a/crypto_aead.js +++ b/crypto_aead.js @@ -29,7 +29,7 @@ function crypto_aead_chacha20poly1305_ietf_encrypt (c, m, ad, nsec, npub, k) { } function crypto_aead_chacha20poly1305_ietf_encrypt_detached (c, mac, m, ad, nsec, npub, k) { - if (ad === null) return crypto_aead_chacha20poly1305_ietf_encrypt(c, mac, m, new Uint8Array(0), nsec, npub, k) + if (ad === null) return crypto_aead_chacha20poly1305_ietf_encrypt_detached(c, mac, m, new Uint8Array(0), nsec, npub, k) assert(c.byteLength === m.byteLength, 'ciphertext should be same length than message') assert(npub.byteLength === crypto_aead_chacha20poly1305_ietf_NPUBBYTES, @@ -90,7 +90,7 @@ function crypto_aead_chacha20poly1305_ietf_decrypt (m, nsec, c, ad, npub, k) { } function crypto_aead_chacha20poly1305_ietf_decrypt_detached (m, nsec, c, mac, ad, npub, k) { - if (ad === null) return crypto_aead_chacha20poly1305_ietf_decrypt(m, nsec, c, mac, new Uint8Array(0), npub, k) + if (ad === null) return crypto_aead_chacha20poly1305_ietf_decrypt_detached(m, nsec, c, mac, new Uint8Array(0), npub, k) assert(c.byteLength === m.byteLength, 'message should be same length than ciphertext') assert(npub.byteLength === crypto_aead_chacha20poly1305_ietf_NPUBBYTES, diff --git a/crypto_box.js b/crypto_box.js index 2eb8d44..84a7ab1 100644 --- a/crypto_box.js +++ b/crypto_box.js @@ -1,6 +1,6 @@ const { crypto_hash_sha512 } = require('./crypto_hash') const { crypto_scalarmult, crypto_scalarmult_base } = require('./crypto_scalarmult') -const { randombytes } = require('./randombytes') +const { randombytes_buf } = require('./randombytes') const { crypto_generichash_batch } = require('./crypto_generichash') const { crypto_secretbox_open_easy, crypto_secretbox_easy } = require('./crypto_secretbox') const xsalsa20 = require('xsalsa20') @@ -35,7 +35,7 @@ module.exports = { function crypto_box_keypair(pk, sk) { check(pk, crypto_box_PUBLICKEYBYTES) check(sk, crypto_box_SECRETKEYBYTES) - randombytes(sk, 32) + randombytes_buf(sk, 32) return crypto_scalarmult_base(pk, sk) }