feat(libSceSsl): implement CA certificate queries and sceHttp2AbortRequest

sceSslGetCaCerts reports that no CA certificates are available and
sceSslFreeCaCerts clears the structure, in line with the library's
no-network behaviour. sceHttp2AbortRequest succeeds like
sceHttpAbortRequest. sceSslClose and sceSslGetSerialNumber keep throwing
and are listed as unknown signatures.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Adrià Franch 2026-10-01 18:35:02 +02:00
parent bc51b337ad
commit c548cd25b7
5 changed files with 87 additions and 11 deletions

View File

@ -204,9 +204,9 @@ int APS5_VABI sceHttp2WaitAsync(int req_id, Http2AsyncResult* result, uint32_t*
return ERROR_NETWORK;
}
int APS5_VABI sceHttp2AbortRequest() {
NotImplemented_nid_no_patch(__func__);
return 0;
int APS5_VABI sceHttp2AbortRequest(int req_id) {
(void)req_id;
return 0;
}
}

View File

@ -0,0 +1,20 @@
add_library(libSceSsl SHARED EXCLUDE_FROM_ALL Export.cpp)
target_include_directories(libSceSsl PRIVATE ${LIBS_INCLUDE_DIR})
configure_windows_unwind(libSceSsl)
if(MINGW)
foreach(runtimeLinkFlag IN ITEMS -static-libgcc -static-libstdc++ -static)
string(REPLACE "${runtimeLinkFlag}" "" CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}")
endforeach()
endif()
if(BUILD_TESTING)
add_test_executable(guest_ssl_tests ${LIBS_INCLUDE_DIR}/tests/GuestSsl.cpp)
target_include_directories(guest_ssl_tests PRIVATE ${LIBS_INCLUDE_DIR})
target_link_libraries(guest_ssl_tests PRIVATE libSceSsl)
add_test(NAME guest_ssl COMMAND guest_ssl_tests)
if(WIN32)
set_tests_properties(guest_ssl PROPERTIES ENVIRONMENT_MODIFICATION
"PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceSsl>")
endif()
endif()

View File

@ -9,20 +9,38 @@
static constexpr int ERROR_NETWORK = static_cast<int>(0x80435001);
static std::atomic<int> g_nextHandle{1};
namespace {
constexpr int ERROR_NOT_FOUND = static_cast<int>(0x8095F004);
constexpr int ERROR_INVALID_ARG = static_cast<int>(0x8095177A);
struct SslData {
char* ptr;
size_t size;
};
struct SslCaCerts {
SslData* certs;
size_t num;
void* pool;
};
}
extern "C" {
int APS5_VABI sceSslFreeCaCerts(int ssl_ctx_id, void* ca_certs) {
(void)ssl_ctx_id;
(void)ca_certs;
NotImplemented_nid_no_patch(__func__);
return 0;
(void)ssl_ctx_id;
if (!ca_certs) return ERROR_INVALID_ARG;
*static_cast<SslCaCerts*>(ca_certs) = {};
return 0;
}
int APS5_VABI sceSslGetCaCerts(int ssl_ctx_id, void* ca_certs) {
(void)ssl_ctx_id;
(void)ca_certs;
NotImplemented_nid_no_patch(__func__);
return 0;
(void)ssl_ctx_id;
if (!ca_certs) return ERROR_INVALID_ARG;
*static_cast<SslCaCerts*>(ca_certs) = {};
return ERROR_NOT_FOUND;
}
int APS5_VABI sceSslInit_nid_postfix(uint64_t pool_size) {

View File

@ -0,0 +1,36 @@
#include "prx/libc/include/general/VabiMacros.hpp"
#include <cstddef>
#include <cstdlib>
extern "C" {
int APS5_VABI sceSslInit_nid_postfix(std::size_t);
int APS5_VABI sceSslGetCaCerts(int, void*);
int APS5_VABI sceSslFreeCaCerts(int, void*);
}
static void Require(bool value) { if (!value) std::abort(); }
struct SslCaCerts {
void* certs;
std::size_t num;
void* pool;
};
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);
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);
}

View File

@ -29,6 +29,8 @@ Throughout the project, every function at every stage either **does exactly what
- [sceLibcInternalBacktraceForGame](../../core/libs/prx/libc/src/HeapDiagnostics.cpp) (libSceLibcInternal, implemented in libc) - unknown signature
- [sceLibcInternalHeapErrorReportForGame](../../core/libs/prx/libc/src/HeapDiagnostics.cpp) (libSceLibcInternal, implemented in libc) - unknown signature
- [__progname](../../core/libs/prx/libkernel/System/src/Process.cpp) (libkernel) - unknown data export
- [sceSslClose](../../core/libs/prx/libSceSsl/Export.cpp) (libSceSsl) - unknown signature
- [sceSslGetSerialNumber](../../core/libs/prx/libSceSsl/Export.cpp) (libSceSsl) - unknown signature
### Functional