Atmosphere/stratosphere/spl/source/spl_deprecated_service.cpp

131 lines
6.8 KiB
C++
Raw Normal View History

2019-04-25 18:12:30 +00:00
/*
* Copyright (c) 2018-2020 Atmosphère-NX
2019-04-25 18:12:30 +00:00
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stratosphere.hpp>
2019-06-22 19:23:46 +00:00
#include "spl_api_impl.hpp"
2019-04-25 18:12:30 +00:00
#include "spl_deprecated_service.hpp"
namespace ams::spl {
2019-04-25 18:12:30 +00:00
Result DeprecatedService::GetConfig(sf::Out<u64> out, u32 which) {
2019-06-22 19:23:46 +00:00
return impl::GetConfig(out.GetPointer(), static_cast<SplConfigItem>(which));
2019-06-21 08:36:00 +00:00
}
2019-04-25 18:12:30 +00:00
Result DeprecatedService::ExpMod(const sf::OutPointerBuffer &out, const sf::InPointerBuffer &base, const sf::InPointerBuffer &exp, const sf::InPointerBuffer &mod) {
return impl::ExpMod(out.GetPointer(), out.GetSize(), base.GetPointer(), base.GetSize(), exp.GetPointer(), exp.GetSize(), mod.GetPointer(), mod.GetSize());
2019-06-21 08:36:00 +00:00
}
2019-04-25 18:12:30 +00:00
Result DeprecatedService::GenerateAesKek(sf::Out<AccessKey> out_access_key, KeySource key_source, u32 generation, u32 option) {
2019-06-22 19:23:46 +00:00
return impl::GenerateAesKek(out_access_key.GetPointer(), key_source, generation, option);
2019-06-21 08:36:00 +00:00
}
2019-04-25 18:12:30 +00:00
Result DeprecatedService::LoadAesKey(s32 keyslot, AccessKey access_key, KeySource key_source) {
2019-06-22 19:23:46 +00:00
return impl::LoadAesKey(keyslot, this, access_key, key_source);
2019-06-21 08:36:00 +00:00
}
2019-04-25 18:12:30 +00:00
Result DeprecatedService::GenerateAesKey(sf::Out<AesKey> out_key, AccessKey access_key, KeySource key_source) {
2019-06-22 19:23:46 +00:00
return impl::GenerateAesKey(out_key.GetPointer(), access_key, key_source);
2019-06-21 08:36:00 +00:00
}
2019-04-25 18:12:30 +00:00
2019-06-21 08:36:00 +00:00
Result DeprecatedService::SetConfig(u32 which, u64 value) {
2019-06-22 19:23:46 +00:00
return impl::SetConfig(static_cast<SplConfigItem>(which), value);
2019-06-21 08:36:00 +00:00
}
2019-04-25 18:12:30 +00:00
Result DeprecatedService::GenerateRandomBytes(const sf::OutPointerBuffer &out) {
return impl::GenerateRandomBytes(out.GetPointer(), out.GetSize());
2019-06-21 08:36:00 +00:00
}
2019-04-25 18:12:30 +00:00
Result DeprecatedService::ImportLotusKey(const sf::InPointerBuffer &src, AccessKey access_key, KeySource key_source, u32 option) {
return impl::ImportLotusKey(src.GetPointer(), src.GetSize(), access_key, key_source, option);
2019-06-21 08:36:00 +00:00
}
2019-04-25 18:12:30 +00:00
Result DeprecatedService::DecryptLotusMessage(sf::Out<u32> out_size, const sf::OutPointerBuffer &out, const sf::InPointerBuffer &base, const sf::InPointerBuffer &mod, const sf::InPointerBuffer &label_digest) {
return impl::DecryptLotusMessage(out_size.GetPointer(), out.GetPointer(), out.GetSize(), base.GetPointer(), base.GetSize(), mod.GetPointer(), mod.GetSize(), label_digest.GetPointer(), label_digest.GetSize());
2019-06-21 08:36:00 +00:00
}
2019-04-25 18:12:30 +00:00
Result DeprecatedService::IsDevelopment(sf::Out<bool> is_dev) {
2019-06-22 19:23:46 +00:00
return impl::IsDevelopment(is_dev.GetPointer());
2019-06-21 08:36:00 +00:00
}
2019-04-25 18:12:30 +00:00
Result DeprecatedService::GenerateSpecificAesKey(sf::Out<AesKey> out_key, KeySource key_source, u32 generation, u32 which) {
2019-06-22 19:23:46 +00:00
return impl::GenerateSpecificAesKey(out_key.GetPointer(), key_source, generation, which);
2019-06-21 08:36:00 +00:00
}
2019-04-25 18:12:30 +00:00
Result DeprecatedService::DecryptRsaPrivateKey(const sf::OutPointerBuffer &dst, const sf::InPointerBuffer &src, AccessKey access_key, KeySource key_source, u32 option) {
return impl::DecryptRsaPrivateKey(dst.GetPointer(), dst.GetSize(), src.GetPointer(), src.GetSize(), access_key, key_source, option);
2019-06-21 08:36:00 +00:00
}
2019-04-25 18:12:30 +00:00
Result DeprecatedService::DecryptAesKey(sf::Out<AesKey> out_key, KeySource key_source, u32 generation, u32 option) {
2019-06-22 19:23:46 +00:00
return impl::DecryptAesKey(out_key.GetPointer(), key_source, generation, option);
2019-06-21 08:36:00 +00:00
}
2019-04-25 18:12:30 +00:00
Result DeprecatedService::CryptAesCtrDeprecated(const sf::OutBuffer &out_buf, s32 keyslot, const sf::InBuffer &in_buf, IvCtr iv_ctr) {
return impl::CryptAesCtr(out_buf.GetPointer(), out_buf.GetSize(), keyslot, this, in_buf.GetPointer(), in_buf.GetSize(), iv_ctr);
2019-06-21 08:36:00 +00:00
}
2019-04-25 18:12:30 +00:00
Result DeprecatedService::CryptAesCtr(const sf::OutNonSecureBuffer &out_buf, s32 keyslot, const sf::InNonSecureBuffer &in_buf, IvCtr iv_ctr) {
return impl::CryptAesCtr(out_buf.GetPointer(), out_buf.GetSize(), keyslot, this, in_buf.GetPointer(), in_buf.GetSize(), iv_ctr);
2019-06-21 08:36:00 +00:00
}
2019-04-25 18:12:30 +00:00
Result DeprecatedService::ComputeCmac(sf::Out<Cmac> out_cmac, s32 keyslot, const sf::InPointerBuffer &in_buf) {
return impl::ComputeCmac(out_cmac.GetPointer(), keyslot, this, in_buf.GetPointer(), in_buf.GetSize());
2019-06-21 08:36:00 +00:00
}
2019-04-25 18:12:30 +00:00
Result DeprecatedService::ImportEsKey(const sf::InPointerBuffer &src, AccessKey access_key, KeySource key_source, u32 option) {
return impl::ImportEsKey(src.GetPointer(), src.GetSize(), access_key, key_source, option);
2019-06-21 08:36:00 +00:00
}
2019-04-25 18:12:30 +00:00
Result DeprecatedService::UnwrapTitleKeyDeprecated(sf::Out<AccessKey> out_access_key, const sf::InPointerBuffer &base, const sf::InPointerBuffer &mod, const sf::InPointerBuffer &label_digest) {
return impl::UnwrapTitleKey(out_access_key.GetPointer(), base.GetPointer(), base.GetSize(), mod.GetPointer(), mod.GetSize(), label_digest.GetPointer(), label_digest.GetSize(), 0);
}
Result DeprecatedService::UnwrapTitleKey(sf::Out<AccessKey> out_access_key, const sf::InPointerBuffer &base, const sf::InPointerBuffer &mod, const sf::InPointerBuffer &label_digest, u32 generation) {
return impl::UnwrapTitleKey(out_access_key.GetPointer(), base.GetPointer(), base.GetSize(), mod.GetPointer(), mod.GetSize(), label_digest.GetPointer(), label_digest.GetSize(), generation);
2019-06-21 08:36:00 +00:00
}
2019-04-25 18:12:30 +00:00
Result DeprecatedService::LoadTitleKey(s32 keyslot, AccessKey access_key) {
2019-06-22 19:23:46 +00:00
return impl::LoadTitleKey(keyslot, this, access_key);
2019-06-21 08:36:00 +00:00
}
2019-04-25 18:12:30 +00:00
Result DeprecatedService::UnwrapCommonTitleKeyDeprecated(sf::Out<AccessKey> out_access_key, KeySource key_source) {
return impl::UnwrapCommonTitleKey(out_access_key.GetPointer(), key_source, 0);
}
Result DeprecatedService::UnwrapCommonTitleKey(sf::Out<AccessKey> out_access_key, KeySource key_source, u32 generation) {
2019-06-22 19:23:46 +00:00
return impl::UnwrapCommonTitleKey(out_access_key.GetPointer(), key_source, generation);
2019-06-21 08:36:00 +00:00
}
2019-04-25 18:12:30 +00:00
Result DeprecatedService::AllocateAesKeyslot(sf::Out<s32> out_keyslot) {
2019-06-22 19:23:46 +00:00
return impl::AllocateAesKeyslot(out_keyslot.GetPointer(), this);
2019-06-21 08:36:00 +00:00
}
2019-04-25 18:12:30 +00:00
Result DeprecatedService::FreeAesKeyslot(s32 keyslot) {
2019-06-22 19:23:46 +00:00
return impl::FreeAesKeyslot(keyslot, this);
2019-06-21 08:36:00 +00:00
}
2019-04-25 18:12:30 +00:00
void DeprecatedService::GetAesKeyslotAvailableEvent(sf::OutCopyHandle out_hnd) {
2019-06-22 19:23:46 +00:00
out_hnd.SetValue(impl::GetAesKeyslotAvailableEventHandle());
2019-06-21 08:36:00 +00:00
}
Result DeprecatedService::SetBootReason(BootReasonValue boot_reason) {
2019-06-22 19:23:46 +00:00
return impl::SetBootReason(boot_reason);
2019-06-21 08:36:00 +00:00
}
Result DeprecatedService::GetBootReason(sf::Out<BootReasonValue> out) {
2019-06-22 19:23:46 +00:00
return impl::GetBootReason(out.GetPointer());
2019-06-21 08:36:00 +00:00
}
2019-04-25 18:12:30 +00:00
}