From b2e86f5a1b23a58987e83e8fc5ed5a6ff7346957 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 --- .../source/fssystem/fssystem_aes_ctr_storage.cpp | 4 ++-- libraries/libvapours/include/vapours/results/fs_results.hpp | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/libraries/libstratosphere/source/fssystem/fssystem_aes_ctr_storage.cpp b/libraries/libstratosphere/source/fssystem/fssystem_aes_ctr_storage.cpp index 948f9b480..756d0e2b2 100644 --- a/libraries/libstratosphere/source/fssystem/fssystem_aes_ctr_storage.cpp +++ b/libraries/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/libraries/libvapours/include/vapours/results/fs_results.hpp b/libraries/libvapours/include/vapours/results/fs_results.hpp index dd09ae506..af03f52d4 100644 --- a/libraries/libvapours/include/vapours/results/fs_results.hpp +++ b/libraries/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);