Rename len to bitlen in function parameters
Clarify a few comments too.
diff --git a/include/mbedtls/aes.h b/include/mbedtls/aes.h
index 1ddde82..fb97c7b 100644
--- a/include/mbedtls/aes.h
+++ b/include/mbedtls/aes.h
@@ -83,24 +83,24 @@
*
* \param ctx AES context to be initialized
* \param key encryption key
- * \param keysize must be 128, 192 or 256
+ * \param keybits must be 128, 192 or 256
*
* \return 0 if successful, or MBEDTLS_ERR_AES_INVALID_KEY_LENGTH
*/
int mbedtls_aes_setkey_enc( mbedtls_aes_context *ctx, const unsigned char *key,
- unsigned int keysize );
+ unsigned int keybits );
/**
* \brief AES key schedule (decryption)
*
* \param ctx AES context to be initialized
* \param key decryption key
- * \param keysize must be 128, 192 or 256
+ * \param keybits must be 128, 192 or 256
*
* \return 0 if successful, or MBEDTLS_ERR_AES_INVALID_KEY_LENGTH
*/
int mbedtls_aes_setkey_dec( mbedtls_aes_context *ctx, const unsigned char *key,
- unsigned int keysize );
+ unsigned int keybits );
/**
* \brief AES-ECB block encryption/decryption
diff --git a/include/mbedtls/asn1.h b/include/mbedtls/asn1.h
index bec24d1..675a8eb 100644
--- a/include/mbedtls/asn1.h
+++ b/include/mbedtls/asn1.h
@@ -119,7 +119,7 @@
typedef struct mbedtls_asn1_buf
{
int tag; /**< ASN1 type, e.g. MBEDTLS_ASN1_UTF8_STRING. */
- size_t len; /**< ASN1 length, e.g. in octets. */
+ size_t len; /**< ASN1 length, in octets. */
unsigned char *p; /**< ASN1 data, e.g. in ASCII. */
}
mbedtls_asn1_buf;
@@ -129,7 +129,7 @@
*/
typedef struct mbedtls_asn1_bitstring
{
- size_t len; /**< ASN1 length, e.g. in octets. */
+ size_t len; /**< ASN1 length, in octets. */
unsigned char unused_bits; /**< Number of unused bits at the end of the string */
unsigned char *p; /**< Raw ASN1 data for the bit string */
}
diff --git a/include/mbedtls/blowfish.h b/include/mbedtls/blowfish.h
index d692058..74bbe26 100644
--- a/include/mbedtls/blowfish.h
+++ b/include/mbedtls/blowfish.h
@@ -80,12 +80,12 @@
*
* \param ctx Blowfish context to be initialized
* \param key encryption key
- * \param keysize must be between 32 and 448 bits
+ * \param keybits must be between 32 and 448 bits
*
* \return 0 if successful, or MBEDTLS_ERR_BLOWFISH_INVALID_KEY_LENGTH
*/
int mbedtls_blowfish_setkey( mbedtls_blowfish_context *ctx, const unsigned char *key,
- unsigned int keysize );
+ unsigned int keybits );
/**
* \brief Blowfish-ECB block encryption/decryption
diff --git a/include/mbedtls/camellia.h b/include/mbedtls/camellia.h
index c160341..37675d1 100644
--- a/include/mbedtls/camellia.h
+++ b/include/mbedtls/camellia.h
@@ -76,24 +76,24 @@
*
* \param ctx CAMELLIA context to be initialized
* \param key encryption key
- * \param keysize must be 128, 192 or 256
+ * \param keybits must be 128, 192 or 256
*
* \return 0 if successful, or MBEDTLS_ERR_CAMELLIA_INVALID_KEY_LENGTH
*/
int mbedtls_camellia_setkey_enc( mbedtls_camellia_context *ctx, const unsigned char *key,
- unsigned int keysize );
+ unsigned int keybits );
/**
* \brief CAMELLIA key schedule (decryption)
*
* \param ctx CAMELLIA context to be initialized
* \param key decryption key
- * \param keysize must be 128, 192 or 256
+ * \param keybits must be 128, 192 or 256
*
* \return 0 if successful, or MBEDTLS_ERR_CAMELLIA_INVALID_KEY_LENGTH
*/
int mbedtls_camellia_setkey_dec( mbedtls_camellia_context *ctx, const unsigned char *key,
- unsigned int keysize );
+ unsigned int keybits );
/**
* \brief CAMELLIA-ECB block encryption/decryption
diff --git a/include/mbedtls/ccm.h b/include/mbedtls/ccm.h
index 894794d..a1dba4f 100644
--- a/include/mbedtls/ccm.h
+++ b/include/mbedtls/ccm.h
@@ -56,14 +56,14 @@
* \param ctx CCM context to be initialized
* \param cipher cipher to use (a 128-bit block cipher)
* \param key encryption key
- * \param keysize key size in bits (must be acceptable by the cipher)
+ * \param keybits key size in bits (must be acceptable by the cipher)
*
* \return 0 if successful, or a cipher specific error code
*/
int mbedtls_ccm_setkey( mbedtls_ccm_context *ctx,
mbedtls_cipher_id_t cipher,
const unsigned char *key,
- unsigned int keysize );
+ unsigned int keybits );
/**
* \brief Free a CCM context and underlying cipher sub-context
diff --git a/include/mbedtls/cipher.h b/include/mbedtls/cipher.h
index 58c974b..46b82ca 100644
--- a/include/mbedtls/cipher.h
+++ b/include/mbedtls/cipher.h
@@ -282,14 +282,14 @@
*
* \param cipher_id Id of the cipher to search for
* (e.g. MBEDTLS_CIPHER_ID_AES)
- * \param key_length Length of the key in bits
+ * \param key_bitlen Length of the key in bits
* \param mode Cipher mode (e.g. MBEDTLS_MODE_CBC)
*
* \return the cipher information structure associated with the
* given cipher_type, or NULL if not found.
*/
const mbedtls_cipher_info_t *mbedtls_cipher_info_from_values( const mbedtls_cipher_id_t cipher_id,
- int key_length,
+ int key_bitlen,
const mbedtls_cipher_mode_t mode );
/**
@@ -447,7 +447,7 @@
* initialised using cipher_context_from_type or
* cipher_context_from_string.
* \param key The key to use.
- * \param key_length key length to use, in bits.
+ * \param key_bitlen key length to use, in bits.
* \param operation Operation that the key will be used for, either
* MBEDTLS_ENCRYPT or MBEDTLS_DECRYPT.
*
@@ -456,7 +456,7 @@
* error code.
*/
int mbedtls_cipher_setkey( mbedtls_cipher_context_t *ctx, const unsigned char *key,
- int key_length, const mbedtls_operation_t operation );
+ int key_bitlen, const mbedtls_operation_t operation );
#if defined(MBEDTLS_CIPHER_MODE_WITH_PADDING)
/**
diff --git a/include/mbedtls/gcm.h b/include/mbedtls/gcm.h
index c2f6d68..c6e9d26 100644
--- a/include/mbedtls/gcm.h
+++ b/include/mbedtls/gcm.h
@@ -69,14 +69,14 @@
* \param ctx GCM context to be initialized
* \param cipher cipher to use (a 128-bit block cipher)
* \param key encryption key
- * \param keysize must be 128, 192 or 256
+ * \param keybits must be 128, 192 or 256
*
* \return 0 if successful, or a cipher specific error code
*/
int mbedtls_gcm_setkey( mbedtls_gcm_context *ctx,
mbedtls_cipher_id_t cipher,
const unsigned char *key,
- unsigned int keysize );
+ unsigned int keybits );
/**
* \brief GCM buffer encryption/decryption using a block cipher
diff --git a/include/mbedtls/md.h b/include/mbedtls/md.h
index cb3e058..8e57025 100644
--- a/include/mbedtls/md.h
+++ b/include/mbedtls/md.h
@@ -172,7 +172,7 @@
*
* \param md_info message digest info
*
- * \return size of the message digest output.
+ * \return size of the message digest output in bytes.
*/
unsigned char mbedtls_md_get_size( const mbedtls_md_info_t *md_info );
@@ -269,7 +269,7 @@
*
* \param ctx HMAC context
* \param key HMAC secret key
- * \param keylen length of the HMAC key
+ * \param keylen length of the HMAC key in bytes
*
* \returns 0 on success, MBEDTLS_ERR_MD_BAD_INPUT_DATA if parameter
* verification fails.
@@ -323,7 +323,7 @@
*
* \param md_info message digest info
* \param key HMAC secret key
- * \param keylen length of the HMAC key
+ * \param keylen length of the HMAC key in bytes
* \param input buffer holding the data
* \param ilen length of the input data
* \param output Generic HMAC-result
diff --git a/include/mbedtls/md_internal.h b/include/mbedtls/md_internal.h
index 8cc8c5b..fe0feb3 100644
--- a/include/mbedtls/md_internal.h
+++ b/include/mbedtls/md_internal.h
@@ -52,10 +52,10 @@
/** Name of the message digest */
const char * name;
- /** Output length of the digest function */
+ /** Output length of the digest function in bytes */
int size;
- /** Block length of the digest function */
+ /** Block length of the digest function in bytes */
int block_size;
/** Digest initialisation function */