mirror of
https://github.com/cesanta/mongoose.git
synced 2026-11-26 20:38:25 +00:00
Squash warning
This commit is contained in:
1 parent
f95283e341
commit
490eb0f57f
2 files changed
+10
-10
No files matched your search
+5
-5
@@ -12654,14 +12654,14 @@ static PORTABLE_8439_DECL void poly1305_calculate_mac(
|
|||||||
poly1305_finish(&poly_ctx, mac);
|
poly1305_finish(&poly_ctx, mac);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define PM(p) ((size_t) (p))
|
#define MG_PM(p) ((size_t) (p))
|
||||||
|
|
||||||
// pointers overlap if the smaller either ahead of the end,
|
// pointers overlap if the smaller either ahead of the end,
|
||||||
// or its end is before the start of the other
|
// or its end is before the start of the other
|
||||||
//
|
//
|
||||||
// s_size should be smaller or equal to b_size
|
// s_size should be smaller or equal to b_size
|
||||||
#define OVERLAPPING(s, s_size, b, b_size) \
|
#define MG_OVERLAPPING(s, s_size, b, b_size) \
|
||||||
(PM(s) < PM((b) + (b_size))) && (PM(b) < PM((s) + (s_size)))
|
(MG_PM(s) < MG_PM((b) + (b_size))) && (MG_PM(b) < MG_PM((s) + (s_size)))
|
||||||
|
|
||||||
PORTABLE_8439_DECL size_t mg_chacha20_poly1305_encrypt(
|
PORTABLE_8439_DECL size_t mg_chacha20_poly1305_encrypt(
|
||||||
uint8_t *restrict cipher_text, const uint8_t key[RFC_8439_KEY_SIZE],
|
uint8_t *restrict cipher_text, const uint8_t key[RFC_8439_KEY_SIZE],
|
||||||
@@ -12669,7 +12669,7 @@ PORTABLE_8439_DECL size_t mg_chacha20_poly1305_encrypt(
|
|||||||
size_t ad_size, const uint8_t *restrict plain_text,
|
size_t ad_size, const uint8_t *restrict plain_text,
|
||||||
size_t plain_text_size) {
|
size_t plain_text_size) {
|
||||||
size_t new_size = plain_text_size + RFC_8439_TAG_SIZE;
|
size_t new_size = plain_text_size + RFC_8439_TAG_SIZE;
|
||||||
if (OVERLAPPING(plain_text, plain_text_size, cipher_text, new_size)) {
|
if (MG_OVERLAPPING(plain_text, plain_text_size, cipher_text, new_size)) {
|
||||||
return (size_t) -1;
|
return (size_t) -1;
|
||||||
}
|
}
|
||||||
chacha20_xor_stream(cipher_text, plain_text, plain_text_size, key, nonce, 1);
|
chacha20_xor_stream(cipher_text, plain_text, plain_text_size, key, nonce, 1);
|
||||||
@@ -12684,7 +12684,7 @@ PORTABLE_8439_DECL size_t mg_chacha20_poly1305_decrypt(
|
|||||||
const uint8_t *restrict cipher_text, size_t cipher_text_size) {
|
const uint8_t *restrict cipher_text, size_t cipher_text_size) {
|
||||||
// first we calculate the mac and see if it lines up, only then do we decrypt
|
// first we calculate the mac and see if it lines up, only then do we decrypt
|
||||||
size_t actual_size = cipher_text_size - RFC_8439_TAG_SIZE;
|
size_t actual_size = cipher_text_size - RFC_8439_TAG_SIZE;
|
||||||
if (OVERLAPPING(plain_text, actual_size, cipher_text, cipher_text_size)) {
|
if (MG_OVERLAPPING(plain_text, actual_size, cipher_text, cipher_text_size)) {
|
||||||
return (size_t) -1;
|
return (size_t) -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+5
-5
@@ -1300,14 +1300,14 @@ static PORTABLE_8439_DECL void poly1305_calculate_mac(
|
|||||||
poly1305_finish(&poly_ctx, mac);
|
poly1305_finish(&poly_ctx, mac);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define PM(p) ((size_t) (p))
|
#define MG_PM(p) ((size_t) (p))
|
||||||
|
|
||||||
// pointers overlap if the smaller either ahead of the end,
|
// pointers overlap if the smaller either ahead of the end,
|
||||||
// or its end is before the start of the other
|
// or its end is before the start of the other
|
||||||
//
|
//
|
||||||
// s_size should be smaller or equal to b_size
|
// s_size should be smaller or equal to b_size
|
||||||
#define OVERLAPPING(s, s_size, b, b_size) \
|
#define MG_OVERLAPPING(s, s_size, b, b_size) \
|
||||||
(PM(s) < PM((b) + (b_size))) && (PM(b) < PM((s) + (s_size)))
|
(MG_PM(s) < MG_PM((b) + (b_size))) && (MG_PM(b) < MG_PM((s) + (s_size)))
|
||||||
|
|
||||||
PORTABLE_8439_DECL size_t mg_chacha20_poly1305_encrypt(
|
PORTABLE_8439_DECL size_t mg_chacha20_poly1305_encrypt(
|
||||||
uint8_t *restrict cipher_text, const uint8_t key[RFC_8439_KEY_SIZE],
|
uint8_t *restrict cipher_text, const uint8_t key[RFC_8439_KEY_SIZE],
|
||||||
@@ -1315,7 +1315,7 @@ PORTABLE_8439_DECL size_t mg_chacha20_poly1305_encrypt(
|
|||||||
size_t ad_size, const uint8_t *restrict plain_text,
|
size_t ad_size, const uint8_t *restrict plain_text,
|
||||||
size_t plain_text_size) {
|
size_t plain_text_size) {
|
||||||
size_t new_size = plain_text_size + RFC_8439_TAG_SIZE;
|
size_t new_size = plain_text_size + RFC_8439_TAG_SIZE;
|
||||||
if (OVERLAPPING(plain_text, plain_text_size, cipher_text, new_size)) {
|
if (MG_OVERLAPPING(plain_text, plain_text_size, cipher_text, new_size)) {
|
||||||
return (size_t) -1;
|
return (size_t) -1;
|
||||||
}
|
}
|
||||||
chacha20_xor_stream(cipher_text, plain_text, plain_text_size, key, nonce, 1);
|
chacha20_xor_stream(cipher_text, plain_text, plain_text_size, key, nonce, 1);
|
||||||
@@ -1330,7 +1330,7 @@ PORTABLE_8439_DECL size_t mg_chacha20_poly1305_decrypt(
|
|||||||
const uint8_t *restrict cipher_text, size_t cipher_text_size) {
|
const uint8_t *restrict cipher_text, size_t cipher_text_size) {
|
||||||
// first we calculate the mac and see if it lines up, only then do we decrypt
|
// first we calculate the mac and see if it lines up, only then do we decrypt
|
||||||
size_t actual_size = cipher_text_size - RFC_8439_TAG_SIZE;
|
size_t actual_size = cipher_text_size - RFC_8439_TAG_SIZE;
|
||||||
if (OVERLAPPING(plain_text, actual_size, cipher_text, cipher_text_size)) {
|
if (MG_OVERLAPPING(plain_text, actual_size, cipher_text, cipher_text_size)) {
|
||||||
return (size_t) -1;
|
return (size_t) -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user