Skip to content

Instantly share code, notes, and snippets.

@flandr
Created June 20, 2013 15:33
Show Gist options
  • Save flandr/5823800 to your computer and use it in GitHub Desktop.
Save flandr/5823800 to your computer and use it in GitHub Desktop.
From e8fb47a394e5c2e0ba6110ff96d216ba2c16bf61 Mon Sep 17 00:00:00 2001
From: Nate Rosenblum <nater@maginatics.com>
Date: Mon, 13 May 2013 16:33:19 -0700
Subject: [PATCH] Hide camellia symbols that collide with openssl
---
src/lib/crypto/builtin/camellia/camellia.c | 32 +++++++++++++++---------------
src/lib/crypto/builtin/camellia/camellia.h | 15 --------------
2 files changed, 16 insertions(+), 31 deletions(-)
diff --git a/src/lib/crypto/builtin/camellia/camellia.c b/src/lib/crypto/builtin/camellia/camellia.c
index 88dfe99..aecee4e 100644
--- a/src/lib/crypto/builtin/camellia/camellia.c
+++ b/src/lib/crypto/builtin/camellia/camellia.c
@@ -26,7 +26,7 @@
*/
/*
- * Algorithm Specification
+ * Algorithm Specification
* http://info.isl.ntt.co.jp/crypt/eng/camellia/specifications.html
*/
@@ -943,7 +943,7 @@ camellia_setup256(const unsigned char *key, u32 *subkey)
CamelliaSubkeyR(30) = CamelliaSubkeyL(30) ^ dw, CamelliaSubkeyL(30) = dw;
dw = CamelliaSubkeyL(31) ^ CamelliaSubkeyR(31), dw = CAMELLIA_RL8(dw);
CamelliaSubkeyR(31) = CamelliaSubkeyL(31) ^ dw,CamelliaSubkeyL(31) = dw;
-
+
return;
}
@@ -1057,7 +1057,7 @@ camellia_encrypt128(const u32 *subkey, u32 *io)
io[1] = io[3];
io[2] = t0;
io[3] = t1;
-
+
return;
}
@@ -1065,7 +1065,7 @@ void
camellia_decrypt128(const u32 *subkey, u32 *io)
{
u32 il,ir,t0,t1; /* temporary valiables */
-
+
/* pre whitening but absorb kw2*/
io[0] ^= CamelliaSubkeyL(24);
io[1] ^= CamelliaSubkeyR(24);
@@ -1278,7 +1278,7 @@ camellia_decrypt256(const u32 *subkey, u32 *io)
/* pre whitening but absorb kw2*/
io[0] ^= CamelliaSubkeyL(32);
io[1] ^= CamelliaSubkeyR(32);
-
+
/* main iteration */
CAMELLIA_ROUNDSM(io[0],io[1],
CamelliaSubkeyL(31),CamelliaSubkeyR(31),
@@ -1390,9 +1390,9 @@ camellia_decrypt256(const u32 *subkey, u32 *io)
* API for compatibility
*/
-void
-Camellia_Ekeygen(const int keyBitLength,
- const unsigned char *rawKey,
+static void
+Camellia_Ekeygen(const int keyBitLength,
+ const unsigned char *rawKey,
KEY_TABLE_TYPE keyTable)
{
switch(keyBitLength) {
@@ -1411,10 +1411,10 @@ Camellia_Ekeygen(const int keyBitLength,
}
-void
-Camellia_EncryptBlock(const int keyBitLength,
- const unsigned char *plaintext,
- const KEY_TABLE_TYPE keyTable,
+static void
+Camellia_EncryptBlock(const int keyBitLength,
+ const unsigned char *plaintext,
+ const KEY_TABLE_TYPE keyTable,
unsigned char *ciphertext)
{
u32 tmp[4];
@@ -1443,10 +1443,10 @@ Camellia_EncryptBlock(const int keyBitLength,
PUTU32(ciphertext + 12, tmp[3]);
}
-void
-Camellia_DecryptBlock(const int keyBitLength,
- const unsigned char *ciphertext,
- const KEY_TABLE_TYPE keyTable,
+static void
+Camellia_DecryptBlock(const int keyBitLength,
+ const unsigned char *ciphertext,
+ const KEY_TABLE_TYPE keyTable,
unsigned char *plaintext)
{
u32 tmp[4];
diff --git a/src/lib/crypto/builtin/camellia/camellia.h b/src/lib/crypto/builtin/camellia/camellia.h
index 1e59a2e..796d80e 100644
--- a/src/lib/crypto/builtin/camellia/camellia.h
+++ b/src/lib/crypto/builtin/camellia/camellia.h
@@ -56,21 +56,6 @@ void camellia_decrypt128(const u32 *subkey, u32 *io);
void camellia_encrypt256(const u32 *subkey, u32 *io);
void camellia_decrypt256(const u32 *subkey, u32 *io);
-void Camellia_Ekeygen(const int keyBitLength,
- const unsigned char *rawKey,
- KEY_TABLE_TYPE keyTable);
-
-void Camellia_EncryptBlock(const int keyBitLength,
- const unsigned char *plaintext,
- const KEY_TABLE_TYPE keyTable,
- unsigned char *cipherText);
-
-void Camellia_DecryptBlock(const int keyBitLength,
- const unsigned char *cipherText,
- const KEY_TABLE_TYPE keyTable,
- unsigned char *plaintext);
-
-
typedef uint16_t cam_fret; /* type for function return value */
#define camellia_good 1
#define camellia_bad 1
--
1.7.12.4 (Apple Git-37)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment