Skip to content

Commit a6cf1f8

Browse files
committed
esp: fix silly cbc bug, and add cbc hmac 256 test.
1 parent 5b92271 commit a6cf1f8

3 files changed

Lines changed: 6 additions & 5 deletions

File tree

.github/workflows/linux.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ jobs:
3737
sudo ./build/test-esp -m 0
3838
sudo killall tcpdump || true
3939
sudo ./tools/ip-xfrm/delete_all
40+
sudo ./tools/ip-xfrm/cbc_auth sha256 128
41+
sudo ./build/test-esp -m 1
42+
sudo killall tcpdump || true
43+
sudo ./tools/ip-xfrm/delete_all
4044
4145
- name: Run standalone wolfssl test
4246
run: |

src/test/test_esp.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,6 @@
3838
#include "wolfesp.h"
3939

4040
static void __attribute__((noreturn)) print_usage_and_die(void);
41-
#if 0
42-
#include "esp_sa_list.c"
43-
#endif
4441

4542
#define TEST_SIZE (12 * 1024)
4643

@@ -606,7 +603,7 @@ int main(int argc, char **argv)
606603

607604
err = wolfIP_esp_sa_new_cbc_sha256(0, out_sa_cbc, atoip4(WOLFIP_IP),
608605
atoip4(HOST_STACK_IP),
609-
out_enc_key, sizeof(out_enc_key - 4),
606+
out_enc_key, sizeof(out_enc_key) - 4,
610607
out_auth_key, sizeof(out_auth_key),
611608
ESP_ICVLEN_HMAC_128);
612609
break;

src/wolfesp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,7 @@ esp_aes_rfc3602_enc(const struct wolfIP_esp_sa * esp_sa, uint8_t * esp_data,
541541
}
542542

543543
inited = 1;
544-
ret = wc_AesSetKey(&cbc_enc, esp_sa->enc_key, AES_BLOCK_SIZE,
544+
ret = wc_AesSetKey(&cbc_enc, esp_sa->enc_key, esp_sa->enc_key_len,
545545
iv, AES_ENCRYPTION);
546546

547547
if (ret != 0) {

0 commit comments

Comments
 (0)