pqcrypto icon indicating copy to clipboard operation
pqcrypto copied to clipboard

Serialization with no_std

Open KyleKotowick opened this issue 1 year ago • 0 comments

When the serialization feature is enabled, pqcrypto will include the serde crate. The serde crate includes std as a default feature. This means that it's not possible to use pqcrypto with serialization in a no_std environment.

Would it be possible disable standard features in the serde dependency? i.e. serde = { version = "1.0", default-features = false, features = ["derive"] }?

Edit: I tried this with a fork and it's throwing a number of errors. Looking for any alternative on how to achieve serialization/deserialization in a no_std environment.

Compilation error with serde = { version = "1.0", default-features = false, features = ["derive", "alloc"], optional = true }

The following warnings were emitted during compilation:

warning: ar: '/home/.../target/debug/build/pqcrypto-dilithium-918f739615645239/out/libdilithium2_clean.a': No such file

error: failed to run custom build command for `pqcrypto-dilithium v0.5.0 (/home/.../pqcrypto/pqcrypto-dilithium)`

Caused by:
  process didn't exit successfully: `/home/.../target/debug/build/pqcrypto-dilithium-192d2ee7428ca425/build-script-build` (exit status: 1)
  --- stdout
  OUT_DIR = Some(/home/.../target/debug/build/pqcrypto-dilithium-918f739615645239/out)
  TARGET = Some(x86_64-unknown-linux-gnu)
  HOST = Some(x86_64-unknown-linux-gnu)
  cargo:rerun-if-env-changed=AR_x86_64-unknown-linux-gnu
  AR_x86_64-unknown-linux-gnu = None
  cargo:rerun-if-env-changed=AR_x86_64_unknown_linux_gnu
  AR_x86_64_unknown_linux_gnu = None
  cargo:rerun-if-env-changed=HOST_AR
  HOST_AR = None
  cargo:rerun-if-env-changed=AR
  AR = None
  cargo:rerun-if-env-changed=ARFLAGS_x86_64-unknown-linux-gnu
  ARFLAGS_x86_64-unknown-linux-gnu = None
  cargo:rerun-if-env-changed=ARFLAGS_x86_64_unknown_linux_gnu
  ARFLAGS_x86_64_unknown_linux_gnu = None
  cargo:rerun-if-env-changed=HOST_ARFLAGS
  HOST_ARFLAGS = None
  cargo:rerun-if-env-changed=ARFLAGS
  ARFLAGS = None
  cargo:rerun-if-env-changed=CC_ENABLE_DEBUG_OUTPUT
  cargo:warning=ar: '/home/.../target/debug/build/pqcrypto-dilithium-918f739615645239/out/libdilithium2_clean.a': No such file

  --- stderr


  error occurred: Command "ar" "s" "/home/.../target/debug/build/pqcrypto-dilithium-918f739615645239/out/libdilithium2_clean.a" with args ar did not execute successfully (status code exit status: 1).

KyleKotowick avatar Sep 13 '24 21:09 KyleKotowick