Commit 83e0bb8cd123c99eae0948d36b18d19e3d87e527
Use sodium function to generate curve25519 keypair
cel committed on 10/13/2017, 7:57:33 PMParent: b6bf05e83bdc7ca9c431c57558c39bc61fc85011
Files changed
sbotc.c | changed |
sbotc.c | ||
---|---|---|
@@ -99,16 +99,8 @@ | ||
99 | 99 … | "<method> [<argument>...]\n", stderr); |
100 | 100 … | exit(EXIT_FAILURE); |
101 | 101 … | } |
102 | 102 … | |
103 | -static int auth_keypair(unsigned char *pk, unsigned char *sk, unsigned char *seed) { | |
104 | - unsigned char pk_ed[32], sk_ed[64]; | |
105 | - int rc = crypto_sign_seed_keypair(pk_ed, sk_ed, seed); | |
106 | - rc |= crypto_sign_ed25519_pk_to_curve25519(pk, pk_ed); | |
107 | - rc |= crypto_sign_ed25519_sk_to_curve25519(sk, sk_ed); | |
108 | - return rc; | |
109 | -} | |
110 | - | |
111 | 103 … | static int tcp_connect(const char *host, const char *port) { |
112 | 104 … | struct addrinfo hints; |
113 | 105 … | struct addrinfo *result, *rp; |
114 | 106 … | int s; |
@@ -165,11 +157,9 @@ | ||
165 | 157 … | int rc; |
166 | 158 … | unsigned char local_app_mac[32], remote_app_mac[32]; |
167 | 159 … | |
168 | 160 … | unsigned char kx_pk[32], kx_sk[32]; |
169 | - unsigned char seed[32]; | |
170 | - randombytes_buf(seed, sizeof(seed)); | |
171 | - rc = auth_keypair(kx_pk, kx_sk, seed); | |
161 … | + rc = crypto_box_keypair(kx_pk, kx_sk); | |
172 | 162 … | if (rc < 0) errx(1, "failed to generate auth keypair"); |
173 | 163 … | |
174 | 164 … | rc = crypto_auth(local_app_mac, kx_pk, 32, appkey); |
175 | 165 … | if (rc < 0) err(1, "failed to generate app mac"); |
Built with git-ssb-web