mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-05-18 09:04:23 -04:00
crypto: implement RSA-2048-PSS
This commit is contained in:
parent
d675aa3414
commit
f3629f863d
13 changed files with 692 additions and 3 deletions
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* Copyright (c) 2018-2020 Atmosphère-NX
|
||||
*
|
||||
* 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 <vapours.hpp>
|
||||
|
||||
namespace ams::crypto::impl {
|
||||
|
||||
#ifdef ATMOSPHERE_IS_STRATOSPHERE
|
||||
|
||||
void Sha256Impl::Initialize() {
|
||||
static_assert(sizeof(this->state) == sizeof(::Sha256Context));
|
||||
::sha256ContextCreate(reinterpret_cast<::Sha256Context *>(std::addressof(this->state)));
|
||||
}
|
||||
|
||||
void Sha256Impl::Update(const void *data, size_t size) {
|
||||
static_assert(sizeof(this->state) == sizeof(::Sha256Context));
|
||||
::sha256ContextUpdate(reinterpret_cast<::Sha256Context *>(std::addressof(this->state)), data, size);
|
||||
}
|
||||
|
||||
void Sha256Impl::GetHash(void *dst, size_t size) {
|
||||
static_assert(sizeof(this->state) == sizeof(::Sha256Context));
|
||||
AMS_ASSERT(size >= HashSize);
|
||||
::sha256ContextGetHash(reinterpret_cast<::Sha256Context *>(std::addressof(this->state)), dst);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
/* TODO: Non-EL0 implementation. */
|
||||
|
||||
#endif
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue