Added mechanism to provide alternative cipher / hash implementations
All symmetric cipher algorithms and hash algorithms now include support
for a POLARSSL_XXX_ALT flag that prevents the definition of the
algorithm context structure and all 'core' functions.
diff --git a/include/polarssl/sha4.h b/include/polarssl/sha4.h
index 6aae124..7b0cdf6 100644
--- a/include/polarssl/sha4.h
+++ b/include/polarssl/sha4.h
@@ -3,7 +3,7 @@
*
* \brief SHA-384 and SHA-512 cryptographic hash function
*
- * Copyright (C) 2006-2010, Brainspark B.V.
+ * Copyright (C) 2006-2013, Brainspark B.V.
*
* This file is part of PolarSSL (http://www.polarssl.org)
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
@@ -27,6 +27,8 @@
#ifndef POLARSSL_SHA4_H
#define POLARSSL_SHA4_H
+#include "config.h"
+
#include <string.h>
#if defined(_MSC_VER) || defined(__WATCOMC__)
@@ -39,6 +41,10 @@
#define POLARSSL_ERR_SHA4_FILE_IO_ERROR -0x007A /**< Read/write error in file. */
+#if !defined(POLARSSL_SHA1_ALT)
+// Regular implementation
+//
+
/**
* \brief SHA-512 context structure
*/
@@ -83,6 +89,18 @@
*/
void sha4_finish( sha4_context *ctx, unsigned char output[64] );
+#ifdef __cplusplus
+}
+#endif
+
+#else /* POLARSSL_SHA4_ALT */
+#include "sha4_alt.h"
+#endif /* POLARSSL_SHA4_ALT */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/**
* \brief Output = SHA-512( input buffer )
*