isfshax/stage2/crypto.c

37 lines
908 B
C
Raw Normal View History

2021-05-26 01:53:11 +02:00
/*
* minute - a port of the "mini" IOS replacement for the Wii U.
*
* Copyright (C) 2016 SALT
* Copyright (C) 2016 Daz Jones <daz@dazzozo.com>
*
* Copyright (C) 2008, 2009 Haxx Enterprises <bushing@gmail.com>
* Copyright (C) 2008, 2009 Sven Peter <svenpeter@gmail.com>
*
* This code is licensed to you under the terms of the GNU GPL, version 2;
* see file COPYING or http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
*/
#include "crypto.h"
#include "latte.h"
#include "utils.h"
#include "memory.h"
#include "irq.h"
#include "string.h"
#include "aes.h"
otp_t otp;
void crypto_read_otp(void)
{
u32 *otpd = (u32*)&otp;
int word, bank;
for (bank = 0; bank < 8; bank++)
{
for (word = 0; word < 0x20; word++)
{
write32(LT_OTPCMD, 0x80000000 | bank << 8 | word);
*otpd++ = read32(LT_OTPDATA);
}
}
}