1
0
Fork 0
mirror of https://github.com/Atmosphere-NX/Atmosphere.git synced 2024-11-27 06:12:15 +00:00
Atmosphere/libraries/libexosphere/source/pmc/pmc_secure_scratch_test.inc
Michael Scire f66b41c027 exo2: Initial work on the exosphere rewrite.
exo2: Implement uncompressor stub and boot code up to Main().

exo2: implement some more init (uart/gic)

exo2: implement more of init

exo2: improve reg api, add keyslot flag setters

exo2: implement se aes decryption/enc

exo2: fix bugs in loader stub/mmu mappings

exo2: start skeletoning bootconfig/global context types

arch: fix makefile flags

exo2: implement through master key derivation

exo2: implement device master keygen

exo2: more init through start of SetupSocSecurity

exo2: implement pmc secure scratch management

se: implement sticky bit validation

libexosphere: fix building for arm32

libexo: fix makefile flags

libexo: support building for arm64/arm

sc7fw: skeleton binary

sc7fw: skeleton a little more

sc7fw: implement all non-dram functionality

exo2: fix DivideUp error

sc7fw: implement more dram code, fix reg library errors

sc7fw: complete sc7fw impl.

exo2: skeleton the rest of SetupSocSecurity

exo2: implement fiq interrupt handler

exo2: implement all exception handlers

exo2: skeleton the entire smc api, implement the svc invoker

exo2: implement rest of SetupSocSecurity

exo2: correct slave security errors

exo2: fix register definition

exo2: minor fixes
2020-06-14 22:07:45 -07:00

100 lines
No EOL
4.4 KiB
C++

/*
* 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/>.
*/
namespace test {
constexpr inline auto Other = GetSecureScratchMasks<SecureRegister_Other>();
static_assert(Other[0] == 0x00700FF0u);
static_assert(Other[1] == 0xFC000000u);
static_assert(Other[2] == 0x3F0FFF00u);
static_assert(Other[3] == 0x00000000u);
static_assert(Other[4] == 0x00000000u);
static_assert(Other[5] == 0x0C000000u);
static_assert(Other[6] == 0x00000000u);
static_assert(Other[7] == 0xFF00FF00u);
constexpr inline auto DramParameters = GetSecureScratchMasks<SecureRegister_DramParameters>();
static_assert(DramParameters[0] == 0x00000000u);
static_assert(DramParameters[1] == 0x03FCFFFFu);
static_assert(DramParameters[2] == 0x00000000u);
static_assert(DramParameters[3] == 0x3F3FFFFFu);
static_assert(DramParameters[4] == 0xFFFFFFFFu);
static_assert(DramParameters[5] == 0xF3FFC00Fu);
static_assert(DramParameters[6] == 0x003FFFFFu);
static_assert(DramParameters[7] == 0x000000FFu);
constexpr inline auto ResetVector = GetSecureScratchMasks<SecureRegister_ResetVector>();
static_assert(ResetVector[0] == 0x00000000u);
static_assert(ResetVector[1] == 0x00000000u);
static_assert(ResetVector[2] == 0x00F00000u);
static_assert(ResetVector[3] == 0x00000000u);
static_assert(ResetVector[4] == 0x00000000u);
static_assert(ResetVector[5] == 0x00000000u);
static_assert(ResetVector[6] == 0x00000000u);
static_assert(ResetVector[7] == 0x00000000u);
constexpr inline auto CmacWrite = GetSecureScratchMasks<SecureRegister_CmacWrite>();
static_assert(CmacWrite[0] == 0x00000000u);
static_assert(CmacWrite[1] == 0x00000000u);
static_assert(CmacWrite[2] == 0x00000000u);
static_assert(CmacWrite[3] == 0x00000000u);
static_assert(CmacWrite[4] == 0x00000000u);
static_assert(CmacWrite[5] == 0x00000000u);
static_assert(CmacWrite[6] == 0x00000000u);
static_assert(CmacWrite[7] == 0x00550000u);
constexpr inline auto CmacRead = GetSecureScratchMasks<SecureRegister_CmacRead>();
static_assert(CmacRead[0] == 0x00000000u);
static_assert(CmacRead[1] == 0x00000000u);
static_assert(CmacRead[2] == 0x00000000u);
static_assert(CmacRead[3] == 0x00000000u);
static_assert(CmacRead[4] == 0x00000000u);
static_assert(CmacRead[5] == 0x00000000u);
static_assert(CmacRead[6] == 0x00000000u);
static_assert(CmacRead[7] == 0x00AA0000u);
constexpr inline auto KeySourceWrite = GetSecureScratchMasks<SecureRegister_KeySourceWrite>();
static_assert(KeySourceWrite[0] == 0x00000000u);
static_assert(KeySourceWrite[1] == 0x00000000u);
static_assert(KeySourceWrite[2] == 0x00000055u);
static_assert(KeySourceWrite[3] == 0x00000000u);
static_assert(KeySourceWrite[4] == 0x00000000u);
static_assert(KeySourceWrite[5] == 0x00000000u);
static_assert(KeySourceWrite[6] == 0x00000000u);
static_assert(KeySourceWrite[7] == 0x00000000u);
constexpr inline auto KeySourceRead = GetSecureScratchMasks<SecureRegister_KeySourceRead>();
static_assert(KeySourceRead[0] == 0x00000000u);
static_assert(KeySourceRead[1] == 0x00000000u);
static_assert(KeySourceRead[2] == 0x000000AAu);
static_assert(KeySourceRead[3] == 0x00000000u);
static_assert(KeySourceRead[4] == 0x00000000u);
static_assert(KeySourceRead[5] == 0x00000000u);
static_assert(KeySourceRead[6] == 0x00000000u);
static_assert(KeySourceRead[7] == 0x00000000u);
constexpr inline auto Srk = GetSecureScratchMasks<SecureRegister_Srk>();
static_assert(Srk[0] == 0x000FF000u);
static_assert(Srk[1] == 0x00000000u);
static_assert(Srk[2] == 0x00000000u);
static_assert(Srk[3] == 0x00000000u);
static_assert(Srk[4] == 0x00000000u);
static_assert(Srk[5] == 0x00000000u);
static_assert(Srk[6] == 0x00000000u);
static_assert(Srk[7] == 0x00000000u);
}