aboutsummaryrefslogtreecommitdiff
path: root/src/daemon/https/lgl/des.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/daemon/https/lgl/des.h')
-rw-r--r--src/daemon/https/lgl/des.h113
1 files changed, 0 insertions, 113 deletions
diff --git a/src/daemon/https/lgl/des.h b/src/daemon/https/lgl/des.h
deleted file mode 100644
index d2ad058e..00000000
--- a/src/daemon/https/lgl/des.h
+++ /dev/null
@@ -1,113 +0,0 @@
1/* des.h --- DES cipher implementation.
2 * Copyright (C) 2005, 2007 Free Software Foundation, Inc.
3 *
4 * This file is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published
6 * by the Free Software Foundation; either version 2.1, or (at your
7 * option) any later version.
8 *
9 * This file is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with this file; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17 * 02110-1301, USA.
18 *
19 */
20
21/* Adapted for gnulib by Simon Josefsson, based on Libgcrypt. */
22
23#ifndef DES_H
24# define DES_H
25
26#include <stddef.h>
27#include <stdint.h>
28#include <stdbool.h>
29
30/*
31 * Encryption/Decryption context of DES
32 */
33typedef struct
34{
35 uint32_t encrypt_subkeys[32];
36 uint32_t decrypt_subkeys[32];
37} MHD_gl_des_ctx;
38
39/*
40 * Encryption/Decryption context of Triple-DES
41 */
42typedef struct
43{
44 uint32_t encrypt_subkeys[96];
45 uint32_t decrypt_subkeys[96];
46} MHD_gl_3des_ctx;
47
48/* Check whether the 8 byte key is weak. Does not check the parity
49 * bits of the key but simple ignore them. */
50extern bool MHD_gl_des_is_weak_key (const char *key);
51
52/*
53 * DES
54 * ---
55 */
56
57/* Fill a DES context CTX with subkeys calculated from 64bit KEY.
58 * Does not check parity bits, but simply ignore them. Does not check
59 * for weak keys. */
60extern void MHD_gl_des_setkey (MHD_gl_des_ctx * ctx, const char *key);
61
62/* Fill a DES context CTX with subkeys calculated from 64bit KEY, with
63 * weak key checking. Does not check parity bits, but simply ignore
64 * them. */
65extern bool MHD_gl_des_makekey (MHD_gl_des_ctx * ctx, const char *key,
66 size_t keylen);
67
68/* Electronic Codebook Mode DES encryption/decryption of data
69 * according to 'mode'. */
70extern void
71MHD_gl_des_ecb_crypt (MHD_gl_des_ctx * ctx, const char *from, char *to,
72 int mode);
73
74#define MHD_gl_des_ecb_encrypt(ctx, from, to) MHD_gl_des_ecb_crypt(ctx, from, to, 0)
75#define MHD_gl_des_ecb_decrypt(ctx, from, to) MHD_gl_des_ecb_crypt(ctx, from, to, 1)
76
77/* Triple-DES
78 * ----------
79 */
80
81/* Fill a Triple-DES context CTX with subkeys calculated from two
82 * 64bit keys in KEY1 and KEY2. Does not check the parity bits of the
83 * keys, but simply ignore them. Does not check for weak keys. */
84extern void
85MHD_gl_3des_set2keys (MHD_gl_3des_ctx * ctx, const char *key1,
86 const char *key2);
87
88/*
89 * Fill a Triple-DES context CTX with subkeys calculated from three
90 * 64bit keys in KEY1, KEY2 and KEY3. Does not check the parity bits
91 * of the keys, but simply ignore them. Does not check for weak
92 * keys. */
93extern void
94MHD_gl_3des_set3keys (MHD_gl_3des_ctx * ctx,
95 const char *key1, const char *key2, const char *key3);
96
97/* Fill a Triple-DES context CTX with subkeys calculated from three
98 * concatenated 64bit keys in KEY, with weak key checking. Does not
99 * check the parity bits of the keys, but simply ignore them. */
100extern bool
101MHD_gl_3des_makekey (MHD_gl_3des_ctx * ctx, const char *key, size_t keylen);
102
103/* Electronic Codebook Mode Triple-DES encryption/decryption of data
104 * according to 'mode'. Sometimes this mode is named 'EDE' mode
105 * (Encryption-Decryption-Encryption). */
106extern void
107MHD_gl_3des_ecb_crypt (MHD_gl_3des_ctx * ctx, const char *from, char *to,
108 int mode);
109
110#define MHD_gl_3des_ecb_encrypt(ctx, from, to) MHD_gl_3des_ecb_crypt(ctx,from,to,0)
111#define MHD_gl_3des_ecb_decrypt(ctx, from, to) MHD_gl_3des_ecb_crypt(ctx,from,to,1)
112
113#endif /* DES_H */