git ssb

8+

cel / sbotc



Commit 83e0bb8cd123c99eae0948d36b18d19e3d87e527

Use sodium function to generate curve25519 keypair

cel committed on 10/13/2017, 7:57:33 PM
Parent: b6bf05e83bdc7ca9c431c57558c39bc61fc85011

Files changed

sbotc.cchanged
sbotc.cView
@@ -99,16 +99,8 @@
9999 "<method> [<argument>...]\n", stderr);
100100 exit(EXIT_FAILURE);
101101 }
102102
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-
111103 static int tcp_connect(const char *host, const char *port) {
112104 struct addrinfo hints;
113105 struct addrinfo *result, *rp;
114106 int s;
@@ -165,11 +157,9 @@
165157 int rc;
166158 unsigned char local_app_mac[32], remote_app_mac[32];
167159
168160 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);
172162 if (rc < 0) errx(1, "failed to generate auth keypair");
173163
174164 rc = crypto_auth(local_app_mac, kx_pk, 32, appkey);
175165 if (rc < 0) err(1, "failed to generate app mac");

Built with git-ssb-web