Fix SSL GetCertificates with certificate ID set to All (#3727)

* Fix SSL GetCertificates with certificate ID set to All

* Fix last entry status value
This commit is contained in:
gdkchan 2022-09-29 12:45:25 -03:00 committed by GitHub
parent f502cfaf62
commit dbe43c1719
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 40 additions and 22 deletions

View file

@ -181,7 +181,11 @@ namespace Ryujinx.HLE.HOS.Services.Ssl
}
}
public bool TryGetCertificates(ReadOnlySpan<CaCertificateId> ids, out CertStoreEntry[] entries)
public bool TryGetCertificates(
ReadOnlySpan<CaCertificateId> ids,
out CertStoreEntry[] entries,
out bool hasAllCertificates,
out int requiredSize)
{
lock (_lock)
{
@ -190,7 +194,8 @@ namespace Ryujinx.HLE.HOS.Services.Ssl
throw new InvalidSystemResourceException(CertStoreTitleMissingErrorMessage);
}
bool hasAllCertificates = false;
requiredSize = 0;
hasAllCertificates = false;
foreach (CaCertificateId id in ids)
{
@ -205,12 +210,14 @@ namespace Ryujinx.HLE.HOS.Services.Ssl
if (hasAllCertificates)
{
entries = new CertStoreEntry[_certificates.Count];
requiredSize = (_certificates.Count + 1) * Unsafe.SizeOf<BuiltInCertificateInfo>();
int i = 0;
foreach (CertStoreEntry entry in _certificates.Values)
{
entries[i++] = entry;
requiredSize += (entry.Data.Length + 3) & ~3;
}
return true;
@ -218,6 +225,7 @@ namespace Ryujinx.HLE.HOS.Services.Ssl
else
{
entries = new CertStoreEntry[ids.Length];
requiredSize = ids.Length * Unsafe.SizeOf<BuiltInCertificateInfo>();
for (int i = 0; i < ids.Length; i++)
{
@ -227,6 +235,7 @@ namespace Ryujinx.HLE.HOS.Services.Ssl
}
entries[i] = entry;
requiredSize += (entry.Data.Length + 3) & ~3;
}
return true;