From aa9523f385f76c67cc1c3a66ba7b024b3c2f3568 Mon Sep 17 00:00:00 2001 From: Michael Scire Date: Mon, 6 Apr 2020 04:56:49 -0700 Subject: [PATCH] fs: correct error result in AesCtrStorage --- libstratosphere/source/fssystem/fssystem_aes_ctr_storage.cpp | 4 ++-- libvapours/include/vapours/results/fs_results.hpp | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/libstratosphere/source/fssystem/fssystem_aes_ctr_storage.cpp b/libstratosphere/source/fssystem/fssystem_aes_ctr_storage.cpp index 948f9b48..756d0e2b 100644 --- a/libstratosphere/source/fssystem/fssystem_aes_ctr_storage.cpp +++ b/libstratosphere/source/fssystem/fssystem_aes_ctr_storage.cpp @@ -64,7 +64,7 @@ namespace ams::fssystem { /* Decrypt, ensure we decrypt correctly. */ auto dec_size = crypto::DecryptAes128Ctr(buffer, size, this->key, KeySize, ctr, IvSize, buffer, size); - AMS_ABORT_UNLESS(size == dec_size); + R_UNLESS(size == dec_size, fs::ResultUnexpectedInAesCtrStorageA()); return ResultSuccess(); } @@ -105,7 +105,7 @@ namespace ams::fssystem { ScopedThreadPriorityChanger cp(+1, ScopedThreadPriorityChanger::Mode::Relative); auto enc_size = crypto::EncryptAes128Ctr(write_buf, write_size, this->key, KeySize, ctr, IvSize, reinterpret_cast(buffer) + cur_offset, write_size); - AMS_ABORT_UNLESS(enc_size == write_size); + R_UNLESS(enc_size == write_size, fs::ResultUnexpectedInAesCtrStorageA()); } /* Write the encrypted data. */ diff --git a/libvapours/include/vapours/results/fs_results.hpp b/libvapours/include/vapours/results/fs_results.hpp index dd09ae50..af03f52d 100644 --- a/libvapours/include/vapours/results/fs_results.hpp +++ b/libvapours/include/vapours/results/fs_results.hpp @@ -214,6 +214,7 @@ namespace ams::fs { R_DEFINE_ERROR_RESULT(GameCardLogoDataCorrupted, 4781); R_DEFINE_ERROR_RANGE(Unexpected, 5000, 5999); + R_DEFINE_ERROR_RESULT(UnexpectedInAesCtrStorageA, 5315); R_DEFINE_ERROR_RESULT(UnexpectedInFindFileSystemA, 5319); R_DEFINE_ERROR_RANGE(PreconditionViolation, 6000, 6499);