The Great Renaming
A simple execution of tmp/invoke-rename.pl
diff --git a/include/mbedtls/ctr_drbg.h b/include/mbedtls/ctr_drbg.h
index ebab55f..f32ae80 100644
--- a/include/mbedtls/ctr_drbg.h
+++ b/include/mbedtls/ctr_drbg.h
@@ -21,20 +21,20 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifndef POLARSSL_CTR_DRBG_H
-#define POLARSSL_CTR_DRBG_H
+#ifndef MBEDTLS_CTR_DRBG_H
+#define MBEDTLS_CTR_DRBG_H
#include "aes.h"
-#define POLARSSL_ERR_CTR_DRBG_ENTROPY_SOURCE_FAILED -0x0034 /**< The entropy source failed. */
-#define POLARSSL_ERR_CTR_DRBG_REQUEST_TOO_BIG -0x0036 /**< Too many random requested in single call. */
-#define POLARSSL_ERR_CTR_DRBG_INPUT_TOO_BIG -0x0038 /**< Input too large (Entropy + additional). */
-#define POLARSSL_ERR_CTR_DRBG_FILE_IO_ERROR -0x003A /**< Read/write error in file. */
+#define MBEDTLS_ERR_CTR_DRBG_ENTROPY_SOURCE_FAILED -0x0034 /**< The entropy source failed. */
+#define MBEDTLS_ERR_CTR_DRBG_REQUEST_TOO_BIG -0x0036 /**< Too many random requested in single call. */
+#define MBEDTLS_ERR_CTR_DRBG_INPUT_TOO_BIG -0x0038 /**< Input too large (Entropy + additional). */
+#define MBEDTLS_ERR_CTR_DRBG_FILE_IO_ERROR -0x003A /**< Read/write error in file. */
-#define CTR_DRBG_BLOCKSIZE 16 /**< Block size used by the cipher */
-#define CTR_DRBG_KEYSIZE 32 /**< Key size used by the cipher */
-#define CTR_DRBG_KEYBITS ( CTR_DRBG_KEYSIZE * 8 )
-#define CTR_DRBG_SEEDLEN ( CTR_DRBG_KEYSIZE + CTR_DRBG_BLOCKSIZE )
+#define MBEDTLS_CTR_DRBG_BLOCKSIZE 16 /**< Block size used by the cipher */
+#define MBEDTLS_CTR_DRBG_KEYSIZE 32 /**< Key size used by the cipher */
+#define MBEDTLS_CTR_DRBG_KEYBITS ( MBEDTLS_CTR_DRBG_KEYSIZE * 8 )
+#define MBEDTLS_CTR_DRBG_SEEDLEN ( MBEDTLS_CTR_DRBG_KEYSIZE + MBEDTLS_CTR_DRBG_BLOCKSIZE )
/**< The seed length (counter + AES key) */
/**
@@ -45,34 +45,34 @@
* \{
*/
-#if !defined(CTR_DRBG_ENTROPY_LEN)
-#if defined(POLARSSL_SHA512_C) && !defined(POLARSSL_ENTROPY_FORCE_SHA256)
-#define CTR_DRBG_ENTROPY_LEN 48 /**< Amount of entropy used per seed by default (48 with SHA-512, 32 with SHA-256) */
+#if !defined(MBEDTLS_CTR_DRBG_ENTROPY_LEN)
+#if defined(MBEDTLS_SHA512_C) && !defined(MBEDTLS_ENTROPY_FORCE_SHA256)
+#define MBEDTLS_CTR_DRBG_ENTROPY_LEN 48 /**< Amount of entropy used per seed by default (48 with SHA-512, 32 with SHA-256) */
#else
-#define CTR_DRBG_ENTROPY_LEN 32 /**< Amount of entropy used per seed by default (48 with SHA-512, 32 with SHA-256) */
+#define MBEDTLS_CTR_DRBG_ENTROPY_LEN 32 /**< Amount of entropy used per seed by default (48 with SHA-512, 32 with SHA-256) */
#endif
#endif
-#if !defined(CTR_DRBG_RESEED_INTERVAL)
-#define CTR_DRBG_RESEED_INTERVAL 10000 /**< Interval before reseed is performed by default */
+#if !defined(MBEDTLS_CTR_DRBG_RESEED_INTERVAL)
+#define MBEDTLS_CTR_DRBG_RESEED_INTERVAL 10000 /**< Interval before reseed is performed by default */
#endif
-#if !defined(CTR_DRBG_MAX_INPUT)
-#define CTR_DRBG_MAX_INPUT 256 /**< Maximum number of additional input bytes */
+#if !defined(MBEDTLS_CTR_DRBG_MAX_INPUT)
+#define MBEDTLS_CTR_DRBG_MAX_INPUT 256 /**< Maximum number of additional input bytes */
#endif
-#if !defined(CTR_DRBG_MAX_REQUEST)
-#define CTR_DRBG_MAX_REQUEST 1024 /**< Maximum number of requested bytes per call */
+#if !defined(MBEDTLS_CTR_DRBG_MAX_REQUEST)
+#define MBEDTLS_CTR_DRBG_MAX_REQUEST 1024 /**< Maximum number of requested bytes per call */
#endif
-#if !defined(CTR_DRBG_MAX_SEED_INPUT)
-#define CTR_DRBG_MAX_SEED_INPUT 384 /**< Maximum size of (re)seed buffer */
+#if !defined(MBEDTLS_CTR_DRBG_MAX_SEED_INPUT)
+#define MBEDTLS_CTR_DRBG_MAX_SEED_INPUT 384 /**< Maximum size of (re)seed buffer */
#endif
/* \} name SECTION: Module settings */
-#define CTR_DRBG_PR_OFF 0 /**< No prediction resistance */
-#define CTR_DRBG_PR_ON 1 /**< Prediction resistance enabled */
+#define MBEDTLS_CTR_DRBG_PR_OFF 0 /**< No prediction resistance */
+#define MBEDTLS_CTR_DRBG_PR_ON 1 /**< Prediction resistance enabled */
#ifdef __cplusplus
extern "C" {
@@ -91,7 +91,7 @@
(re)seed */
int reseed_interval; /*!< reseed interval */
- aes_context aes_ctx; /*!< AES context */
+ mbedtls_aes_context aes_ctx; /*!< AES context */
/*
* Callbacks (Entropy)
@@ -100,7 +100,7 @@
void *p_entropy; /*!< context for the entropy function */
}
-ctr_drbg_context;
+mbedtls_ctr_drbg_context;
/**
* \brief CTR_DRBG initialization
@@ -117,9 +117,9 @@
* \param len Length of personalization data
*
* \return 0 if successful, or
- * POLARSSL_ERR_CTR_DRBG_ENTROPY_SOURCE_FAILED
+ * MBEDTLS_ERR_CTR_DRBG_ENTROPY_SOURCE_FAILED
*/
-int ctr_drbg_init( ctr_drbg_context *ctx,
+int mbedtls_ctr_drbg_init( mbedtls_ctr_drbg_context *ctx,
int (*f_entropy)(void *, unsigned char *, size_t),
void *p_entropy,
const unsigned char *custom,
@@ -130,7 +130,7 @@
*
* \param ctx CTR_DRBG context to clear
*/
-void ctr_drbg_free( ctr_drbg_context *ctx );
+void mbedtls_ctr_drbg_free( mbedtls_ctr_drbg_context *ctx );
/**
* \brief Enable / disable prediction resistance (Default: Off)
@@ -139,29 +139,29 @@
* Only use this if you have ample supply of good entropy!
*
* \param ctx CTR_DRBG context
- * \param resistance CTR_DRBG_PR_ON or CTR_DRBG_PR_OFF
+ * \param resistance MBEDTLS_CTR_DRBG_PR_ON or MBEDTLS_CTR_DRBG_PR_OFF
*/
-void ctr_drbg_set_prediction_resistance( ctr_drbg_context *ctx,
+void mbedtls_ctr_drbg_set_prediction_resistance( mbedtls_ctr_drbg_context *ctx,
int resistance );
/**
* \brief Set the amount of entropy grabbed on each (re)seed
- * (Default: CTR_DRBG_ENTROPY_LEN)
+ * (Default: MBEDTLS_CTR_DRBG_ENTROPY_LEN)
*
* \param ctx CTR_DRBG context
* \param len Amount of entropy to grab
*/
-void ctr_drbg_set_entropy_len( ctr_drbg_context *ctx,
+void mbedtls_ctr_drbg_set_entropy_len( mbedtls_ctr_drbg_context *ctx,
size_t len );
/**
* \brief Set the reseed interval
- * (Default: CTR_DRBG_RESEED_INTERVAL)
+ * (Default: MBEDTLS_CTR_DRBG_RESEED_INTERVAL)
*
* \param ctx CTR_DRBG context
* \param interval Reseed interval
*/
-void ctr_drbg_set_reseed_interval( ctr_drbg_context *ctx,
+void mbedtls_ctr_drbg_set_reseed_interval( mbedtls_ctr_drbg_context *ctx,
int interval );
/**
@@ -172,9 +172,9 @@
* \param len Length of additional data
*
* \return 0 if successful, or
- * POLARSSL_ERR_CTR_DRBG_ENTROPY_SOURCE_FAILED
+ * MBEDTLS_ERR_CTR_DRBG_ENTROPY_SOURCE_FAILED
*/
-int ctr_drbg_reseed( ctr_drbg_context *ctx,
+int mbedtls_ctr_drbg_reseed( mbedtls_ctr_drbg_context *ctx,
const unsigned char *additional, size_t len );
/**
@@ -184,11 +184,11 @@
* \param additional Additional data to update state with
* \param add_len Length of additional data
*
- * \note If add_len is greater than CTR_DRBG_MAX_SEED_INPUT,
- * only the first CTR_DRBG_MAX_SEED_INPUT bytes are used,
+ * \note If add_len is greater than MBEDTLS_CTR_DRBG_MAX_SEED_INPUT,
+ * only the first MBEDTLS_CTR_DRBG_MAX_SEED_INPUT bytes are used,
* the remaining ones are silently discarded.
*/
-void ctr_drbg_update( ctr_drbg_context *ctx,
+void mbedtls_ctr_drbg_update( mbedtls_ctr_drbg_context *ctx,
const unsigned char *additional, size_t add_len );
/**
@@ -203,10 +203,10 @@
* \param add_len Length of additional data
*
* \return 0 if successful, or
- * POLARSSL_ERR_CTR_DRBG_ENTROPY_SOURCE_FAILED, or
- * POLARSSL_ERR_CTR_DRBG_REQUEST_TOO_BIG
+ * MBEDTLS_ERR_CTR_DRBG_ENTROPY_SOURCE_FAILED, or
+ * MBEDTLS_ERR_CTR_DRBG_REQUEST_TOO_BIG
*/
-int ctr_drbg_random_with_add( void *p_rng,
+int mbedtls_ctr_drbg_random_with_add( void *p_rng,
unsigned char *output, size_t output_len,
const unsigned char *additional, size_t add_len );
@@ -220,13 +220,13 @@
* \param output_len Length of the buffer
*
* \return 0 if successful, or
- * POLARSSL_ERR_CTR_DRBG_ENTROPY_SOURCE_FAILED, or
- * POLARSSL_ERR_CTR_DRBG_REQUEST_TOO_BIG
+ * MBEDTLS_ERR_CTR_DRBG_ENTROPY_SOURCE_FAILED, or
+ * MBEDTLS_ERR_CTR_DRBG_REQUEST_TOO_BIG
*/
-int ctr_drbg_random( void *p_rng,
+int mbedtls_ctr_drbg_random( void *p_rng,
unsigned char *output, size_t output_len );
-#if defined(POLARSSL_FS_IO)
+#if defined(MBEDTLS_FS_IO)
/**
* \brief Write a seed file
*
@@ -234,10 +234,10 @@
* \param path Name of the file
*
* \return 0 if successful,
- * POLARSSL_ERR_CTR_DRBG_FILE_IO_ERROR on file error, or
- * POLARSSL_ERR_CTR_DRBG_ENTROPY_SOURCE_FAILED
+ * MBEDTLS_ERR_CTR_DRBG_FILE_IO_ERROR on file error, or
+ * MBEDTLS_ERR_CTR_DRBG_ENTROPY_SOURCE_FAILED
*/
-int ctr_drbg_write_seed_file( ctr_drbg_context *ctx, const char *path );
+int mbedtls_ctr_drbg_write_seed_file( mbedtls_ctr_drbg_context *ctx, const char *path );
/**
* \brief Read and update a seed file. Seed is added to this
@@ -247,22 +247,22 @@
* \param path Name of the file
*
* \return 0 if successful,
- * POLARSSL_ERR_CTR_DRBG_FILE_IO_ERROR on file error,
- * POLARSSL_ERR_CTR_DRBG_ENTROPY_SOURCE_FAILED or
- * POLARSSL_ERR_CTR_DRBG_INPUT_TOO_BIG
+ * MBEDTLS_ERR_CTR_DRBG_FILE_IO_ERROR on file error,
+ * MBEDTLS_ERR_CTR_DRBG_ENTROPY_SOURCE_FAILED or
+ * MBEDTLS_ERR_CTR_DRBG_INPUT_TOO_BIG
*/
-int ctr_drbg_update_seed_file( ctr_drbg_context *ctx, const char *path );
-#endif /* POLARSSL_FS_IO */
+int mbedtls_ctr_drbg_update_seed_file( mbedtls_ctr_drbg_context *ctx, const char *path );
+#endif /* MBEDTLS_FS_IO */
/**
* \brief Checkup routine
*
* \return 0 if successful, or 1 if the test failed
*/
-int ctr_drbg_self_test( int verbose );
+int mbedtls_ctr_drbg_self_test( int verbose );
/* Internal functions (do not call directly) */
-int ctr_drbg_init_entropy_len( ctr_drbg_context *,
+int mbedtls_ctr_drbg_init_entropy_len( mbedtls_ctr_drbg_context *,
int (*)(void *, unsigned char *, size_t), void *,
const unsigned char *, size_t, size_t );