argon2 1.1.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +7 -4
- data/Changelog.md +3 -0
- data/README.md +2 -0
- data/argon2.gemspec +1 -1
- data/ext/argon2_wrap/Makefile +6 -0
- data/ext/argon2_wrap/argon_wrap.c +1 -7
- data/ext/phc-winner-argon2/.gitignore +1 -0
- data/ext/phc-winner-argon2/Argon2.sln +64 -2
- data/ext/phc-winner-argon2/CHANGELOG.md +8 -1
- data/ext/phc-winner-argon2/LICENSE +301 -18
- data/ext/phc-winner-argon2/Makefile +85 -20
- data/ext/phc-winner-argon2/README.md +73 -30
- data/ext/phc-winner-argon2/argon2-specs.pdf +0 -0
- data/ext/phc-winner-argon2/include/argon2.h +73 -10
- data/ext/phc-winner-argon2/kats/argon2id +12304 -0
- data/ext/phc-winner-argon2/kats/argon2id.shasum +1 -0
- data/ext/phc-winner-argon2/kats/argon2id_v16 +12304 -0
- data/ext/phc-winner-argon2/kats/argon2id_v16.shasum +1 -0
- data/ext/phc-winner-argon2/kats/test.ps1 +1 -1
- data/ext/phc-winner-argon2/kats/test.sh +1 -1
- data/ext/phc-winner-argon2/latex/IEEEtran.cls +6347 -0
- data/ext/phc-winner-argon2/latex/argon2-spec.tex +920 -0
- data/ext/phc-winner-argon2/latex/pics/argon2-par.pdf +0 -0
- data/ext/phc-winner-argon2/latex/pics/compression.pdf +0 -0
- data/ext/phc-winner-argon2/latex/pics/generic.pdf +0 -0
- data/ext/phc-winner-argon2/latex/pics/power-distribution.jpg +0 -0
- data/ext/phc-winner-argon2/latex/tradeoff.bib +822 -0
- data/ext/phc-winner-argon2/libargon2.pc +16 -0
- data/ext/phc-winner-argon2/man/argon2.1 +13 -3
- data/ext/phc-winner-argon2/src/argon2.c +112 -68
- data/ext/phc-winner-argon2/src/bench.c +44 -27
- data/ext/phc-winner-argon2/src/blake2/blake2-impl.h +18 -5
- data/ext/phc-winner-argon2/src/blake2/blake2.h +17 -0
- data/ext/phc-winner-argon2/src/blake2/blake2b.c +25 -7
- data/ext/phc-winner-argon2/src/blake2/blamka-round-opt.h +17 -0
- data/ext/phc-winner-argon2/src/blake2/blamka-round-ref.h +17 -0
- data/ext/phc-winner-argon2/src/core.c +138 -110
- data/ext/phc-winner-argon2/src/core.h +41 -26
- data/ext/phc-winner-argon2/src/encoding.c +79 -55
- data/ext/phc-winner-argon2/src/encoding.h +25 -8
- data/ext/phc-winner-argon2/src/genkat.c +35 -39
- data/ext/phc-winner-argon2/src/genkat.h +11 -7
- data/ext/phc-winner-argon2/src/opt.c +65 -99
- data/ext/phc-winner-argon2/src/opt.h +15 -32
- data/ext/phc-winner-argon2/src/ref.c +50 -93
- data/ext/phc-winner-argon2/src/ref.h +15 -31
- data/ext/phc-winner-argon2/src/run.c +73 -30
- data/ext/phc-winner-argon2/src/test.c +33 -2
- data/ext/phc-winner-argon2/src/thread.c +21 -0
- data/ext/phc-winner-argon2/src/thread.h +21 -0
- data/ext/phc-winner-argon2/vs2015/Argon2Opt/Argon2Opt.vcxproj +69 -1
- data/ext/phc-winner-argon2/vs2015/Argon2OptBench/Argon2OptBench.vcxproj +69 -1
- data/ext/phc-winner-argon2/vs2015/Argon2OptDll/Argon2OptDll.vcxproj +225 -0
- data/ext/phc-winner-argon2/vs2015/Argon2OptDll/Argon2OptDll.vcxproj.filters +66 -0
- data/ext/phc-winner-argon2/vs2015/Argon2OptGenKAT/Argon2OptGenKAT.vcxproj +73 -1
- data/ext/phc-winner-argon2/vs2015/Argon2OptTestCI/Argon2OptTestCI.vcxproj +69 -1
- data/ext/phc-winner-argon2/vs2015/Argon2Ref/Argon2Ref.vcxproj +69 -1
- data/ext/phc-winner-argon2/vs2015/Argon2RefBench/Argon2RefBench.vcxproj +69 -1
- data/ext/phc-winner-argon2/vs2015/Argon2RefDll/Argon2RefDll.vcxproj +225 -0
- data/ext/phc-winner-argon2/vs2015/Argon2RefDll/Argon2RefDll.vcxproj.filters +66 -0
- data/ext/phc-winner-argon2/vs2015/Argon2RefGenKAT/Argon2RefGenKAT.vcxproj +69 -1
- data/ext/phc-winner-argon2/vs2015/Argon2RefTestCI/Argon2RefTestCI.vcxproj +69 -1
- data/lib/argon2.rb +3 -3
- data/lib/argon2/ffi_engine.rb +3 -3
- data/lib/argon2/version.rb +1 -1
- metadata +21 -5
@@ -1,14 +1,18 @@
|
|
1
1
|
/*
|
2
|
-
* Argon2 source code package
|
2
|
+
* Argon2 reference source code package - reference C implementations
|
3
3
|
*
|
4
|
-
*
|
4
|
+
* Copyright 2015
|
5
|
+
* Daniel Dinu, Dmitry Khovratovich, Jean-Philippe Aumasson, and Samuel Neves
|
5
6
|
*
|
6
|
-
*
|
7
|
+
* You may use this work under the terms of a Creative Commons CC0 1.0
|
8
|
+
* License/Waiver or the Apache Public License 2.0, at your option. The terms of
|
9
|
+
* these licenses can be found at:
|
7
10
|
*
|
8
|
-
*
|
9
|
-
*
|
10
|
-
*
|
11
|
-
*
|
11
|
+
* - CC0 1.0 Universal : http://creativecommons.org/publicdomain/zero/1.0
|
12
|
+
* - Apache 2.0 : http://www.apache.org/licenses/LICENSE-2.0
|
13
|
+
*
|
14
|
+
* You should have received a copy of both of these licenses along with this
|
15
|
+
* software. If not, they may be obtained at the above URLs.
|
12
16
|
*/
|
13
17
|
|
14
18
|
#ifndef ARGON2_REF_H
|
@@ -17,35 +21,15 @@
|
|
17
21
|
#include "core.h"
|
18
22
|
|
19
23
|
/*
|
20
|
-
* Function fills a new memory block
|
24
|
+
* Function fills a new memory block and optionally XORs the old block over the new one.
|
25
|
+
* @next_block must be initialized.
|
21
26
|
* @param prev_block Pointer to the previous block
|
22
27
|
* @param ref_block Pointer to the reference block
|
23
28
|
* @param next_block Pointer to the block to be constructed
|
29
|
+
* @param with_xor Whether to XOR into the new block (1) or just overwrite (0)
|
24
30
|
* @pre all block pointers must be valid
|
25
31
|
*/
|
26
|
-
void fill_block_with_xor(const block *prev_block, const block *ref_block,
|
27
|
-
block *next_block);
|
28
|
-
|
29
|
-
/* LEGACY CODE: version 1.2.1 and earlier
|
30
|
-
* Function fills a new memory block by overwriting @next_block.
|
31
|
-
* @param prev_block Pointer to the previous block
|
32
|
-
* @param ref_block Pointer to the reference block
|
33
|
-
* @param next_block Pointer to the block to be constructed
|
34
|
-
* @pre all block pointers must be valid
|
35
|
-
*/
|
36
32
|
void fill_block(const block *prev_block, const block *ref_block,
|
37
|
-
|
38
|
-
|
39
|
-
/*
|
40
|
-
* Generate pseudo-random values to reference blocks in the segment and puts
|
41
|
-
* them into the array
|
42
|
-
* @param instance Pointer to the current instance
|
43
|
-
* @param position Pointer to the current position
|
44
|
-
* @param pseudo_rands Pointer to the array of 64-bit values
|
45
|
-
* @pre pseudo_rands must point to @a instance->segment_length allocated values
|
46
|
-
*/
|
47
|
-
void generate_addresses(const argon2_instance_t *instance,
|
48
|
-
const argon2_position_t *position,
|
49
|
-
uint64_t *pseudo_rands);
|
33
|
+
block *next_block, int with_xor);
|
50
34
|
|
51
35
|
#endif /* ARGON2_REF_H */
|
@@ -1,14 +1,18 @@
|
|
1
1
|
/*
|
2
|
-
* Argon2 source code package
|
2
|
+
* Argon2 reference source code package - reference C implementations
|
3
3
|
*
|
4
|
-
*
|
4
|
+
* Copyright 2015
|
5
|
+
* Daniel Dinu, Dmitry Khovratovich, Jean-Philippe Aumasson, and Samuel Neves
|
5
6
|
*
|
6
|
-
*
|
7
|
+
* You may use this work under the terms of a Creative Commons CC0 1.0
|
8
|
+
* License/Waiver or the Apache Public License 2.0, at your option. The terms of
|
9
|
+
* these licenses can be found at:
|
7
10
|
*
|
8
|
-
*
|
9
|
-
*
|
10
|
-
*
|
11
|
-
*
|
11
|
+
* - CC0 1.0 Universal : http://creativecommons.org/publicdomain/zero/1.0
|
12
|
+
* - Apache 2.0 : http://www.apache.org/licenses/LICENSE-2.0
|
13
|
+
*
|
14
|
+
* You should have received a copy of both of these licenses along with this
|
15
|
+
* software. If not, they may be obtained at the above URLs.
|
12
16
|
*/
|
13
17
|
|
14
18
|
#define _GNU_SOURCE 1
|
@@ -33,23 +37,28 @@
|
|
33
37
|
#define UNUSED_PARAMETER(x) (void)(x)
|
34
38
|
|
35
39
|
static void usage(const char *cmd) {
|
36
|
-
printf("Usage: %s salt [-d] [-t iterations] [-m memory] "
|
37
|
-
"[-p parallelism] [-
|
40
|
+
printf("Usage: %s [-h] salt [-i|-d|-id] [-t iterations] [-m memory] "
|
41
|
+
"[-p parallelism] [-l hash length] [-e|-r] [-v (10|13)]\n",
|
38
42
|
cmd);
|
39
43
|
printf("\tPassword is read from stdin\n");
|
40
44
|
printf("Parameters:\n");
|
41
45
|
printf("\tsalt\t\tThe salt to use, at least 8 characters\n");
|
42
|
-
printf("\t-
|
46
|
+
printf("\t-i\t\tUse Argon2i (this is the default)\n");
|
47
|
+
printf("\t-d\t\tUse Argon2d instead of Argon2i\n");
|
48
|
+
printf("\t-id\t\tUse Argon2id instead of Argon2i\n");
|
43
49
|
printf("\t-t N\t\tSets the number of iterations to N (default = %d)\n",
|
44
50
|
T_COST_DEF);
|
45
51
|
printf("\t-m N\t\tSets the memory usage of 2^N KiB (default %d)\n",
|
46
52
|
LOG_M_COST_DEF);
|
47
53
|
printf("\t-p N\t\tSets parallelism to N threads (default %d)\n",
|
48
54
|
THREADS_DEF);
|
49
|
-
printf("\t-
|
55
|
+
printf("\t-l N\t\tSets hash output length to N bytes (default %d)\n",
|
50
56
|
OUTLEN_DEF);
|
51
57
|
printf("\t-e\t\tOutput only encoded hash\n");
|
52
58
|
printf("\t-r\t\tOutput only the raw bytes of the hash\n");
|
59
|
+
printf("\t-v (10|13)\tArgon2 version (defaults to the most recent version, currently %x)\n",
|
60
|
+
ARGON2_VERSION_NUMBER);
|
61
|
+
printf("\t-h\t\tPrint %s usage\n", cmd);
|
53
62
|
}
|
54
63
|
|
55
64
|
static void fatal(const char *error) {
|
@@ -75,16 +84,19 @@ Base64-encoded hash string
|
|
75
84
|
@m_cost amount of requested memory in KB
|
76
85
|
@lanes amount of requested parallelism
|
77
86
|
@threads actual parallelism
|
78
|
-
@type
|
87
|
+
@type Argon2 type we want to run
|
79
88
|
@encoded_only display only the encoded hash
|
80
89
|
@raw_only display only the hexadecimal of the hash
|
90
|
+
@version Argon2 version
|
81
91
|
*/
|
82
92
|
static void run(uint32_t outlen, char *pwd, char *salt, uint32_t t_cost,
|
83
93
|
uint32_t m_cost, uint32_t lanes, uint32_t threads,
|
84
|
-
argon2_type type, int encoded_only, int raw_only) {
|
94
|
+
argon2_type type, int encoded_only, int raw_only, uint32_t version) {
|
85
95
|
clock_t start_time, stop_time;
|
86
96
|
size_t pwdlen, saltlen, encodedlen;
|
87
97
|
int result;
|
98
|
+
unsigned char * out = NULL;
|
99
|
+
char * encoded = NULL;
|
88
100
|
|
89
101
|
start_time = clock();
|
90
102
|
|
@@ -93,31 +105,34 @@ static void run(uint32_t outlen, char *pwd, char *salt, uint32_t t_cost,
|
|
93
105
|
}
|
94
106
|
|
95
107
|
if (!salt) {
|
96
|
-
|
108
|
+
clear_internal_memory(pwd, strlen(pwd));
|
97
109
|
fatal("salt missing");
|
98
110
|
}
|
99
111
|
|
100
112
|
pwdlen = strlen(pwd);
|
101
113
|
saltlen = strlen(salt);
|
114
|
+
if(UINT32_MAX < saltlen) {
|
115
|
+
fatal("salt is too long");
|
116
|
+
}
|
102
117
|
|
103
118
|
UNUSED_PARAMETER(lanes);
|
104
119
|
|
105
|
-
|
120
|
+
out = malloc(outlen + 1);
|
106
121
|
if (!out) {
|
107
|
-
|
122
|
+
clear_internal_memory(pwd, strlen(pwd));
|
108
123
|
fatal("could not allocate memory for output");
|
109
124
|
}
|
110
125
|
|
111
|
-
encodedlen = argon2_encodedlen(t_cost, m_cost, lanes, saltlen, outlen);
|
112
|
-
|
126
|
+
encodedlen = argon2_encodedlen(t_cost, m_cost, lanes, (uint32_t)saltlen, outlen, type);
|
127
|
+
encoded = malloc(encodedlen + 1);
|
113
128
|
if (!encoded) {
|
114
|
-
|
129
|
+
clear_internal_memory(pwd, strlen(pwd));
|
115
130
|
fatal("could not allocate memory for hash");
|
116
131
|
}
|
117
132
|
|
118
133
|
result = argon2_hash(t_cost, m_cost, threads, pwd, pwdlen, salt, saltlen,
|
119
134
|
out, outlen, encoded, encodedlen, type,
|
120
|
-
|
135
|
+
version);
|
121
136
|
if (result != ARGON2_OK)
|
122
137
|
fatal(argon2_error_message(result));
|
123
138
|
|
@@ -157,9 +172,11 @@ int main(int argc, char *argv[]) {
|
|
157
172
|
uint32_t t_cost = T_COST_DEF;
|
158
173
|
uint32_t lanes = LANES_DEF;
|
159
174
|
uint32_t threads = THREADS_DEF;
|
160
|
-
argon2_type type = Argon2_i;
|
175
|
+
argon2_type type = Argon2_i; /* Argon2i is the default type */
|
176
|
+
int types_specified = 0;
|
161
177
|
int encoded_only = 0;
|
162
178
|
int raw_only = 0;
|
179
|
+
uint32_t version = ARGON2_VERSION_NUMBER;
|
163
180
|
int i;
|
164
181
|
size_t n;
|
165
182
|
char pwd[MAX_PASS_LEN], *salt;
|
@@ -167,6 +184,9 @@ int main(int argc, char *argv[]) {
|
|
167
184
|
if (argc < 2) {
|
168
185
|
usage(argv[0]);
|
169
186
|
return ARGON2_MISSING_ARGS;
|
187
|
+
} else if (argc >= 2 && strcmp(argv[1], "-h") == 0) {
|
188
|
+
usage(argv[0]);
|
189
|
+
return 1;
|
170
190
|
}
|
171
191
|
|
172
192
|
/* get password from stdin */
|
@@ -189,7 +209,10 @@ int main(int argc, char *argv[]) {
|
|
189
209
|
for (i = 2; i < argc; i++) {
|
190
210
|
const char *a = argv[i];
|
191
211
|
unsigned long input = 0;
|
192
|
-
if (!strcmp(a, "-
|
212
|
+
if (!strcmp(a, "-h")) {
|
213
|
+
usage(argv[0]);
|
214
|
+
return 1;
|
215
|
+
} else if (!strcmp(a, "-m")) {
|
193
216
|
if (i < argc - 1) {
|
194
217
|
i++;
|
195
218
|
input = strtoul(argv[i], NULL, 10);
|
@@ -232,42 +255,62 @@ int main(int argc, char *argv[]) {
|
|
232
255
|
} else {
|
233
256
|
fatal("missing -p argument");
|
234
257
|
}
|
235
|
-
} else if (!strcmp(a, "-
|
258
|
+
} else if (!strcmp(a, "-l")) {
|
236
259
|
if (i < argc - 1) {
|
237
260
|
i++;
|
238
261
|
input = strtoul(argv[i], NULL, 10);
|
239
262
|
outlen = input;
|
240
263
|
continue;
|
241
264
|
} else {
|
242
|
-
fatal("missing -
|
265
|
+
fatal("missing -l argument");
|
243
266
|
}
|
267
|
+
} else if (!strcmp(a, "-i")) {
|
268
|
+
type = Argon2_i;
|
269
|
+
++types_specified;
|
244
270
|
} else if (!strcmp(a, "-d")) {
|
245
271
|
type = Argon2_d;
|
272
|
+
++types_specified;
|
273
|
+
} else if (!strcmp(a, "-id")) {
|
274
|
+
type = Argon2_id;
|
275
|
+
++types_specified;
|
246
276
|
} else if (!strcmp(a, "-e")) {
|
247
277
|
encoded_only = 1;
|
248
278
|
} else if (!strcmp(a, "-r")) {
|
249
279
|
raw_only = 1;
|
280
|
+
} else if (!strcmp(a, "-v")) {
|
281
|
+
if (i < argc - 1) {
|
282
|
+
i++;
|
283
|
+
if (!strcmp(argv[i], "10")) {
|
284
|
+
version = ARGON2_VERSION_10;
|
285
|
+
} else if (!strcmp(argv[i], "13")) {
|
286
|
+
version = ARGON2_VERSION_13;
|
287
|
+
} else {
|
288
|
+
fatal("invalid Argon2 version");
|
289
|
+
}
|
290
|
+
} else {
|
291
|
+
fatal("missing -v argument");
|
292
|
+
}
|
250
293
|
} else {
|
251
294
|
fatal("unknown argument");
|
252
295
|
}
|
253
296
|
}
|
254
297
|
|
298
|
+
if (types_specified > 1) {
|
299
|
+
fatal("cannot specify multiple Argon2 types");
|
300
|
+
}
|
301
|
+
|
255
302
|
if(encoded_only && raw_only)
|
256
303
|
fatal("cannot provide both -e and -r");
|
257
304
|
|
258
305
|
if(!encoded_only && !raw_only) {
|
259
|
-
|
260
|
-
printf("Type:\t\tArgon2i\n");
|
261
|
-
} else {
|
262
|
-
printf("Type:\t\tArgon2d\n");
|
263
|
-
}
|
306
|
+
printf("Type:\t\t%s\n", argon2_type2string(type, 1));
|
264
307
|
printf("Iterations:\t%" PRIu32 " \n", t_cost);
|
265
308
|
printf("Memory:\t\t%" PRIu32 " KiB\n", m_cost);
|
266
309
|
printf("Parallelism:\t%" PRIu32 " \n", lanes);
|
267
310
|
}
|
268
311
|
|
269
312
|
run(outlen, pwd, salt, t_cost, m_cost, lanes, threads, type,
|
270
|
-
encoded_only, raw_only);
|
313
|
+
encoded_only, raw_only, version);
|
271
314
|
|
272
315
|
return ARGON2_OK;
|
273
316
|
}
|
@@ -1,3 +1,20 @@
|
|
1
|
+
/*
|
2
|
+
* Argon2 reference source code package - reference C implementations
|
3
|
+
*
|
4
|
+
* Copyright 2015
|
5
|
+
* Daniel Dinu, Dmitry Khovratovich, Jean-Philippe Aumasson, and Samuel Neves
|
6
|
+
*
|
7
|
+
* You may use this work under the terms of a Creative Commons CC0 1.0
|
8
|
+
* License/Waiver or the Apache Public License 2.0, at your option. The terms of
|
9
|
+
* these licenses can be found at:
|
10
|
+
*
|
11
|
+
* - CC0 1.0 Universal : http://creativecommons.org/publicdomain/zero/1.0
|
12
|
+
* - Apache 2.0 : http://www.apache.org/licenses/LICENSE-2.0
|
13
|
+
*
|
14
|
+
* You should have received a copy of both of these licenses along with this
|
15
|
+
* software. If not, they may be obtained at the above URLs.
|
16
|
+
*/
|
17
|
+
|
1
18
|
#include <stdio.h>
|
2
19
|
#include <stdint.h>
|
3
20
|
#include <inttypes.h>
|
@@ -111,9 +128,16 @@ int main() {
|
|
111
128
|
ret = argon2_verify("$argon2i$m=65536,t=2,p=1$c29tZXNhbHQ"
|
112
129
|
"9sTbSlTio3Biev89thdrlKKiCaYsjjYVJxGAL3swxpQ",
|
113
130
|
"password", strlen("password"), Argon2_i);
|
114
|
-
assert(ret ==
|
131
|
+
assert(ret == ARGON2_DECODING_FAIL);
|
115
132
|
printf("Recognise an invalid encoding: PASS\n");
|
116
133
|
|
134
|
+
/* Handle an invalid encoding correctly (salt is too short) */
|
135
|
+
ret = argon2_verify("$argon2i$m=65536,t=2,p=1$"
|
136
|
+
"$9sTbSlTio3Biev89thdrlKKiCaYsjjYVJxGAL3swxpQ",
|
137
|
+
"password", strlen("password"), Argon2_i);
|
138
|
+
assert(ret == ARGON2_SALT_TOO_SHORT);
|
139
|
+
printf("Recognise an invalid salt in encoding: PASS\n");
|
140
|
+
|
117
141
|
/* Handle an mismatching hash (the encoded password is "passwore") */
|
118
142
|
ret = argon2_verify("$argon2i$m=65536,t=2,p=1$c29tZXNhbHQ"
|
119
143
|
"$b2G3seW+uPzerwQQC+/E1K50CLLO7YXy0JRcaTuswRo",
|
@@ -183,9 +207,16 @@ int main() {
|
|
183
207
|
ret = argon2_verify("$argon2i$v=19$m=65536,t=2,p=1$c29tZXNhbHQ"
|
184
208
|
"wWKIMhR9lyDFvRz9YTZweHKfbftvj+qf+YFY4NeBbtA",
|
185
209
|
"password", strlen("password"), Argon2_i);
|
186
|
-
assert(ret ==
|
210
|
+
assert(ret == ARGON2_DECODING_FAIL);
|
187
211
|
printf("Recognise an invalid encoding: PASS\n");
|
188
212
|
|
213
|
+
/* Handle an invalid encoding correctly (salt is too short) */
|
214
|
+
ret = argon2_verify("$argon2i$v=19$m=65536,t=2,p=1$"
|
215
|
+
"$9sTbSlTio3Biev89thdrlKKiCaYsjjYVJxGAL3swxpQ",
|
216
|
+
"password", strlen("password"), Argon2_i);
|
217
|
+
assert(ret == ARGON2_SALT_TOO_SHORT);
|
218
|
+
printf("Recognise an invalid salt in encoding: PASS\n");
|
219
|
+
|
189
220
|
/* Handle an mismatching hash (the encoded password is "passwore") */
|
190
221
|
ret = argon2_verify("$argon2i$v=19$m=65536,t=2,p=1$c29tZXNhbHQ"
|
191
222
|
"$8iIuixkI73Js3G1uMbezQXD0b8LG4SXGsOwoQkdAQIM",
|
@@ -1,3 +1,22 @@
|
|
1
|
+
/*
|
2
|
+
* Argon2 reference source code package - reference C implementations
|
3
|
+
*
|
4
|
+
* Copyright 2015
|
5
|
+
* Daniel Dinu, Dmitry Khovratovich, Jean-Philippe Aumasson, and Samuel Neves
|
6
|
+
*
|
7
|
+
* You may use this work under the terms of a Creative Commons CC0 1.0
|
8
|
+
* License/Waiver or the Apache Public License 2.0, at your option. The terms of
|
9
|
+
* these licenses can be found at:
|
10
|
+
*
|
11
|
+
* - CC0 1.0 Universal : http://creativecommons.org/publicdomain/zero/1.0
|
12
|
+
* - Apache 2.0 : http://www.apache.org/licenses/LICENSE-2.0
|
13
|
+
*
|
14
|
+
* You should have received a copy of both of these licenses along with this
|
15
|
+
* software. If not, they may be obtained at the above URLs.
|
16
|
+
*/
|
17
|
+
|
18
|
+
#if !defined(ARGON2_NO_THREADS)
|
19
|
+
|
1
20
|
#include "thread.h"
|
2
21
|
#if defined(_WIN32)
|
3
22
|
#include <windows.h>
|
@@ -34,3 +53,5 @@ void argon2_thread_exit(void) {
|
|
34
53
|
pthread_exit(NULL);
|
35
54
|
#endif
|
36
55
|
}
|
56
|
+
|
57
|
+
#endif /* ARGON2_NO_THREADS */
|
@@ -1,5 +1,25 @@
|
|
1
|
+
/*
|
2
|
+
* Argon2 reference source code package - reference C implementations
|
3
|
+
*
|
4
|
+
* Copyright 2015
|
5
|
+
* Daniel Dinu, Dmitry Khovratovich, Jean-Philippe Aumasson, and Samuel Neves
|
6
|
+
*
|
7
|
+
* You may use this work under the terms of a Creative Commons CC0 1.0
|
8
|
+
* License/Waiver or the Apache Public License 2.0, at your option. The terms of
|
9
|
+
* these licenses can be found at:
|
10
|
+
*
|
11
|
+
* - CC0 1.0 Universal : http://creativecommons.org/publicdomain/zero/1.0
|
12
|
+
* - Apache 2.0 : http://www.apache.org/licenses/LICENSE-2.0
|
13
|
+
*
|
14
|
+
* You should have received a copy of both of these licenses along with this
|
15
|
+
* software. If not, they may be obtained at the above URLs.
|
16
|
+
*/
|
17
|
+
|
1
18
|
#ifndef ARGON2_THREAD_H
|
2
19
|
#define ARGON2_THREAD_H
|
20
|
+
|
21
|
+
#if !defined(ARGON2_NO_THREADS)
|
22
|
+
|
3
23
|
/*
|
4
24
|
Here we implement an abstraction layer for the simpĺe requirements
|
5
25
|
of the Argon2 code. We only require 3 primitives---thread creation,
|
@@ -43,4 +63,5 @@ int argon2_thread_join(argon2_thread_handle_t handle);
|
|
43
63
|
*/
|
44
64
|
void argon2_thread_exit(void);
|
45
65
|
|
66
|
+
#endif /* ARGON2_NO_THREADS */
|
46
67
|
#endif
|
@@ -5,6 +5,14 @@
|
|
5
5
|
<Configuration>Debug</Configuration>
|
6
6
|
<Platform>Win32</Platform>
|
7
7
|
</ProjectConfiguration>
|
8
|
+
<ProjectConfiguration Include="ReleaseStatic|Win32">
|
9
|
+
<Configuration>ReleaseStatic</Configuration>
|
10
|
+
<Platform>Win32</Platform>
|
11
|
+
</ProjectConfiguration>
|
12
|
+
<ProjectConfiguration Include="ReleaseStatic|x64">
|
13
|
+
<Configuration>ReleaseStatic</Configuration>
|
14
|
+
<Platform>x64</Platform>
|
15
|
+
</ProjectConfiguration>
|
8
16
|
<ProjectConfiguration Include="Release|Win32">
|
9
17
|
<Configuration>Release</Configuration>
|
10
18
|
<Platform>Win32</Platform>
|
@@ -37,6 +45,13 @@
|
|
37
45
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
38
46
|
<CharacterSet>MultiByte</CharacterSet>
|
39
47
|
</PropertyGroup>
|
48
|
+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseStatic|Win32'" Label="Configuration">
|
49
|
+
<ConfigurationType>Application</ConfigurationType>
|
50
|
+
<UseDebugLibraries>false</UseDebugLibraries>
|
51
|
+
<PlatformToolset>v140</PlatformToolset>
|
52
|
+
<WholeProgramOptimization>true</WholeProgramOptimization>
|
53
|
+
<CharacterSet>MultiByte</CharacterSet>
|
54
|
+
</PropertyGroup>
|
40
55
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
41
56
|
<ConfigurationType>Application</ConfigurationType>
|
42
57
|
<UseDebugLibraries>true</UseDebugLibraries>
|
@@ -50,6 +65,13 @@
|
|
50
65
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
51
66
|
<CharacterSet>MultiByte</CharacterSet>
|
52
67
|
</PropertyGroup>
|
68
|
+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseStatic|x64'" Label="Configuration">
|
69
|
+
<ConfigurationType>Application</ConfigurationType>
|
70
|
+
<UseDebugLibraries>false</UseDebugLibraries>
|
71
|
+
<PlatformToolset>v140</PlatformToolset>
|
72
|
+
<WholeProgramOptimization>true</WholeProgramOptimization>
|
73
|
+
<CharacterSet>MultiByte</CharacterSet>
|
74
|
+
</PropertyGroup>
|
53
75
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
54
76
|
<ImportGroup Label="ExtensionSettings">
|
55
77
|
</ImportGroup>
|
@@ -61,12 +83,18 @@
|
|
61
83
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
62
84
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
63
85
|
</ImportGroup>
|
86
|
+
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseStatic|Win32'" Label="PropertySheets">
|
87
|
+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
88
|
+
</ImportGroup>
|
64
89
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
65
90
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
66
91
|
</ImportGroup>
|
67
92
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
68
93
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
69
94
|
</ImportGroup>
|
95
|
+
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseStatic|x64'" Label="PropertySheets">
|
96
|
+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
97
|
+
</ImportGroup>
|
70
98
|
<PropertyGroup Label="UserMacros" />
|
71
99
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
72
100
|
<OutDir>$(SolutionDir)vs2015\build\</OutDir>
|
@@ -78,6 +106,11 @@
|
|
78
106
|
<IntDir>$(SolutionDir)vs2015\build\$(ProjectName)\</IntDir>
|
79
107
|
<IncludePath>$(SolutionDir)include;$(IncludePath)</IncludePath>
|
80
108
|
</PropertyGroup>
|
109
|
+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseStatic|Win32'">
|
110
|
+
<OutDir>$(SolutionDir)vs2015\build\</OutDir>
|
111
|
+
<IntDir>$(SolutionDir)vs2015\build\$(ProjectName)\</IntDir>
|
112
|
+
<IncludePath>$(SolutionDir)include;$(IncludePath)</IncludePath>
|
113
|
+
</PropertyGroup>
|
81
114
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
82
115
|
<OutDir>$(SolutionDir)vs2015\build\</OutDir>
|
83
116
|
<IntDir>$(SolutionDir)vs2015\build\$(ProjectName)\</IntDir>
|
@@ -88,6 +121,11 @@
|
|
88
121
|
<IntDir>$(SolutionDir)vs2015\build\$(ProjectName)\</IntDir>
|
89
122
|
<IncludePath>$(SolutionDir)include;$(IncludePath)</IncludePath>
|
90
123
|
</PropertyGroup>
|
124
|
+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseStatic|x64'">
|
125
|
+
<OutDir>$(SolutionDir)vs2015\build\</OutDir>
|
126
|
+
<IntDir>$(SolutionDir)vs2015\build\$(ProjectName)\</IntDir>
|
127
|
+
<IncludePath>$(SolutionDir)include;$(IncludePath)</IncludePath>
|
128
|
+
</PropertyGroup>
|
91
129
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
92
130
|
<ClCompile>
|
93
131
|
<WarningLevel>Level3</WarningLevel>
|
@@ -118,6 +156,21 @@
|
|
118
156
|
<OptimizeReferences>true</OptimizeReferences>
|
119
157
|
</Link>
|
120
158
|
</ItemDefinitionGroup>
|
159
|
+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseStatic|Win32'">
|
160
|
+
<ClCompile>
|
161
|
+
<WarningLevel>Level3</WarningLevel>
|
162
|
+
<Optimization>MaxSpeed</Optimization>
|
163
|
+
<FunctionLevelLinking>true</FunctionLevelLinking>
|
164
|
+
<IntrinsicFunctions>true</IntrinsicFunctions>
|
165
|
+
<SDLCheck>true</SDLCheck>
|
166
|
+
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
167
|
+
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
168
|
+
</ClCompile>
|
169
|
+
<Link>
|
170
|
+
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
171
|
+
<OptimizeReferences>true</OptimizeReferences>
|
172
|
+
</Link>
|
173
|
+
</ItemDefinitionGroup>
|
121
174
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
122
175
|
<ClCompile>
|
123
176
|
<WarningLevel>Level3</WarningLevel>
|
@@ -132,6 +185,21 @@
|
|
132
185
|
<OptimizeReferences>true</OptimizeReferences>
|
133
186
|
</Link>
|
134
187
|
</ItemDefinitionGroup>
|
188
|
+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseStatic|x64'">
|
189
|
+
<ClCompile>
|
190
|
+
<WarningLevel>Level3</WarningLevel>
|
191
|
+
<Optimization>MaxSpeed</Optimization>
|
192
|
+
<FunctionLevelLinking>true</FunctionLevelLinking>
|
193
|
+
<IntrinsicFunctions>true</IntrinsicFunctions>
|
194
|
+
<SDLCheck>true</SDLCheck>
|
195
|
+
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
196
|
+
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
197
|
+
</ClCompile>
|
198
|
+
<Link>
|
199
|
+
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
200
|
+
<OptimizeReferences>true</OptimizeReferences>
|
201
|
+
</Link>
|
202
|
+
</ItemDefinitionGroup>
|
135
203
|
<ItemGroup>
|
136
204
|
<ClInclude Include="..\..\include\argon2.h" />
|
137
205
|
<ClInclude Include="..\..\src\blake2\blake2-impl.h" />
|
@@ -155,4 +223,4 @@
|
|
155
223
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
156
224
|
<ImportGroup Label="ExtensionTargets">
|
157
225
|
</ImportGroup>
|
158
|
-
</Project>
|
226
|
+
</Project>
|