Topic: How to use Dilithium?

I am trying Dilithium with wolfssl on Zephyr.

I added

#define HAVE_DILITHIUM

which results in errors.
E.g.:

  • 'DILITHIUM_LEVEL5_PUB_KEY_SIZE' undeclared here (not in a function); did you mean 'DILITHIUM_MAX_PUB_KEY_SIZE'?

  • C:/ncs/v3.1.0/modules/crypto/wolfssl/src/ssl.c:6029:21: error: 'ML_DSA_LEVEL2_KEY_SIZE' undeclared (first use in this function); did you mean 'ML_DSA_LEVEL2_TYPE'?
    6029 |   ML_DSA_LEVEL2_KEY_SIZE < (word16)cm->minDilithiumKeySz)

and plenty of there errors related to: DILITHIUM_LEVEL5_PUB_KEY_SIZE, DILITHIUM_LEVEL5_KEY_SIZE, DILITHIUM_LEVEL5_SIG_SIZE
ML_DSA_LEVEL{2,3,5}_KEY_SIZE

Do I need to add extra includes?

Share

Re: How to use Dilithium?

Please try adding a define for `WOLFSSL_WC_DILITHIUM`

Re: How to use Dilithium?

Thanks, that worked.
I have created a dilithium key pair with wolfclu.

wolfssl -genkey dilithium -level 2 -out dilithium_key -outform der -output keypair

Now how do I create and self sign a x.509 certificate with Dilithium?
I tried various commands, such as 

wolfssl -req -new -key dilithium_key.priv -keyform der -out dilithium_req.pem -outform pem

but getting ASN no Header errors, etc.

Share

Re: How to use Dilithium?

I'll need to confirm that wolfCLU can handle generating certs with PQC keys