Skip to content

Commit ef0ee36

Browse files
committed
Alter ISO-TP example to use wolfSSL native
Uses the wolfSSL native ISO-TP instead of a third-party one.
1 parent 7be7d7f commit ef0ee36

File tree

6 files changed

+60
-209
lines changed

6 files changed

+60
-209
lines changed

.gitmodules

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,3 @@
1616
[submodule "android/wolfcryptjni-ndk-gradle/wolfcrypt-jni"]
1717
path = android/wolfcryptjni-ndk-gradle/wolfcrypt-jni
1818
url = https://github.com/wolfssl/wolfcrypt-jni
19-
[submodule "can-bus/isotp-c"]
20-
path = can-bus/isotp-c
21-
url = https://github.com/lishen2/isotp-c

can-bus/Makefile

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
11
CC=gcc
22
LIBS=-lwolfssl
3-
CFLAGS=-Iisotp-c -Wno-cpp -Wall -Wextra -Wdeclaration-after-statement
3+
CFLAGS=-g -Wno-cpp -Wall -Wextra -Wpedantic -Wdeclaration-after-statement
44

5-
COMMON_OBJS=isotp-c/isotp.o common.o
5+
COMMON_OBJS=common.o
66
CLIENT_OBJS=client.o
77
SERVER_OBJS=server.o
88

99
all: client server
1010

11-
isotp-c/isotp.o: isotp-c/isotp.c
12-
@$(CC) -c $< -o $@
13-
1411
%.o: %.c
1512
@$(CC) -c $< -o $@ $(CFLAGS)
1613

@@ -24,4 +21,3 @@ clean:
2421
@rm -f *.o
2522
@rm -f client
2623
@rm -f server
27-
@rm -f isotp-c/isotp.o

can-bus/README.md

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This example implements a simple echo client and server that uses TLS over a CAN
44

55
## Building
66

7-
You need to have wolfSSL installed on your computer prior to building. If you haven't already you will also need to get the git submodules for this tree, you can do this by using `git submodule update --init`. A simple `make` will then build the source files.
7+
You need to have wolfSSL installed on your computer prior to building, this will need to be built with `WOLFSSL_ISOTP` defined to provide ISO-TP functionality.
88

99
To generate the required SSL certificates use `./generate_ssl.sh`.
1010

@@ -13,7 +13,7 @@ To generate the required SSL certificates use `./generate_ssl.sh`.
1313
If you do not have a physical CAN bus between too machines you can use the virtual CAN bus which is a Linux kernel module. This behaves just like a real CAN bus with a similar bandwidth. To enable this run the following commands:
1414

1515
```sh
16-
modprobe vcan
16+
sudo modprobe vcan
1717
sudo ip link add dev vcan0 type vcan
1818
sudo ip link set vcan0 up
1919
```
@@ -32,29 +32,9 @@ Then in another terminal run the client:
3232
server vcan0
3333
```
3434

35-
On the client you will see (byte numbers will vary):
35+
On both ends you will see:
3636

3737
```
38-
Sending 242 bytes
39-
Receiving 128 bytes
40-
Receiving 28 bytes
41-
Receiving 974 bytes
42-
Receiving 286 bytes
43-
Receiving 58 bytes
44-
Sending 58 bytes
45-
SSL handshake done!
46-
```
47-
48-
And on the server:
49-
50-
```
51-
Receiving 242 bytes
52-
Sending 128 bytes
53-
Sending 28 bytes
54-
Sending 974 bytes
55-
Sending 286 bytes
56-
Sending 58 bytes
57-
Receiving 58 bytes
5838
SSL handshake done!
5939
```
6040

@@ -66,14 +46,12 @@ For example, on the client if we type "Hello world, this is a TLS test!":
6646
Hello world! This is a CAN bus test!
6747
Sending: Hello world! This is a CAN bus test!
6848
69-
Sending 59 bytes
7049
Message sent
7150
```
7251

7352
The server will echo:
7453

7554
```
76-
Receiving 59 bytes
7755
Got message: Hello world! This is a CAN bus test!
7856
```
7957

0 commit comments

Comments
 (0)