rename API wc_XChaCha20Poly1305_{encrypt,decrypt}_oneshot to wc_XChaCha20Poly1305_{Encrypt,Decrypt} for consistency; remove stray debugging printf in XChaCha20Poly1305_test().

This commit is contained in:
Daniel Pouzzner
2020-10-21 14:36:46 -05:00
parent 299e88a993
commit c910c94824
3 changed files with 7 additions and 9 deletions

View File

@ -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,

View File

@ -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,

View File

@ -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,