Skip to content

Commit ce5b003

Browse files
committed
fixup! chore: sync ncrypto from nodejs/node
Signed-off-by: Filip Skokan <[email protected]>
1 parent 0b0ecca commit ce5b003

2 files changed

Lines changed: 0 additions & 123 deletions

File tree

include/ncrypto.h

Lines changed: 0 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1703,7 +1703,6 @@ DataPointer pbkdf2(const Digest& md,
17031703
uint32_t iterations,
17041704
size_t length);
17051705

1706-
<<<<<<< nodejs/ncrypto:include/ncrypto.h
17071706
#if OPENSSL_VERSION_NUMBER >= 0x30200000L
17081707
#ifndef OPENSSL_NO_ARGON2
17091708
enum class Argon2Type { ARGON2D, ARGON2I, ARGON2ID };
@@ -1721,60 +1720,6 @@ DataPointer argon2(const Buffer<const char>& pass,
17211720
#endif
17221721
#endif
17231722

1724-
||||||| nodejs/node:deps/ncrypto/ncrypto.h@84aaed75978e
1725-
=======
1726-
#if OPENSSL_VERSION_NUMBER >= 0x30200000L
1727-
#ifndef OPENSSL_NO_ARGON2
1728-
enum class Argon2Type { ARGON2D, ARGON2I, ARGON2ID };
1729-
1730-
DataPointer argon2(const Buffer<const char>& pass,
1731-
const Buffer<const unsigned char>& salt,
1732-
uint32_t lanes,
1733-
size_t length,
1734-
uint32_t memcost,
1735-
uint32_t iter,
1736-
uint32_t version,
1737-
const Buffer<const unsigned char>& secret,
1738-
const Buffer<const unsigned char>& ad,
1739-
Argon2Type type);
1740-
#endif
1741-
#endif
1742-
1743-
// ============================================================================
1744-
// KEM (Key Encapsulation Mechanism)
1745-
#if OPENSSL_VERSION_MAJOR >= 3
1746-
1747-
class KEM final {
1748-
public:
1749-
struct EncapsulateResult {
1750-
DataPointer ciphertext;
1751-
DataPointer shared_key;
1752-
1753-
EncapsulateResult() = default;
1754-
EncapsulateResult(DataPointer ct, DataPointer sk)
1755-
: ciphertext(std::move(ct)), shared_key(std::move(sk)) {}
1756-
};
1757-
1758-
// Encapsulate a shared secret using KEM with a public key.
1759-
// Returns both the ciphertext and shared secret.
1760-
static std::optional<EncapsulateResult> Encapsulate(
1761-
const EVPKeyPointer& public_key);
1762-
1763-
// Decapsulate a shared secret using KEM with a private key and ciphertext.
1764-
// Returns the shared secret.
1765-
static DataPointer Decapsulate(const EVPKeyPointer& private_key,
1766-
const Buffer<const void>& ciphertext);
1767-
1768-
private:
1769-
#if !OPENSSL_VERSION_PREREQ(3, 5)
1770-
static bool SetOperationParameter(EVP_PKEY_CTX* ctx,
1771-
const EVPKeyPointer& key);
1772-
#endif
1773-
};
1774-
1775-
#endif // OPENSSL_VERSION_MAJOR >= 3
1776-
1777-
>>>>>>> nodejs/node:deps/ncrypto/ncrypto.h@8385efc01343
17781723
// ============================================================================
17791724
// KEM (Key Encapsulation Mechanism)
17801725
#if OPENSSL_VERSION_MAJOR >= 3

src/ncrypto.cpp

Lines changed: 0 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,11 @@
1515
#include <openssl/hkdf.h>
1616
#endif
1717

18-
#if OPENSSL_VERSION_NUMBER >= 0x30200000L
19-
#include <openssl/thread.h>
20-
#endif
21-
2218
#include <algorithm>
2319
#include <array>
2420
#include <cstring>
25-
<<<<<<< nodejs/ncrypto:src/ncrypto.cpp
2621
#include <string_view>
2722
#include <vector>
28-
||||||| nodejs/node:deps/ncrypto/ncrypto.cc@84aaed75978e
29-
=======
30-
#include <string_view>
31-
>>>>>>> nodejs/node:deps/ncrypto/ncrypto.cc@8385efc01343
3223
#if OPENSSL_VERSION_MAJOR >= 3
3324
#include <openssl/core_names.h>
3425
#include <openssl/params.h>
@@ -3258,20 +3249,13 @@ const Cipher Cipher::AES_256_GCM = Cipher::FromNid(NID_aes_256_gcm);
32583249
const Cipher Cipher::AES_128_KW = Cipher::FromNid(NID_id_aes128_wrap);
32593250
const Cipher Cipher::AES_192_KW = Cipher::FromNid(NID_id_aes192_wrap);
32603251
const Cipher Cipher::AES_256_KW = Cipher::FromNid(NID_id_aes256_wrap);
3261-
<<<<<<< nodejs/ncrypto:src/ncrypto.cpp
32623252

32633253
#ifndef OPENSSL_IS_BORINGSSL
32643254
const Cipher Cipher::AES_128_OCB = Cipher::FromNid(NID_aes_128_ocb);
32653255
const Cipher Cipher::AES_192_OCB = Cipher::FromNid(NID_aes_192_ocb);
32663256
const Cipher Cipher::AES_256_OCB = Cipher::FromNid(NID_aes_256_ocb);
32673257
#endif
32683258

3269-
||||||| nodejs/node:deps/ncrypto/ncrypto.cc@84aaed75978e
3270-
=======
3271-
const Cipher Cipher::AES_128_OCB = Cipher::FromNid(NID_aes_128_ocb);
3272-
const Cipher Cipher::AES_192_OCB = Cipher::FromNid(NID_aes_192_ocb);
3273-
const Cipher Cipher::AES_256_OCB = Cipher::FromNid(NID_aes_256_ocb);
3274-
>>>>>>> nodejs/node:deps/ncrypto/ncrypto.cc@8385efc01343
32753259
const Cipher Cipher::CHACHA20_POLY1305 = Cipher::FromNid(NID_chacha20_poly1305);
32763260

32773261
bool Cipher::isGcmMode() const {
@@ -4552,57 +4536,6 @@ std::optional<EVP_PKEY_CTX*> EVPMDCtxPointer::verifyInit(
45524536
return ctx;
45534537
}
45544538

4555-
<<<<<<< nodejs/ncrypto:src/ncrypto.cpp
4556-
std::optional<EVP_PKEY_CTX*> EVPMDCtxPointer::signInitWithContext(
4557-
const EVPKeyPointer& key,
4558-
const Digest& digest,
4559-
const Buffer<const unsigned char>& context_string) {
4560-
#ifdef OSSL_SIGNATURE_PARAM_CONTEXT_STRING
4561-
EVP_PKEY_CTX* ctx = nullptr;
4562-
4563-
const OSSL_PARAM params[] = {
4564-
OSSL_PARAM_construct_octet_string(
4565-
OSSL_SIGNATURE_PARAM_CONTEXT_STRING,
4566-
const_cast<unsigned char*>(context_string.data),
4567-
context_string.len),
4568-
OSSL_PARAM_END};
4569-
4570-
if (!EVP_DigestSignInit_ex(
4571-
ctx_.get(), &ctx, nullptr, nullptr, nullptr, key.get(), params)) {
4572-
return std::nullopt;
4573-
}
4574-
return ctx;
4575-
#else
4576-
return std::nullopt;
4577-
#endif
4578-
}
4579-
4580-
std::optional<EVP_PKEY_CTX*> EVPMDCtxPointer::verifyInitWithContext(
4581-
const EVPKeyPointer& key,
4582-
const Digest& digest,
4583-
const Buffer<const unsigned char>& context_string) {
4584-
#ifdef OSSL_SIGNATURE_PARAM_CONTEXT_STRING
4585-
EVP_PKEY_CTX* ctx = nullptr;
4586-
4587-
const OSSL_PARAM params[] = {
4588-
OSSL_PARAM_construct_octet_string(
4589-
OSSL_SIGNATURE_PARAM_CONTEXT_STRING,
4590-
const_cast<unsigned char*>(context_string.data),
4591-
context_string.len),
4592-
OSSL_PARAM_END};
4593-
4594-
if (!EVP_DigestVerifyInit_ex(
4595-
ctx_.get(), &ctx, nullptr, nullptr, nullptr, key.get(), params)) {
4596-
return std::nullopt;
4597-
}
4598-
return ctx;
4599-
#else
4600-
return std::nullopt;
4601-
#endif
4602-
}
4603-
4604-
||||||| nodejs/node:deps/ncrypto/ncrypto.cc@84aaed75978e
4605-
=======
46064539
std::optional<EVP_PKEY_CTX*> EVPMDCtxPointer::signInitWithContext(
46074540
const EVPKeyPointer& key,
46084541
const Digest& digest,
@@ -4693,7 +4626,6 @@ std::optional<EVP_PKEY_CTX*> EVPMDCtxPointer::verifyInitWithContext(
46934626
#endif
46944627
}
46954628

4696-
>>>>>>> nodejs/node:deps/ncrypto/ncrypto.cc@8385efc01343
46974629
DataPointer EVPMDCtxPointer::signOneShot(
46984630
const Buffer<const unsigned char>& buf) const {
46994631
if (!ctx_) return {};

0 commit comments

Comments
 (0)