aboutsummaryrefslogtreecommitdiffstats
path: root/community/john/libressl.patch
blob: f60414d782ee46e8f4fde8c45b62f12dcbd9bc2e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
diff --git a/src/KRB4_fmt_plug.c b/src/KRB4_fmt_plug.c
index f2134bc..a64e059 100644
--- a/src/KRB4_fmt_plug.c
+++ b/src/KRB4_fmt_plug.c
@@ -50,7 +50,7 @@ john_register_one(&fmt_KRB4);
 #include "formats.h"
 #include "memdbg.h"
 
-#define TGT_LENGTH		16	/* 2 des_cblock's */
+#define TGT_LENGTH		16	/* 2 DES_cblock's */
 
 #define FORMAT_LABEL		"krb4"
 #define FORMAT_NAME		"Kerberos v4 TGT"
@@ -202,7 +202,7 @@ static int crypt_all(int *pcount, struct db_salt *salt)
 		                  saved_salt->realm,
 		                  &saved_key.key);
 	else
-		des_string_to_key(saved_key.string,
+		DES_string_to_key(saved_key.string,
 		                  &saved_key.key);
 
 	return *pcount;
diff --git a/src/KRB4_std_plug.c b/src/KRB4_std_plug.c
index 6e248ac..e85b0fc 100644
--- a/src/KRB4_std_plug.c
+++ b/src/KRB4_std_plug.c
@@ -35,8 +35,8 @@
 #include "KRB4_std.h"
 #include "memdbg.h"
 
-#ifndef des_fixup_key_parity
-#define des_fixup_key_parity	des_set_odd_parity
+#ifndef DES_fixup_key_parity
+#define DES_fixup_key_parity	DES_set_odd_parity
 #endif
 
 static void
@@ -88,7 +88,7 @@ afs_cmu_StringToKey (char *str, char *cell, DES_cblock *key)
             keybytes[i] = (unsigned char) (temp << 1);
         }
     }
-    des_fixup_key_parity (key);
+    DES_fixup_key_parity (key);
 }
 
 /*
@@ -111,16 +111,16 @@ afs_transarc_StringToKey (char *str, char *cell, DES_cblock *key)
 
     memcpy(&ivec, "kerberos", 8);
     memcpy(&temp_key, "kerberos", 8);
-    des_fixup_key_parity (&temp_key);
+    DES_fixup_key_parity (&temp_key);
     DES_key_sched (&temp_key, &schedule);
     DES_cbc_cksum ((unsigned char *)password, &ivec, passlen, &schedule, &ivec);
 
     memcpy(&temp_key, &ivec, 8);
-    des_fixup_key_parity (&temp_key);
+    DES_fixup_key_parity (&temp_key);
     DES_key_sched (&temp_key, &schedule);
     DES_cbc_cksum ((unsigned char *)password, key, passlen, &schedule, &ivec);
 
-    des_fixup_key_parity (key);
+    DES_fixup_key_parity (key);
 }
 
 void
diff --git a/src/common.h b/src/common.h
index fce8c63..7fbebc3 100644
--- a/src/common.h
+++ b/src/common.h
@@ -75,4 +75,6 @@ extern const char itoa16u[16]; // uppercase
  */
 extern void common_init(void);
 
+#define C_Block DES_cblock
+
 #endif
