Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to bring PQC to an Arduino sketch #8374

Open
jhhdez opened this issue Jan 24, 2025 · 1 comment
Open

Unable to bring PQC to an Arduino sketch #8374

jhhdez opened this issue Jan 24, 2025 · 1 comment
Assignees

Comments

@jhhdez
Copy link

jhhdez commented Jan 24, 2025

Version

5.7.4

Description

Hi folks!!!

I would appreciate any help or guidance. I am working on Arduino IDE with the official library wolfssl, which was installed using the Arduino Library Manager. However, I am able to use <wolfssl/wolfcrypt/aes.h> but not <wolfssl/wolfcrypt/wc_kyber.h>. I do not know whether the wolfssl in Arduino was compiled with libqos or not, or if the way to work with PQC is different from what I using.

I will leave my code below. This is just a simple example to set things up and build upon.

`#define WOLFSSL_EXPERIMENTAL_SETTINGS
#define WOLFSSL_HAVE_KYBER
#define WOLFSSL_WC_KYBER
#define WOLFSSL_SHAKE256
#define WOLFSSL_SHA3

#include <wolfssl.h>
#include <wolfssl/wolfcrypt/wc_kyber.h>

KyberKey kyberkey;

void setup() {
Serial.begin(115200);
Serial.println("WolfSSL library is included successfully!");

// Initialize WolfSSL
Serial.println("Initializing WolfSSL...");
if (wolfSSL_Init() != WOLFSSL_SUCCESS) {
    Serial.println("Failed to initialize WolfSSL");
    return;
}
Serial.println("WolfSSL initialized successfully");

// Initialize Kyber
Serial.println("Initializing Kyber...");

// Set key type to KYBER512, KYBER768, or KYBER1024
kyberkey.type = KYBER512;
kyber_init();

}

void loop() {
// Your code here
}`

The error that I am getting is:

user/.arduino15/packages/esp32/tools/esp-xs3/2302/bin/../lib/gcc/xtensa-esp32s3-elf/12.2.0/../../../../xtensa-esp32s3-elf/bin/ld:user/.cache/arduino/sketches/83F0BC3D0F174449E307A31B46415E99/sketch/first_test_pqc_test.ino.cpp.o:(.literal._Z5setupv+0x18): undefined reference to kyber_init' user/.arduino15/packages/esp32/tools/esp-xs3/2302/bin/../lib/gcc/xtensa-esp32s3-elf/12.2.0/../../../../xtensa-esp32s3-elf/bin/ld:user/.cache/arduino/sketches/83F0BC3D0F174449E307A31B46415E99/sketch/first_test_pqc_test.ino.cpp.o: in function _Z5setupv':
user/Arduino/first_test_pqc_test/first_test_pqc_test.ino:23: undefined reference to `kyber_init'
collect2: error: ld returned 1 exit status

exit status 1

Compilation error: exit status 1

Thanks in advance !!

@anhu
Copy link
Member

anhu commented Jan 24, 2025

Hi,

You're trying to call kyber_init() but that is not considered a public API; it is marked with WOLFSSL_LOCAL. You'll want to use the following instead: wc_KyberKey_Init()

Thanks for using wolfSSL! Can you please let us know a bit about yourself and your project? Where are you located? Is this out of personal, academic or professional interest? What are you trying to make? What are your goals?

Warm regards, Anthony

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants