Skip to content

Commit ba39e40

Browse files
committed
fix: unconditionally include vector
1 parent e072f46 commit ba39e40

File tree

2 files changed

+37
-3
lines changed

2 files changed

+37
-3
lines changed

src/ncrypto.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,13 @@
1717

1818
#if OPENSSL_VERSION_NUMBER >= 0x30200000L
1919
#include <openssl/thread.h>
20-
#ifndef OPENSSL_NO_ARGON2
21-
#include <vector>
22-
#endif
2320
#endif
2421

2522
#include <algorithm>
2623
#include <array>
2724
#include <cstring>
2825
#include <string_view>
26+
#include <vector>
2927
#if OPENSSL_VERSION_MAJOR >= 3
3028
#include <openssl/core_names.h>
3129
#include <openssl/params.h>

tests/basic.cpp

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,42 @@ TEST(Ec, getCurve) {
215215
ASSERT_EQ(curve, NID_X9_62_prime256v1);
216216
}
217217

218+
TEST(Ec, GetCurves) {
219+
std::vector<std::string> curves;
220+
221+
bool result = Ec::GetCurves([&](const char* name) {
222+
curves.push_back(name);
223+
return true;
224+
});
225+
226+
ASSERT_TRUE(result);
227+
// Should have at least some built-in curves
228+
ASSERT_GT(curves.size(), 0u);
229+
230+
// Check that common curves are present
231+
bool hasP256 = false;
232+
bool hasP384 = false;
233+
for (const auto& curve : curves) {
234+
if (curve == "prime256v1" || curve == "P-256") hasP256 = true;
235+
if (curve == "secp384r1" || curve == "P-384") hasP384 = true;
236+
}
237+
ASSERT_TRUE(hasP256);
238+
ASSERT_TRUE(hasP384);
239+
}
240+
241+
TEST(Ec, GetCurves_early_exit) {
242+
int count = 0;
243+
244+
// Test that returning false stops iteration
245+
bool result = Ec::GetCurves([&](const char* name) {
246+
count++;
247+
return count < 3; // Stop after 2 curves
248+
});
249+
250+
ASSERT_FALSE(result);
251+
ASSERT_EQ(count, 3);
252+
}
253+
218254
// ============================================================================
219255
// EVPKeyPointer tests
220256

0 commit comments

Comments
 (0)