diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/net_crypto.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/core/net_crypto.c b/core/net_crypto.c index 83cb20a2..2dbaa87c 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_encrypted[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 */ |