Liboscore: basic OSCORE client example

Hi everyone,

I’ve been trying to integrate liboscore, but I’m having issues with the client. As the server I’m using the plugtest-server demo. Here’s my client code: https://github.com/sssemil/riot_app/blob/master/src/coap_oscore/client/main.c#L233

The issue is that the OSCORE option is created with length 0 (so it’s just 0x90), and hence results in an unauthorized error or a no security context found error in logs.

If you would like to run the code, clone the repo with recurse submodules, run ./setup_iface.sh, and after that in src/coap_oscore/{plugtest-server, client} run make all -j16; PORT=tap0 make term and make all -j16; PORT=tap1 make term.

Any idea on what I’m doing wrong? Thanks.

CC @chrysn

There is a bug in libOSCORE that you stumbled on that applies to the (basically correct) way you are using it; it was already fixed but not put on the right branch to be immediately available.

The current libOSCORE master contains a fix (setting IS_REQUEST in the right place; your debug statements already went in the right direction).

Just beware (and there the docs are not fixed yet) that for many OSCORE applications you need a current libCOSE; https://github.com/RIOT-OS/RIOT/pull/16464 should help.