Fix typos for endian

This commit is contained in:
Max Lv
2017-01-31 18:51:52 +08:00
parent 3b2a5d1a1f
commit 05d5121707
2 changed files with 7 additions and 3 deletions
+2 -2
View File
@@ -505,7 +505,7 @@ aead_chunk_encrypt(cipher_ctx_t *ctx, uint8_t *p, uint8_t *c, uint8_t *n,
int err;
size_t clen;
uint8_t len_buf[CHUNK_SIZE_LEN];
uint16_t t = ntohs((plen + tlen) & CHUNK_SIZE_MASK);
uint16_t t = htons((plen + tlen) & CHUNK_SIZE_MASK);
memcpy(len_buf, &t, CHUNK_SIZE_LEN);
clen = CHUNK_SIZE_LEN + tlen;
@@ -599,7 +599,7 @@ aead_chunk_decrypt(cipher_ctx_t *ctx, uint8_t *p, uint8_t *c, uint8_t *n,
return CRYPTO_ERROR;
assert(*plen == CHUNK_SIZE_LEN);
mlen = htons(*(uint16_t *)len_buf);
mlen = ntohs(*(uint16_t *)len_buf);
mlen = mlen & CHUNK_SIZE_MASK;
size_t chunk_len = tlen + CHUNK_SIZE_LEN + mlen;
+5 -1
View File
@@ -1627,7 +1627,11 @@ main(int argc, char **argv)
struct ev_loop *loop = EV_DEFAULT;
// setup udns
resolv_init(loop, nameservers, nameserver_num, ipv6first);
if (nameserver_num == 0) {
resolv_init(loop, NULL, 0, ipv6first);
} else {
resolv_init(loop, nameservers, nameserver_num, ipv6first);
}
for (int i = 0; i < nameserver_num; i++)
LOGI("using nameserver: %s", nameservers[i]);