Topic: Testing TLS connection on LPC1768 MCU

Hi every one,
I need to test TLS connection with my LPC1768 processor(Bare metal/freeRTOS/etc.)
It seems I need a network stack library for POSIX compliant socket functions(like LWIP)
then is there any sample program or tutorial note where I need to start ?

Share

Re: Testing TLS connection on LPC1768 MCU

@dizgah,

Can you tell us a bit about your use case and project goals?

It seems I need a network stack library for POSIX compliant socket functions(like LWIP)

It would depend on the use-case. wolfSSL is transport level agnostic meaning if it can send and receive we can do a TLS handshake over that medium. If you are planning on using Wifi/Ethernet then yes you would want a TCP/IP stack (like LWIP). If however it would better fit your use-case to do a TLS connection of USB/Serial then you could just register custom I/O callbacks with wolfSSL that read/write over USB serial instead. Again the use-case matters.

I need to test TLS connection with my LPC1768 processor(Bare metal/freeRTOS/etc.)
... is there any sample program or tutorial note where I need to start ?

We do provide an LPCExpresso example in our download wolfssl-4.0.0/IDE/LPCEXPRESSO/ The example was setup and tested on an LPC43S37 but you should be able to use and retarget for your LPC1768. That example only runs the wolfCrypt tests and benchmark but could be extended to a client/server example by referencing our examples in https://github.com/wolfSSL/wolfssl-exam … master/tls

Warm Regards,

K

3 (edited by dizgah 2019-06-11 10:45:32)

Re: Testing TLS connection on LPC1768 MCU

Dear Kaleb,
I am experiencing another amazing support and really appreciated about it;)
I am trying to send/receive encrypted data from my LPC1768 client over Ethernet to a server based on TLS secure connection.
I am interested to secure IOT communication and am interested to do this based on mature open source solutions.
Yes, I saw provided example for MCUXPRESSO and I am trying to port it to LPC1768 MCU.
As I understand en/decryption layer is isolated and abstracted from transportation layer in WolfSSL.Am I true ?
( for example calling my receive function inside wolfSSL_read() method).
And as I understand crypto algorithms like (AES,DES,RSA) are implemented in wolfcrypt and SSL/TLS in wolfssl, am I true?
Also Is there any minimal sample project just using wlofCrypt(not wolfssl or any other extra library) ?

With Best Regards,
Dizgah.

Share

Re: Testing TLS connection on LPC1768 MCU

@dizgah,

As I understand en/decryption layer is isolated and abstracted from transportation layer in WolfSSL.Am I true ?

If you add the setting #define WOLFCRYPT_ONLY to the wolfssl-4.0.0/IDE/LPCEXPRESSO/lib_wolfssl/user_settings.h header that will turn off the SSL/TLS layer leaving you with just the wolfCrypt solution in that example. You can build and use the crypto library without the TLS library but the TLS library has a dependency on the crypto library and can not be built without the crypto.

Warm Regards,

K

Re: Testing TLS connection on LPC1768 MCU

Dear Kaleb,
Thank you for answers.
I try to build WolfSSl example for LPC1837 in my MCUXPRESSO( newer version of LPCXPRESSO) based on provided readme file.
Every steps is followed and I do not change any thing.
but I received following errors which seems assembler could not detect correct MCU architecture.

WBR,
Dizgah.

Finished building: ../wolfcrypt/src/aes.c
 
