Check-in [1bb3e03251]
Overview
Comment:If we are not generating the private key, do not write to it at all
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 1bb3e03251b034de523095772369ad6fff64f1f1bd14e249a8ef6d7e10108558
User & Date: rkeene on 2018-07-02 06:09:37
Other Links: manifest | tags
Context
2018-07-02
06:10
A bit of restructuring and cleanup check-in: a1a2a058e2 user: rkeene tags: trunk
06:09
If we are not generating the private key, do not write to it at all check-in: 1bb3e03251 user: rkeene tags: trunk
03:51
When in debugging mode, do not strip out all symbols check-in: 6108bf018f user: rkeene tags: trunk
Changes

Modified tweetnacl/patches/tweetnacl-derivepubkey.diff from [22ab288973] to [13b5ea391c].


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
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
+
-
-
+
+


















+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+









diff -uNr a/tweetnacl.c.new b/tweetnacl.c.new
--- a/tweetnacl.c.new
+++ b/tweetnacl.c.new
--- a/tweetnacl.c.new	2018-07-01 15:49:55.377820017 -0500
+++ b/tweetnacl.c.new	2018-07-02 00:47:35.564231900 -0500
@@ -653,13 +653,15 @@
   scalarmult(p,q,s);
 }
 
-int crypto_sign_keypair(u8 *pk, u8 *sk)
+int crypto_sign_keypair(u8 *pk, u8 *sk, u8 generate_sk)
 {
   u8 d[64];
   gf p[4];
   int i;
 
-  randombytes(sk, 32);
+  if (generate_sk) {
+    randombytes(sk, 32);
+  }
   crypto_hash(d, sk, 32);
   d[0] &= 248;
   d[31] &= 127;
@@ -668,7 +670,9 @@
   scalarbase(p,d);
   pack(pk,p);
 
-  FOR(i,32) sk[32 + i] = pk[i];
+  if (generate_sk) {
+    FOR(i,32) sk[32 + i] = pk[i];
+  }
   return 0;
 }
 
diff -uNr a/tweetnacl.h.new b/tweetnacl.h.new
--- a/tweetnacl.h.new
+++ b/tweetnacl.h.new
--- a/tweetnacl.h.new	2018-07-01 15:49:55.377820017 -0500
+++ b/tweetnacl.h.new	2018-07-02 00:47:06.814232424 -0500
@@ -211,7 +211,7 @@
 #define crypto_sign_ed25519_tweet_SECRETKEYBYTES 64
 extern int crypto_sign_ed25519_tweet(unsigned char *,unsigned long long *,const unsigned char *,unsigned long long,const unsigned char *);
 extern int crypto_sign_ed25519_tweet_open(unsigned char *,unsigned long long *,const unsigned char *,unsigned long long,const unsigned char *);
-extern int crypto_sign_ed25519_tweet_keypair(unsigned char *,unsigned char *);
+extern int crypto_sign_ed25519_tweet_keypair(unsigned char *,unsigned char *, unsigned char);
 #define crypto_sign_ed25519_tweet_VERSION "-"
 #define crypto_sign_ed25519 crypto_sign_ed25519_tweet
 #define crypto_sign_ed25519_open crypto_sign_ed25519_tweet_open