summaryrefslogtreecommitdiff
path: root/rijndael.c
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@zip.com.au>2014-12-10 02:12:51 +1100
committerDarren Tucker <dtucker@zip.com.au>2014-12-10 02:12:51 +1100
commit4bfad14ca56f8ae04f418997816b4ba84e2cfc3c (patch)
tree982dbd4b23db4170bbde75db297fe7b74966cd47 /rijndael.c
parent642652d280499691c8212ec6b79724b50008ce09 (diff)
Resync more with OpenBSD's rijndael.c, in particular "#if 0"-ing out some
unused code. Should fix compile error reported by plautrba at redhat.
Diffstat (limited to 'rijndael.c')
-rw-r--r--rijndael.c40
1 files changed, 6 insertions, 34 deletions
diff --git a/rijndael.c b/rijndael.c
index 91ef513c..0f81a1bd 100644
--- a/rijndael.c
+++ b/rijndael.c
@@ -708,25 +708,20 @@ rijndaelKeySetupEnc(u32 rk[/*4*(Nr + 1)*/], const u8 cipherKey[], int keyBits)
return 0;
}
+#if 0
/**
* Expand the cipher key into the decryption key schedule.
*
* @return the number of rounds for the given cipher key size.
*/
int
-rijndaelKeySetupDec(u32 rk[/*4*(Nr + 1)*/], const u8 cipherKey[], int keyBits,
- int have_encrypt)
+rijndaelKeySetupDec(u32 rk[/*4*(Nr + 1)*/], const u8 cipherKey[], int keyBits)
{
int Nr, i, j;
u32 temp;
/* expand the cipher key: */
- if (have_encrypt > 0) {
- /* Already done */
- Nr = have_encrypt;
- } else {
- Nr = rijndaelKeySetupEnc(rk, cipherKey, keyBits);
- }
+ Nr = rijndaelKeySetupEnc(rk, cipherKey, keyBits);
/* invert the order of the round keys: */
for (i = 0, j = 4*Nr; i < j; i += 4, j -= 4) {
@@ -761,6 +756,7 @@ rijndaelKeySetupDec(u32 rk[/*4*(Nr + 1)*/], const u8 cipherKey[], int keyBits,
}
return Nr;
}
+#endif
void
rijndaelEncrypt(const u32 rk[/*4*(Nr + 1)*/], int Nr, const u8 pt[16],
@@ -946,6 +942,7 @@ rijndaelEncrypt(const u32 rk[/*4*(Nr + 1)*/], int Nr, const u8 pt[16],
PUTU32(ct + 12, s3);
}
+#if 0
static void
rijndaelDecrypt(const u32 rk[/*4*(Nr + 1)*/], int Nr, const u8 ct[16],
u8 pt[16])
@@ -1129,29 +1126,4 @@ rijndaelDecrypt(const u32 rk[/*4*(Nr + 1)*/], int Nr, const u8 ct[16],
rk[3];
PUTU32(pt + 12, s3);
}
-
-void
-rijndael_set_key(rijndael_ctx *ctx, u_char *key, int bits, int do_encrypt)
-{
- ctx->Nr = rijndaelKeySetupEnc(ctx->ek, key, bits);
- if (do_encrypt) {
- ctx->decrypt = 0;
- memset(ctx->dk, 0, sizeof(ctx->dk));
- } else {
- ctx->decrypt = 1;
- memcpy(ctx->dk, ctx->ek, sizeof(ctx->dk));
- rijndaelKeySetupDec(ctx->dk, key, bits, ctx->Nr);
- }
-}
-
-void
-rijndael_decrypt(rijndael_ctx *ctx, u_char *src, u_char *dst)
-{
- rijndaelDecrypt(ctx->dk, ctx->Nr, src, dst);
-}
-
-void
-rijndael_encrypt(rijndael_ctx *ctx, u_char *src, u_char *dst)
-{
- rijndaelEncrypt(ctx->ek, ctx->Nr, src, dst);
-}
+#endif