diff --git a/wolfcrypt/src/chacha20_poly1305.c b/wolfcrypt/src/chacha20_poly1305.c index 3e9b5a04e..20827e041 100644 --- a/wolfcrypt/src/chacha20_poly1305.c +++ b/wolfcrypt/src/chacha20_poly1305.c @@ -443,7 +443,7 @@ static WC_INLINE int wc_XChaCha20Poly1305_crypt_oneshot( return ret; } -int wc_XChaCha20Poly1305_encrypt_oneshot( +int wc_XChaCha20Poly1305_Encrypt( byte *dst, const size_t dst_space, const byte *src, const size_t src_len, const byte *ad, const size_t ad_len, @@ -453,7 +453,7 @@ int wc_XChaCha20Poly1305_encrypt_oneshot( return wc_XChaCha20Poly1305_crypt_oneshot(dst, dst_space, src, src_len, ad, ad_len, nonce, nonce_len, key, key_len, 1); } -int wc_XChaCha20Poly1305_decrypt_oneshot( +int wc_XChaCha20Poly1305_Decrypt( byte *dst, const size_t dst_space, const byte *src, const size_t src_len, const byte *ad, const size_t ad_len, diff --git a/wolfcrypt/test/test.c b/wolfcrypt/test/test.c index 3222613aa..d2277f1a6 100644 --- a/wolfcrypt/test/test.c +++ b/wolfcrypt/test/test.c @@ -10194,16 +10194,14 @@ static int XChaCha20Poly1305_test(void) { byte buf2[sizeof Plaintext]; #endif - ret = wc_XChaCha20Poly1305_encrypt_oneshot(buf1, sizeof Ciphertext + sizeof Tag, + ret = wc_XChaCha20Poly1305_Encrypt(buf1, sizeof Ciphertext + sizeof Tag, Plaintext, sizeof Plaintext, AAD, sizeof AAD, IV, sizeof IV, Key, sizeof Key); - if (ret < 0) { - printf("wc_XChaCha20Poly1305_encrypt_oneshot failed: %s\n",wc_GetErrorString(ret)); + if (ret < 0) ERROR_OUT(-4760, out); - } if (XMEMCMP(buf1, Ciphertext, sizeof Plaintext)) ERROR_OUT(-4761, out); @@ -10211,7 +10209,7 @@ static int XChaCha20Poly1305_test(void) { if (XMEMCMP(buf1 + sizeof Plaintext, Tag, CHACHA20_POLY1305_AEAD_AUTHTAG_SIZE)) ERROR_OUT(-4762, out); - ret = wc_XChaCha20Poly1305_decrypt_oneshot(buf2, sizeof Plaintext, + ret = wc_XChaCha20Poly1305_Decrypt(buf2, sizeof Plaintext, buf1, sizeof Plaintext + sizeof Tag, AAD, sizeof AAD, IV, sizeof IV, diff --git a/wolfssl/wolfcrypt/chacha20_poly1305.h b/wolfssl/wolfcrypt/chacha20_poly1305.h index 86c61c2ad..26289d165 100644 --- a/wolfssl/wolfcrypt/chacha20_poly1305.h +++ b/wolfssl/wolfcrypt/chacha20_poly1305.h @@ -133,14 +133,14 @@ WOLFSSL_API int wc_XChaCha20Poly1305_Init( const byte *inIV, word32 inIVSz, int isEncrypt); -WOLFSSL_API int wc_XChaCha20Poly1305_encrypt_oneshot( +WOLFSSL_API int wc_XChaCha20Poly1305_Encrypt( byte *dst, const size_t dst_space, const byte *src, const size_t src_len, const byte *ad, const size_t ad_len, const byte *nonce, const size_t nonce_len, const byte *key, const size_t key_len); -WOLFSSL_API int wc_XChaCha20Poly1305_decrypt_oneshot( +WOLFSSL_API int wc_XChaCha20Poly1305_Decrypt( byte *dst, const size_t dst_space, const byte *src, const size_t src_len, const byte *ad, const size_t ad_len,