ntop / n2n

Peer-to-peer VPN
GNU General Public License v3.0
6.19k stars 933 forks source link

supernode drop the packet from edge on Openwrt (WNDR4300 AR9344 mips24kc) #951

Open vcore85 opened 2 years ago

vcore85 commented 2 years ago

I run supernode 3.0 on ubuntu , and test edge 3.0 on ubuntu,win10,openwrt(AR9344 mips24kc),openwrt(MT7620 mipsel24kc). Only the edge on openwrt(AR9344 mips24kc) could not connect to the supernode , others work well, the edge config is same with the others. The edge was compiled base on openwrt 21.02. when edge connect to the supernode ,the supernode shows : dropped a packet with seemingly encrypted header for which no matching community which uses encrypted headers was found

I read the Faq about this , seems not fit my situation . Maybe the issues #922 is the same problem, is this a byte-swap issue ? What can I do to test something ?

edge config : -d=n2n0 -c=tvnetwork_20220207 -a=static:192.168.166.101 -l=xxx.xxx.xxx:xxx -I=test -J=test -k=tvnetwork -f -v -A5

Logan007 commented 2 years ago

This is really strange.

I see that you use -J. Have you double-checked the key entry at the supernode according to the the Authentication documentation? The line generated from they keygen tool needs to go directly under the community name (tvnetwork_20220207 in your case) in the community file provided to the supernode.

If you want to exclude/narrow down to the byte-swap error, you could test the edge without -J (in some other community) on that computer plus some other edge on a knowingly well working computer. The byte-swap error would show at the edge then (with / without encryption) as described in #922 (especially unknown ether type message in log with -vvvvv).

Logan007 commented 2 years ago

And, I guess you cross-compile? Otherwise, if you compile on your MIPS24Kc, I would be interested in the tests output.

vcore85 commented 2 years ago

yes, I use the keygen tool get the key , and put that under the community tvnetwork_20220207 . Now I add new community tvnetwork_test to test without user/password, like this :

tvnetwork_20220207
* test yJcVdhGNWETGONqWY0sI-qx8a4XK6CyWePitGuiTxpi

tvnetwork_test

the new edge config :

-d=n2n0
-c=tvnetwork_test
-a=static:192.168.188.101
-l=xxx.xxxx.xxx:xxx
-k=tvnetwork
-f
-vvvvv

this time , the edge on openwrt(AR9344 mips24kc) works well , and could ping the edge on ubuntu . the log on the openwrt while pinging the edge on ubuntu :

09/Feb/2022 11:03:39 [edge_utils.c:2419] Rx N2N_UDP of size 152 from [101.43.170.219:39743]
09/Feb/2022 11:03:39 [edge_utils.c:2517] [p2p] from FA:DD:E4:A3:CD:73
09/Feb/2022 11:03:39 [edge_utils.c:1633] handle_PACKET size 114 transform 3
09/Feb/2022 11:03:39 [transform_aes.c:138] transop_decode_aes 114 bytes ciphertext
09/Feb/2022 11:03:39 [edge_utils.c:1749] sending data of size 98 to TAP
09/Feb/2022 11:03:40 [edge_utils.c:2334] Rx TAP packet (  98) for FA:DD:E4:A3:CD:73
09/Feb/2022 11:03:40 [transform_aes.c:82] transop_encode_aes 98 bytes plaintext
09/Feb/2022 11:03:40 [edge_utils.c:2284] encode PACKET of 152 bytes, 98 bytes data, 54 bytes overhead, transform 3
09/Feb/2022 11:03:40 [edge_utils.c:2089] searching destination socket for FA:DD:E4:A3:CD:73
09/Feb/2022 11:03:40 [edge_utils.c:2117] found peer's socket FA:DD:E4:A3:CD:73 [101.43.170.219:39743]
09/Feb/2022 11:03:40 [edge_utils.c:2144] Tx PACKET of 152 bytes to FA:DD:E4:A3:CD:73 [101.43.170.219:39743]
09/Feb/2022 11:03:40 [edge_utils.c:1040] sent=152 to 
09/Feb/2022 11:03:40 [edge_utils.c:1184] send PING to supernodes
09/Feb/2022 11:03:40 [edge_utils.c:1040] sent=38 to 
09/Feb/2022 11:03:40 [edge_utils.c:2419] Rx N2N_UDP of size 152 from [101.43.170.219:39743]
09/Feb/2022 11:03:40 [edge_utils.c:2517] [p2p] from FA:DD:E4:A3:CD:73
09/Feb/2022 11:03:40 [edge_utils.c:1633] handle_PACKET size 114 transform 3
09/Feb/2022 11:03:40 [transform_aes.c:138] transop_decode_aes 114 bytes ciphertext
09/Feb/2022 11:03:40 [edge_utils.c:1749] sending data of size 98 to TAP
09/Feb/2022 11:03:40 [edge_utils.c:2419] Rx N2N_UDP of size 74 from [101.43.170.219:9981]
09/Feb/2022 11:03:40 [edge_utils.c:2833] Rx PONG from supernode 12:65:14:57:3F:8D
09/Feb/2022 11:03:41 [edge_utils.c:2334] Rx TAP packet (  98) for FA:DD:E4:A3:CD:73
09/Feb/2022 11:03:41 [transform_aes.c:82] transop_encode_aes 98 bytes plaintext
09/Feb/2022 11:03:41 [edge_utils.c:2284] encode PACKET of 152 bytes, 98 bytes data, 54 bytes overhead, transform 3
09/Feb/2022 11:03:41 [edge_utils.c:2089] searching destination socket for FA:DD:E4:A3:CD:73
09/Feb/2022 11:03:41 [edge_utils.c:2117] found peer's socket FA:DD:E4:A3:CD:73 [101.43.170.219:39743]
09/Feb/2022 11:03:41 [edge_utils.c:2144] Tx PACKET of 152 bytes to FA:DD:E4:A3:CD:73 [101.43.170.219:39743]
09/Feb/2022 11:03:41 [edge_utils.c:1040] sent=152 to 
09/Feb/2022 11:03:41 [edge_utils.c:2419] Rx N2N_UDP of size 152 from [101.43.170.219:39743]
09/Feb/2022 11:03:41 [edge_utils.c:2517] [p2p] from FA:DD:E4:A3:CD:73
09/Feb/2022 11:03:41 [edge_utils.c:1633] handle_PACKET size 114 transform 3
09/Feb/2022 11:03:41 [transform_aes.c:138] transop_decode_aes 114 bytes ciphertext
09/Feb/2022 11:03:41 [edge_utils.c:1749] sending data of size 98 to TAP

version 3.0 does not have tests-auth , can I use tests-auth in version 3.1 ? this is the test result :

root@OpenWrt:~# ./tests-compress 
original: input size = 0x20000000000
000: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
010: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
020: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
030: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
040: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
050: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
060: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
070: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
080: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
090: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
0a0: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
0b0: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
0c0: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
0d0: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
0e0: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
0f0: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
100: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
110: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
120: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
130: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
140: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
150: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
160: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
170: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
180: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
190: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
1a0: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
1b0: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
1c0: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
1d0: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
1e0: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
1f0: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |

lzo1x: output size = 0x2f7fd8ed60
000: 0d 00 01 02 03 04 05 06  07 08 09 0a 0b 0c 0d 0e   |                |
010: 0f 20 00 bc 3c 00 00 02  0c 0d 0e 0f 00 01 02 03   |    <           |
020: 04 05 06 07 08 09 0a 0b  0c 0d 0e 0f 11 00 00      |               |
lzo1x: tested

