mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-10-22 00:22:57 -05:00
8.4 KiB
8.4 KiB
libSceSsl technical debt
Unknown function info
- sceSslCreateConnection, sceSslDeleteConnection, sceSslSetVerifyCallback, sceSslConnect, sceSslRead, sceSslWrite (libSceSsl) - imported by
ffmpeg.prx. Signatures follow SharpProspero, which also says the socket stays open aftersceSslDeleteConnectionand thatsceSslReadreturns 0 at the end of the stream. An unknown context returnsSSL_ERROR_INVALID_ID(0x8095F006), assceSslGetMemoryPoolStatsdoes on the console and as KytyPS5 and sharpemu return for other context calls; for an unknown connection, a connection whose context was terminated and a null host the console's codes are unknown, so these throw.sceSslConnectruns a TLS 1.2 client handshake with Mbed TLS 3.6.7 over the host socket that the guest number maps to in the libkernel or libSceNet socket table, andsceSslReadandsceSslWritecarry application data over it. TLS 1.3 is compiled out: SharpProspero'sSceSslVersionends at TLS 1.2, and Mbed TLS 1.3 needs PSA crypto state that is process-wide rather than allocated from a context's pool. Connection state is allocated from the context's pool and returned to it bysceSslDeleteConnection; a connection keeps the pool alive aftersceSslTerm. The server is verified against the CAs loaded withsceSslLoadCert: chain, validity dates and the host name the connection was created with, which is also sent as SNI. A client certificate loaded withsceSslLoadCertis sent when the server asks for one. With no CA loadedsceSslConnectthrows, because no root bundle is shipped and the console's built-in roots are unknown. With a verify callback set it throws: SharpProspero describes the arguments as an id, bits saying what failed, the chain, its length and the user argument, with a negative return failing the handshake with that value, but whether the id is the context or the connection, the bit values, the chain element type and when the callback runs are unknown. Handshake, verification and socket failures, a secondsceSslConnect, a read or write before the handshake, a descriptor that is not a socket, a null buffer, write flags other than 0 and read flags other than 0 andMsgFlagPartialRead(1) throw, as their console codes are unknown;MsgFlagPeek(3) is not implemented. A non-blocking socket that would block throws, and so does a libSceNet socket whoseSO_RCVTIMEOorSO_SNDTIMEOexpires, as libSceNet sets them on the host socket; libkernel keeps them above the host socket, so they do not bound SSL reads and writes on a libkernel socket.sceSslReadreturns what one Mbed TLS read delivers, up tolen, with flags 0 and withMsgFlagPartialReadalike; SharpProspero describessceSslReadas reading up tolenbutMsgFlagPartialReadas returning before the buffer is full, so whether flags 0 waits to fill the buffer is unknown. It returns 0 after the server's close_notify and also when the transport ends without one.sceSslWritesends all oflen, capped atINT_MAX, and returns the count. A connection serializes its reads and writes, so a read blocked in one thread holds back a write on the same connection from another.sceSslDeleteConnectionsends no close_notify. The socket is not checked when the connection is created,sceSslTermleaves the context's connections tosceSslDeleteConnection, andsceSslSetVerifyCallbackaccepts any callback, null included, and returns 0. None of this is verified on the console.SSL_ERROR_BEFORE_INIT(0x8095F001) is never returned, as the library keeps no state apart from its contexts - sceSslClose (libSceSsl) - takes the connection ID (
int) and throwsNotImplemented_nid_no_patch(__func__)until there is a transport that closes it. - sceSslGetSerialNumber, sceSslGetSubjectName, sceSslGetIssuerName, sceSslGetNameEntryCount, sceSslGetNameEntryInfo, sceSslFreeSslCertName, sceSslGetNotBefore, sceSslGetNotAfter, sceSslGetFingerprint (libSceSsl) - signatures and context ownership follow SharpProspero, with hash types matching its
SceSslFingerprintHashAlgorithmenum. Operations take a context handle as their first argument and operate on certificate and name handles scoped to that context.sceSslGetSerialNumbercopies into a caller-allocated output buffer or queries the required length when the buffer is null or capacity is zero; a buffer smaller than the serial number returnsSSL_ERROR_INVALID_ARG(0x8095177a). Mbed TLS parses the certificate's serial number, validity period (converted to microseconds since Gregorian year 0001 epoch), fingerprint digests and X.509 subject and issuer distinguished names, extracting OID attribute short names (or numeric strings) and value strings. An unknown context, unknown or expired certificate handle or invalid certificate name handle throws; null output pointers, unsupported hash types or out-of-range entry indices returnSSL_ERROR_INVALID_ARG(0x8095177a). The error codes, the zero-capacity length query, the NUL-terminated truncation of name entry strings with the full value length invalueLen, and the lifetime of name handles (released only bysceSslFreeSslCertNameor when the context is terminated) have not been measured on a PS5 - sceSslLoadCert, sceSslGetCaList, sceSslFreeCaList, sceSslGetCaCerts, sceSslFreeCaCerts, sceSslUnloadCert (libSceSsl) - signatures and layouts follow SharpProspero. PPSA15508/01.002.000 calls
sceSslLoadCertwith one 1,408-byte PEM CA and null client certificate/key arguments; this confirms that call shape, not console error behavior. Mbed TLS 3.6.7 parses DER/PEM chains and checks an optional client certificate/key pair. Imports are retained per context and committed together; a failed import preserves existing credentials. CA queries return independently owned snapshots; unload clears active credentials while outstanding snapshots remain valid. Appending repeated CA imports, snapshot lifetime across unload, memory overhead and error precedence have not been measured on a PS5. Invalid loads, malformed material, exhausted pools and unsupported keys throw rather than inventing console error codes. No root bundle is shipped; an empty context still returnsNOT_FOUND. The existing null-list error, unknown-context behavior and legacy clearing of foreign raw CA lists remain unchanged. Certificate reader queries reflect active certificates or outstanding snapshots. Loading credentials does not start a TLS connection;sceSslConnectverifies the server against the loaded CAs and offers the loaded client certificate - sceSslEnableVerifyOption, sceSslDisableVerifyOption, sceSslSetMinSslVersion, sceSslSetAlpn, sceSslGetAlpnSelected (libSceSsl) - imported by PPSA01317 and PPSA07411. Signatures follow SharpProspero, the source of the other connection signatures. The verify options, the minimum version and the ALPN protocol list are recorded on the connection; nothing reads them, and how the console applies them is unknown. The initial verify options are unknown and taken as 0.
sceSslSetMinSslVersionaccepts theSceSslVersionvalues SharpProspero lists, 0 (none) to 5 (TLS 1.2), and throws for others; whether the console accepts a TLS 1.3 value is unknown.sceSslSetAlpnstores the string up to its terminator and throws for a null list; whether the console expects a comma-separated list or the TLS wire format is unknown.sceSslGetAlpnSelectedreturns null, as the protocol negotiated by the handshake is not read. An unknown connection and a connection whose context was terminated throw, as forsceSslSetVerifyCallback