From 521d0737eab3102ca88e4a60798d37b1d75339e4 Mon Sep 17 00:00:00 2001 From: Steffen Jaeckel Date: Tue, 17 Oct 2017 23:37:30 +0200 Subject: [PATCH] fix typo (cherry picked from commit 442bb90a51621deb38a5f9dce890db0f3b312e49) --- doc/crypt.tex | 4 ++-- src/encauth/chachapoly/chacha20poly1305_memory.c | 6 +++--- src/encauth/chachapoly/chacha20poly1305_test.c | 4 ++-- src/headers/tomcrypt_mac.h | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/doc/crypt.tex b/doc/crypt.tex index 58534e6..ea4a3ee 100644 --- a/doc/crypt.tex +++ b/doc/crypt.tex @@ -2281,8 +2281,8 @@ int chacha20poly1305_memory(const unsigned char *key, int direction); \end{verbatim} This will initialize the ChaCha20--Poly1305 state with the given key, IV and AAD value then proceed to -encrypt (\textit{direction} equals \textbf{CHCHA20POLY1305\_ENCRYPT}) or decrypt (\textit{direction} equals -\textbf{CHCHA20POLY1305\_DECRYPT}) the message text and store the final message tag. The definition of the +encrypt (\textit{direction} equals \textbf{CHACHA20POLY1305\_ENCRYPT}) or decrypt (\textit{direction} equals +\textbf{CHACHA20POLY1305\_DECRYPT}) the message text and store the final message tag. The definition of the variables is the same as it is for all the manual functions. \chapter{One-Way Cryptographic Hash Functions} diff --git a/src/encauth/chachapoly/chacha20poly1305_memory.c b/src/encauth/chachapoly/chacha20poly1305_memory.c index e1999cb..54e2011 100644 --- a/src/encauth/chachapoly/chacha20poly1305_memory.c +++ b/src/encauth/chachapoly/chacha20poly1305_memory.c @@ -24,7 +24,7 @@ @param out The ciphertext @param tag [out] The MAC tag @param taglen [in/out] The MAC tag length - @param direction Encrypt or Decrypt mode (CHCHA20POLY1305_ENCRYPT or CHCHA20POLY1305_DECRYPT) + @param direction Encrypt or Decrypt mode (CHACHA20POLY1305_ENCRYPT or CHACHA20POLY1305_DECRYPT) @return CRYPT_OK on success */ int chacha20poly1305_memory(const unsigned char *key, unsigned long keylen, @@ -49,10 +49,10 @@ int chacha20poly1305_memory(const unsigned char *key, unsigned long keylen, if (aad && aadlen > 0) { if ((err = chacha20poly1305_add_aad(&st, aad, aadlen)) != CRYPT_OK) { goto LBL_ERR; } } - if (direction == CHCHA20POLY1305_ENCRYPT) { + if (direction == CHACHA20POLY1305_ENCRYPT) { if ((err = chacha20poly1305_encrypt(&st, in, inlen, out)) != CRYPT_OK) { goto LBL_ERR; } } - else if (direction == CHCHA20POLY1305_DECRYPT) { + else if (direction == CHACHA20POLY1305_DECRYPT) { if ((err = chacha20poly1305_decrypt(&st, in, inlen, out)) != CRYPT_OK) { goto LBL_ERR; } } else { diff --git a/src/encauth/chachapoly/chacha20poly1305_test.c b/src/encauth/chachapoly/chacha20poly1305_test.c index ee44e68..2ba88dd 100644 --- a/src/encauth/chachapoly/chacha20poly1305_test.c +++ b/src/encauth/chachapoly/chacha20poly1305_test.c @@ -71,14 +71,14 @@ int chacha20poly1305_test(void) /* chacha20poly1305_memory - encrypt */ len = sizeof(emac); if ((err = chacha20poly1305_memory(k, sizeof(k), i12, sizeof(i12), aad, sizeof(aad), (unsigned char *)m, - mlen, ct, emac, &len, CHCHA20POLY1305_ENCRYPT)) != CRYPT_OK) return err; + mlen, ct, emac, &len, CHACHA20POLY1305_ENCRYPT)) != CRYPT_OK) return err; if (compare_testvector(ct, mlen, enc, sizeof(enc), "ENC-CT2", 1) != 0) return CRYPT_FAIL_TESTVECTOR; if (compare_testvector(emac, len, tag, sizeof(tag), "ENC-TAG2", 2) != 0) return CRYPT_FAIL_TESTVECTOR; /* chacha20poly1305_memory - decrypt */ len = sizeof(dmac); if ((err = chacha20poly1305_memory(k, sizeof(k), i12, sizeof(i12), aad, sizeof(aad), - ct, mlen, pt, dmac, &len, CHCHA20POLY1305_DECRYPT)) != CRYPT_OK) return err; + ct, mlen, pt, dmac, &len, CHACHA20POLY1305_DECRYPT)) != CRYPT_OK) return err; if (compare_testvector(pt, mlen, m, mlen, "DEC-PT2", 3) != 0) return CRYPT_FAIL_TESTVECTOR; if (compare_testvector(dmac, len, tag, sizeof(tag), "DEC-TAG2", 4) != 0) return CRYPT_FAIL_TESTVECTOR; diff --git a/src/headers/tomcrypt_mac.h b/src/headers/tomcrypt_mac.h index 4081cc7..dea48e1 100644 --- a/src/headers/tomcrypt_mac.h +++ b/src/headers/tomcrypt_mac.h @@ -542,8 +542,8 @@ typedef struct { int aadflg; } chacha20poly1305_state; -#define CHCHA20POLY1305_ENCRYPT LTC_ENCRYPT -#define CHCHA20POLY1305_DECRYPT LTC_DECRYPT +#define CHACHA20POLY1305_ENCRYPT LTC_ENCRYPT +#define CHACHA20POLY1305_DECRYPT LTC_DECRYPT int chacha20poly1305_init(chacha20poly1305_state *st, const unsigned char *key, unsigned long keylen); int chacha20poly1305_setiv(chacha20poly1305_state *st, const unsigned char *iv, unsigned long ivlen);