Add documentation warnings for weak algorithms
MD2, MD4, MD5, DES and SHA-1 are considered weak and their use
constitutes a security risk. If possible, we recommend avoiding
dependencies on them, and considering stronger message digests and
ciphers instead.
diff --git a/include/polarssl/md5.h b/include/polarssl/md5.h
index d5ce136..915fe51 100644
--- a/include/polarssl/md5.h
+++ b/include/polarssl/md5.h
@@ -20,6 +20,11 @@
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * \warning MD5 is considered a weak message digest and its use constitutes a
+ * security risk. We recommend considering stronger message digests
+ * instead.
+ *
*/
#ifndef POLARSSL_MD5_H
#define POLARSSL_MD5_H
@@ -51,6 +56,11 @@
/**
* \brief MD5 context structure
+ *
+ * \warning MD5 is considered a weak message digest and its use
+ * constitutes a security risk. We recommend considering
+ * stronger message digests instead.
+ *
*/
typedef struct
{
@@ -67,6 +77,11 @@
* \brief Initialize MD5 context
*
* \param ctx MD5 context to be initialized
+ *
+ * \warning MD5 is considered a weak message digest and its use
+ * constitutes a security risk. We recommend considering
+ * stronger message digests instead.
+ *
*/
void md5_init( md5_context *ctx );
@@ -74,6 +89,11 @@
* \brief Clear MD5 context
*
* \param ctx MD5 context to be cleared
+ *
+ * \warning MD5 is considered a weak message digest and its use
+ * constitutes a security risk. We recommend considering
+ * stronger message digests instead.
+ *
*/
void md5_free( md5_context *ctx );
@@ -81,6 +101,11 @@
* \brief MD5 context setup
*
* \param ctx context to be initialized
+ *
+ * \warning MD5 is considered a weak message digest and its use
+ * constitutes a security risk. We recommend considering
+ * stronger message digests instead.
+ *
*/
void md5_starts( md5_context *ctx );
@@ -90,6 +115,11 @@
* \param ctx MD5 context
* \param input buffer holding the data
* \param ilen length of the input data
+ *
+ * \warning MD5 is considered a weak message digest and its use
+ * constitutes a security risk. We recommend considering
+ * stronger message digests instead.
+ *
*/
void md5_update( md5_context *ctx, const unsigned char *input, size_t ilen );
@@ -98,6 +128,11 @@
*
* \param ctx MD5 context
* \param output MD5 checksum result
+ *
+ * \warning MD5 is considered a weak message digest and its use
+ * constitutes a security risk. We recommend considering
+ * stronger message digests instead.
+ *
*/
void md5_finish( md5_context *ctx, unsigned char output[16] );
@@ -122,6 +157,11 @@
* \param input buffer holding the data
* \param ilen length of the input data
* \param output MD5 checksum result
+ *
+ * \warning MD5 is considered a weak message digest and its use
+ * constitutes a security risk. We recommend considering
+ * stronger message digests instead.
+ *
*/
void md5( const unsigned char *input, size_t ilen, unsigned char output[16] );
@@ -132,6 +172,11 @@
* \param output MD5 checksum result
*
* \return 0 if successful, or POLARSSL_ERR_MD5_FILE_IO_ERROR
+ *
+ * \warning MD5 is considered a weak message digest and its use
+ * constitutes a security risk. We recommend considering
+ * stronger message digests instead.
+ *
*/
int md5_file( const char *path, unsigned char output[16] );
@@ -141,6 +186,11 @@
* \param ctx HMAC context to be initialized
* \param key HMAC secret key
* \param keylen length of the HMAC key
+ *
+ * \warning MD5 is considered a weak message digest and its use
+ * constitutes a security risk. We recommend considering
+ * stronger message digests instead.
+ *
*/
void md5_hmac_starts( md5_context *ctx,
const unsigned char *key, size_t keylen );
@@ -151,6 +201,11 @@
* \param ctx HMAC context
* \param input buffer holding the data
* \param ilen length of the input data
+ *
+ * \warning MD5 is considered a weak message digest and its use
+ * constitutes a security risk. We recommend considering
+ * stronger message digests instead.
+ *
*/
void md5_hmac_update( md5_context *ctx,
const unsigned char *input, size_t ilen );
@@ -160,6 +215,11 @@
*
* \param ctx HMAC context
* \param output MD5 HMAC checksum result
+ *
+ * \warning MD5 is considered a weak message digest and its use
+ * constitutes a security risk. We recommend considering
+ * stronger message digests instead.
+ *
*/
void md5_hmac_finish( md5_context *ctx, unsigned char output[16] );
@@ -167,6 +227,11 @@
* \brief MD5 HMAC context reset
*
* \param ctx HMAC context to be reset
+ *
+ * \warning MD5 is considered a weak message digest and its use
+ * constitutes a security risk. We recommend considering
+ * stronger message digests instead.
+ *
*/
void md5_hmac_reset( md5_context *ctx );
@@ -178,6 +243,11 @@
* \param input buffer holding the data
* \param ilen length of the input data
* \param output HMAC-MD5 result
+ *
+ * \warning MD5 is considered a weak message digest and its use
+ * constitutes a security risk. We recommend considering
+ * stronger message digests instead.
+ *
*/
void md5_hmac( const unsigned char *key, size_t keylen,
const unsigned char *input, size_t ilen,
@@ -187,6 +257,11 @@
* \brief Checkup routine
*
* \return 0 if successful, or 1 if the test failed
+ *
+ * \warning MD5 is considered a weak message digest and its use
+ * constitutes a security risk. We recommend considering
+ * stronger message digests instead.
+ *
*/
int md5_self_test( int verbose );