From 0917cb21bb5835912cacf91e16a29c41ccae275c Mon Sep 17 00:00:00 2001 From: bol-van Date: Sun, 8 Feb 2026 17:12:36 +0300 Subject: [PATCH] AI fixes --- lua/zapret-lib.lua | 10 ++++++---- lua/zapret-obfs.lua | 4 ++-- nfq2/crypto/sha224-256.c | 12 ++++++------ 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/lua/zapret-lib.lua b/lua/zapret-lib.lua index c7588f0..d684cdb 100644 --- a/lua/zapret-lib.lua +++ b/lua/zapret-lib.lua @@ -321,22 +321,24 @@ end -- convert array a to packed string using 'packer' function. only numeric indexes starting from 1, order preserved function barray(a, packer) + local sa={} if a then local s="" for i=1,#a do - s = s .. packer(a[i]) + sa[i] = packer(a[i]) end - return s + return table.concat(sa) end end -- convert table a to packed string using 'packer' function. any indexes, any order function btable(a, packer) + local sa={} if a then local s="" for k,v in pairs(a) do - s = s .. packer(v) + sa[k] = packer(v) end - return s + return table.concat(sa) end end diff --git a/lua/zapret-obfs.lua b/lua/zapret-obfs.lua index 393cf33..f5b0e50 100644 --- a/lua/zapret-obfs.lua +++ b/lua/zapret-obfs.lua @@ -82,13 +82,13 @@ end -- test case : -- endpoint1: --- --filter-icmp=0,8,128,129 --filter-ipp=193,198,209,250 --filter-tcp=* --filter-udp=* --in-range=a --lua-desync=ippxor:xor=192:dataxor=0xABCD +-- --filter-icmp=0,8,128,129 --filter-ipp=193,198,209,250 --filter-tcp=* --filter-udp=* --in-range=a --lua-desync=ippxor:ippxor=192:dataxor=0xABCD -- nft add rule inet ztest pre meta mark and 0x40000000 == 0 meta l4proto {193, 198, 209, 250} queue num 200 bypass -- nft add rule inet ztest post meta mark and 0x40000000 == 0 tcp dport "{5001}" queue num 200 bypass -- nft add rule inet ztest post meta mark and 0x40000000 == 0 udp dport "{5001}" queue num 200 bypass -- iperf -i 1 -c endpoint2 -- endpoint2: --- --filter-icmp=0,8,128,129 --filter-ipp=193,198,209,250 --filter-tcp=* --filter-udp=* --in-range=a --lua-desync=ippxor:xor=192:dataxor=0xABCD --server +-- --filter-icmp=0,8,128,129 --filter-ipp=193,198,209,250 --filter-tcp=* --filter-udp=* --in-range=a --lua-desync=ippxor:ippxor=192:dataxor=0xABCD --server -- nft add rule inet ztest pre meta mark and 0x40000000 == 0 meta l4proto {193, 198, 209, 250} queue num 200 bypass -- nft add rule inet ztest post meta mark and 0x40000000 == 0 tcp sport "{5001}" queue num 200 bypass -- nft add rule inet ztest post meta mark and 0x40000000 == 0 udp sport "{5001}" queue num 200 bypass diff --git a/nfq2/crypto/sha224-256.c b/nfq2/crypto/sha224-256.c index 2c9bc9c..ec4954d 100644 --- a/nfq2/crypto/sha224-256.c +++ b/nfq2/crypto/sha224-256.c @@ -64,12 +64,12 @@ * Add "length" to the length. * Set Corrupted when overflow has occurred. */ -static uint32_t addTemp; -#define SHA224_256AddLength(context, length) \ - (addTemp = (context)->Length_Low, (context)->Corrupted = \ - (((context)->Length_Low += (length)) < addTemp) && \ - (++(context)->Length_High == 0) ? shaInputTooLong : \ - (context)->Corrupted ) +static int SHA224_256AddLength(SHA256Context *context, uint32_t length) +{ + uint32_t addTemp = context->Length_Low; + if (((context->Length_Low += length) < addTemp) && (++(context)->Length_High == 0)) context->Corrupted = shaInputTooLong; + return context->Corrupted; +} /* Local Function Prototypes */ static int SHA224_256Reset(SHA256Context *context, uint32_t *H0);