From 83e0bb8cd123c99eae0948d36b18d19e3d87e527 Mon Sep 17 00:00:00 2001 From: cel Date: Fri, 13 Oct 2017 09:56:22 -1000 Subject: [PATCH] Use sodium function to generate curve25519 keypair --- sbotc.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/sbotc.c b/sbotc.c index a5be292..88da832 100644 --- a/sbotc.c +++ b/sbotc.c @@ -100,14 +100,6 @@ static void usage() { exit(EXIT_FAILURE); } -static int auth_keypair(unsigned char *pk, unsigned char *sk, unsigned char *seed) { - unsigned char pk_ed[32], sk_ed[64]; - int rc = crypto_sign_seed_keypair(pk_ed, sk_ed, seed); - rc |= crypto_sign_ed25519_pk_to_curve25519(pk, pk_ed); - rc |= crypto_sign_ed25519_sk_to_curve25519(sk, sk_ed); - return rc; -} - static int tcp_connect(const char *host, const char *port) { struct addrinfo hints; struct addrinfo *result, *rp; @@ -166,9 +158,7 @@ static void shs_connect(int s, const unsigned char pubkey[32], const unsigned ch unsigned char local_app_mac[32], remote_app_mac[32]; unsigned char kx_pk[32], kx_sk[32]; - unsigned char seed[32]; - randombytes_buf(seed, sizeof(seed)); - rc = auth_keypair(kx_pk, kx_sk, seed); + rc = crypto_box_keypair(kx_pk, kx_sk); if (rc < 0) errx(1, "failed to generate auth keypair"); rc = crypto_auth(local_app_mac, kx_pk, 32, appkey);