summaryrefslogtreecommitdiff
path: root/lgl/des.h
diff options
context:
space:
mode:
Diffstat (limited to 'lgl/des.h')
-rw-r--r--lgl/des.h43
1 files changed, 25 insertions, 18 deletions
diff --git a/lgl/des.h b/lgl/des.h
index 2b5f71237a..fdc8686f9a 100644
--- a/lgl/des.h
+++ b/lgl/des.h
@@ -1,5 +1,5 @@
/* des.h --- DES cipher implementation.
- * Copyright (C) 2005 Free Software Foundation, Inc.
+ * Copyright (C) 2005, 2007 Free Software Foundation, Inc.
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
@@ -34,7 +34,7 @@ typedef struct
{
uint32_t encrypt_subkeys[32];
uint32_t decrypt_subkeys[32];
-} des_ctx;
+} gl_des_ctx;
/*
* Encryption/Decryption context of Triple-DES
@@ -43,12 +43,12 @@ typedef struct
{
uint32_t encrypt_subkeys[96];
uint32_t decrypt_subkeys[96];
-} tripledes_ctx;
+} gl_3des_ctx;
/* Check whether the 8 byte key is weak. Does not check the parity
* bits of the key but simple ignore them. */
extern bool
-des_is_weak_key (const char * key);
+gl_des_is_weak_key (const char * key);
/*
* DES
@@ -59,21 +59,21 @@ des_is_weak_key (const char * key);
* Does not check parity bits, but simply ignore them. Does not check
* for weak keys. */
extern void
-des_setkey (des_ctx *ctx, const char * key);
+gl_des_setkey (gl_des_ctx *ctx, const char * key);
/* Fill a DES context CTX with subkeys calculated from 64bit KEY, with
* weak key checking. Does not check parity bits, but simply ignore
* them. */
extern bool
-des_makekey (des_ctx *ctx, const char * key, size_t keylen);
+gl_des_makekey (gl_des_ctx *ctx, const char * key, size_t keylen);
/* Electronic Codebook Mode DES encryption/decryption of data
* according to 'mode'. */
extern void
-des_ecb_crypt (des_ctx *ctx, const char * from, char * to, int mode);
+gl_des_ecb_crypt (gl_des_ctx *ctx, const char * from, char * to, int mode);
-#define des_ecb_encrypt(ctx, from, to) des_ecb_crypt(ctx, from, to, 0)
-#define des_ecb_decrypt(ctx, from, to) des_ecb_crypt(ctx, from, to, 1)
+#define gl_des_ecb_encrypt(ctx, from, to) gl_des_ecb_crypt(ctx, from, to, 0)
+#define gl_des_ecb_decrypt(ctx, from, to) gl_des_ecb_crypt(ctx, from, to, 1)
/* Triple-DES
* ----------
@@ -83,7 +83,9 @@ des_ecb_crypt (des_ctx *ctx, const char * from, char * to, int mode);
* 64bit keys in KEY1 and KEY2. Does not check the parity bits of the
* keys, but simply ignore them. Does not check for weak keys. */
extern void
-tripledes_set2keys (tripledes_ctx *ctx, const char * key1, const char * key2);
+gl_3des_set2keys (gl_3des_ctx *ctx,
+ const char * key1,
+ const char * key2);
/*
* Fill a Triple-DES context CTX with subkeys calculated from three
@@ -91,24 +93,29 @@ tripledes_set2keys (tripledes_ctx *ctx, const char * key1, const char * key2);
* of the keys, but simply ignore them. Does not check for weak
* keys. */
extern void
-tripledes_set3keys (tripledes_ctx *ctx, const char * key1,
- const char * key2, const char * key3);
+gl_3des_set3keys (gl_3des_ctx *ctx,
+ const char * key1,
+ const char * key2,
+ const char * key3);
/* Fill a Triple-DES context CTX with subkeys calculated from three
* concatenated 64bit keys in KEY, with weak key checking. Does not
* check the parity bits of the keys, but simply ignore them. */
extern bool
-tripledes_makekey (tripledes_ctx *ctx, const char * key, size_t keylen);
+gl_3des_makekey (gl_3des_ctx *ctx,
+ const char * key,
+ size_t keylen);
/* Electronic Codebook Mode Triple-DES encryption/decryption of data
* according to 'mode'. Sometimes this mode is named 'EDE' mode
* (Encryption-Decryption-Encryption). */
extern void
-tripledes_ecb_crypt (tripledes_ctx *ctx,
- const char * from,
- char * to, int mode);
+gl_3des_ecb_crypt (gl_3des_ctx *ctx,
+ const char * from,
+ char * to,
+ int mode);
-#define tripledes_ecb_encrypt(ctx, from, to) tripledes_ecb_crypt(ctx,from,to,0)
-#define tripledes_ecb_decrypt(ctx, from, to) tripledes_ecb_crypt(ctx,from,to,1)
+#define gl_3des_ecb_encrypt(ctx, from, to) gl_3des_ecb_crypt(ctx,from,to,0)
+#define gl_3des_ecb_decrypt(ctx, from, to) gl_3des_ecb_crypt(ctx,from,to,1)
#endif /* DES_H */