-
Notifications
You must be signed in to change notification settings - Fork 18
Add IPsec ESP transport support, packet print debug functions, and misc cleanup. #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
bffa3c2 to
2746fc1
Compare
2746fc1 to
3d47370
Compare
562fc2e to
5b92271
Compare
5eb24a1 to
c2c3854
Compare
| printf(esp_str_4hex " (%s, %d bytes)\n", | ||
| val[0], val[1], val[2], val[3], fld, val_len); | ||
| if (val_len > 4) { | ||
| for (size_t i = 4; i < val_len; i += 4) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can val_len be a non-multiple of 4? because if so this part of code can result in a buffer over-read in a last iteration.
e.g.: val_len is not a multiple of 4, and is >= 5 and <= 16 the loop could go over I think, and read up to 3 bytes past val_len on the last iteration of the loop.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think all these fields must be 4 byte multiples, but I'll double check
| case ESP_ENC_CBC_AES: | ||
| block_len = AES_BLOCK_SIZE; | ||
| break; | ||
| #ifndef NO_DES3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see any definition of a wolfIP_esp_sa_new_des3, is this expected if the user decides to use DES3? Since the enum exists.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was lazy and hadn't added des3 support yet! Doing it now.
| @@ -0,0 +1,48 @@ | |||
| /* esp_common.c | |||
| * | |||
| * Copyright (C) 2024 wolfSSL Inc. | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit:2026?
Description
esp_sa.txtconfig totools/ip-xfrm/.DHCP_OPT_data_to_u32(),DHCP_OPT_u32_to_data()to trim duplicated code.error: initializer-string for array), etc.packet print functions
Added packet print functions
wolfIP_print_X()foreth,ip,esp:Testing
Added
test_esp.c:Added github workflow that tests aes-gcm and aes-cbc + hmac auth:
rfc4106 gcm example
Setup ip xfrm state/policy with:
then run:
cbc hmac auth example
Set ip xfrm state / policy with script:
test-esp output with debug flags
-DDEBUG_IP -DWOLFIP_DEBUG_ESP: