service::HTTP_C: Implement OpenClientCertContext, OpenDefaultClientCertContext, CloseClientCertContext

This commit is contained in:
B3n30
2018-08-09 22:51:36 +02:00
parent 5e658efdb8
commit c6bdcf72a4
2 changed files with 216 additions and 3 deletions

View File

@@ -43,6 +43,8 @@ enum class RequestState : u8 {
struct ClientCertContext {
using Handle = u32;
Handle handle;
u32 session_id;
u8 cert_id;
std::vector<u8> certificate;
std::vector<u8> private_key;
};
@@ -54,11 +56,13 @@ struct RootCertChain {
struct RootCACert {
using Handle = u32;
Handle handle;
u32 session_id;
std::vector<u8> certificate;
};
using Handle = u32;
Handle handle;
u32 session_id;
std::vector<RootCACert> certificates;
};
@@ -105,6 +109,7 @@ public:
};
Handle handle;
u32 session_id;
std::string url;
RequestMethod method;
RequestState state = RequestState::NotStarted;
@@ -121,6 +126,8 @@ struct SessionData : public Kernel::SessionRequestHandler::SessionDataBase {
/// has been bound. Certain commands can only be called on a session with a bound context.
boost::optional<Context::Handle> current_http_context;
u32 session_id;
/// Number of HTTP contexts that are currently opened in this session.
u32 num_http_contexts = 0;
/// Number of ClientCert contexts that are currently opened in this session.
@@ -197,10 +204,46 @@ private:
*/
void AddRequestHeader(Kernel::HLERequestContext& ctx);
/**
* HTTP_C::OpenClientCertContext service function
* Inputs:
* 1 : Cert size
* 2 : Key size
* 3 : (CertSize<<4) | 10
* 4 : Pointer to input cert
* 5 : (KeySize<<4) | 10
* 6 : Pointer to input key
* Outputs:
* 1 : Result of function, 0 on success, otherwise error code
*/
void OpenClientCertContext(Kernel::HLERequestContext& ctx);
/**
* HTTP_C::OpenDefaultClientCertContext service function
* Inputs:
* 1 : CertID
* Outputs:
* 1 : Result of function, 0 on success, otherwise error code
* 2 : Client Cert context handle
*/
void OpenDefaultClientCertContext(Kernel::HLERequestContext& ctx);
/**
* HTTP_C::CloseClientCertContext service function
* Inputs:
* 1 : ClientCert Handle
* Outputs:
* 1 : Result of function, 0 on success, otherwise error code
*/
void CloseClientCertContext(Kernel::HLERequestContext& ctx);
void DecryptClCertA();
Kernel::SharedPtr<Kernel::SharedMemory> shared_memory = nullptr;
/// The next number to use when a new HTTP session is initalized.
u32 session_counter = 0;
/// The next handle number to use when a new HTTP context is created.
Context::Handle context_counter = 0;