In a server handshake initialise all the shit before sending our hello.
This commit is contained in:
parent
2680674c71
commit
722baa7da3
21
src/main.c
21
src/main.c
@ -167,6 +167,16 @@ int server_handshake(net_t *const n, crypt_session_t *const s, crypt_key_t *cons
|
||||
if ((hello = crypt_hello(ok)) == NULL)
|
||||
return -1;
|
||||
|
||||
if ((nonce = crypt_hello_get_nonce(hello, (unsigned char *)buffer, false)) == NULL) {
|
||||
free(hello);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (crypt_session_init(s, ok, rk, nonce, false) == -1) {
|
||||
free(nonce);
|
||||
return -3;
|
||||
}
|
||||
|
||||
n->raddr = n->inaddr;
|
||||
n->raddr_len = n->inaddr_len;
|
||||
|
||||
@ -175,18 +185,7 @@ int server_handshake(net_t *const n, crypt_session_t *const s, crypt_key_t *cons
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ((nonce = crypt_hello_get_nonce(hello, (unsigned char *)buffer, false)) == NULL) {
|
||||
free(hello);
|
||||
return -1;
|
||||
}
|
||||
|
||||
free(hello);
|
||||
|
||||
if (crypt_session_init(s, ok, rk, nonce, false) == -1) {
|
||||
free(nonce);
|
||||
return -3;
|
||||
}
|
||||
|
||||
free(nonce);
|
||||
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user