From aa72cfe1d9344a7371e5d7a43854b17cb696e470 Mon Sep 17 00:00:00 2001 From: Steffen Jaeckel Date: Wed, 30 Apr 2014 20:19:11 +0200 Subject: [PATCH] ccm: clarify pt and ct parameters in doc and API description this fixes #42 [skip ci] --- crypt.tex | 8 ++++---- src/encauth/ccm/ccm_memory.c | 7 +++++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/crypt.tex b/crypt.tex index 3a9d69b..7e854a7 100644 --- a/crypt.tex +++ b/crypt.tex @@ -1579,8 +1579,8 @@ int main(void) NULL, /* not prescheduled */ nonce, 12, /* 96-bit nonce */ NULL, 0, /* no header */ - pt, 32, /* 32-byte plaintext */ - ct, /* ciphertext */ + pt, 32, /* [in] 32-byte plaintext */ + ct, /* [out] ciphertext */ tag, &taglen, CCM_ENCRYPT)) != CRYPT_OK) { printf("ccm_memory error %s\n", error_to_string(err)); @@ -1596,8 +1596,8 @@ int main(void) NULL, /* not prescheduled */ nonce, 12, /* 96-bit nonce */ NULL, 0, /* no header */ - ct, 32, /* 32-byte ciphertext */ - pt, /* plaintext */ + pt, 32, /* [out] 32-byte plaintext */ + ct, /* [in] ciphertext */ tagcp, &taglen, CCM_DECRYPT)) != CRYPT_OK) { printf("ccm_memory error %s\n", error_to_string(err)); diff --git a/src/encauth/ccm/ccm_memory.c b/src/encauth/ccm/ccm_memory.c index b19e94a..1b4328d 100644 --- a/src/encauth/ccm/ccm_memory.c +++ b/src/encauth/ccm/ccm_memory.c @@ -19,6 +19,9 @@ /** CCM encrypt/decrypt and produce an authentication tag + + *1 'pt' and 'ct' can both be 'in' or 'out', depending on 'direction' + @param cipher The index of the cipher desired @param key The secret key to use @param keylen The length of the secret key (octets) @@ -27,9 +30,9 @@ @param noncelen The length of the nonce @param header The header for the session @param headerlen The length of the header (octets) - @param pt [out] The plaintext + @param pt [*1] The plaintext @param ptlen The length of the plaintext (octets) - @param ct [out] The ciphertext + @param ct [*1] The ciphertext @param tag [out] The destination tag @param taglen [in/out] The max size and resulting size of the authentication tag @param direction Encrypt or Decrypt direction (0 or 1)