Browse Source

ccm: clarify pt and ct parameters in doc and API description

this fixes #42
[skip ci]
Steffen Jaeckel 11 years ago
parent
commit
aa72cfe1d9
2 changed files with 9 additions and 6 deletions
  1. 4 4
      crypt.tex
  2. 5 2
      src/encauth/ccm/ccm_memory.c

+ 4 - 4
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));

+ 5 - 2
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)