Remove some more crypto ifdef, fix a few small bugs
authorJohannes Berg <johannes@sipsolutions.net>
Thu, 13 Aug 2009 08:28:03 +0000 (11:28 +0300)
committerJouni Malinen <j@w1.fi>
Thu, 13 Aug 2009 08:28:03 +0000 (11:28 +0300)
src/crypto/crypto_internal.c
src/crypto/fips_prf_internal.c
src/crypto/md5-internal.c
src/crypto/md5.h
src/crypto/md5_i.h [new file with mode: 0644]
src/crypto/sha1-internal.c
src/crypto/sha1.h
src/crypto/sha1_i.h [new file with mode: 0644]

index f8d841f..98a1ddc 100644 (file)
@@ -24,8 +24,8 @@
 #include "tls/bignum.h"
 #include "tls/asn1.h"
 
-
-#ifdef CONFIG_CRYPTO_INTERNAL
+#include "sha1_i.h"
+#include "md5_i.h"
 
 #ifdef CONFIG_TLS_INTERNAL
 
@@ -831,6 +831,3 @@ error:
 }
 
 #endif /* EAP_FAST || EAP_SERVER_FAST || CONFIG_WPS */
-
-
-#endif /* CONFIG_CRYPTO_INTERNAL */
index 30acb64..a85cb14 100644 (file)
 
 #include "common.h"
 #include "sha1.h"
+#include "sha1_i.h"
 #include "crypto.h"
 
-void SHA1Transform(u32 state[5], const unsigned char buffer[64]);
-
 
 int fips186_2_prf(const u8 *seed, size_t seed_len, u8 *x, size_t xlen)
 {
index 6651da5..411757b 100644 (file)
@@ -16,6 +16,7 @@
 
 #include "common.h"
 #include "md5.h"
+#include "md5_i.h"
 #include "crypto.h"
 
 struct MD5Context {
@@ -24,12 +25,6 @@ struct MD5Context {
        u8 in[64];
 };
 
-#ifndef CONFIG_CRYPTO_INTERNAL
-static void MD5Init(struct MD5Context *context);
-static void MD5Update(struct MD5Context *context, unsigned char const *buf,
-                         unsigned len);
-static void MD5Final(unsigned char digest[16], struct MD5Context *context);
-#endif /* CONFIG_CRYPTO_INTERNAL */
 static void MD5Transform(u32 buf[4], u32 const in[16]);
 
 
index e82f396..480a2f4 100644 (file)
@@ -21,14 +21,4 @@ void hmac_md5_vector(const u8 *key, size_t key_len, size_t num_elem,
                     const u8 *addr[], const size_t *len, u8 *mac);
 void hmac_md5(const u8 *key, size_t key_len, const u8 *data, size_t data_len,
              u8 *mac);
-
-#ifdef CONFIG_CRYPTO_INTERNAL
-struct MD5Context;
-
-void MD5Init(struct MD5Context *context);
-void MD5Update(struct MD5Context *context, unsigned char const *buf,
-              unsigned len);
-void MD5Final(unsigned char digest[16], struct MD5Context *context);
-#endif /* CONFIG_CRYPTO_INTERNAL */
-
 #endif /* MD5_H */
diff --git a/src/crypto/md5_i.h b/src/crypto/md5_i.h
new file mode 100644 (file)
index 0000000..7697c3f
--- /dev/null
@@ -0,0 +1,25 @@
+/*
+ * MD5 internal definitions
+ * Copyright (c) 2003-2005, Jouni Malinen <j@w1.fi>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * Alternatively, this software may be distributed under the terms of BSD
+ * license.
+ *
+ * See README and COPYING for more details.
+ */
+
+#ifndef MD5_I_H
+#define MD5_I_H
+
+struct MD5Context;
+
+void MD5Init(struct MD5Context *context);
+void MD5Update(struct MD5Context *context, unsigned char const *buf,
+              unsigned len);
+void MD5Final(unsigned char digest[16], struct MD5Context *context);
+
+#endif /* MD5_I_H */
index f40401c..1f66e92 100644 (file)
@@ -16,6 +16,7 @@
 
 #include "common.h"
 #include "sha1.h"
+#include "sha1_i.h"
 #include "md5.h"
 #include "crypto.h"
 
@@ -27,11 +28,6 @@ struct SHA1Context {
 
 typedef struct SHA1Context SHA1_CTX;
 
-#ifndef CONFIG_CRYPTO_INTERNAL
-static void SHA1Init(struct SHA1Context *context);
-static void SHA1Update(struct SHA1Context *context, const void *data, u32 len);
-static void SHA1Final(unsigned char digest[20], struct SHA1Context *context);
-#endif /* CONFIG_CRYPTO_INTERNAL */
 void SHA1Transform(u32 state[5], const unsigned char buffer[64]);
 
 
index 9c365e2..b1dc647 100644 (file)
@@ -30,13 +30,4 @@ int __must_check tls_prf(const u8 *secret, size_t secret_len,
                         u8 *out, size_t outlen);
 void pbkdf2_sha1(const char *passphrase, const char *ssid, size_t ssid_len,
                 int iterations, u8 *buf, size_t buflen);
-
-#ifdef CONFIG_CRYPTO_INTERNAL
-struct SHA1Context;
-
-void SHA1Init(struct SHA1Context *context);
-void SHA1Update(struct SHA1Context *context, const void *data, u32 len);
-void SHA1Final(unsigned char digest[20], struct SHA1Context *context);
-#endif /* CONFIG_CRYPTO_INTERNAL */
-
 #endif /* SHA1_H */
diff --git a/src/crypto/sha1_i.h b/src/crypto/sha1_i.h
new file mode 100644 (file)
index 0000000..e4b3a96
--- /dev/null
@@ -0,0 +1,25 @@
+/*
+ * SHA1 internal definitions
+ * Copyright (c) 2003-2005, Jouni Malinen <j@w1.fi>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * Alternatively, this software may be distributed under the terms of BSD
+ * license.
+ *
+ * See README and COPYING for more details.
+ */
+
+#ifndef SHA1_I_H
+#define SHA1_I_H
+
+struct SHA1Context;
+
+void SHA1Init(struct SHA1Context *context);
+void SHA1Update(struct SHA1Context *context, const void *data, u32 len);
+void SHA1Final(unsigned char digest[20], struct SHA1Context *context);
+void SHA1Transform(u32 state[5], const unsigned char buffer[64]);
+
+#endif /* SHA1_I_H */