ntop / n2n

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

transop_decode_aes payload decryption failed with unexpected cipher text stealing padding #1007

Open oldmaCloud opened 2 years ago

oldmaCloud commented 2 years ago

02/Jun/2022 20:33:33 [transform_aes.c:162] WARNING: transop_decode_aes payload decryption failed with unexpected cipher text stealing padding 02/Jun/2022 20:33:34 [transform_aes.c:162] WARNING: transop_decode_aes payload decryption failed with unexpected cipher text stealing padding 02/Jun/2022 20:33:35 [transform_aes.c:162] WARNING: transop_decode_aes payload decryption failed with unexpected cipher text stealing padding

it comes on arm 926ejs board, network cannot acesss

Logan007 commented 2 years ago

Hello,

Do you operate the board in little endian or big endian mode?

Also, have you tried the other ciphers -A1 ... -A5 and does any of them work?

oldmaCloud commented 2 years ago

yes,i tried. A1 A2,A3 same WARNING,A5 no WARNING, ping still can not access. A4 comes: /Jun/2022 09:19:42 [edge_utils.c:1779] WARNING: invalid transop ID: expected ChaCha20 (4), got invalid (76) from 22:74:45:90:F2:61 [218.204.252.29:20453] 03/Jun/2022 09:19:42 [edge_utils.c:1779] WARNING: invalid transop ID: expected ChaCha20 (4), got invalid (17) from 22:74:45:90:F2:61 [218.204.252.29:20453] 03/Jun/2022 09:19:43 [edge_utils.c:1779] WARNING: invalid transop ID: expected ChaCha20 (4), got invalid (135) from 22:74:45:90:F2:61 [218.204.252.29:20453] 03/Jun/2022 09:19:44 [edge_utils.c:1779] WARNING: invalid transop ID: expected ChaCha20 (4), got invalid (10) from 22:74:45:90:F2:61 [218.204.252.29:20453] 03/Jun/2022 09:19:45 [edge_utils.c:1779] WARNING: invalid transop ID: expected ChaCha20 (4), got invalid (142) from 22:74:45:90:F2:61 [218.204.252.29:20453] 03/Jun/2022 09:19:46 [edge_utils.c:1779] WARNING: invalid transop ID: expected ChaCha20 (4), got invalid (10) from 22:74:45:90:F2:61 [218.204.252.29:20453] 03/Jun/2022 09:19:48 [edge_utils.c:1779] WARNING: invalid transop ID: expected ChaCha20 (4), got invalid (88) from 22:74:45:90:F2:61 [218.204.252.29:20453] 03/Jun/2022 09:19:48 [edge_utils.c:1779] WARNING: invalid transop ID: expected ChaCha20 (4), got invalid (207) from 22:74:45:90:F2:61 [218.204.252.29:20453] 03/Jun/2022 09:19:49 [edge_utils.c:1779] WARNING: invalid transop ID: expected ChaCha20 (4), got invalid (47) from 22:74:45:90:F2:61 [218.204.252.29:20453] 03/Jun/2022 09:19:51 [edge_utils.c:1779] WARNING: invalid transop ID: expected ChaCha20 (4), got invalid (231) from 22:74:45:90:F2:61 [218.204.252.29:20453]

oldmaCloud commented 2 years ago

It is Little_endian!/n i use this code test:

include "stdio.h"

int main() { union w { int a; //4 bytes char b; //1 byte } c; c.a=1; if (c.b==1) printf("It is Little_endian!/n"); else printf("It is Big_endian!/n"); return 1; }

oldmaCloud commented 2 years ago

it comes from version 3.0, i degrade to 2.8 ,it is ok.

Logan007 commented 2 years ago

I suspect that this might also be related to #951 and #922, also it could be endianess-related. Endianess is determined at compile time. We maybe need to go through the include/portable_endian.h file.

What does tools/tests-transform output?

Logan007 commented 2 years ago

And also, just for encircling the bug, does it work better if compiled with openSSL support?

NiceShow-Cxp commented 1 year ago

I'm having the same issue, but I'm cross-compiling the environment (ARM, Little_endian). When I use tests-transform tests, the results tf:round-trip buffer mismatch, aes:round-trip buffer mismatch, cc20:round-trip buffer mismatch. When I use the OPENSSL N2N_OPTION_USE_OPENSSL. AES passed, tf, cc20 are still wrong. Currently I have tried versions 3.1.1, 3.1.0, 3.0, 2.9.1 all have this problem.

Logan007 commented 1 year ago

I see. TF and CC20 will still be handled inside our code. So, it really seems an endianess issue here. Not sure where to start.

752438771 commented 8 months ago

I also encountered the same problem on the arm926ejs board. I tried some suggestions and solutions mentioned in the above discussion but still no solution.