| 83 | } |
| 84 | |
| 85 | void MLKEMKeys::Decaps (const uint8_t * ciphertext, uint8_t * shared) |
| 86 | { |
| 87 | if (!m_Pkey) return; |
| 88 | auto ctx = EVP_PKEY_CTX_new_from_pkey (NULL, m_Pkey, NULL); |
| 89 | if (ctx) |
| 90 | { |
| 91 | EVP_PKEY_decapsulate_init (ctx, NULL); |
| 92 | size_t sharedLen = 32; |
| 93 | EVP_PKEY_decapsulate (ctx, shared, &sharedLen, ciphertext, m_CTLen); |
| 94 | EVP_PKEY_CTX_free (ctx); |
| 95 | } |
| 96 | else |
| 97 | LogPrint (eLogError, "MLKEM can't create PKEY context"); |
| 98 | } |
| 99 | |
| 100 | std::unique_ptr<MLKEMKeys> CreateMLKEMKeys (i2p::data::CryptoKeyType type) |
| 101 | { |
no test coverage detected