diff options
Diffstat (limited to 'core/net_crypto.h')
-rw-r--r-- | core/net_crypto.h | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/core/net_crypto.h b/core/net_crypto.h index a9bf1351..c8837c03 100644 --- a/core/net_crypto.h +++ b/core/net_crypto.h | |||
@@ -36,7 +36,7 @@ extern uint8_t self_public_key[crypto_box_PUBLICKEYBYTES]; | |||
36 | 36 | ||
37 | 37 | ||
38 | //encrypts plain of length length to encrypted of length + 16 using the | 38 | //encrypts plain of length length to encrypted of length + 16 using the |
39 | //public key(32 bytes) of the reciever and the secret key of the sender and a 24 byte nonce | 39 | //public key(32 bytes) of the receiver and the secret key of the sender and a 24 byte nonce |
40 | //return -1 if there was a problem. | 40 | //return -1 if there was a problem. |
41 | //return length of encrypted data if everything was fine. | 41 | //return length of encrypted data if everything was fine. |
42 | int encrypt_data(uint8_t * public_key, uint8_t * secret_key, uint8_t * nonce, | 42 | int encrypt_data(uint8_t * public_key, uint8_t * secret_key, uint8_t * nonce, |
@@ -44,7 +44,7 @@ int encrypt_data(uint8_t * public_key, uint8_t * secret_key, uint8_t * nonce, | |||
44 | 44 | ||
45 | 45 | ||
46 | //decrypts encrypted of length length to plain of length length - 16 using the | 46 | //decrypts encrypted of length length to plain of length length - 16 using the |
47 | //public key(32 bytes) of the sender, the secret key of the reciever and a 24 byte nonce | 47 | //public key(32 bytes) of the sender, the secret key of the receiver and a 24 byte nonce |
48 | //return -1 if there was a problem(decryption failed) | 48 | //return -1 if there was a problem(decryption failed) |
49 | //return length of plain data if everything was fine. | 49 | //return length of plain data if everything was fine. |
50 | int decrypt_data(uint8_t * public_key, uint8_t * secret_key, uint8_t * nonce, | 50 | int decrypt_data(uint8_t * public_key, uint8_t * secret_key, uint8_t * nonce, |
@@ -53,7 +53,7 @@ int decrypt_data(uint8_t * public_key, uint8_t * secret_key, uint8_t * nonce, | |||
53 | 53 | ||
54 | //return 0 if there is no received data in the buffer | 54 | //return 0 if there is no received data in the buffer |
55 | //return -1 if the packet was discarded. | 55 | //return -1 if the packet was discarded. |
56 | //return length of recieved data if successful | 56 | //return length of received data if successful |
57 | int read_cryptpacket(int crypt_connection_id, uint8_t * data); | 57 | int read_cryptpacket(int crypt_connection_id, uint8_t * data); |
58 | 58 | ||
59 | 59 | ||
@@ -94,7 +94,7 @@ int crypto_kill(int crypt_connection_id); | |||
94 | 94 | ||
95 | //handle an incoming connection | 95 | //handle an incoming connection |
96 | //return -1 if no crypto inbound connection | 96 | //return -1 if no crypto inbound connection |
97 | //return incomming connection id (Lossless_UDP one) if there is an incomming crypto connection | 97 | //return incoming connection id (Lossless_UDP one) if there is an incoming crypto connection |
98 | //Put the public key of the peer in public_key, the secret_nonce from the handshake into secret_nonce | 98 | //Put the public key of the peer in public_key, the secret_nonce from the handshake into secret_nonce |
99 | //and the session public key for the connection in session_key | 99 | //and the session public key for the connection in session_key |
100 | //to accept it see: accept_crypto_inbound(...) | 100 | //to accept it see: accept_crypto_inbound(...) |
@@ -108,8 +108,8 @@ int crypto_inbound(uint8_t * public_key, uint8_t * secret_nonce, uint8_t * sessi | |||
108 | int accept_crypto_inbound(int connection_id, uint8_t * public_key, uint8_t * secret_nonce, uint8_t * session_key); | 108 | int accept_crypto_inbound(int connection_id, uint8_t * public_key, uint8_t * secret_nonce, uint8_t * session_key); |
109 | 109 | ||
110 | //return 0 if no connection, 1 we have sent a handshake, 2 if connexion is not confirmed yet | 110 | //return 0 if no connection, 1 we have sent a handshake, 2 if connexion is not confirmed yet |
111 | //(we have recieved a hanshake but no empty data packet), 3 if the connection is established. | 111 | //(we have received a handshake but no empty data packet), 3 if the connection is established. |
112 | //4 if the connection is timed out and wating to be killed | 112 | //4 if the connection is timed out and waiting to be killed |
113 | int is_cryptoconnected(int crypt_connection_id); | 113 | int is_cryptoconnected(int crypt_connection_id); |
114 | 114 | ||
115 | 115 | ||