Add HW_FAILED error codes for message digest modules
New error codes to report failures from alternative implementations of
MD2, MD4, MD5, RIPEMD160, SHA-1, SHA-256, SHA-512.
diff --git a/include/mbedtls/error.h b/include/mbedtls/error.h
index 4eb7b78..16bc8dc 100644
--- a/include/mbedtls/error.h
+++ b/include/mbedtls/error.h
@@ -64,8 +64,15 @@
* NET 11 0x0042-0x0052 0x0043-0x0045
* ASN1 7 0x0060-0x006C
* PBKDF2 1 0x007C-0x007C
- * HMAC_DRBG 4 0x0003-0x0009
+ * HMAC_DRBG 4 0x0003-0x0009
* CCM 2 0x000D-0x000F
+ * MD2 1 0x002B-0x002B
+ * MD4 1 0x002D-0x002D
+ * MD5 1 0x002F-0x002F
+ * RIPEMD160 1 0x0031-0x0031
+ * SHA1 1 0x0035-0x0035
+ * SHA256 1 0x0037-0x0037
+ * SHA512 1 0x0039-0x0039
*
* High-level module nr (3 bits - 0x0...-0x7...)
* Name ID Nr of Errors
diff --git a/include/mbedtls/md2.h b/include/mbedtls/md2.h
index 925c69d..1a9940b 100644
--- a/include/mbedtls/md2.h
+++ b/include/mbedtls/md2.h
@@ -31,6 +31,8 @@
#include <stddef.h>
+#define MBEDTLS_ERR_MD2_HW_ACCEL_FAILED -0x002B /**< MD2 hardware accelerator failed */
+
#if ( defined(__ARMCC_VERSION) || defined(_MSC_VER) ) && \
!defined(inline) && !defined(__cplusplus)
#define inline __inline
diff --git a/include/mbedtls/md4.h b/include/mbedtls/md4.h
index f9341a8..ed20370 100644
--- a/include/mbedtls/md4.h
+++ b/include/mbedtls/md4.h
@@ -32,6 +32,8 @@
#include <stddef.h>
#include <stdint.h>
+#define MBEDTLS_ERR_MD4_HW_ACCEL_FAILED -0x002D /**< MD4 hardware accelerator failed */
+
#if ( defined(__ARMCC_VERSION) || defined(_MSC_VER) ) && \
!defined(inline) && !defined(__cplusplus)
#define inline __inline
diff --git a/include/mbedtls/md5.h b/include/mbedtls/md5.h
index bbfcae1..dfd704c 100644
--- a/include/mbedtls/md5.h
+++ b/include/mbedtls/md5.h
@@ -32,6 +32,8 @@
#include <stddef.h>
#include <stdint.h>
+#define MBEDTLS_ERR_MD5_HW_ACCEL_FAILED -0x002F /**< MD5 hardware accelerator failed */
+
#if !defined(MBEDTLS_MD5_ALT)
// Regular implementation
//
diff --git a/include/mbedtls/ripemd160.h b/include/mbedtls/ripemd160.h
index ad548d3..93a16bc 100644
--- a/include/mbedtls/ripemd160.h
+++ b/include/mbedtls/ripemd160.h
@@ -32,6 +32,8 @@
#include <stddef.h>
#include <stdint.h>
+#define MBEDTLS_ERR_RIPEMD160_HW_ACCEL_FAILED -0x0031 /**< RIPEMD160 hardware accelerator failed */
+
#if ( defined(__ARMCC_VERSION) || defined(_MSC_VER) ) && \
!defined(inline) && !defined(__cplusplus)
#define inline __inline
diff --git a/include/mbedtls/sha1.h b/include/mbedtls/sha1.h
index 03c474b..b879ee6 100644
--- a/include/mbedtls/sha1.h
+++ b/include/mbedtls/sha1.h
@@ -32,6 +32,8 @@
#include <stddef.h>
#include <stdint.h>
+#define MBEDTLS_ERR_SHA1_HW_ACCEL_FAILED -0x0035 /**< SHA-1 hardware accelerator failed */
+
#if ( defined(__ARMCC_VERSION) || defined(_MSC_VER) ) && \
!defined(inline) && !defined(__cplusplus)
#define inline __inline
diff --git a/include/mbedtls/sha256.h b/include/mbedtls/sha256.h
index 9c52f78..e9cc0ca 100644
--- a/include/mbedtls/sha256.h
+++ b/include/mbedtls/sha256.h
@@ -32,6 +32,8 @@
#include <stddef.h>
#include <stdint.h>
+#define MBEDTLS_ERR_SHA256_HW_ACCEL_FAILED -0x0037 /**< SHA-256 hardware accelerator failed */
+
#if ( defined(__ARMCC_VERSION) || defined(_MSC_VER) ) && \
!defined(inline) && !defined(__cplusplus)
#define inline __inline
diff --git a/include/mbedtls/sha512.h b/include/mbedtls/sha512.h
index 7e2fcc5..395f8bb 100644
--- a/include/mbedtls/sha512.h
+++ b/include/mbedtls/sha512.h
@@ -32,6 +32,8 @@
#include <stddef.h>
#include <stdint.h>
+#define MBEDTLS_ERR_SHA512_HW_ACCEL_FAILED -0x0039 /**< SHA-512 hardware accelerator failed */
+
#if ( defined(__ARMCC_VERSION) || defined(_MSC_VER) ) && \
!defined(inline) && !defined(__cplusplus)
#define inline __inline