mirror of
https://github.com/cesanta/mongoose.git
synced 2026-11-08 16:11:18 +00:00
improve error handling with ChaCha
This commit is contained in:
1 parent
967d746574
commit
0cc40b0c70
2 files changed
+8
No files matched your search
@@ -11581,6 +11581,10 @@ static int mg_tls_recv_record(struct mg_connection *c) {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
n = mg_chacha20_poly1305_decrypt(dec, key, nonce, msg, msgsz);
|
n = mg_chacha20_poly1305_decrypt(dec, key, nonce, msg, msgsz);
|
||||||
|
if (n == (size_t) -1) {
|
||||||
|
mg_error(c, "decryption error");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
memmove(msg, dec, n);
|
memmove(msg, dec, n);
|
||||||
mg_free(dec);
|
mg_free(dec);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -516,6 +516,10 @@ static int mg_tls_recv_record(struct mg_connection *c) {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
n = mg_chacha20_poly1305_decrypt(dec, key, nonce, msg, msgsz);
|
n = mg_chacha20_poly1305_decrypt(dec, key, nonce, msg, msgsz);
|
||||||
|
if (n == (size_t) -1) {
|
||||||
|
mg_error(c, "decryption error");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
memmove(msg, dec, n);
|
memmove(msg, dec, n);
|
||||||
mg_free(dec);
|
mg_free(dec);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user