mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-10-22 00:22:57 -05:00
PPSA11386 imports sceSslGetCaList and sceSslFreeCaList and PPSA15508 imports sceSslUnloadCert; on main all three are missing and the loaders of both titles stop on them. No root certificate bundle is shipped and no loaded certificate is kept, so an SSL context holds no certificates: sceSslGetCaList clears the list and returns NOT_FOUND, as sceSslGetCaCerts does; sceSslFreeCaList accepts only that cleared list; sceSslUnloadCert has nothing to drop and is assumed to return 0. A null list returns the invalid-argument code that sceSslGetCaCerts and KytyPS5 return. An unknown context and a list sceSslGetCaList did not return throw, as their codes are not confirmed. Signatures and the SceSslCaList layout follow SharpProspero and shadPS4. guest_ssl_tests now links libc, as guest_http2_tests does, so an exception thrown from libSceSsl unwinds with the same unwinder that resumes it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
99 lines
3.2 KiB
C++
99 lines
3.2 KiB
C++
#include "prx/libc/include/general/VabiMacros.hpp"
|
|
#include <cstddef>
|
|
#include <cstdint>
|
|
#include <cstdlib>
|
|
#include <exception>
|
|
|
|
extern "C" {
|
|
int APS5_VABI sceSslInit_nid_postfix(std::size_t);
|
|
int APS5_VABI sceSslTerm_nid_postfix(int);
|
|
int APS5_VABI sceSslGetCaCerts(int, void*);
|
|
int APS5_VABI sceSslFreeCaCerts(int, void*);
|
|
int APS5_VABI sceSslGetCaList(int, void*);
|
|
int APS5_VABI sceSslFreeCaList(int, void*);
|
|
int APS5_VABI sceSslUnloadCert(int);
|
|
}
|
|
|
|
struct SslMemoryPoolStats {
|
|
std::size_t pool_size;
|
|
std::size_t max_inuse_size;
|
|
std::size_t current_inuse_size;
|
|
std::int32_t reserved;
|
|
};
|
|
|
|
extern "C" int APS5_VABI sceSslGetMemoryPoolStats(int, SslMemoryPoolStats*);
|
|
|
|
static void Require(bool value) { if (!value) std::abort(); }
|
|
|
|
template <typename TCall>
|
|
static bool Throws(TCall call) {
|
|
try {
|
|
call();
|
|
} catch (const std::exception&) {
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
struct SslCaCerts {
|
|
void* certs;
|
|
std::size_t num;
|
|
void* pool;
|
|
};
|
|
|
|
struct SslCaList {
|
|
void** certs;
|
|
int num;
|
|
};
|
|
|
|
int main() {
|
|
constexpr int notFound = static_cast<int>(0x8095F004);
|
|
constexpr int invalidArg = static_cast<int>(0x8095177A);
|
|
int marker = 0;
|
|
|
|
const int context = sceSslInit_nid_postfix(0x10000);
|
|
Require(context > 0);
|
|
SslMemoryPoolStats stats{1, 1, 1, 1};
|
|
Require(sceSslGetMemoryPoolStats(context, &stats) == 0);
|
|
Require(stats.pool_size == 0x10000 && stats.max_inuse_size == 0 && stats.current_inuse_size == 0 && stats.reserved == 0);
|
|
Require(sceSslGetCaCerts(context, nullptr) == invalidArg);
|
|
Require(sceSslFreeCaCerts(context, nullptr) == invalidArg);
|
|
|
|
SslCaCerts certs{&marker, 3, &marker};
|
|
Require(sceSslGetCaCerts(context, &certs) == notFound);
|
|
Require(certs.certs == nullptr && certs.num == 0 && certs.pool == nullptr);
|
|
|
|
certs = {&marker, 3, &marker};
|
|
Require(sceSslFreeCaCerts(context, &certs) == 0);
|
|
Require(certs.certs == nullptr && certs.num == 0 && certs.pool == nullptr);
|
|
|
|
Require(sceSslGetCaList(context, nullptr) == invalidArg);
|
|
Require(sceSslFreeCaList(context, nullptr) == invalidArg);
|
|
|
|
void* handle = ▮
|
|
SslCaList list{&handle, 3};
|
|
Require(sceSslGetCaList(context, &list) == notFound);
|
|
Require(list.certs == nullptr && list.num == 0);
|
|
Require(sceSslFreeCaList(context, &list) == 0);
|
|
Require(list.certs == nullptr && list.num == 0);
|
|
|
|
SslCaList foreign{&handle, 1};
|
|
Require(Throws([&] { sceSslFreeCaList(context, &foreign); }));
|
|
foreign = {nullptr, 1};
|
|
Require(Throws([&] { sceSslFreeCaList(context, &foreign); }));
|
|
foreign = {&handle, 0};
|
|
Require(Throws([&] { sceSslFreeCaList(context, &foreign); }));
|
|
|
|
Require(sceSslUnloadCert(context) == 0);
|
|
Require(sceSslGetCaList(context, &list) == notFound);
|
|
Require(list.certs == nullptr && list.num == 0);
|
|
|
|
Require(sceSslTerm_nid_postfix(context) == 0);
|
|
Require(sceSslGetCaList(context, nullptr) == invalidArg);
|
|
Require(sceSslFreeCaList(context, nullptr) == invalidArg);
|
|
list = {&handle, 3};
|
|
Require(Throws([&] { sceSslGetCaList(context, &list); }));
|
|
Require(Throws([&] { sceSslFreeCaList(context, &list); }));
|
|
Require(Throws([&] { sceSslUnloadCert(context); }));
|
|
}
|