diff --git a/src/rawSHA0_fmt_plug.c b/src/rawSHA0_fmt_plug.c
deleted file mode 100644
index 9375fff..0000000
--- a/src/rawSHA0_fmt_plug.c
+++ /dev/null
@@ -1,210 +0,0 @@
-/*
- * This software is Copyright (c) 2011 magnum, and it is hereby released to the
- * general public under the following terms:  Redistribution and use in source
- * and binary forms, with or without modification, are permitted.
- *
- * Based on Raw-SHA1, but this is OpenSSL only.
- */
-
-#if FMT_EXTERNS_H
-extern struct fmt_main fmt_rawSHA_0;
-#elif FMT_REGISTERS_H
-john_register_one(&fmt_rawSHA_0);
-#else
-
-#include <string.h>
-#include <openssl/sha.h>
-
-#include "arch.h"
-#include "misc.h"
-#include "common.h"
-#include "formats.h"
-#include "memdbg.h"
-
-#define FORMAT_LABEL			"Raw-SHA"
-#define FORMAT_NAME			"\"SHA-0\""
-#define ALGORITHM_NAME			"SHA 32/" ARCH_BITS_STR
-
-#define BENCHMARK_COMMENT		""
-#define BENCHMARK_LENGTH		-1
-
-#define FORMAT_TAG			"$SHA$"
-#define TAG_LENGTH			5
-
-#define PLAINTEXT_LENGTH		125
-#define HASH_LENGTH			40
-#define CIPHERTEXT_LENGTH		(HASH_LENGTH + TAG_LENGTH)
-
-#define BINARY_SIZE			20
-#define BINARY_ALIGN			4
-#define SALT_SIZE			0
-#define SALT_ALIGN			1
-
-#define MIN_KEYS_PER_CRYPT		1
-#define MAX_KEYS_PER_CRYPT		1
-
-static struct fmt_tests tests[] = {
-	{"17e7ba749415d4d332447a43830ef39ac8100ab8", "magnum"},
-	{FORMAT_TAG "17e7ba749415d4d332447a43830ef39ac8100ab8", "magnum"},
-	{FORMAT_TAG "f96cea198ad1dd5617ac084a3d92c6107708c0ef", ""},
-	{NULL}
-};
-
-static char saved_key[PLAINTEXT_LENGTH + 1];
-static ARCH_WORD_32 crypt_key[BINARY_SIZE / 4];
-static SHA_CTX ctx;
-
-static int valid(char *ciphertext, struct fmt_main *self)
-{
-	int i;
-
-	if (!strncmp(ciphertext, FORMAT_TAG, TAG_LENGTH))
-		ciphertext += TAG_LENGTH;
-
-	if (strlen(ciphertext) != HASH_LENGTH)
-		return 0;
-
-	for (i = 0; i < HASH_LENGTH; i++){
-		if (!(  (('0' <= ciphertext[i])&&(ciphertext[i] <= '9')) ||
-					(('a' <= ciphertext[i])&&(ciphertext[i] <= 'f'))
-					|| (('A' <= ciphertext[i])&&(ciphertext[i] <= 'F'))))
-			return 0;
-	}
-	return 1;
-}
-
-static char *split(char *ciphertext, int index, struct fmt_main *self)
-{
-	static char out[CIPHERTEXT_LENGTH + 1];
-
-	if (!strncmp(ciphertext, FORMAT_TAG, TAG_LENGTH))
-		ciphertext += TAG_LENGTH;
-
-	strncpy(out, FORMAT_TAG, sizeof(out));
-
-	memcpy(&out[TAG_LENGTH], ciphertext, HASH_LENGTH);
-	out[CIPHERTEXT_LENGTH] = 0;
-
-	strlwr(&out[TAG_LENGTH]);
-
-	return out;
-}
-
-static void set_key(char *key, int index) {
-	strnzcpy(saved_key, key, PLAINTEXT_LENGTH+1);
-}
-
-static char *get_key(int index) {
-	return saved_key;
-}
-
-static int cmp_all(void *binary, int count) {
-	return !memcmp(binary, crypt_key, BINARY_SIZE);
-}
-
-static int cmp_exact(char *source, int count){
-  return (1);
-}
-
-static int cmp_one(void * binary, int index)
-{
-	return cmp_all(binary, index);
-}
-
-static int crypt_all(int *pcount, struct db_salt *salt)
-{
-	int count = *pcount;
-
-	SHA_Init( &ctx );
-	SHA_Update( &ctx, (unsigned char *) saved_key, strlen( saved_key ) );
-	SHA_Final( (unsigned char *) crypt_key, &ctx);
-
-	return count;
-}
-
-static void *binary(char *ciphertext)
-{
-	static ARCH_WORD_32 outb[BINARY_SIZE / 4];
-	unsigned char *realcipher = (unsigned char*)outb;
-	int i;
-
-	ciphertext += TAG_LENGTH;
-
-	for(i=0;i<BINARY_SIZE;i++)
-	{
-		realcipher[i] = atoi16[ARCH_INDEX(ciphertext[i*2])]*16 + atoi16[ARCH_INDEX(ciphertext[i*2+1])];
-	}
-	return (void *)realcipher;
-}
-
-static int get_hash_0(int index) { return ((unsigned int *)crypt_key)[0] & 0xf; }
-static int get_hash_1(int index) { return ((unsigned int *)crypt_key)[0] & 0xff; }
-static int get_hash_2(int index) { return ((unsigned int *)crypt_key)[0] & 0xfff; }
-static int get_hash_3(int index) { return ((unsigned int *)crypt_key)[0] & 0xffff; }
-static int get_hash_4(int index) { return ((unsigned int *)crypt_key)[0] & 0xfffff; }
-static int get_hash_5(int index) { return ((unsigned int *)crypt_key)[0] & 0xffffff; }
-static int get_hash_6(int index) { return ((unsigned int *)crypt_key)[0] & 0x7ffffff; }
-
-struct fmt_main fmt_rawSHA_0 = {
-	{
-		FORMAT_LABEL,
-		FORMAT_NAME,
-		ALGORITHM_NAME,
-		BENCHMARK_COMMENT,
-		BENCHMARK_LENGTH,
-		PLAINTEXT_LENGTH,
-		BINARY_SIZE,
-		BINARY_ALIGN,
-		SALT_SIZE,
-		SALT_ALIGN,
-		MIN_KEYS_PER_CRYPT,
-		MAX_KEYS_PER_CRYPT,
-		FMT_CASE | FMT_8_BIT | FMT_SPLIT_UNIFIES_CASE,
-#if FMT_MAIN_VERSION > 11
-		{ NULL },
-#endif
-		tests
-	}, {
-		fmt_default_init,
-		fmt_default_done,
-		fmt_default_reset,
-		fmt_default_prepare,
-		valid,
-		split,
-		binary,
-		fmt_default_salt,
-#if FMT_MAIN_VERSION > 11
-		{ NULL },
-#endif
-		fmt_default_source,
-		{
-			fmt_default_binary_hash_0,
-			fmt_default_binary_hash_1,
-			fmt_default_binary_hash_2,
-			fmt_default_binary_hash_3,
-			fmt_default_binary_hash_4,
-			fmt_default_binary_hash_5,
-			fmt_default_binary_hash_6
-		},
-		fmt_default_salt_hash,
-		fmt_default_set_salt,
-		set_key,
-		get_key,
-		fmt_default_clear_keys,
-		crypt_all,
-		{
-			get_hash_0,
-			get_hash_1,
-			get_hash_2,
-			get_hash_3,
-			get_hash_4,
-			get_hash_5,
-			get_hash_6
-		},
-		cmp_all,
-		cmp_one,
-		cmp_exact
-	}
-};
-
-#endif /* plugin stanza */