diff options
author | irungentoo <irungentoo@gmail.com> | 2013-07-08 12:36:11 -0400 |
---|---|---|
committer | irungentoo <irungentoo@gmail.com> | 2013-07-08 12:36:11 -0400 |
commit | c00cf85078a3d0ba372dc95d9ca1f54007d10ba5 (patch) | |
tree | c3d1a1da9c4e026d200152fa6b2acb46a218a808 /core/net_crypto.c | |
parent | 9a0d74908340e1a5e244eebae54feef584544261 (diff) |
Spelling mistakes fixed.
Diffstat (limited to 'core/net_crypto.c')
-rw-r--r-- | core/net_crypto.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/core/net_crypto.c b/core/net_crypto.c index 3a3785ff..980250d0 100644 --- a/core/net_crypto.c +++ b/core/net_crypto.c | |||
@@ -36,13 +36,13 @@ uint8_t self_secret_key[crypto_box_SECRETKEYBYTES]; | |||
36 | typedef struct | 36 | typedef struct |
37 | { | 37 | { |
38 | uint8_t public_key[crypto_box_PUBLICKEYBYTES];//the real public key of the peer. | 38 | uint8_t public_key[crypto_box_PUBLICKEYBYTES];//the real public key of the peer. |
39 | uint8_t recv_nonce[crypto_box_NONCEBYTES];//nonce of recieved packets | 39 | uint8_t recv_nonce[crypto_box_NONCEBYTES];//nonce of received packets |
40 | uint8_t sent_nonce[crypto_box_NONCEBYTES];//nonce of sent packets. | 40 | uint8_t sent_nonce[crypto_box_NONCEBYTES];//nonce of sent packets. |
41 | uint8_t sessionpublic_key[crypto_box_PUBLICKEYBYTES];//our public key for this session. | 41 | uint8_t sessionpublic_key[crypto_box_PUBLICKEYBYTES];//our public key for this session. |
42 | uint8_t sessionsecret_key[crypto_box_SECRETKEYBYTES];//our private key for this session. | 42 | uint8_t sessionsecret_key[crypto_box_SECRETKEYBYTES];//our private key for this session. |
43 | uint8_t peersessionpublic_key[crypto_box_PUBLICKEYBYTES];//The public key of the peer. | 43 | uint8_t peersessionpublic_key[crypto_box_PUBLICKEYBYTES];//The public key of the peer. |
44 | uint8_t status;//0 if no connection, 1 we have sent a handshake, 2 if connexion is not confirmed yet | 44 | uint8_t status;//0 if no connection, 1 we have sent a handshake, 2 if connexion is not confirmed yet |
45 | //(we have recieved a hanshake but no empty data packet), 3 if the connection is established. | 45 | //(we have received a handshake but no empty data packet), 3 if the connection is established. |
46 | //4 if the connection is timed out. | 46 | //4 if the connection is timed out. |
47 | uint16_t number; //Lossless_UDP connection number corresponding to this connection. | 47 | uint16_t number; //Lossless_UDP connection number corresponding to this connection. |
48 | 48 | ||
@@ -63,7 +63,7 @@ int outbound_friendrequests[MAX_FRIEND_REQUESTS]; | |||
63 | int incoming_connections[MAX_INCOMING]; | 63 | int incoming_connections[MAX_INCOMING]; |
64 | 64 | ||
65 | //encrypts plain of length length to encrypted of length + 16 using the | 65 | //encrypts plain of length length to encrypted of length + 16 using the |
66 | //public key(32 bytes) of the reciever and the secret key of the sender and a 24 byte nonce | 66 | //public key(32 bytes) of the receiver and the secret key of the sender and a 24 byte nonce |
67 | //return -1 if there was a problem. | 67 | //return -1 if there was a problem. |
68 | //return length of encrypted data if everything was fine. | 68 | //return length of encrypted data if everything was fine. |
69 | int encrypt_data(uint8_t * public_key, uint8_t * secret_key, uint8_t * nonce, | 69 | int encrypt_data(uint8_t * public_key, uint8_t * secret_key, uint8_t * nonce, |
@@ -93,7 +93,7 @@ int encrypt_data(uint8_t * public_key, uint8_t * secret_key, uint8_t * nonce, | |||
93 | } | 93 | } |
94 | 94 | ||
95 | //decrypts encrypted of length length to plain of length length - 16 using the | 95 | //decrypts encrypted of length length to plain of length length - 16 using the |
96 | //public key(32 bytes) of the sender, the secret key of the reciever and a 24 byte nonce | 96 | //public key(32 bytes) of the sender, the secret key of the receiver and a 24 byte nonce |
97 | //return -1 if there was a problem(decryption failed) | 97 | //return -1 if there was a problem(decryption failed) |
98 | //return length of plain data if everything was fine. | 98 | //return length of plain data if everything was fine. |
99 | int decrypt_data(uint8_t * public_key, uint8_t * secret_key, uint8_t * nonce, | 99 | int decrypt_data(uint8_t * public_key, uint8_t * secret_key, uint8_t * nonce, |
@@ -151,7 +151,7 @@ void random_nonce(uint8_t * nonce) | |||
151 | 151 | ||
152 | //return 0 if there is no received data in the buffer | 152 | //return 0 if there is no received data in the buffer |
153 | //return -1 if the packet was discarded. | 153 | //return -1 if the packet was discarded. |
154 | //return length of recieved data if successful | 154 | //return length of received data if successful |
155 | int read_cryptpacket(int crypt_connection_id, uint8_t * data) | 155 | int read_cryptpacket(int crypt_connection_id, uint8_t * data) |
156 | { | 156 | { |
157 | if(crypt_connection_id < 0 || crypt_connection_id >= MAX_CRYPTO_CONNECTIONS) | 157 | if(crypt_connection_id < 0 || crypt_connection_id >= MAX_CRYPTO_CONNECTIONS) |
@@ -436,7 +436,7 @@ int crypto_connect(uint8_t * public_key, IP_Port ip_port) | |||
436 | 436 | ||
437 | //handle an incoming connection | 437 | //handle an incoming connection |
438 | //return -1 if no crypto inbound connection | 438 | //return -1 if no crypto inbound connection |
439 | //return incomming connection id (Lossless_UDP one) if there is an incomming crypto connection | 439 | //return incoming connection id (Lossless_UDP one) if there is an incoming crypto connection |
440 | //Put the public key of the peer in public_key, the secret_nonce from the handshake into secret_nonce | 440 | //Put the public key of the peer in public_key, the secret_nonce from the handshake into secret_nonce |
441 | //and the session public key for the connection in session_key | 441 | //and the session public key for the connection in session_key |
442 | //to accept it see: accept_crypto_inbound(...) | 442 | //to accept it see: accept_crypto_inbound(...) |
@@ -524,8 +524,8 @@ int accept_crypto_inbound(int connection_id, uint8_t * public_key, uint8_t * sec | |||
524 | } | 524 | } |
525 | 525 | ||
526 | //return 0 if no connection, 1 we have sent a handshake, 2 if connexion is not confirmed yet | 526 | //return 0 if no connection, 1 we have sent a handshake, 2 if connexion is not confirmed yet |
527 | //(we have recieved a hanshake but no empty data packet), 3 if the connection is established. | 527 | //(we have received a handshake but no empty data packet), 3 if the connection is established. |
528 | //4 if the connection is timed out and wating to be killed | 528 | //4 if the connection is timed out and waiting to be killed |
529 | int is_cryptoconnected(int crypt_connection_id) | 529 | int is_cryptoconnected(int crypt_connection_id) |
530 | { | 530 | { |
531 | if(crypt_connection_id >= 0 && crypt_connection_id < MAX_CRYPTO_CONNECTIONS) | 531 | if(crypt_connection_id >= 0 && crypt_connection_id < MAX_CRYPTO_CONNECTIONS) |
@@ -580,8 +580,8 @@ void handle_incomings() | |||
580 | } | 580 | } |
581 | } | 581 | } |
582 | 582 | ||
583 | //handle recieved packets for not yet established crypto connections. | 583 | //handle received packets for not yet established crypto connections. |
584 | void recieve_crypto() | 584 | void receive_crypto() |
585 | { | 585 | { |
586 | uint32_t i; | 586 | uint32_t i; |
587 | for(i = 0; i < MAX_CRYPTO_CONNECTIONS; i++) | 587 | for(i = 0; i < MAX_CRYPTO_CONNECTIONS; i++) |
@@ -678,6 +678,6 @@ void doNetCrypto() | |||
678 | //handle new incoming connections | 678 | //handle new incoming connections |
679 | //handle friend requests | 679 | //handle friend requests |
680 | handle_incomings(); | 680 | handle_incomings(); |
681 | recieve_crypto(); | 681 | receive_crypto(); |
682 | killTimedout(); | 682 | killTimedout(); |
683 | } | 683 | } |