Reference implementations of PQC
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.md 2.0 KiB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. # PQ Crypto Catalog
  2. This is a repository of post-quantum schemes coppied from the submission to the NIST Post-Quantum Standarization. The sources were cloned from the PQClean project to form new library. The goal of the library is mainly experimentation.
  3. Users shouldn't expect any level of security provided by this code.
  4. ## Schemes
  5. ### Key Encapsulation Mechanisms
  6. **Finalists:**
  7. * Kyber
  8. * NTRU
  9. * SABER
  10. **Alternate candidates:**
  11. * FrodoKEM
  12. ### Signature schemes
  13. **Finalists:**
  14. * Dilithium
  15. * Falcon
  16. * Rainbow
  17. **Alternate candidates:**
  18. * SPHINCS+
  19. ## Building
  20. CMake is used to build the library:
  21. ```
  22. mkdir build
  23. cd build
  24. cmake -DCMAKE_BUILD_TYPE=Release ..
  25. make
  26. ```
  27. Build outputs two libraries, a static ``libpqc_s.a`` and dynamic ``libpqc.so``, which can be linked with a project.
  28. ## API
  29. Library provides simple API, wrapping PQClean. For example to use KEM, one should call the library in following way:
  30. ```c
  31. #include <pqc/pqc.h>
  32. std::vector<uint8_t> ct(ciphertext_bsz(p));
  33. std::vector<uint8_t> ss1(shared_secret_bsz(p));
  34. std::vector<uint8_t> ss2(shared_secret_bsz(p));
  35. std::vector<uint8_t> sk(private_key_bsz(p));
  36. std::vector<uint8_t> pk(public_key_bsz(p));
  37. const params_t *p = pqc_kem_alg_by_id(KYBER512);
  38. pqc_keygen(p, pk.data(), sk.data());
  39. pqc_kem_encapsulate(p, ct.data(), ss1.data(), pk.data());
  40. pqc_kem_decapsulate(p, ss2.data(), ct.data(), sk.data());
  41. const params_t *p = pqc_sig_alg_by_id(DILITHIUM2);
  42. size_t sigsz = sig.capacity();
  43. pqc_keygen(p, pk.data(), sk.data());
  44. pqc_sig_create(p, sig.data(), &sigsz, msg.data(), msg.size(), sk.data());
  45. pqc_sig_verify(p, sig.data(), sig.size(), msg.data(), msg.size(), pk.data());
  46. ```
  47. See test implemetnation in ``test/ut.cpp`` for more details.
  48. ## Rust binding
  49. Rust bindgings are provided in the ``src/rustapi/pqc-sys`` and can be regenerated automatically by running ``cargo build`` in this directory.
  50. ## Testing
  51. Algorithms are tested against KATs, by the runner implemented in the ``teste/katrunner`` (wip). The runner uses ``katwalk`` crate.