Check-in [483b914916]
Overview
Comment:Reduce argon2 code a bit by removing features we do not use
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 483b914916548a6aade46dffd9dcd11038067f6169371f6c391d5b4f46fb8066
User & Date: rkeene on 2019-01-11 18:03:42
Other Links: manifest | tags
Context
2019-01-12
21:48
Better handling of stats -- keep them in a transient SQLite3 DB check-in: a010d6c0a7 user: rkeene tags: trunk
2019-01-11
18:03
Reduce argon2 code a bit by removing features we do not use check-in: 483b914916 user: rkeene tags: trunk
17:50
Add more TODO check-in: 91adaf3629 user: rkeene tags: trunk
Changes

Modified build/argon2/Makefile from [44d77b732f] to [ddf60919a7].

1
2
3
4
5
6
7
8
9
10
11

12
13
14
15
16
17
18
PREFIX := $(shell pwd)/INST

all: out/argon2.c out/argon2.h

src-patched/argon2.c src-patched/argon2.h src-patched/blake2b.c src-patched/blamka-round-ref.h src-patched/core.c src-patched/core.h src-patched/encoding.c src-patched/encoding.h src-patched/ref.c: src-patched Makefile

src-patched: src/argon2.c src/argon2.h src/blake2b.c src/blamka-round-ref.h src/core.c src/core.h src/encoding.c src/encoding.h src/ref.c patches/argon2-20181109-tclamalgamation.diff Makefile
	rm -rf src-patched src-patched.new
	mkdir src-patched.new
	cp $^ src-patched.new/
	cd src-patched.new && patch --batch --posix -p1 < ../patches/argon2-20181109-tclamalgamation.diff

	mv src-patched.new src-patched

out/argon2.c: src-patched/argon2.c src-patched/ref.c src-patched/core.c src-patched/blake2b.c src-patched/encoding.c monocypher-blake2b.h Makefile
	mkdir -p out
	echo '#define ARGON2_NO_THREADS 1' > out/argon2.c.new.1
	echo '#define ARGON2_INTERNAL_ONLY 1' >> out/argon2.c.new.1
	cat monocypher-blake2b.h >> out/argon2.c.new.1






|




>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
PREFIX := $(shell pwd)/INST

all: out/argon2.c out/argon2.h

src-patched/argon2.c src-patched/argon2.h src-patched/blake2b.c src-patched/blamka-round-ref.h src-patched/core.c src-patched/core.h src-patched/encoding.c src-patched/encoding.h src-patched/ref.c: src-patched Makefile

src-patched: src/argon2.c src/argon2.h src/blake2b.c src/blamka-round-ref.h src/core.c src/core.h src/encoding.c src/encoding.h src/ref.c patches/argon2-20181109-tclamalgamation.diff patches/argon2-20181109-noencoding.diff Makefile
	rm -rf src-patched src-patched.new
	mkdir src-patched.new
	cp $^ src-patched.new/
	cd src-patched.new && patch --batch --posix -p1 < ../patches/argon2-20181109-tclamalgamation.diff
	cd src-patched.new && patch --batch --posix -p1 < ../patches/argon2-20181109-noencoding.diff
	mv src-patched.new src-patched

out/argon2.c: src-patched/argon2.c src-patched/ref.c src-patched/core.c src-patched/blake2b.c src-patched/encoding.c monocypher-blake2b.h Makefile
	mkdir -p out
	echo '#define ARGON2_NO_THREADS 1' > out/argon2.c.new.1
	echo '#define ARGON2_INTERNAL_ONLY 1' >> out/argon2.c.new.1
	cat monocypher-blake2b.h >> out/argon2.c.new.1

Added build/argon2/patches/argon2-20181109-noencoding.diff version [4dd2514bd1].







































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
diff -uNr a/argon2.c b/argon2.c
--- a/argon2.c	2019-01-11 10:45:44.193444670 -0600
+++ b/argon2.c	2019-01-11 12:01:03.325362284 -0600
@@ -163,12 +163,16 @@
 
     /* if encoding requested, write it */
     if (encoded && encodedlen) {
+        clear_internal_memory(out, hashlen);
+        free(out);
+        return ARGON2_ENCODING_FAIL;
+#if 0
         if (encode_string(encoded, encodedlen, &context, type) != ARGON2_OK) {
             clear_internal_memory(out, hashlen); /* wipe buffers if error */
             clear_internal_memory(encoded, encodedlen);
             free(out);
-            return ARGON2_ENCODING_FAIL;
         }
+#endif
     }
     clear_internal_memory(out, hashlen);
     free(out);
@@ -246,6 +250,7 @@
     return (int)((1 & ((d - 1) >> 8)) - 1);
 }
 
+#if 0
 int argon2_verify(const char *encoded, const void *pwd, const size_t pwdlen,
                   argon2_type type) {
 
@@ -326,6 +331,7 @@
 
     return argon2_verify(encoded, pwd, pwdlen, Argon2_id);
 }
+#endif
 
 int argon2d_ctx(argon2_context *context) {
     return argon2_ctx(context, Argon2_d);
@@ -444,9 +450,11 @@
     }
 }
 
+#if 0
 size_t argon2_encodedlen(uint32_t t_cost, uint32_t m_cost, uint32_t parallelism,
                          uint32_t saltlen, uint32_t hashlen, argon2_type type) {
   return strlen("$$v=$m=,t=,p=$$") + strlen(argon2_type2string(type, 0)) +
          numlen(t_cost) + numlen(m_cost) + numlen(parallelism) +
          b64len(saltlen) + b64len(hashlen) + numlen(ARGON2_VERSION_NUMBER) + 1;
 }
+#endif
diff -uNr a/encoding.c b/encoding.c
--- a/encoding.c	2019-01-11 10:45:44.195444669 -0600
+++ b/encoding.c	2019-01-11 12:01:35.466361698 -0600
@@ -15,6 +15,8 @@
  * software. If not, they may be obtained at the above URLs.
  */
 
+#if 0
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -461,3 +463,4 @@
     return len;
 }
 
+#endif
diff -uNr a/encoding.h b/encoding.h
--- a/encoding.h	2019-01-11 10:45:44.196444669 -0600
+++ b/encoding.h	2019-01-11 12:02:49.941360340 -0600
@@ -19,6 +19,7 @@
 #define ENCODING_H
 #include "argon2.h"
 
+#if 0
 #define ARGON2_MAX_DECODED_LANES UINT32_C(255)
 #define ARGON2_MIN_DECODED_SALT_LEN UINT32_C(8)
 #define ARGON2_MIN_DECODED_OUT_LEN UINT32_C(12)
@@ -55,3 +56,5 @@
 size_t numlen(uint32_t num);
 
 #endif
+
+#endif