#include #include #include #include "capi/pqapi.h" extern const kem_params_t kems[]; TEST(Kyber,KEMOneOff) { for (int i=0; i<3; i++) { const params_t *p = (params_t*)&kems[i]; std::vector ct(ciphertext_bsz(p)); std::vector ss1(shared_secret_bsz(p)); std::vector ss2(shared_secret_bsz(p)); std::vector sk(private_key_bsz(p)); std::vector pk(public_key_bsz(p)); ASSERT_TRUE( pqc_keygen(p, pk.data(), sk.data())); ASSERT_TRUE( pqc_kem_encapsulate(p, ct.data(), ss1.data(), pk.data())); ASSERT_TRUE( pqc_kem_decapsulate(p, ss2.data(), ct.data(), sk.data())); ASSERT_TRUE( std::equal(ss1.begin(), ss1.end(), ss2.begin())); } }