Building file: ../wolfcrypt/src/aes_asm.S
Invoking: MCU Assembler
arm-none-eabi-gcc -c -x assembler-with-cpp -D__REDLIB__ -DDEBUG -D__CODE_RED -I"D:\workspace\MCUXpresso\wolfssl" -I"D:\workspace\MCUXpresso\wolfssl\IDE\LPCXPRESSO\lib_wolfssl" -I"D:\workspace\MCUXpresso\lpc_chip_18xx\inc" -I"D:\workspace\MCUXpresso\lpc_board_nxp_lpcxpresso_1837\inc" -g3 -mcpu=cortex-m3 -mthumb -D__REDLIB__ -specs=redlib.specs -o "wolfcrypt/src/aes_asm.o" "../wolfcrypt/src/aes_asm.S"
../wolfcrypt/src/aes_asm.S: Assembler messages:
../wolfcrypt/src/aes_asm.S:52: Error: bad instruction `movq %rcx,%r10'
../wolfcrypt/src/aes_asm.S:53: Error: bad instruction `shrq $4,%rcx'
../wolfcrypt/src/aes_asm.S:54: Error: bad instruction `shlq $60,%r10'
../wolfcrypt/src/aes_asm.S:55: Error: bad instruction `je NO_PARTS'
../wolfcrypt/src/aes_asm.S:56: Error: bad instruction `addq $1,%rcx'
../wolfcrypt/src/aes_asm.S:58: Error: bad instruction `subq $16,%rsi'
../wolfcrypt/src/aes_asm.S:59: Error: bad instruction `movdqa (%rdx),%xmm1'
../wolfcrypt/src/aes_asm.S:61: Error: bad instruction `pxor (%rdi),%xmm1'
../wolfcrypt/src/aes_asm.S:62: Error: bad instruction `pxor (%r8),%xmm1'

Share

Re: Testing TLS connection on LPC1768 MCU

Dear Kaleb,
As I said before I have no success in building example by MCUXPRESSO.
Also because project file includes all supported ISE configs and this confusing me, then I try to make a simple minimal project in MCUXPRESSO with just adding wolfCrypt sources.
I have Some question:

1- As I understand core crypto operations are written in assembly, then is at&t syntax correct choice for cross compiling for LPC1768 ?
2- If yes, why Assembler return "bad instruction

movq    %rcx, %r10

aes_asm.S as I said in my last post?
3- whats function of ksdk_port.c file in wolfcrypt\src\port\nxp files ?why crypto functions does not implemented in general wolfcrypt directory(I could not find any NXP specific function in this file)
4- what are *.i & *.am files?
5- why wlofcrypt headers are not located beside sources and are located in wolfssl/wolfcrpy directory ?

WBR,
Dizgah.

Share

Re: Testing TLS connection on LPC1768 MCU

Hi @dizgah,

I apologize for this confusion. Can you please exclude the aes_asm.S from the build, that should not be compiled as those assembly instructions are for Intel Chips. Could you please also add the settings

#define TFM_NO_ASM
#define WOLFSSL_NO_ASM

I am not sure why it is attempting to build those files unless the IDE toolchain is just trying to compile everything in the wolfcrypt directory and you need to exclude those from the build explicitly?

Warm Regards,

K

8 (edited by dizgah 2019-06-13 13:35:41)

Re: Testing TLS connection on LPC1768 MCU

Dear Kaleb,

Thank to your helps, Wolfssl project was built successfully but there is linker problem in building wolf-ssl example project yet.
As you can find in attached below picture and based on read-me file I just added wolfssl & wolfssl_example beside lpc-chip & lpc board reference projects.
but seems there is a setting for lib-wolfssl project in compiler & linker include sections which i could not find.
Also based on below command line output you can see that is a linker problem which could not find lib-wolfssl.a library in

"${workspace_loc:/lib_wolfssl/Debug}"

,Although as I said before wolfssl was built successfully and there is a

libwolfssl.a

file in

"${workspace_loc:/wolfssl/Debug}"

Do you have any suggestion how could I fix it ?

WBR,
Dizgah.

make -r -j4 all 
Building target: wolf_example.axf
Invoking: MCU Linker
arm-none-eabi-gcc -nostdlib -L"D:\workspace\MCUXpresso\wolfssl\Debug" -L"D:\workspace\MCUXpresso\wolfssl\Debug" -L"D:\workspace\MCUXpresso\lpc_chip_18xx\Debug" -L"D:\workspace\MCUXpresso\lpc_board_nxp_lpcxpresso_1837\Debug" -Xlinker -Map="wolf_example.map" -Xlinker --gc-sections -mcpu=cortex-m3 -mthumb -T "wolf_example_Debug.ld" -o "wolf_example.axf"  ./src/lpc_18xx_startup.o ./src/wolfssl_example.o   -llib_wolfssl -lwolfssl -llpc_chip_18xx -llpc_board_nxp_lpcxpresso_1837
c:/nxp/mcuxpressoide_10.3.0_2200/ide/plugins/com.nxp.mcuxpresso.tools.win32_10.3.0.201811011841/tools/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/bin/ld.exe: cannot find -llib_wolfssl
collect2.exe: error: ld returned 1 exit status
make: *** [makefile:37: wolf_example.axf] Error 1
Post's attachments

wolfssl.png
wolfssl.png 249.43 kb, 1 downloads since 2019-06-13 

You don't have the permssions to download the attachments of this post.

Share

Re: Testing TLS connection on LPC1768 MCU

Please remove -lib_wolfssl from the libs, the one right below that -lwolfssl should resolve to -libwolfssl.a

- K