|
|
|
@ -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);
|
|
|
|
|