Files
AnyPS5/core/libs/tests/GuestLibreSslPkeyId.cpp
T
Dean GalvinandMarcZX10 f0e737ae6b test(libSceLibreSsl): keep the EVP_PKEY_id test to supported input
The null-key case pinned a NotImplemented throw, which the test conventions do not allow. The debt entry now links evp.h, where LibreSSL 2.5.4 defines the EVP_PKEY layout, instead of evp_local.h.

Co-authored-by: MarcZX10 <[email protected]>
2026-11-06 17:12:52 +13:00

29 lines
780 B
C++

#include "prx/libSceLibreSsl/include/Api.hpp"
#include "prx/libc/include/general/VabiMacros.hpp"
#include <array>
#include <cstddef>
#include <cstdint>
#include <cstdio>
#include <cstring>
#include <exception>
#include <limits>
namespace {
void Require(bool condition, const char* message) {
if (condition) return;
std::fprintf(stderr, "failed: %s\n", message);
std::terminate();
}
}
int main() {
alignas(8) std::array<std::byte, 64> pkey{};
constexpr int ids[] = {0, 1, 6, 408, 0x7fffffff, std::numeric_limits<int>::min()};
for (const int expected : ids) {
std::memcpy(pkey.data(), &expected, sizeof(expected));
Require(EVP_PKEY_id_nid_postfix(pkey.data()) == expected, "returns the key's stored type unchanged");
}
return 0;
}