diff options
Diffstat (limited to 'src/crypto')
-rw-r--r-- | src/crypto/chacha20poly1305.c | 13 | ||||
-rw-r--r-- | src/crypto/chacha20poly1305.h | 12 |
2 files changed, 10 insertions, 15 deletions
diff --git a/src/crypto/chacha20poly1305.c b/src/crypto/chacha20poly1305.c index b7b7bef..9cc1305 100644 --- a/src/crypto/chacha20poly1305.c +++ b/src/crypto/chacha20poly1305.c @@ -568,7 +568,7 @@ static struct blkcipher_desc chacha20_desc = { .tfm = &chacha20_cipher }; -bool chacha20poly1305_encrypt(u8 *dst, const u8 *src, const size_t src_len, +void chacha20poly1305_encrypt(u8 *dst, const u8 *src, const size_t src_len, const u8 *ad, const size_t ad_len, const u64 nonce, const u8 key[CHACHA20POLY1305_KEYLEN]) { @@ -605,11 +605,9 @@ bool chacha20poly1305_encrypt(u8 *dst, const u8 *src, const size_t src_len, memzero_explicit(&chacha20_state, sizeof(chacha20_state)); chacha20poly1305_deinit_simd(have_simd); - - return true; } -bool chacha20poly1305_encrypt_sg(struct scatterlist *dst, struct scatterlist *src, const size_t src_len, +void chacha20poly1305_encrypt_sg(struct scatterlist *dst, struct scatterlist *src, const size_t src_len, const u8 *ad, const size_t ad_len, const u64 nonce, const u8 key[CHACHA20POLY1305_KEYLEN], bool have_simd) @@ -660,7 +658,6 @@ bool chacha20poly1305_encrypt_sg(struct scatterlist *dst, struct scatterlist *sr memzero_explicit(&poly1305_state, sizeof(poly1305_state)); memzero_explicit(&chacha20_state, sizeof(chacha20_state)); memzero_explicit(mac, sizeof(mac)); - return true; } bool chacha20poly1305_decrypt(u8 *dst, const u8 *src, const size_t src_len, @@ -782,17 +779,15 @@ bool chacha20poly1305_decrypt_sg(struct scatterlist *dst, struct scatterlist *sr } -bool xchacha20poly1305_encrypt(u8 *dst, const u8 *src, const size_t src_len, +void xchacha20poly1305_encrypt(u8 *dst, const u8 *src, const size_t src_len, const u8 *ad, const size_t ad_len, const u8 nonce[XCHACHA20POLY1305_NONCELEN], const u8 key[CHACHA20POLY1305_KEYLEN]) { u8 derived_key[CHACHA20POLY1305_KEYLEN]; - bool ret; hchacha20(derived_key, nonce, key); - ret = chacha20poly1305_encrypt(dst, src, src_len, ad, ad_len, le64_to_cpuvp(nonce + 16), derived_key); + chacha20poly1305_encrypt(dst, src, src_len, ad, ad_len, le64_to_cpuvp(nonce + 16), derived_key); memzero_explicit(derived_key, CHACHA20POLY1305_KEYLEN); - return ret; } bool xchacha20poly1305_decrypt(u8 *dst, const u8 *src, const size_t src_len, diff --git a/src/crypto/chacha20poly1305.h b/src/crypto/chacha20poly1305.h index 560ba84..76b76d2 100644 --- a/src/crypto/chacha20poly1305.h +++ b/src/crypto/chacha20poly1305.h @@ -15,29 +15,29 @@ enum chacha20poly1305_lengths { void chacha20poly1305_fpu_init(void); -bool chacha20poly1305_encrypt(u8 *dst, const u8 *src, const size_t src_len, +void chacha20poly1305_encrypt(u8 *dst, const u8 *src, const size_t src_len, const u8 *ad, const size_t ad_len, const u64 nonce, const u8 key[CHACHA20POLY1305_KEYLEN]); -bool chacha20poly1305_encrypt_sg(struct scatterlist *dst, struct scatterlist *src, const size_t src_len, +void chacha20poly1305_encrypt_sg(struct scatterlist *dst, struct scatterlist *src, const size_t src_len, const u8 *ad, const size_t ad_len, const u64 nonce, const u8 key[CHACHA20POLY1305_KEYLEN], bool have_simd); -bool chacha20poly1305_decrypt(u8 *dst, const u8 *src, const size_t src_len, +bool __must_check chacha20poly1305_decrypt(u8 *dst, const u8 *src, const size_t src_len, const u8 *ad, const size_t ad_len, const u64 nonce, const u8 key[CHACHA20POLY1305_KEYLEN]); -bool chacha20poly1305_decrypt_sg(struct scatterlist *dst, struct scatterlist *src, const size_t src_len, +bool __must_check chacha20poly1305_decrypt_sg(struct scatterlist *dst, struct scatterlist *src, const size_t src_len, const u8 *ad, const size_t ad_len, const u64 nonce, const u8 key[CHACHA20POLY1305_KEYLEN]); -bool xchacha20poly1305_encrypt(u8 *dst, const u8 *src, const size_t src_len, +void xchacha20poly1305_encrypt(u8 *dst, const u8 *src, const size_t src_len, const u8 *ad, const size_t ad_len, const u8 nonce[XCHACHA20POLY1305_NONCELEN], const u8 key[CHACHA20POLY1305_KEYLEN]); -bool xchacha20poly1305_decrypt(u8 *dst, const u8 *src, const size_t src_len, +bool __must_check xchacha20poly1305_decrypt(u8 *dst, const u8 *src, const size_t src_len, const u8 *ad, const size_t ad_len, const u8 nonce[XCHACHA20POLY1305_NONCELEN], const u8 key[CHACHA20POLY1305_KEYLEN]); |