MCPcopy Create free account
hub / github.com/PurpleI2P/i2pd / Decaps

Method Decaps

libi2pd/PostQuantum.cpp:85–98  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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 {

Calls 1

LogPrintFunction · 0.85

Tested by

no test coverage detected