| 68 | } |
| 69 | |
| 70 | void MLKEMKeys::Encaps (uint8_t * ciphertext, uint8_t * shared) |
| 71 | { |
| 72 | if (!m_Pkey) return; |
| 73 | auto ctx = EVP_PKEY_CTX_new_from_pkey (NULL, m_Pkey, NULL); |
| 74 | if (ctx) |
| 75 | { |
| 76 | EVP_PKEY_encapsulate_init (ctx, NULL); |
| 77 | size_t len = m_CTLen, sharedLen = 32; |
| 78 | EVP_PKEY_encapsulate (ctx, ciphertext, &len, shared, &sharedLen); |
| 79 | EVP_PKEY_CTX_free (ctx); |
| 80 | } |
| 81 | else |
| 82 | LogPrint (eLogError, "MLKEM can't create PKEY context"); |
| 83 | } |
| 84 | |
| 85 | void MLKEMKeys::Decaps (const uint8_t * ciphertext, uint8_t * shared) |
| 86 | { |
no test coverage detected