mirror of
https://github.com/ryujinx-mirror/ryujinx.git
synced 2024-12-25 07:32:54 +00:00
0746b83edf
* Rename CommandAttribute as CommandHIpcAttribute to prepare for 12.x changes * Implement inital support for TIPC and adds SM command ids * *Ipc to *ipc * Missed a ref in last commit... * CommandAttributeTIpc to CommandAttributeTipc * Addresses comment and fixes some bugs around TIPC doesn't have any padding requirements as buffer C isn't a thing Fix for RegisterService inverting two argument only on TIPC
62 lines
2.2 KiB
C#
62 lines
2.2 KiB
C#
using Ryujinx.Common.Logging;
|
|
using Ryujinx.HLE.HOS.Services.Ssl.Types;
|
|
using System.Text;
|
|
|
|
namespace Ryujinx.HLE.HOS.Services.Ssl.SslService
|
|
{
|
|
class ISslContext : IpcService
|
|
{
|
|
private ulong _serverCertificateId;
|
|
private ulong _clientCertificateId;
|
|
|
|
public ISslContext(ServiceCtx context) { }
|
|
|
|
[CommandHipc(2)]
|
|
// CreateConnection() -> object<nn::ssl::sf::ISslConnection>
|
|
public ResultCode CreateConnection(ServiceCtx context)
|
|
{
|
|
MakeObject(context, new ISslConnection());
|
|
|
|
return ResultCode.Success;
|
|
}
|
|
|
|
[CommandHipc(4)]
|
|
// ImportServerPki(nn::ssl::sf::CertificateFormat certificateFormat, buffer<bytes, 5> certificate) -> u64 certificateId
|
|
public ResultCode ImportServerPki(ServiceCtx context)
|
|
{
|
|
CertificateFormat certificateFormat = (CertificateFormat)context.RequestData.ReadUInt32();
|
|
|
|
long certificateDataPosition = context.Request.SendBuff[0].Position;
|
|
long certificateDataSize = context.Request.SendBuff[0].Size;
|
|
|
|
context.ResponseData.Write(_serverCertificateId++);
|
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceSsl, new { certificateFormat });
|
|
|
|
return ResultCode.Success;
|
|
}
|
|
|
|
[CommandHipc(5)]
|
|
// ImportClientPki(buffer<bytes, 5> certificate, buffer<bytes, 5> ascii_password) -> u64 certificateId
|
|
public ResultCode ImportClientPki(ServiceCtx context)
|
|
{
|
|
long certificateDataPosition = context.Request.SendBuff[0].Position;
|
|
long certificateDataSize = context.Request.SendBuff[0].Size;
|
|
|
|
long asciiPasswordDataPosition = context.Request.SendBuff[1].Position;
|
|
long asciiPasswordDataSize = context.Request.SendBuff[1].Size;
|
|
|
|
byte[] asciiPasswordData = new byte[asciiPasswordDataSize];
|
|
|
|
context.Memory.Read((ulong)asciiPasswordDataPosition, asciiPasswordData);
|
|
|
|
string asciiPassword = Encoding.ASCII.GetString(asciiPasswordData).Trim('\0');
|
|
|
|
context.ResponseData.Write(_clientCertificateId++);
|
|
|
|
Logger.Stub?.PrintStub(LogClass.ServiceSsl, new { asciiPassword });
|
|
|
|
return ResultCode.Success;
|
|
}
|
|
}
|
|
} |