mirror of
https://github.com/Huntereb/Awoo-Installer
synced 2024-11-23 04:03:10 +00:00
Make error throws not lock up the software
This commit is contained in:
parent
4746a52edc
commit
e2ed3a8027
2 changed files with 5 additions and 4 deletions
|
@ -413,7 +413,7 @@ u64 NcaWriter::write(const u8* ptr, u64 sz)
|
||||||
crypto.decrypt(&header, &header, sizeof(header), 0, 0x200);
|
crypto.decrypt(&header, &header, sizeof(header), 0, 0x200);
|
||||||
|
|
||||||
if (header.magic != MAGIC_NCA3)
|
if (header.magic != MAGIC_NCA3)
|
||||||
throw "Invalid NCA magic";
|
throw std::runtime_error("Invalid NCA magic");
|
||||||
|
|
||||||
if(isOpen())
|
if(isOpen())
|
||||||
{
|
{
|
||||||
|
@ -440,7 +440,7 @@ u64 NcaWriter::write(const u8* ptr, u64 sz)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw "not enough data to read ncz header";
|
throw std::runtime_error("not enough data to read ncz header");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -450,7 +450,7 @@ u64 NcaWriter::write(const u8* ptr, u64 sz)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw "null writer";
|
throw std::runtime_error("null writer");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
3
source/util/crypto.cpp
Normal file → Executable file
3
source/util/crypto.cpp
Normal file → Executable file
|
@ -1,6 +1,7 @@
|
||||||
#include "util/crypto.hpp"
|
#include "util/crypto.hpp"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <mbedtls/bignum.h>
|
#include <mbedtls/bignum.h>
|
||||||
|
#include <stdexcept>
|
||||||
|
|
||||||
void Crypto::calculateMGF1andXOR(unsigned char* data, size_t data_size, const void* source, size_t source_size) {
|
void Crypto::calculateMGF1andXOR(unsigned char* data, size_t data_size, const void* source, size_t source_size) {
|
||||||
unsigned char h_buf[RSA_2048_BYTES] = {0};
|
unsigned char h_buf[RSA_2048_BYTES] = {0};
|
||||||
|
@ -44,7 +45,7 @@ bool Crypto::rsa2048PssVerify(const void *data, size_t len, const unsigned char
|
||||||
mbedtls_mpi_exp_mod(&message_mpi, &signature_mpi, &e_mpi, &modulus_mpi, NULL);
|
mbedtls_mpi_exp_mod(&message_mpi, &signature_mpi, &e_mpi, &modulus_mpi, NULL);
|
||||||
|
|
||||||
if (mbedtls_mpi_write_binary(&message_mpi, m_buf, RSA_2048_BYTES) != 0) {
|
if (mbedtls_mpi_write_binary(&message_mpi, m_buf, RSA_2048_BYTES) != 0) {
|
||||||
throw "Failed to export exponentiated RSA message!";
|
throw std::runtime_error("Failed to export exponentiated RSA message!");
|
||||||
}
|
}
|
||||||
|
|
||||||
mbedtls_mpi_free(&signature_mpi);
|
mbedtls_mpi_free(&signature_mpi);
|
||||||
|
|
Loading…
Reference in a new issue