Skip to content

Commit

Permalink
use pqc_kyber without hazmat feature
Browse files Browse the repository at this point in the history
  • Loading branch information
tbrezot committed May 23, 2024
1 parent 166aa7e commit 2c0450a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ serialization = []

[dependencies]
cosmian_crypto_core = { git="https://github.com/Cosmian/crypto_core.git", branch="develop", default-features = false, features = ["ser", "sha3", "aes", "curve25519"] }
pqc_kyber = { version = "0.4", features = ["std", "hazmat"] }
pqc_kyber = { version = "0.7", features = ["std", "kyber768"] }
serde = { version = "1.0", features = ["derive"] }
serde_json = { version = "1.0", features = ["preserve_order"] }
tiny-keccak = { version = "2.0.2", features = ["shake", "kmac"] }
Expand Down
10 changes: 5 additions & 5 deletions src/core/postquantum/kyber.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ use std::ops::{Deref, DerefMut};

use crate::Error;
use cosmian_crypto_core::{bytes_ser_de::Serializable, reexport::rand_core::CryptoRngCore, Secret};
use pqc_kyber::{
KYBER_CIPHERTEXTBYTES, KYBER_INDCPA_PUBLICKEYBYTES, KYBER_INDCPA_SECRETKEYBYTES,
KYBER_PUBLICKEYBYTES, KYBER_SECRETKEYBYTES, KYBER_SSBYTES,
};
use pqc_kyber::{KYBER_CIPHERTEXTBYTES, KYBER_PUBLICKEYBYTES, KYBER_SECRETKEYBYTES, KYBER_SSBYTES};

use super::KemTrait;

const KYBER_INDCPA_PUBLICKEYBYTES: usize = KYBER_PUBLICKEYBYTES;
const KYBER_INDCPA_SECRETKEYBYTES: usize = 1152;

/// Kyber public key length
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct PublicKey(Box<[u8; Self::LENGTH]>);
Expand Down Expand Up @@ -205,7 +205,7 @@ impl KemTrait for Kyber {
&self,
rng: &mut impl CryptoRngCore,
) -> Result<(Self::SecretKey, Self::PublicKey), Self::Error> {
let mut keypair = pqc_kyber::keypair(rng);
let mut keypair = pqc_kyber::keypair(rng)?;
Ok((
SecretKey::from(&mut keypair.secret),
PublicKey::from(keypair.public),
Expand Down

0 comments on commit 2c0450a

Please sign in to comment.