mirror of
https://github.com/cesanta/mongoose.git
synced 2026-10-24 11:54:49 +00:00
test checksum primitives, enforce rx frag test
This commit is contained in:
1 parent
b3ee71acbe
commit
2c7f58aed2
4 files changed
+27
-14
No files matched your search
+3
-2
@@ -845,10 +845,11 @@ static void rx_tcp(struct mg_tcpip_if *ifp, struct pkt *pkt) {
|
||||
static void rx_ip(struct mg_tcpip_if *ifp, struct pkt *pkt) {
|
||||
uint16_t frag = mg_ntohs(pkt->ip->frag);
|
||||
if (frag & IP_MORE_FRAGS_MSK || frag & IP_FRAG_OFFSET_MSK) {
|
||||
struct mg_connection *c = getpeer(ifp->mgr, pkt, false);
|
||||
if (c) mg_error(c, "Received fragmented packet");
|
||||
struct mg_connection *c;
|
||||
if (pkt->ip->proto == 17) pkt->udp = (struct udp *) (pkt->ip + 1);
|
||||
if (pkt->ip->proto == 6) pkt->tcp = (struct tcp *) (pkt->ip + 1);
|
||||
c = getpeer(ifp->mgr, pkt, false);
|
||||
if (c) mg_error(c, "Received fragmented packet");
|
||||
} else if (pkt->ip->proto == 1) {
|
||||
pkt->icmp = (struct icmp *) (pkt->ip + 1);
|
||||
if (pkt->pay.len < sizeof(*pkt->icmp)) return;
|
||||
|
||||
+1
-1
@@ -1576,7 +1576,7 @@ NS_INTERNAL bigint *bi_crt(BI_CTX *ctx, bigint *bi, bigint *dP, bigint *dQ,
|
||||
|
||||
int mg_rsa_mod_pow(const uint8_t *mod, size_t modsz, const uint8_t *exp, size_t expsz, const uint8_t *msg, size_t msgsz, uint8_t *out, size_t outsz) {
|
||||
BI_CTX *bi_ctx = bi_initialize();
|
||||
bigint *m1;
|
||||
bigint *m1;
|
||||
bigint *n = bi_import(bi_ctx, mod, (int) modsz);
|
||||
bigint *e = bi_import(bi_ctx, exp, (int) expsz);
|
||||
bigint *h = bi_import(bi_ctx, msg, (int) msgsz);
|
||||
|
||||
Reference in new issue
Block a user