summaryrefslogtreecommitdiff
path: root/core/net_crypto.c
diff options
context:
space:
mode:
authorrlt3 <leroy@bythehilt.com>2013-08-01 16:01:29 -0400
committerrlt3 <leroy@bythehilt.com>2013-08-01 16:01:29 -0400
commit36698f08249fd1530cd7fdb7109a23c8c277beb6 (patch)
treea5b290aebfb8ede9bcfc3aed6e73b198ee4e677d /core/net_crypto.c
parent307e4d2e3edba4c1c297199a9785efcf628d7ee9 (diff)
parentffd69a6525cc706fadbf5ad8d68400fc1d6fd5b4 (diff)
Merge branch 'master' of https://github.com/rlt3/ProjectTox-Core
Diffstat (limited to 'core/net_crypto.c')
-rw-r--r--core/net_crypto.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/core/net_crypto.c b/core/net_crypto.c
index 83cb20a2..34d481ca 100644
--- a/core/net_crypto.c
+++ b/core/net_crypto.c
@@ -75,10 +75,9 @@ int encrypt_data(uint8_t *public_key, uint8_t *secret_key, uint8_t *nonce,
75 uint32_t i; 75 uint32_t i;
76 uint32_t check = 0; 76 uint32_t check = 0;
77 for(i = 0; i < crypto_box_BOXZEROBYTES; ++i) { 77 for(i = 0; i < crypto_box_BOXZEROBYTES; ++i) {
78 if (temp_encrypted[i] != 0) 78 check |= temp_plain[i] ^ 0;
79 check = 1;
80 } 79 }
81 if(check == 1) 80 if(check != 0)
82 return -1; 81 return -1;
83 82
84 /* unpad the encrypted message */ 83 /* unpad the encrypted message */
@@ -110,10 +109,9 @@ int decrypt_data(uint8_t *public_key, uint8_t *secret_key, uint8_t *nonce,
110 uint32_t i; 109 uint32_t i;
111 uint32_t check = 0; 110 uint32_t check = 0;
112 for(i = 0; i < crypto_box_ZEROBYTES; ++i) { 111 for(i = 0; i < crypto_box_ZEROBYTES; ++i) {
113 if (temp_plain[i] != 0) 112 check |= temp_plain[i] ^ 0;
114 check = 1;
115 } 113 }
116 if(check == 1) 114 if(check != 0)
117 return -1; 115 return -1;
118 116
119 /* unpad the plain message */ 117 /* unpad the plain message */