zstd: output size = 0x21
000: 28 b5 2f fd 60 00 01 bd  00 00 80 00 01 02 03 04   |( / `           |
010: 05 06 07 08 09 0a 0b 0c  0d 0e 0f 01 00 da 47 9d   |              G |
020: 4b                                                 |K|
zstd: not compiled - dummy data output

root@OpenWrt:~# ./tests-elliptic 
environment: input
000: 00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00   |                |
010: 00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 09   |                |
environment: key
000: 55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55   |UUUUUUUUUUUUUUUU|
010: 55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55   |UUUUUUUUUUUUUUUU|

curve25519: output
000: 7f 42 1b f9 34 5a 59 84  4a 30 bc 53 64 74 fa 7c   | B  4ZY J0 Sdt ||
010: 15 81 77 a4 4d 34 6d 2f  8b c1 8c 05 d6 a9 44 54   |  w M4m/      DT|
curve25519: tested

root@OpenWrt:~# ./tests-hashing 
environment: input size = 0x20000000005
000: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
010: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
020: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
030: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
040: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
050: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
060: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
070: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
080: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
090: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
0a0: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
0b0: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
0c0: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
0d0: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
0e0: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
0f0: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
100: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
110: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
120: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
130: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
140: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
150: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
160: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
170: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
180: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
190: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
1a0: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
1b0: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
1c0: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
1d0: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
1e0: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
1f0: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |

pearson: output = 0xb2d98fa82ea108be
pearson: tested

root@OpenWrt:~# ./tests-transform 
environment: community_name = "abc123def456"
environment: encrypt_key = "SoMEVer!S$cUREPassWORD"
environment: input size = 0x20000000000
000: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
010: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
020: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
030: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
040: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
050: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
060: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
070: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
080: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
090: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
0a0: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
0b0: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
0c0: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
0d0: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
0e0: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
0f0: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
100: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
110: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
120: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
130: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
140: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
150: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
160: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
170: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
180: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
190: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
1a0: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
1b0: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
1c0: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
1d0: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
1e0: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
1f0: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |

null: output size = 0x2260000000e
000: 03 02 00 03 61 62 63 31  32 33 64 65 66 34 35 36   |    abc123def456|
010: 00 00 00 00 00 00 00 00  00 01 02 03 04 05 00 01   |                |
020: 02 03 04 05 00 00 00 01  02 03 04 05 06 07 08 09   |                |
030: 0a 0b 0c 0d 0e 0f 00 01  02 03 04 05 06 07 08 09   |                |
040: 0a 0b 0c 0d 0e 0f 00 01  02 03 04 05 06 07 08 09   |                |
050: 0a 0b 0c 0d 0e 0f 00 01  02 03 04 05 06 07 08 09   |                |
060: 0a 0b 0c 0d 0e 0f 00 01  02 03 04 05 06 07 08 09   |                |
070: 0a 0b 0c 0d 0e 0f 00 01  02 03 04 05 06 07 08 09   |                |
080: 0a 0b 0c 0d 0e 0f 00 01  02 03 04 05 06 07 08 09   |                |
090: 0a 0b 0c 0d 0e 0f 00 01  02 03 04 05 06 07 08 09   |                |
0a0: 0a 0b 0c 0d 0e 0f 00 01  02 03 04 05 06 07 08 09   |                |
0b0: 0a 0b 0c 0d 0e 0f 00 01  02 03 04 05 06 07 08 09   |                |
0c0: 0a 0b 0c 0d 0e 0f 00 01  02 03 04 05 06 07 08 09   |                |
0d0: 0a 0b 0c 0d 0e 0f 00 01  02 03 04 05 06 07 08 09   |                |
0e0: 0a 0b 0c 0d 0e 0f 00 01  02 03 04 05 06 07 08 09   |                |
0f0: 0a 0b 0c 0d 0e 0f 00 01  02 03 04 05 06 07 08 09   |                |
100: 0a 0b 0c 0d 0e 0f 00 01  02 03 04 05 06 07 08 09   |                |
110: 0a 0b 0c 0d 0e 0f 00 01  02 03 04 05 06 07 08 09   |                |
120: 0a 0b 0c 0d 0e 0f 00 01  02 03 04 05 06 07 08 09   |                |
130: 0a 0b 0c 0d 0e 0f 00 01  02 03 04 05 06 07 08 09   |                |
140: 0a 0b 0c 0d 0e 0f 00 01  02 03 04 05 06 07 08 09   |                |
150: 0a 0b 0c 0d 0e 0f 00 01  02 03 04 05 06 07 08 09   |                |
160: 0a 0b 0c 0d 0e 0f 00 01  02 03 04 05 06 07 08 09   |                |
170: 0a 0b 0c 0d 0e 0f 00 01  02 03 04 05 06 07 08 09   |                |
180: 0a 0b 0c 0d 0e 0f 00 01  02 03 04 05 06 07 08 09   |                |
190: 0a 0b 0c 0d 0e 0f 00 01  02 03 04 05 06 07 08 09   |                |
1a0: 0a 0b 0c 0d 0e 0f 00 01  02 03 04 05 06 07 08 09   |                |
1b0: 0a 0b 0c 0d 0e 0f 00 01  02 03 04 05 06 07 08 09   |                |
1c0: 0a 0b 0c 0d 0e 0f 00 01  02 03 04 05 06 07 08 09   |                |
1d0: 0a 0b 0c 0d 0e 0f 00 01  02 03 04 05 06 07 08 09   |                |
1e0: 0a 0b 0c 0d 0e 0f 00 01  02 03 04 05 06 07 08 09   |                |
1f0: 0a 0b 0c 0d 0e 0f 00 01  02 03 04 05 06 07 08 09   |                |
200: 0a 0b 0c 0d 0e 0f 00 01  02 03 04 05 06 07 08 09   |                |
210: 0a 0b 0c 0d 0e 0f 00 01  02 03 04 05 06 07 08 09   |                |
220: 0a 0b 0c 0d 0e 0f                                  |      |
null: tested

tf: output size = 0x23600000000
000: 03 02 00 03 61 62 63 31  32 33 64 65 66 34 35 36   |    abc123def456|
010: 00 00 00 00 00 00 00 00  00 01 02 03 04 05 00 01   |                |
020: 02 03 04 05 00 00 69 54  ba b7 b9 00 7e 1f 4e 43   |      iT    ~ NC|
030: 6b 6e c0 b7 5a bb e1 6a  7d 8b f6 41 9e fb 7e c1   |kn  Z  j}  A  ~ |
040: a8 6c 67 6b c7 27 17 32  9b 89 f2 5d 1d 67 49 de   | lgk ' 2   ] gI |
050: ab 5c d4 b7 a1 97 99 76  7d 90 8d 2c 7c 0d 65 66   | \     v}  ,| ef|
060: d5 7f 1a 3b bf 0c 52 b3  42 0d c8 c8 0d 62 8e 4b   |   ;  R B    b K|
070: 98 7b bc 0d 9c db bf 61  dc 9d 9f 44 a4 fc 8d 1a   | {     a   D    |
080: 70 f0 14 87 89 0e 4a b8  7e 66 72 7a 04 6e 9b 17   |p     J ~frz n  |
090: e1 2c 06 ce 52 04 2a a0  0f 7f 76 f4 5c c5 e2 09   | ,  R *   v \   |
0a0: f6 35 ff ad 87 ab 72 5a  6f bc 61 78 f6 3c 48 e2   | 5    rZo ax <H |
0b0: b2 a4 27 ae 74 03 c7 83  f4 af 5a 1e da b4 7e 8a   |  ' t     Z   ~ |
0c0: 25 87 45 d2 8e 97 2b c0  69 8f f3 6d e5 8f a5 7f   |% E   + i  m    |
0d0: 91 72 94 49 bc d8 0e 20  d0 ed 16 28 df 78 37 53   | r I       ( x7S|
0e0: 97 63 f9 9e 0a c1 4c 3c  98 a9 c3 79 5a 76 a0 c9   | c    L<   yZv  |
0f0: 34 f1 26 6e 66 27 a9 68  9d d1 24 26 e8 64 a4 a0   |4 &nf' h  $& d  |
100: 71 e1 37 9a c9 b2 d6 7b  1c 56 b3 9d ac b0 47 5d   |q 7    { V    G]|
110: 81 2f 12 c4 56 a7 61 8f  58 20 1d 91 a0 ff fa 43   | /  V a X      C|
120: 4c 46 77 9f 20 66 7f a1  1d 98 b3 c5 b4 36 dd 41   |LFw  f       6 A|
130: 42 f3 4f b0 65 65 aa 94  f0 42 aa 31 2f e3 de c0   |B O ee   B 1/   |
140: a0 d2 02 c4 a8 6c d2 81  56 d7 00 eb c5 1b 3f 10   |     l  V     ? |
150: bc ea 09 c9 b7 f7 9f 08  c4 80 55 b6 04 02 50 f4   |          U   P |
160: 6c 76 bb 70 a0 04 14 da  fd 13 d1 b0 cd cb a6 b2   |lv p            |
170: d0 3f 37 09 47 62 94 bf  39 f4 6b d6 fa 22 0c 23   | ?7 Gb  9 k  " #|
180: a6 07 9b 1e ee b6 ae f7  58 b0 dc a9 db 60 ff a2   |        X    `  |
190: b7 03 a1 a3 26 1b 5b 37  c6 69 43 6b bb 6c 03 3e   |    & [7 iCk l >|
1a0: a7 fc d2 83 5b 61 b1 e0  fd 28 d1 ec 65 a2 cf 6c   |    [a   (  e  l|
1b0: ef 3b ad cc 75 e3 f9 71  0f 90 71 a6 bc 1a d5 17   | ;  u  q  q     |
1c0: 65 64 3e 0c d2 c8 de bd  1f d5 af 84 fc fe aa bd   |ed>             |
1d0: c5 88 13 af 09 ee 8c c0  38 49 79 09 a7 7a 01 48   |        8Iy  z H|
1e0: 2e 3e 9a 38 1b c6 b8 c0  a9 4e 61 0f 19 2a 95 84   |.> 8     Na  *  |
1f0: 3b 53 1c db 9a ec af 8f  2d af 73 d5 cc 71 bd 42   |;S      - s  q B|
200: 4f e2 70 ca 45 b6 44 18  54 fe 6b 23 31 ba f4 b1   |O p E D T k#1   |
210: 02 a1 26 4f f1 a9 c0 78  e6 3b 11 9e d6 3c 61 e5   |  &O   x ;   <a |
220: 3b 6f f3 42 43 9f 77 cf  9e 0d 39 85 eb e0 ad db   |;o BC w   9     |
230: d6 40 b7 94 99 ca                                  | @    |
tf: round-trip buffer mismatch
root@OpenWrt:~# 
root@OpenWrt:~# ./tests-wire 
environment: common.ttl = 2
environment: common.flags = 0
environment: common.community = "abc123def456z"

REGISTER: common.pc = 1
REGISTER: reg.cookie = 0
REGISTER: reg.srcMac[] = 0:1:2:3:4:5
REGISTER: reg.dstMac[] = 10:11:12:13:14:15
REGISTER: reg.dev_addr.net_addr = 0x20212223
REGISTER: reg.dev_addr.net_bitlen = 25
REGISTER: reg.dev_desc = "Dummy_Dev_Desc"

REGISTER: output retval = 0x2400000000
REGISTER: output idx = 0x3d00000000
000: 03 02 00 01 61 62 63 31  32 33 64 65 66 34 35 36   |    abc123def456|
010: 7a 00 00 00 00 00 00 00  00 00 00 00 00 01 02 03   |z               |
020: 04 05 10 11 12 13 14 15  20 21 22 23 19 44 75 6d   |         !"# Dum|
030: 6d 79 5f 44 65 76 5f 44  65 73 63 00 00            |my_Dev_Desc  |
REGISTER: tested

REGISTER_SUPER: common.pc = 5
REGISTER_SUPER: reg.cookie = 0
REGISTER_SUPER: reg.edgeMac[] = 20:21:22:23:24:25
REGISTER_SUPER: reg.dev_addr.net_addr = 0x20212223
REGISTER_SUPER: reg.dev_addr.net_bitlen = 25
REGISTER_SUPER: reg.dev_desc = "Dummy_Dev_Desc"
REGISTER_SUPER: reg.auth.scheme = 1
REGISTER_SUPER: reg.auth.token_size = 16
REGISTER_SUPER: reg.auth.token[0] = 0xfe
REGISTER_SUPER: reg.key_time = 600

REGISTER_SUPER: output retval = 0x3600000000
REGISTER_SUPER: output idx = 0x4f00000000
000: 03 02 00 05 61 62 63 31  32 33 64 65 66 34 35 36   |    abc123def456|
010: 7a 00 00 00 00 00 00 00  00 00 00 00 20 21 22 23   |z            !"#|
020: 24 25 20 21 22 23 19 44  75 6d 6d 79 5f 44 65 76   |$% !"# Dummy_Dev|
030: 5f 44 65 73 63 00 00 00  01 00 10 fe 00 00 00 fd   |_Desc           |
040: 00 00 00 fc 00 00 00 00  00 00 fb 00 00 02 58      |              X|
REGISTER_SUPER: tested

UNREGISTER_SUPER: common.pc = 6
UNREGISTER_SUPER: unreg.auth.scheme = 1
UNREGISTER_SUPER: unreg.auth.token_size = 16
UNREGISTER_SUPER: unreg.auth.token[0] = 0xfe
UNREGISTER_SUPER: unreg.srcMac[] = 30:31:32:33:34:35

UNREGISTER_SUPER: output retval = 0x1900000006
UNREGISTER_SUPER: output idx = 0x3200000000
000: 03 02 00 06 61 62 63 31  32 33 64 65 66 34 35 36   |    abc123def456|
010: 7a 00 00 00 00 00 00 00  00 01 00 10 fe 00 00 00   |z               |
020: fd 00 00 00 fc 00 00 00  00 00 00 fb 30 31 32 33   |            0123|
030: 34 35                                              |45|
UNREGISTER_SUPER: tested
Logan007 commented 2 years ago

Thank you for running the tests. Actually, the twofish (TF) cipher test output shows an anomaly indicating an endianess issue. The output size is supposed to be 0x236 and in your output it shows 0x23600000000.

Although I am not sure where exactly this issue is, I assume it to be endianess related. While the byte-swap itself may work correctly, maybe the system endianess is not correctly assumed – and thus the wrong "define path" is chosen in include/portable_endian.h. scratch this... it's not swapped, it looks shifted... it might be something else... perhaps even faulty endianess path PLUS some error in endianess swapper

vcore85 commented 2 years ago

I'm glad to do more test to solve this issue. After change the printf macros PRIx64 to PRIx8, the output size seems right . I compare the tf output , it's same with the tests-transform.expected. Add some code to display tf test decode buffer , this should be the same with input, but it's different :

    decode_common( &cmn, pktbuf, &rem, &idx);
    decode_PACKET( &pkt, &cmn, pktbuf, &rem, &idx );
    op_fn->rev(op_fn, decodebuf, sizeof(decodebuf), pktbuf+idx, rem, 0);

+  printf("%s: decodefuf size = 0x%" PRIx8 "\n", op_name, rem);
+  fhexdump(0, decodebuf, rem, stdout);

output :

root@OpenWrt:~# ./tests-transform 
environment: community_name = "abc123def456"
environment: encrypt_key = "SoMEVer!S$cUREPassWORD"
environment: input size = 0x200
000: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
010: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
020: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
030: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
040: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
050: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
060: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
070: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
080: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
090: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
0a0: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
0b0: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
0c0: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
0d0: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
0e0: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
0f0: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
100: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
110: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
120: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
130: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
140: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
150: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
160: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
170: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
180: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
190: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
1a0: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
1b0: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
1c0: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
1d0: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
1e0: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
1f0: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |

null: output size = 0x226
000: 03 02 00 03 61 62 63 31  32 33 64 65 66 34 35 36   |    abc123def456|
010: 00 00 00 00 00 00 00 00  00 01 02 03 04 05 00 01   |                |
020: 02 03 04 05 00 00 00 01  02 03 04 05 06 07 08 09   |                |
030: 0a 0b 0c 0d 0e 0f 00 01  02 03 04 05 06 07 08 09   |                |
040: 0a 0b 0c 0d 0e 0f 00 01  02 03 04 05 06 07 08 09   |                |
050: 0a 0b 0c 0d 0e 0f 00 01  02 03 04 05 06 07 08 09   |                |
060: 0a 0b 0c 0d 0e 0f 00 01  02 03 04 05 06 07 08 09   |                |
070: 0a 0b 0c 0d 0e 0f 00 01  02 03 04 05 06 07 08 09   |                |
080: 0a 0b 0c 0d 0e 0f 00 01  02 03 04 05 06 07 08 09   |                |
090: 0a 0b 0c 0d 0e 0f 00 01  02 03 04 05 06 07 08 09   |                |
0a0: 0a 0b 0c 0d 0e 0f 00 01  02 03 04 05 06 07 08 09   |                |
0b0: 0a 0b 0c 0d 0e 0f 00 01  02 03 04 05 06 07 08 09   |                |
0c0: 0a 0b 0c 0d 0e 0f 00 01  02 03 04 05 06 07 08 09   |                |
0d0: 0a 0b 0c 0d 0e 0f 00 01  02 03 04 05 06 07 08 09   |                |
0e0: 0a 0b 0c 0d 0e 0f 00 01  02 03 04 05 06 07 08 09   |                |
0f0: 0a 0b 0c 0d 0e 0f 00 01  02 03 04 05 06 07 08 09   |                |
100: 0a 0b 0c 0d 0e 0f 00 01  02 03 04 05 06 07 08 09   |                |
110: 0a 0b 0c 0d 0e 0f 00 01  02 03 04 05 06 07 08 09   |                |
120: 0a 0b 0c 0d 0e 0f 00 01  02 03 04 05 06 07 08 09   |                |
130: 0a 0b 0c 0d 0e 0f 00 01  02 03 04 05 06 07 08 09   |                |
140: 0a 0b 0c 0d 0e 0f 00 01  02 03 04 05 06 07 08 09   |                |
150: 0a 0b 0c 0d 0e 0f 00 01  02 03 04 05 06 07 08 09   |                |
160: 0a 0b 0c 0d 0e 0f 00 01  02 03 04 05 06 07 08 09   |                |
170: 0a 0b 0c 0d 0e 0f 00 01  02 03 04 05 06 07 08 09   |                |
180: 0a 0b 0c 0d 0e 0f 00 01  02 03 04 05 06 07 08 09   |                |
190: 0a 0b 0c 0d 0e 0f 00 01  02 03 04 05 06 07 08 09   |                |
1a0: 0a 0b 0c 0d 0e 0f 00 01  02 03 04 05 06 07 08 09   |                |
1b0: 0a 0b 0c 0d 0e 0f 00 01  02 03 04 05 06 07 08 09   |                |
1c0: 0a 0b 0c 0d 0e 0f 00 01  02 03 04 05 06 07 08 09   |                |
1d0: 0a 0b 0c 0d 0e 0f 00 01  02 03 04 05 06 07 08 09   |                |
1e0: 0a 0b 0c 0d 0e 0f 00 01  02 03 04 05 06 07 08 09   |                |
1f0: 0a 0b 0c 0d 0e 0f 00 01  02 03 04 05 06 07 08 09   |                |
200: 0a 0b 0c 0d 0e 0f 00 01  02 03 04 05 06 07 08 09   |                |
210: 0a 0b 0c 0d 0e 0f 00 01  02 03 04 05 06 07 08 09   |                |
220: 0a 0b 0c 0d 0e 0f                                  |      |
null: decodefuf size = 0x200
000: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
010: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
020: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
030: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
040: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
050: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
060: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
070: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
080: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
090: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
0a0: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
0b0: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
0c0: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
0d0: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
0e0: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
0f0: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
100: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
110: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
120: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
130: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
140: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
150: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
160: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
170: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
180: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
190: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
1a0: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
1b0: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
1c0: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
1d0: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
1e0: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
1f0: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
null: tested

tf: output size = 0x236
000: 03 02 00 03 61 62 63 31  32 33 64 65 66 34 35 36   |    abc123def456|
010: 00 00 00 00 00 00 00 00  00 01 02 03 04 05 00 01   |                |
020: 02 03 04 05 00 00 69 54  ba b7 b9 00 7e 1f 4e 43   |      iT    ~ NC|
030: 6b 6e c0 b7 5a bb e1 6a  7d 8b f6 41 9e fb 7e c1   |kn  Z  j}  A  ~ |
040: a8 6c 67 6b c7 27 17 32  9b 89 f2 5d 1d 67 49 de   | lgk ' 2   ] gI |
050: ab 5c d4 b7 a1 97 99 76  7d 90 8d 2c 7c 0d 65 66   | \     v}  ,| ef|
060: d5 7f 1a 3b bf 0c 52 b3  42 0d c8 c8 0d 62 8e 4b   |   ;  R B    b K|
070: 98 7b bc 0d 9c db bf 61  dc 9d 9f 44 a4 fc 8d 1a   | {     a   D    |
080: 70 f0 14 87 89 0e 4a b8  7e 66 72 7a 04 6e 9b 17   |p     J ~frz n  |
090: e1 2c 06 ce 52 04 2a a0  0f 7f 76 f4 5c c5 e2 09   | ,  R *   v \   |
0a0: f6 35 ff ad 87 ab 72 5a  6f bc 61 78 f6 3c 48 e2   | 5    rZo ax <H |
0b0: b2 a4 27 ae 74 03 c7 83  f4 af 5a 1e da b4 7e 8a   |  ' t     Z   ~ |
0c0: 25 87 45 d2 8e 97 2b c0  69 8f f3 6d e5 8f a5 7f   |% E   + i  m    |
0d0: 91 72 94 49 bc d8 0e 20  d0 ed 16 28 df 78 37 53   | r I       ( x7S|
0e0: 97 63 f9 9e 0a c1 4c 3c  98 a9 c3 79 5a 76 a0 c9   | c    L<   yZv  |
0f0: 34 f1 26 6e 66 27 a9 68  9d d1 24 26 e8 64 a4 a0   |4 &nf' h  $& d  |
100: 71 e1 37 9a c9 b2 d6 7b  1c 56 b3 9d ac b0 47 5d   |q 7    { V    G]|
110: 81 2f 12 c4 56 a7 61 8f  58 20 1d 91 a0 ff fa 43   | /  V a X      C|
120: 4c 46 77 9f 20 66 7f a1  1d 98 b3 c5 b4 36 dd 41   |LFw  f       6 A|
130: 42 f3 4f b0 65 65 aa 94  f0 42 aa 31 2f e3 de c0   |B O ee   B 1/   |
140: a0 d2 02 c4 a8 6c d2 81  56 d7 00 eb c5 1b 3f 10   |     l  V     ? |
150: bc ea 09 c9 b7 f7 9f 08  c4 80 55 b6 04 02 50 f4   |          U   P |
160: 6c 76 bb 70 a0 04 14 da  fd 13 d1 b0 cd cb a6 b2   |lv p            |
170: d0 3f 37 09 47 62 94 bf  39 f4 6b d6 fa 22 0c 23   | ?7 Gb  9 k  " #|
180: a6 07 9b 1e ee b6 ae f7  58 b0 dc a9 db 60 ff a2   |        X    `  |
190: b7 03 a1 a3 26 1b 5b 37  c6 69 43 6b bb 6c 03 3e   |    & [7 iCk l >|
1a0: a7 fc d2 83 5b 61 b1 e0  fd 28 d1 ec 65 a2 cf 6c   |    [a   (  e  l|
1b0: ef 3b ad cc 75 e3 f9 71  0f 90 71 a6 bc 1a d5 17   | ;  u  q  q     |
1c0: 65 64 3e 0c d2 c8 de bd  1f d5 af 84 fc fe aa bd   |ed>             |
1d0: c5 88 13 af 09 ee 8c c0  38 49 79 09 a7 7a 01 48   |        8Iy  z H|
1e0: 2e 3e 9a 38 1b c6 b8 c0  a9 4e 61 0f 19 2a 95 84   |.> 8     Na  *  |
1f0: 3b 53 1c db 9a ec af 8f  2d af 73 d5 cc 71 bd 42   |;S      - s  q B|
200: 4f e2 70 ca 45 b6 44 18  54 fe 6b 23 31 ba f4 b1   |O p E D T k#1   |
210: 02 a1 26 4f f1 a9 c0 78  e6 3b 11 9e d6 3c 61 e5   |  &O   x ;   <a |
220: 3b 6f f3 42 43 9f 77 cf  9e 0d 39 85 eb e0 ad db   |;o BC w   9     |
230: d6 40 b7 94 99 ca                                  | @    |
tf: decodefuf size = 0x210
000: de ef ec dd a2 7b 78 a1  28 21 22 2b 77 e0 e3 74   |     {x (!"+w  t|
010: 6a 16 15 69 09 da d9 0a  1a 60 63 19 4c a1 a2 4f   |j  i     `c L  O|
020: 9e a8 ab 9d 91 45 46 92  1d 7c 7f 1e 4f 1b 18 4c   |     EF  |  O  L|
030: 09 0a 09 0a 84 55 56 87  12 ba b9 11 1a 89 8a 19   |     UV         |
040: 5f f0 f3 5c ae c0 c3 ad  fd da d9 fe 6b 9c 9f 68   |_  \        k  h|
050: 22 bc bf 21 67 e5 e6 64  75 63 60 76 16 03 00 15   |"  !g  duc`v    |
060: 2c c7 c4 2f 18 7b 78 1b  bf ff fc bc 0e 91 92 0d   |,  / {x         |
070: 55 ae ad 56 b7 ad ae b4  df f6 f5 dc 58 27 24 5b   |U  V        X'$[|
080: ce 34 37 cd 59 8b 88 5a  e4 59 5a e7 28 d7 d4 2b   | 47 Y  Z YZ (  +|
090: 68 76 75 6b ea c1 c2 e9  f1 a6 a5 f2 de 51 52 dd   |hvuk         QR |
0a0: a4 a8 ab a7 78 8d 8e 7b  df e7 e4 dc 40 f8 fb 43   |    x  {    @  C|
0b0: e3 f1 f2 e0 6a f2 f1 69  5c cd ce 5f 34 99 9a 37   |    j  i\  _4  7|
0c0: e5 a5 a6 e6 b1 26 25 b2  59 f4 f7 5a 0d 05 06 0e   |     &% Y  Z    |
0d0: 78 f4 f7 7b 44 cb c8 47  4d d8 db 4e 89 5e 5d 8a   |x  {D  GM  N ^] |
0e0: 80 66 65 83 07 34 37 04  60 d5 d6 63 b9 9f 9c ba   | fe  47 `  c    |
0f0: 41 d6 d5 42 e6 34 37 e5  b4 06 05 b7 1d b2 b1 1e   |A  B 47         |
100: e7 bd be e4 81 74 77 82  26 0a 09 25 26 d8 db 25   |     tw &  %&  %|
110: e8 65 66 eb 4d 1b 18 4e  04 69 6a 07 62 61 62 61   | ef M  N ij baba|
120: 05 d6 d5 06 1f 2b 28 1c  dd a5 a6 de f2 73 70 f1   |     +(      sp |
130: 1f cd ce 1c 53 b7 b4 50  2e 91 92 2d b3 dd de b0   |    S  P.  -    |
140: 07 26 25 04 1e 78 7b 1d  91 6b 68 92 59 43 40 5a   | &%  x{  kh YC@Z|
150: 60 87 84 63 4d 29 2a 4e  03 8c 8f 00 21 fd fe 22   |`  cM)*N    !  "|
160: 1e ae ad 1d b8 77 74 bb  f4 1c 1f f7 b6 88 8b b5   |     wt         |
170: 32 f0 f3 31 2b d5 d6 28  f7 90 93 f4 bf d5 d6 bc   |2  1+  (        |
180: 99 1c 1f 9a 77 8c 8f 74  fc 8a 89 ff 42 b4 b7 41   |    w  t    B  A|
190: 69 7f 7c 6a 6f 1f 1c 6c  b9 7b 78 ba fa d3 d0 f9   |i |jo  l {x     |
1a0: 0b a3 a0 08 55 7d 7e 56  2a 71 72 29 f1 ab a8 f2   |    U}~V*qr)    |
1b0: c5 f9 fa c6 07 ab a8 04  37 6f 6c 34 50 2e 2d 53   |        7ol4P.-S|
1c0: f6 68 6b f5 4f 13 10 4c  ce b6 b5 cd fc 4c 4f ff   | hk O  L     LO |
1d0: 00 a3 a0 03 06 1c 1f 05  57 04 07 54 ca 82 81 c9   |        W  T    |
1e0: ba 4d 4e b9 d5 17 14 d6  5d ba b9 5e 83 b3 b0 80   | MN     ]  ^    |
1f0: fb 9f 9c f8 29 4d 4e 2a  06 d7 d4 05 60 0c 0f 63   |    )MN*    `  c|
200: 00 00 00 00 00 00 00 01  77 ee 41 40 00 00 00 00   |        w A@    |
tf: round-trip buffer mismatch

this test runs well on openwrt mipsel device .

vcore85 commented 2 years ago

modify tests-transform to do decode test on tf,aes,chacha20,speck , the decode output of aes,chacha20 is same as input, while decode output of tf,speck is wrong.

Logan007 commented 2 years ago

After change the printf macros PRIx64 to PRIx8, the output size seems right

This alone is strange. And I am not able to explain. Does it expect the numbers in different memory formats?

modify tests-transform to do decode test on tf,aes,chacha20,speck , the decode output of aes,chacha20 is same as input, while decode output of tf,speck is wrong.

I only can assume some endianess related bug at some point deep in tf.c and speck.c respectively although endianess was taken care of during design. What endianess is that MIPS 24Kc system?

vcore85 commented 2 years ago

This alone is strange. And I am not able to explain. Does it expect the numbers in different memory formats?

I don't know , just try to modify and test.

I only can assume some endianess related bug at some point deep in tf.c and speck.c respectively although endianess was taken care of during design. What endianess is that MIPS 24Kc system?

AR9344 MIP24KC is big endian , while MT7620 MIPSEL24KC is little endian . So it looks like something wrong on big endian device.

ABEDC0DE commented 12 months ago

I also have an old MIPS24Kc big-endian device and I'm trying to fix this problem. Only tested the edge and it seems to work fine on my device.

Here's my OpenWrt package patch base on n2n 3.0-stable(little update for cc20.c):

--- a/src/speck.c
+++ b/src/speck.c
@@ -878,8 +878,8 @@ static int internal_speck_ctr (unsigned
     while(inlen >= 16) {
         x = nonce[1]; y = nonce[0]; nonce[0]++;
         speck_encrypt(&x, &y, ctx, numrounds);
-        ((u64 *)out)[1+t] = htole64(x ^ ((u64 *)in)[1+t]);
-        ((u64 *)out)[0+t] = htole64(y ^ ((u64 *)in)[0+t]);
+        ((u64 *)out)[1+t] = htole64(x ^ le64toh(((u64 *)in)[1+t]));
+        ((u64 *)out)[0+t] = htole64(y ^ le64toh(((u64 *)in)[0+t]));
         t += 2;
         inlen -= 16;
     }

--- a/src/cc20.c
+++ b/src/cc20.c
@@ -251,10 +251,15 @@ int cc20_crypt (unsigned char *out, cons
 static void cc20_init_block(cc20_context_t *ctx, const uint8_t nonce[]) {

     const uint8_t *magic_constant = (uint8_t*)"expand 32-byte k";
+    int i;

     memcpy(&(ctx->state[ 0]), magic_constant, 16);
     memcpy(&(ctx->state[ 4]), ctx->key, CC20_KEY_BYTES);
     memcpy(&(ctx->state[12]), nonce, CC20_IV_SIZE);
+
+    for (i = 0; i < 16; i++) {
+        ctx->state[i] = htole32(ctx->state[i]);
+    }
 }

@@ -282,6 +287,7 @@ static void cc20_init_block(cc20_context
 static void cc20_block_next(cc20_context_t *ctx) {

     uint32_t *counter = ctx->state + 12;
+    int i;

     ctx->keystream32[ 0] = ctx->state[ 0];
     ctx->keystream32[ 1] = ctx->state[ 1];
@@ -329,8 +335,12 @@ static void cc20_block_next(cc20_context
     ctx->keystream32[14] += ctx->state[14];
     ctx->keystream32[15] += ctx->state[15];

+    for (i = 0; i < 16; i++) {
+        ctx->keystream32[i] = le32toh(ctx->keystream32[i]);
+    }
+
     // increment counter, make sure it is and stays little endian in memory
-    *counter = htole32(le32toh(*counter)+1);
+    *counter = le32toh(htole32((*counter)+1));
 }

--- a/src/tf.c
+++ b/src/tf.c
@@ -524,20 +524,20 @@ int tf_cbc_decrypt (unsigned char *out,
         DEC_ROUND(Q2, Q3, Q0, Q1,  0); DEC_ROUND(R2, R3, R0, R1,  0); DEC_ROUND(S2, S3, S0, S1,  0);

         // whiten/byteswap/store output/iv
-        ((uint32_t*)out)[11] = htole32(S1 ^ ctx->K[3] ^ ((uint32_t*)in)[7]);
-        ((uint32_t*)out)[10] = htole32(S0 ^ ctx->K[2] ^ ((uint32_t*)in)[6]);
-        ((uint32_t*)out)[9]  = htole32(S3 ^ ctx->K[1] ^ ((uint32_t*)in)[5]);
-        ((uint32_t*)out)[8]  = htole32(S2 ^ ctx->K[0] ^ ((uint32_t*)in)[4]);
-
-        ((uint32_t*)out)[7]  = htole32(R1 ^ ctx->K[3] ^ ((uint32_t*)in)[3]);
-        ((uint32_t*)out)[6]  = htole32(R0 ^ ctx->K[2] ^ ((uint32_t*)in)[2]);
-        ((uint32_t*)out)[5]  = htole32(R3 ^ ctx->K[1] ^ ((uint32_t*)in)[1]);
-        ((uint32_t*)out)[4]  = htole32(R2 ^ ctx->K[0] ^ ((uint32_t*)in)[0]);
-
-        ((uint32_t*)out)[3]  = htole32(Q1 ^ ctx->K[3] ^ ((uint32_t*)ivec)[3]);
-        ((uint32_t*)out)[2]  = htole32(Q0 ^ ctx->K[2] ^ ((uint32_t*)ivec)[2]);
-        ((uint32_t*)out)[1]  = htole32(Q3 ^ ctx->K[1] ^ ((uint32_t*)ivec)[1]);
-        ((uint32_t*)out)[0]  = htole32(Q2 ^ ctx->K[0] ^ ((uint32_t*)ivec)[0]);
+        ((uint32_t*)out)[11] = htole32(S1 ^ ctx->K[3] ^ le32toh(((uint32_t*)in)[7]));
+        ((uint32_t*)out)[10] = htole32(S0 ^ ctx->K[2] ^ le32toh(((uint32_t*)in)[6]));
+        ((uint32_t*)out)[9]  = htole32(S3 ^ ctx->K[1] ^ le32toh(((uint32_t*)in)[5]));
+        ((uint32_t*)out)[8]  = htole32(S2 ^ ctx->K[0] ^ le32toh(((uint32_t*)in)[4]));
+
+        ((uint32_t*)out)[7]  = htole32(R1 ^ ctx->K[3] ^ le32toh(((uint32_t*)in)[3]));
+        ((uint32_t*)out)[6]  = htole32(R0 ^ ctx->K[2] ^ le32toh(((uint32_t*)in)[2]));
+        ((uint32_t*)out)[5]  = htole32(R3 ^ ctx->K[1] ^ le32toh(((uint32_t*)in)[1]));
+        ((uint32_t*)out)[4]  = htole32(R2 ^ ctx->K[0] ^ le32toh(((uint32_t*)in)[0]));
+
+        ((uint32_t*)out)[3]  = htole32(Q1 ^ ctx->K[3] ^ le32toh(((uint32_t*)ivec)[3]));
+        ((uint32_t*)out)[2]  = htole32(Q0 ^ ctx->K[2] ^ le32toh(((uint32_t*)ivec)[2]));
+        ((uint32_t*)out)[1]  = htole32(Q3 ^ ctx->K[1] ^ le32toh(((uint32_t*)ivec)[1]));
+        ((uint32_t*)out)[0]  = htole32(Q2 ^ ctx->K[0] ^ le32toh(((uint32_t*)ivec)[0]));

         in += 3 * TF_BLOCK_SIZE; out += 3 * TF_BLOCK_SIZE;

@@ -575,10 +575,10 @@ int tf_cbc_decrypt (unsigned char *out,
         DEC_ROUND(Q2, Q3, Q0, Q1,  0);

         // load/byteswap/whiten output/iv
-        ((uint32_t*)out)[3] = htole32(Q1 ^ ctx->K[3] ^ ((uint32_t*)ivec)[3]);
-        ((uint32_t*)out)[2] = htole32(Q0 ^ ctx->K[2] ^ ((uint32_t*)ivec)[2]);
-        ((uint32_t*)out)[1] = htole32(Q3 ^ ctx->K[1] ^ ((uint32_t*)ivec)[1]);
-        ((uint32_t*)out)[0] = htole32(Q2 ^ ctx->K[0] ^ ((uint32_t*)ivec)[0]);
+        ((uint32_t*)out)[3] = htole32(Q1 ^ ctx->K[3] ^ le32toh(((uint32_t*)ivec)[3]));
+        ((uint32_t*)out)[2] = htole32(Q0 ^ ctx->K[2] ^ le32toh(((uint32_t*)ivec)[2]));
+        ((uint32_t*)out)[1] = htole32(Q3 ^ ctx->K[1] ^ le32toh(((uint32_t*)ivec)[1]));
+        ((uint32_t*)out)[0] = htole32(Q2 ^ ctx->K[0] ^ le32toh(((uint32_t*)ivec)[0]));

         in += TF_BLOCK_SIZE; out+= TF_BLOCK_SIZE;
hamishcoleman commented 11 months ago

@ABEDC0DE thanks for sharing that change. I just wanted to check confirm that our tests would have noticed this error - are you able to run the tools/tests-transform on your device?

(With non openwrt builds, this is wrapped up in a comparison against known good results in tests/tests-transform.expected, but the cross-compile nature of openwrt makes this process hard to do automatically)

ABEDC0DE commented 11 months ago

@hamishcoleman Of cause. I'm using the tools/tests-transform for debugging. After patching, everything looks good except the size. It maybe an output bug about printf's PRIx64 on the 32-bit environment.

By the way, tools/tests-transform would be nice to have a small PKT_CONTENT as well. At first time I modify tf.c without the second part. It prints tested but throws transop_decode_tf payload decryption failed with unexpected cipher text stealing padding when I try to use it.

root@OpenWrt:~# ./tests-transform
environment: community_name = "abc123def456"
environment: encrypt_key = "SoMEVer!S$cUREPassWORD"
environment: input size = 0x20000000000
000: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
010: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
020: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
030: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
040: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
050: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
060: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
070: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
080: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
090: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
0a0: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
0b0: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
0c0: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
0d0: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
0e0: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
0f0: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
100: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
110: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
120: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
130: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
140: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
150: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
160: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
170: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
180: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
190: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
1a0: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
1b0: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
1c0: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
1d0: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
1e0: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |
1f0: 00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f   |                |

null: output size = 0x2260000000f
000: 03 02 00 03 61 62 63 31  32 33 64 65 66 34 35 36   |    abc123def456|
010: 00 00 00 00 00 00 00 00  00 01 02 03 04 05 00 01   |                |
020: 02 03 04 05 00 00 00 01  02 03 04 05 06 07 08 09   |                |
030: 0a 0b 0c 0d 0e 0f 00 01  02 03 04 05 06 07 08 09   |                |
040: 0a 0b 0c 0d 0e 0f 00 01  02 03 04 05 06 07 08 09   |                |
050: 0a 0b 0c 0d 0e 0f 00 01  02 03 04 05 06 07 08 09   |                |
060: 0a 0b 0c 0d 0e 0f 00 01  02 03 04 05 06 07 08 09   |                |
070: 0a 0b 0c 0d 0e 0f 00 01  02 03 04 05 06 07 08 09   |                |
080: 0a 0b 0c 0d 0e 0f 00 01  02 03 04 05 06 07 08 09   |                |
090: 0a 0b 0c 0d 0e 0f 00 01  02 03 04 05 06 07 08 09   |                |
0a0: 0a 0b 0c 0d 0e 0f 00 01  02 03 04 05 06 07 08 09   |                |
0b0: 0a 0b 0c 0d 0e 0f 00 01  02 03 04 05 06 07 08 09   |                |
0c0: 0a 0b 0c 0d 0e 0f 00 01  02 03 04 05 06 07 08 09   |                |
0d0: 0a 0b 0c 0d 0e 0f 00 01  02 03 04 05 06 07 08 09   |                |
0e0: 0a 0b 0c 0d 0e 0f 00 01  02 03 04 05 06 07 08 09   |                |
0f0: 0a 0b 0c 0d 0e 0f 00 01  02 03 04 05 06 07 08 09   |                |
100: 0a 0b 0c 0d 0e 0f 00 01  02 03 04 05 06 07 08 09   |                |
110: 0a 0b 0c 0d 0e 0f 00 01  02 03 04 05 06 07 08 09   |                |
120: 0a 0b 0c 0d 0e 0f 00 01  02 03 04 05 06 07 08 09   |                |
130: 0a 0b 0c 0d 0e 0f 00 01  02 03 04 05 06 07 08 09   |                |
140: 0a 0b 0c 0d 0e 0f 00 01  02 03 04 05 06 07 08 09   |                |
150: 0a 0b 0c 0d 0e 0f 00 01  02 03 04 05 06 07 08 09   |                |
160: 0a 0b 0c 0d 0e 0f 00 01  02 03 04 05 06 07 08 09   |                |
170: 0a 0b 0c 0d 0e 0f 00 01  02 03 04 05 06 07 08 09   |                |
180: 0a 0b 0c 0d 0e 0f 00 01  02 03 04 05 06 07 08 09   |                |
190: 0a 0b 0c 0d 0e 0f 00 01  02 03 04 05 06 07 08 09   |                |
1a0: 0a 0b 0c 0d 0e 0f 00 01  02 03 04 05 06 07 08 09   |                |
1b0: 0a 0b 0c 0d 0e 0f 00 01  02 03 04 05 06 07 08 09   |                |
1c0: 0a 0b 0c 0d 0e 0f 00 01  02 03 04 05 06 07 08 09   |                |
1d0: 0a 0b 0c 0d 0e 0f 00 01  02 03 04 05 06 07 08 09   |                |
1e0: 0a 0b 0c 0d 0e 0f 00 01  02 03 04 05 06 07 08 09   |                |
1f0: 0a 0b 0c 0d 0e 0f 00 01  02 03 04 05 06 07 08 09   |                |
200: 0a 0b 0c 0d 0e 0f 00 01  02 03 04 05 06 07 08 09   |                |
210: 0a 0b 0c 0d 0e 0f 00 01  02 03 04 05 06 07 08 09   |                |
220: 0a 0b 0c 0d 0e 0f                                  |      |
null: tested

tf: output size = 0x23600000000
000: 03 02 00 03 61 62 63 31  32 33 64 65 66 34 35 36   |    abc123def456|
010: 00 00 00 00 00 00 00 00  00 01 02 03 04 05 00 01   |                |
020: 02 03 04 05 00 00 69 54  ba b7 b9 00 7e 1f 4e 43   |      iT    ~ NC|
030: 6b 6e c0 b7 5a bb e1 6a  7d 8b f6 41 9e fb 7e c1   |kn  Z  j}  A  ~ |
040: a8 6c 67 6b c7 27 17 32  9b 89 f2 5d 1d 67 49 de   | lgk ' 2   ] gI |
050: ab 5c d4 b7 a1 97 99 76  7d 90 8d 2c 7c 0d 65 66   | \     v}  ,| ef|
060: d5 7f 1a 3b bf 0c 52 b3  42 0d c8 c8 0d 62 8e 4b   |   ;  R B    b K|
070: 98 7b bc 0d 9c db bf 61  dc 9d 9f 44 a4 fc 8d 1a   | {     a   D    |
080: 70 f0 14 87 89 0e 4a b8  7e 66 72 7a 04 6e 9b 17   |p     J ~frz n  |
090: e1 2c 06 ce 52 04 2a a0  0f 7f 76 f4 5c c5 e2 09   | ,  R *   v \   |
0a0: f6 35 ff ad 87 ab 72 5a  6f bc 61 78 f6 3c 48 e2   | 5    rZo ax <H |
0b0: b2 a4 27 ae 74 03 c7 83  f4 af 5a 1e da b4 7e 8a   |  ' t     Z   ~ |
0c0: 25 87 45 d2 8e 97 2b c0  69 8f f3 6d e5 8f a5 7f   |% E   + i  m    |
0d0: 91 72 94 49 bc d8 0e 20  d0 ed 16 28 df 78 37 53   | r I       ( x7S|
0e0: 97 63 f9 9e 0a c1 4c 3c  98 a9 c3 79 5a 76 a0 c9   | c    L<   yZv  |
0f0: 34 f1 26 6e 66 27 a9 68  9d d1 24 26 e8 64 a4 a0   |4 &nf' h  $& d  |
100: 71 e1 37 9a c9 b2 d6 7b  1c 56 b3 9d ac b0 47 5d   |q 7    { V    G]|
110: 81 2f 12 c4 56 a7 61 8f  58 20 1d 91 a0 ff fa 43   | /  V a X      C|
120: 4c 46 77 9f 20 66 7f a1  1d 98 b3 c5 b4 36 dd 41   |LFw  f       6 A|
130: 42 f3 4f b0 65 65 aa 94  f0 42 aa 31 2f e3 de c0   |B O ee   B 1/   |
140: a0 d2 02 c4 a8 6c d2 81  56 d7 00 eb c5 1b 3f 10   |     l  V     ? |
150: bc ea 09 c9 b7 f7 9f 08  c4 80 55 b6 04 02 50 f4   |          U   P |
160: 6c 76 bb 70 a0 04 14 da  fd 13 d1 b0 cd cb a6 b2   |lv p            |
170: d0 3f 37 09 47 62 94 bf  39 f4 6b d6 fa 22 0c 23   | ?7 Gb  9 k  " #|
180: a6 07 9b 1e ee b6 ae f7  58 b0 dc a9 db 60 ff a2   |        X    `  |
190: b7 03 a1 a3 26 1b 5b 37  c6 69 43 6b bb 6c 03 3e   |    & [7 iCk l >|
1a0: a7 fc d2 83 5b 61 b1 e0  fd 28 d1 ec 65 a2 cf 6c   |    [a   (  e  l|
1b0: ef 3b ad cc 75 e3 f9 71  0f 90 71 a6 bc 1a d5 17   | ;  u  q  q     |
1c0: 65 64 3e 0c d2 c8 de bd  1f d5 af 84 fc fe aa bd   |ed>             |
1d0: c5 88 13 af 09 ee 8c c0  38 49 79 09 a7 7a 01 48   |        8Iy  z H|
1e0: 2e 3e 9a 38 1b c6 b8 c0  a9 4e 61 0f 19 2a 95 84   |.> 8     Na  *  |
1f0: 3b 53 1c db 9a ec af 8f  2d af 73 d5 cc 71 bd 42   |;S      - s  q B|
200: 4f e2 70 ca 45 b6 44 18  54 fe 6b 23 31 ba f4 b1   |O p E D T k#1   |
210: 02 a1 26 4f f1 a9 c0 78  e6 3b 11 9e d6 3c 61 e5   |  &O   x ;   <a |
220: 3b 6f f3 42 43 9f 77 cf  9e 0d 39 85 eb e0 ad db   |;o BC w   9     |
230: d6 40 b7 94 99 ca                                  | @    |
tf: tested

aes: output size = 0x23600000000
000: 03 02 00 03 61 62 63 31  32 33 64 65 66 34 35 36   |    abc123def456|
010: 00 00 00 00 00 00 00 00  00 01 02 03 04 05 00 01   |                |
020: 02 03 04 05 00 00 2d 8c  8e f3 c4 7e 94 3a 30 84   |      -    ~ :0 |
030: 4a dc 2d 80 1f 12 3c 16  48 bd a7 4f 6c 2b 88 00   |J -   < H  Ol+  |
040: 58 3f 54 cb dc db 40 7a  9d c9 3a c9 a3 0d 0e ef   |X?T   @z  :     |
050: 95 28 a2 47 94 26 ae bc  75 23 3b 77 19 41 15 4c   | ( G &  u#;w A L|
060: e8 b7 13 8e 6e 8a 21 b9  1a 9e c0 73 f6 be 68 a3   |    n !    s  h |
070: 85 1e 96 e1 b0 7e 94 9e  cd 57 c5 6c 80 b9 d7 74   |     ~   W l   t|
080: 87 8c ef e3 a0 ec b9 c6  d7 29 84 64 24 79 e0 f6   |         ) d$y  |
090: 15 9d 0a 9d c6 b6 c9 20  9e e2 3f 4e 18 d9 c2 4d   |          ?N   M|
0a0: 20 2c 11 d0 e7 52 08 6c  54 c2 fe 5d a2 a8 07 57   | ,   R lT  ]   W|
0b0: 0e 00 fe 83 c6 d2 41 95  5b a5 df 98 02 34 a4 be   |      A [    4  |
0c0: 6a 4d 1a 9d f2 06 33 f5  e8 c0 0f 44 fb b6 e8 22   |jM    3    D   "|
0d0: 25 ca 62 d0 e6 bd c4 62  aa e6 5d 5a 4c 2d 14 e4   |% b    b  ]ZL-  |
0e0: 90 c2 40 36 03 9e 0c d1  fd 0f 80 23 f0 f7 6d 86   |  @6       #  m |
0f0: 96 c9 b4 f7 b8 50 75 cf  7d 22 42 81 2d 18 61 30   |     Pu }"B - a0|
100: b8 05 c8 a6 ca 9c 76 76  6f 0b 90 35 16 a1 12 73   |      vvo  5   s|
110: aa ad 52 aa 3c 03 dd 37  3d bb 29 07 de d2 81 b2   |  R <  7= )     |
120: 61 e8 25 3a a5 03 39 b1  7d 63 25 d7 00 65 18 4d   |a %:  9 }c%  e M|
130: 46 d0 92 15 55 3a d6 6a  42 e1 ea aa 07 d6 cd 36   |F   U: jB      6|
140: eb 85 c0 60 3c 3e 15 db  8d df 9d 65 07 39 9c f8   |   `<>     e 9  |
150: c2 4c 3d 3e 73 a7 15 fc  28 6c a6 e5 8b 16 bd c9   | L=>s   (l      |
160: e2 c9 5e d9 64 8e bc f5  92 a4 e5 74 04 cb 9c 90   |  ^ d      t    |
170: 0c 10 28 5f 30 10 61 b7  44 50 b1 f9 3e 21 a1 41   |  (_0 a DP  >! A|
180: c2 e2 a5 e9 f7 33 16 52  32 61 d1 a3 c5 0b 61 d4   |     3 R2a    a |
190: 53 0f 65 a8 d9 e1 fb e1  9b 1b 61 16 d1 75 0a 4b   |S e       a  u K|
1a0: 9a 9f d1 f3 4e f6 ca b2  a2 24 50 8b 10 4d 45 54   |    N    $P  MET|
1b0: 3d e1 c2 8f 07 52 67 52  7e d1 7f 99 3c 4e de eb   |=    RgR~   <N  |
1c0: ba ba 02 fd 0a ce 43 f6  30 5a f3 5f 45 cb 75 2b   |      C 0Z _E u+|
1d0: fe 7e e1 0d 2c 80 47 8d  26 7d eb d3 be 03 b4 fa   | ~  , G &}      |
1e0: b1 03 b1 ea 7f 39 41 3f  7c b2 80 c7 54 21 b0 c1   |     9A?|   T!  |
1f0: 5e 85 b2 61 5e 19 b6 f8  31 20 a9 76 ed e3 59 31   |^  a^   1  v  Y1|
200: 62 9b 93 f1 6b b1 13 0c  8f 3c 66 1d ec f9 88 df   |b   k    <f     |
210: ff 6f 55 e7 dd 5a 23 10  7c 14 c5 9b b3 5c 47 fa   | oU  Z# |    \G |
220: 8d 65 0a 38 00 6b 35 55  63 73 d9 25 b7 60 b5 33   | e 8 k5Ucs % ` 3|
230: b4 2f d2 04 86 e1                                  | /    |
aes: tested

cc20: output size = 0x23677f03370
000: 03 02 00 03 61 62 63 31  32 33 64 65 66 34 35 36   |    abc123def456|
010: 00 00 00 00 00 00 00 00  00 01 02 03 04 05 00 01   |                |
020: 02 03 04 05 00 00 f2 73  c1 14 6c df 4e 12 d6 7b   |       s  l N  {|
030: 2f 27 56 8d ed 74 32 7a  66 53 0c 74 ad 3f e7 c8   |/'V  t2zfS t ?  |
040: 57 3f dc 21 5c 98 cd 74  a7 c2 55 87 c4 00 a0 34   |W? !\  t  U    4|
050: ca 02 ec da dc 52 9d 90  fa f7 5d 1d 94 00 ec 87   |     R    ]     |
060: 64 3c 3b aa d9 c9 ff 97  8e 3a 0f e7 01 44 f3 9c   |d<;      :   D  |
070: 39 1d 3e f1 95 67 7c 5b  32 fc ca bb 83 36 2e d9   |9 >  g|[2    6. |
080: 74 50 9f a3 de 38 4e c7  ca 6b 35 7c 1b 4e 39 ea   |tP   8N  k5| N9 |
090: 5f e2 8a 80 d9 58 6e 14  32 bf 8e e9 a2 b0 19 8a   |_    Xn 2       |
0a0: e1 1d da fa 3f 4a b7 1c  03 e0 e3 17 85 54 84 c8   |    ?J       T  |
0b0: 3e 90 8e 85 5b e7 12 3d  73 9e b9 ef 7e 48 c0 55   |>   [  =s   ~H U|
0c0: 59 28 29 f4 d1 12 62 b3  b3 db 65 0a 6c 8c 44 be   |Y()   b   e l D |
0d0: e2 76 49 e6 b6 4a 9e 7e  9c 49 c9 10 d3 dc 85 33   | vI  J ~ I     3|
0e0: fe eb a5 dc 5e 18 cf dc  9a 99 da bc 5c 9f c1 ff   |    ^       \   |
0f0: 9c 92 3b a9 9d d6 5d 03  f4 f3 5e a9 52 21 d2 d0   |  ;   ]   ^ R!  |
100: 8b 4e 8a b6 06 af 4e 34  98 e2 bc 9b c2 f1 9d 72   | N    N4       r|
110: f8 0f f3 d5 83 34 7d 47  fe bf 6c 1d c2 d3 89 a4   |     4}G  l     |
120: ff 5b 76 3c cb 9b 4d 09  a6 3a a2 2f 0b 8d 7a 34   | [v<  M  : /  z4|
130: 12 d5 73 c4 bc ba 13 76  e7 69 50 6d 50 ab 76 b5   |  s    v iPmP v |
140: a6 fb b4 fb c7 98 3d ac  ce e1 e1 98 97 9f 24 98   |      =       $ |
150: 90 82 61 00 38 57 b0 36  7d 55 a7 70 9c ee 51 26   |  a 8W 6}U p  Q&|
160: 47 02 4f b5 fe cc 2c e0  07 c6 7b 04 6d a1 89 dc   |G O   ,   { m   |
170: e8 98 71 fd 27 54 d1 f1  2d 0b 3e 64 ef 02 74 71   |  q 'T  - >d  tq|
180: db f5 b1 84 87 6d c9 37  c5 c3 3a de ea 1b 53 d3   |     m 7  :   S |
190: f1 ed 8f 24 2d 74 a3 77  23 20 9b 75 c3 f2 ef 4a   |   $-t w#  u   J|
1a0: 75 ec d3 86 59 11 c5 fc  b0 ed 79 b0 8e a8 03 c8   |u   Y     y     |
1b0: 3e 05 db b0 65 62 53 e5  ef e7 95 88 ce 62 89 7a   |>   ebS      b z|
1c0: 9d 3c bc ea a4 3a f6 df  1d 10 8a a3 80 7c 3b 80   | <   :       |; |
1d0: be 0a 27 76 2b bc 7d 02  98 bf b7 5e 4a 4c 53 df   |  'v+ }    ^JLS |
1e0: 57 ff 67 7e 33 6a 00 4c  ff d6 c0 ff 3f 1c 24 f7   |W g~3j L    ? $ |
1f0: fb fd 3b d2 4f 18 e3 9d  62 5b 9b 15 68 13 44 d8   |  ; O   b[  h D |
200: 71 79 9d b1 ab 2f bd f3  44 6b 77 96 b8 44 bc 90   |qy   /  Dkw  D  |
210: 1f 74 db d2 73 7d 5d 44  f7 a6 92 4e fa 24 e3 92   | t  s}]D   N $  |
220: c8 34 c7 1d 16 8b f5 80  d9 15 48 24 12 16 14 76   | 4        H$   v|
230: 15 5f d0 dc 1e 9c                                  | _    |
cc20: tested

speck: output size = 0x2360041ba78
000: 03 02 00 03 61 62 63 31  32 33 64 65 66 34 35 36   |    abc123def456|
010: 00 00 00 00 00 00 00 00  00 01 02 03 04 05 00 01   |                |
020: 02 03 04 05 00 00 69 c2  17 4a ab 55 f3 8d 44 17   |      i  J U  D |
030: 2c 31 09 b5 b0 2f 0c 87  f2 05 13 59 34 49 72 45   |,1   /     Y4IrE|
040: 2c 79 51 cf 39 f5 ce 0e  b9 fc c8 41 31 08 e9 a5   |,yQ 9      A1   |
050: 54 3c aa 77 aa 29 10 41  4a 16 4b e9 89 8f 92 7b   |T< w ) AJ K    {|
060: 29 b3 0b 4b 84 92 2a 3a  fe bd c0 50 75 fc a4 7e   |)  K  *:   Pu  ~|
070: 4e 20 2e 3b 53 eb d1 37  43 35 b6 5e 55 a6 5e 0e   |N .;S  7C5 ^U ^ |
080: e3 05 db 07 5f a8 74 4d  9f 41 ed 5f 44 93 98 9b   |    _ tM A _D   |
090: fb 48 3c 9c 36 8b a6 71  ed ee f4 e6 10 21 b1 b5   | H< 6  q     !  |
0a0: f4 b7 28 db d5 5d 43 3d  4b 8d 1a 33 cf c5 54 09   |  (  ]C=K  3  T |
0b0: b6 9d f5 f2 27 2f e7 be  dd 4c 3c 5c c8 71 ca 71   |    '/   L<\ q q|
0c0: 8c 47 37 21 6c ad 3f d6  9a 99 ab 18 fc d8 1b c7   | G7!l ?         |
0d0: 72 c2 7d fb 57 8c 97 4f  77 4c 6c 94 4a ab f4 94   |r } W  OwLl J   |
0e0: d8 e3 02 e2 b9 bf 12 47  fb 53 aa b8 4a 93 38 c6   |       G S  J 8 |
0f0: bb 8b 27 8b d6 db f3 e4  e3 43 7e 7f 83 cf c9 df   |  '      C~     |
100: e5 71 b9 80 9c ad 38 e5  10 aa 99 ad e1 0d 34 6f   | q    8       4o|
110: de 7e ff 29 cc fe b5 89  49 a9 a1 b5 9e 9f be 5e   | ~ )    I      ^|
120: e6 d2 74 2c 57 91 86 40  02 a0 7b 6b 42 6e b0 63   |  t,W  @  {kBn c|
130: 0e 04 19 7c f0 e5 ff 3d  db de e3 c5 fc 70 18 7d   |   |   =     p }|
140: 06 33 7e 6a bb 46 3b 94  28 85 87 51 9f 6e 95 22   | 3~j F; (  Q n "|
150: 99 b4 34 bd 29 94 3a a8  a4 ff 5b 19 53 69 cb e5   |  4 ) :   [ Si  |
160: a6 0c 41 c5 22 89 82 a7  a5 f3 f3 49 ed 5d ce f3   |  A "      I ]  |
170: a7 ee 77 dd a9 aa 26 5b  85 ec b1 6e f4 33 a0 b8   |  w   &[   n 3  |
180: 93 2a 80 6f 3f 5f 0a ff  1b 72 14 5d 4f 1a cc 74   | * o?_   r ]O  t|
190: 69 01 da 81 7d 89 4b 0f  68 fe c6 c5 ae 39 86 1d   |i   } K h    9  |
1a0: ab e3 c7 35 2e 5d a8 3d  56 3e 26 52 74 72 5b f2   |   5.] =V>&Rtr[ |
1b0: 41 1a 7a 04 d9 d0 65 fe  92 c4 b9 be 75 e5 9e e1   |A z   e     u   |
1c0: 8e 52 f4 27 98 44 61 26  7f 6b 96 0c c4 6a a6 6b   | R ' Da& k   j k|
1d0: 36 66 81 a1 f6 dd ab 2a  a7 63 e5 7f 63 67 79 08   |6f     * c  cgy |
1e0: ba 7b bb 11 12 9c 14 b2  a4 2b 56 66 14 c1 54 c6   | {       +Vf  T |
1f0: 96 f0 e4 68 8a 5c 11 b6  27 af 61 ef ab 47 9e 7f   |   h \  ' a  G  |
200: 76 0e 39 c3 fb 88 94 29  7c 9e 96 9b e5 e1 6b ae   |v 9    )|     k |
210: 87 03 a4 86 a2 1f 91 cf  90 1c 11 08 57 bc c7 90   |            W   |
220: 0b c1 51 2e 28 a6 58 96  e2 e7 f2 20 c6 ac 06 05   |  Q.( X         |
230: 39 75 4a 56 cf f8                                  |9uJV  |
speck: tested