excellent, thanks again!

Can I have Jim's new email address please Anthony?

Thanks Anthony. I'll log a support ticket.
And yes, I would like to keep in touch with Jim, if I can get his email address that would be great.
kind regards

Are you looking into this Anthony? I do need to solve this fairly soon.
Happy to log an issue report somewhere else if need be, just let me know
thanks, Chris

Hi again Anthony, great to hear from you again !!

I am not quite sure how to "build with the following macro". Is it as simple as adding #define WOLFCRYPT_ONLY to the code?
I've only used AES in Counter mode for all my work so far, so I don't think TLS is involved.

cheers & kind regards 

PS: Is Jim Scarletta still part of the team? His email address was jim@wolfssl.com last year, but that bounced when i tried earlier ?

I've come across an issue compiling with the latest wolfssl 5.8.4 arduino library on Teensy 4.1

The wolfssl_AES_CTR example included in the library compiles with no issues for Teensy Micromod, but not for Teensy 4.1 ?

This would compiile for both Teensy models on the earlier wolfssl 5.7.6 library last year, so this is somewhat puzzling. See attached the compilation output.

What could be causing this?

TIA

Thank you anthony
I will follow up via support@wolfSSL.com but first I'll see what happens with the code you've generously offerred.
stand by :-)

Thanks, I think :-) certainly is a large file. Searching for AES_CTR or AES_COUNTER revealed a few hits, but nothing jumped out at me.

My project is quite straight forward ... I'm building an instrumentation system for a small electric vehicle. To monitor battery condition I have a Smartshunt made by Victron Energy: https://www.victronenergy.com/battery-m … tery-shunt

My project uses a high powered Arduino relative (a Teensy 4.x https://www.pjrc.com/store/ ) to integrate information from several sensors around the vehicle (e.g temperatures, GPS, speed, battery voltage, current, % remaining etc) into a small display ... a dashboard if you like.

Victron have kindly made information on their Bluetooth Low Energy (BLE) Advertising protocol available to the public, for many of their bluetooth devices. So now people like me can continually receive data from a Smartshunt (or any 'smart' Victron product) over BLE. This is the same protocol and data the VictronConnect mobile phone app utilises to display device information.

BTW a neat aspect of the advertised data: it's broadcast and available without needing a BLE connection.

A portion of the data continually advertised by the Smartshunt (less than 16 bytes) is encrypted using AES-CTR. These few bytes include voltages, current etc. so I need to decrypt them. The data updates every 150ms or so.

From the unencypted portion I can see and extract the "salt" as two bytes (also called "Nonce/Data Counter")

I also have the encryption key (128 bits) specific to my SmartShunt (retreived via the VictronConnect app)

So I think have all the inputs, I just need to code the AES-CTR algorithm in C/C++ in the Arduino IDE. I am very experienced in that environment, so I don't need the whole solution, just the Algorithm, how to call it, with salt and key in hand.

As I see the algorithm simply has to process the encrypted byte array as an input stream using the salt and key, and output the decrypted bytes to a bytes array/variable that I can print or display. ON further thought I will also need code for the reverse, i.e. to encrypt 16 bytes, then I could generate specific data and test the encryption/decyprion cycle is working.

Searching on the Arduino forum I came across a few mentions of wolfSSL, but none were looking at AES-CTR. Hence why I am here ...

I was going to attach a rather detailed but very useful extract (in PDF) from the Victon forum, a user post that explains some of the finer points of decrypting the Victron data (e.g. watch out for the little endians!) :-)
but I keep getting a warning "The server was unable to save the uploaded file"

best regards

PS: If I can get this to work it would make a great additional example in the wolfSSL library for ArduinoIDE. I would be happy to contribute towards that ...

Where exactly will I find tests/api.c? (it's not under sketches/libraries/wolfSSL)

I am aware of this AES-CTR section in the manual: https://www.wolfssl.com/documentation/m … ctrencrypt but it doesn't really help me.

If I'm given a working example in a similar context to my use case I can usually adapt it to my needs ...   

My compilation errors are simply because I'm not experienced enough as a programmer to convert the examples I found (like the C# AES-CTR decryption code) to C/C++ (the code I have kludged together so far is rubbish, no point in sharing)

I've been scouring the internet and relevant forums for info on decryption using AES-CTR mode.

I've installed wolfSSL in my Arduino IDE but unfortunately the provided examples focus on TLS not SSL or AES.

I've been searching for a suitable code examples. These two have been a bit helpful

a) wolfSSL aesctr-file-encryp example on GitHub
https://github.com/wolfSSL/wolfssl-exam … -encrypt.c

b) aes-ctr post on Stack Overflow (code in C#)
https://stackoverflow.com/questions/637 … 2#51188472

But neither are written for Arduino so only partly useful for my purposes.

After setting WOLFSSL_AES_COUNTER and WOLFSSL_AES_DIRECT in user_settings.h and some likely code tweaks I tried compiling item (a) but no luck.

I'm not even close to a professional software developer, so a good AES-CTR example in (C/C++) would be a huge help, ideally in a form I can easily get into the Arduino IDE.

help! :-) 
TIA