ssl: Updated sslConnectionSetPrivateOption for 17.0.0.

This commit is contained in:
yellows8 2023-10-26 14:46:54 -04:00
parent 386118d16b
commit 9439b39631
No known key found for this signature in database
GPG Key ID: 0AF90DA3F1E60E43
2 changed files with 17 additions and 4 deletions

View File

@ -180,6 +180,7 @@ typedef enum {
/// PrivateOptionType /// PrivateOptionType
typedef enum { typedef enum {
SslPrivateOptionType_DtlsSession = 1, ///< \ref sslConnectionSetSessionCacheMode will throw an error if the input ::SslSessionCacheMode is non-zero and this option flag is set. SslPrivateOptionType_DtlsSession = 1, ///< \ref sslConnectionSetSessionCacheMode will throw an error if the input ::SslSessionCacheMode is non-zero and this option flag is set.
SslPrivateOptionType_SetCipher = 2, ///< [17.0.0+] This exclusively enables the cipher suite specified in the input u32 value passed to \ref sslConnectionSetPrivateOption (all other ciphers disabled).
} SslPrivateOptionType; } SslPrivateOptionType;
/// AlpnProtoState /// AlpnProtoState
@ -747,9 +748,9 @@ Result sslConnectionGetDtlsHandshakeTimeout(SslConnection *c, u64 *out);
* @note Only available on [16.0.0+]. * @note Only available on [16.0.0+].
* @param c \ref SslConnection * @param c \ref SslConnection
* @param[in] option \ref SslPrivateOptionType * @param[in] option \ref SslPrivateOptionType
* @param[in] flag Input flag value. * @param[in] value Input value.
*/ */
Result sslConnectionSetPrivateOption(SslConnection *c, SslPrivateOptionType option, bool flag); Result sslConnectionSetPrivateOption(SslConnection *c, SslPrivateOptionType option, u32 value);
/** /**
* @brief SetSrtpCiphers * @brief SetSrtpCiphers

View File

@ -135,6 +135,15 @@ static Result _sslCmdInU8U32NoOut(Service* srv, u8 val0, u32 val1, u32 cmd_id) {
return _sslObjectDispatchIn(srv, cmd_id, in); return _sslObjectDispatchIn(srv, cmd_id, in);
} }
static Result _sslCmdInTwoU32sNoOut(Service* srv, u32 val0, u32 val1, u32 cmd_id) {
const struct {
u32 val0;
u32 val1;
} in = { val0, val1 };
return _sslObjectDispatchIn(srv, cmd_id, in);
}
static Result _sslCmdNoInOutU32(Service* srv, u32 *out, u32 cmd_id) { static Result _sslCmdNoInOutU32(Service* srv, u32 *out, u32 cmd_id) {
return _sslObjectDispatchOut(srv, cmd_id, *out); return _sslObjectDispatchOut(srv, cmd_id, *out);
} }
@ -897,14 +906,17 @@ Result sslConnectionGetDtlsHandshakeTimeout(SslConnection *c, u64 *out) {
); );
} }
Result sslConnectionSetPrivateOption(SslConnection *c, SslPrivateOptionType option, bool flag) { Result sslConnectionSetPrivateOption(SslConnection *c, SslPrivateOptionType option, u32 value) {
if (!serviceIsActive(&c->s)) if (!serviceIsActive(&c->s))
return MAKERESULT(Module_Libnx, LibnxError_NotInitialized); return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
if (hosversionBefore(16,0,0)) if (hosversionBefore(16,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer); return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _sslCmdInU8U32NoOut(&c->s, flag!=0, option, 30); if (hosversionBefore(17,0,0))
return _sslCmdInU8U32NoOut(&c->s, value!=0, option, 30);
else
return _sslCmdInTwoU32sNoOut(&c->s, option, value, 30);
} }
Result sslConnectionSetSrtpCiphers(SslConnection *c, const u16 *ciphers, u32 count) { Result sslConnectionSetSrtpCiphers(SslConnection *c, const u16 *ciphers, u32 count) {