summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Narr the Reg2023-02-27 19:05:08 -0600
committerGravatar german772023-03-05 12:02:04 -0600
commitf01540da6c385c7239aa31a748ced6d671349d6a (patch)
treeff1cb3c0116deff1e47cdd646a40d0fa47bcd4bc /src
parentservice: usb: Update names (diff)
downloadyuzu-f01540da6c385c7239aa31a748ced6d671349d6a.tar.gz
yuzu-f01540da6c385c7239aa31a748ced6d671349d6a.tar.xz
yuzu-f01540da6c385c7239aa31a748ced6d671349d6a.zip
service: ssl: Add missing properties and update names
Diffstat (limited to '')
-rw-r--r--src/core/hle/service/ssl/ssl.cpp76
1 files changed, 58 insertions, 18 deletions
diff --git a/src/core/hle/service/ssl/ssl.cpp b/src/core/hle/service/ssl/ssl.cpp
index b19bc1b3e..2b99dd7ac 100644
--- a/src/core/hle/service/ssl/ssl.cpp
+++ b/src/core/hle/service/ssl/ssl.cpp
@@ -8,14 +8,36 @@
8 8
9namespace Service::SSL { 9namespace Service::SSL {
10 10
11// This is nn::ssl::sf::CertificateFormat
11enum class CertificateFormat : u32 { 12enum class CertificateFormat : u32 {
12 Pem = 1, 13 Pem = 1,
13 Der = 2, 14 Der = 2,
14}; 15};
15 16
17// This is nn::ssl::sf::ContextOption
18enum class ContextOption : u32 {
19 None = 0,
20 CrlImportDateCheckEnable = 1,
21};
22
23// This is nn::ssl::sf::SslVersion
24struct SslVersion {
25 union {
26 u32 raw{};
27
28 BitField<0, 1, u32> tls_auto;
29 BitField<3, 1, u32> tls_v10;
30 BitField<4, 1, u32> tls_v11;
31 BitField<5, 1, u32> tls_v12;
32 BitField<6, 1, u32> tls_v13;
33 BitField<24, 7, u32> api_version;
34 };
35};
36
16class ISslConnection final : public ServiceFramework<ISslConnection> { 37class ISslConnection final : public ServiceFramework<ISslConnection> {
17public: 38public:
18 explicit ISslConnection(Core::System& system_) : ServiceFramework{system_, "ISslConnection"} { 39 explicit ISslConnection(Core::System& system_, SslVersion version)
40 : ServiceFramework{system_, "ISslConnection"}, ssl_version{version} {
19 // clang-format off 41 // clang-format off
20 static const FunctionInfo functions[] = { 42 static const FunctionInfo functions[] = {
21 {0, nullptr, "SetSocketDescriptor"}, 43 {0, nullptr, "SetSocketDescriptor"},
@@ -59,11 +81,15 @@ public:
59 81
60 RegisterHandlers(functions); 82 RegisterHandlers(functions);
61 } 83 }
84
85private:
86 SslVersion ssl_version;
62}; 87};
63 88
64class ISslContext final : public ServiceFramework<ISslContext> { 89class ISslContext final : public ServiceFramework<ISslContext> {
65public: 90public:
66 explicit ISslContext(Core::System& system_) : ServiceFramework{system_, "ISslContext"} { 91 explicit ISslContext(Core::System& system_, SslVersion version)
92 : ServiceFramework{system_, "ISslContext"}, ssl_version{version} {
67 static const FunctionInfo functions[] = { 93 static const FunctionInfo functions[] = {
68 {0, &ISslContext::SetOption, "SetOption"}, 94 {0, &ISslContext::SetOption, "SetOption"},
69 {1, nullptr, "GetOption"}, 95 {1, nullptr, "GetOption"},
@@ -84,17 +110,20 @@ public:
84 } 110 }
85 111
86private: 112private:
113 SslVersion ssl_version;
114
87 void SetOption(HLERequestContext& ctx) { 115 void SetOption(HLERequestContext& ctx) {
88 struct Parameters { 116 struct Parameters {
89 u8 enable; 117 ContextOption option;
90 u32 option; 118 s32 value;
91 }; 119 };
120 static_assert(sizeof(Parameters) == 0x8, "Parameters is an invalid size");
92 121
93 IPC::RequestParser rp{ctx}; 122 IPC::RequestParser rp{ctx};
94 const auto parameters = rp.PopRaw<Parameters>(); 123 const auto parameters = rp.PopRaw<Parameters>();
95 124
96 LOG_WARNING(Service_SSL, "(STUBBED) called. enable={}, option={}", parameters.enable, 125 LOG_WARNING(Service_SSL, "(STUBBED) called. option={}, value={}", parameters.option,
97 parameters.option); 126 parameters.value);
98 127
99 IPC::ResponseBuilder rb{ctx, 2}; 128 IPC::ResponseBuilder rb{ctx, 2};
100 rb.Push(ResultSuccess); 129 rb.Push(ResultSuccess);
@@ -105,7 +134,7 @@ private:
105 134
106 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 135 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
107 rb.Push(ResultSuccess); 136 rb.Push(ResultSuccess);
108 rb.PushIpcInterface<ISslConnection>(system); 137 rb.PushIpcInterface<ISslConnection>(system, ssl_version);
109 } 138 }
110 139
111 void ImportServerPki(HLERequestContext& ctx) { 140 void ImportServerPki(HLERequestContext& ctx) {
@@ -142,20 +171,21 @@ private:
142 } 171 }
143}; 172};
144 173
145class SSL final : public ServiceFramework<SSL> { 174class ISslService final : public ServiceFramework<ISslService> {
146public: 175public:
147 explicit SSL(Core::System& system_) : ServiceFramework{system_, "ssl"} { 176 explicit ISslService(Core::System& system_) : ServiceFramework{system_, "ssl"} {
148 // clang-format off 177 // clang-format off
149 static const FunctionInfo functions[] = { 178 static const FunctionInfo functions[] = {
150 {0, &SSL::CreateContext, "CreateContext"}, 179 {0, &ISslService::CreateContext, "CreateContext"},
151 {1, nullptr, "GetContextCount"}, 180 {1, nullptr, "GetContextCount"},
152 {2, nullptr, "GetCertificates"}, 181 {2, nullptr, "GetCertificates"},
153 {3, nullptr, "GetCertificateBufSize"}, 182 {3, nullptr, "GetCertificateBufSize"},
154 {4, nullptr, "DebugIoctl"}, 183 {4, nullptr, "DebugIoctl"},
155 {5, &SSL::SetInterfaceVersion, "SetInterfaceVersion"}, 184 {5, &ISslService::SetInterfaceVersion, "SetInterfaceVersion"},
156 {6, nullptr, "FlushSessionCache"}, 185 {6, nullptr, "FlushSessionCache"},
157 {7, nullptr, "SetDebugOption"}, 186 {7, nullptr, "SetDebugOption"},
158 {8, nullptr, "GetDebugOption"}, 187 {8, nullptr, "GetDebugOption"},
188 {8, nullptr, "ClearTls12FallbackFlag"},
159 }; 189 };
160 // clang-format on 190 // clang-format on
161 191
@@ -163,20 +193,30 @@ public:
163 } 193 }
164 194
165private: 195private:
166 u32 ssl_version{};
167 void CreateContext(HLERequestContext& ctx) { 196 void CreateContext(HLERequestContext& ctx) {
168 LOG_WARNING(Service_SSL, "(STUBBED) called"); 197 struct Parameters {
198 SslVersion ssl_version;
199 INSERT_PADDING_BYTES(0x4);
200 u64 pid_placeholder;
201 };
202 static_assert(sizeof(Parameters) == 0x10, "Parameters is an invalid size");
203
204 IPC::RequestParser rp{ctx};
205 const auto parameters = rp.PopRaw<Parameters>();
206
207 LOG_WARNING(Service_SSL, "(STUBBED) called, api_version={}, pid_placeholder={}",
208 parameters.ssl_version.api_version, parameters.pid_placeholder);
169 209
170 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 210 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
171 rb.Push(ResultSuccess); 211 rb.Push(ResultSuccess);
172 rb.PushIpcInterface<ISslContext>(system); 212 rb.PushIpcInterface<ISslContext>(system, parameters.ssl_version);
173 } 213 }
174 214
175 void SetInterfaceVersion(HLERequestContext& ctx) { 215 void SetInterfaceVersion(HLERequestContext& ctx) {
176 LOG_DEBUG(Service_SSL, "called");
177
178 IPC::RequestParser rp{ctx}; 216 IPC::RequestParser rp{ctx};
179 ssl_version = rp.Pop<u32>(); 217 u32 ssl_version = rp.Pop<u32>();
218
219 LOG_DEBUG(Service_SSL, "called, ssl_version={}", ssl_version);
180 220
181 IPC::ResponseBuilder rb{ctx, 2}; 221 IPC::ResponseBuilder rb{ctx, 2};
182 rb.Push(ResultSuccess); 222 rb.Push(ResultSuccess);
@@ -186,7 +226,7 @@ private:
186void LoopProcess(Core::System& system) { 226void LoopProcess(Core::System& system) {
187 auto server_manager = std::make_unique<ServerManager>(system); 227 auto server_manager = std::make_unique<ServerManager>(system);
188 228
189 server_manager->RegisterNamedService("ssl", std::make_shared<SSL>(system)); 229 server_manager->RegisterNamedService("ssl", std::make_shared<ISslService>(system));
190 ServerManager::RunServer(std::move(server_manager)); 230 ServerManager::RunServer(std::move(server_manager));
191} 231}
192 232