mirror of
https://github.com/Atmosphere-NX/Atmosphere
synced 2024-11-09 22:56:35 +00:00
vapours: new include style, add crypto
This commit is contained in:
parent
081bd0aefc
commit
eb75d54b2b
36 changed files with 198 additions and 80 deletions
|
@ -15,12 +15,13 @@
|
|||
*/
|
||||
|
||||
#pragma once
|
||||
#include "vapours/includes.hpp"
|
||||
#include "vapours/defines.hpp"
|
||||
#include "vapours/literals.hpp"
|
||||
#include <vapours/includes.hpp>
|
||||
#include <vapours/defines.hpp>
|
||||
#include <vapours/literals.hpp>
|
||||
|
||||
#include "vapours/timespan.hpp"
|
||||
#include <vapours/timespan.hpp>
|
||||
|
||||
#include "vapours/util.hpp"
|
||||
#include "vapours/results.hpp"
|
||||
#include "vapours/svc.hpp"
|
||||
#include <vapours/util.hpp>
|
||||
#include <vapours/results.hpp>
|
||||
#include <vapours/crypto.hpp>
|
||||
#include <vapours/svc.hpp>
|
||||
|
|
20
libraries/libvapours/include/vapours/crypto.hpp
Normal file
20
libraries/libvapours/include/vapours/crypto.hpp
Normal file
|
@ -0,0 +1,20 @@
|
|||
/*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <vapours/defines.hpp>
|
||||
|
||||
#include <vapours/crypto/crypto_memory_compare.hpp>
|
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <vapours/defines.hpp>
|
||||
#include <vapours/util.hpp>
|
||||
|
||||
#ifdef ATMOSPHERE_ARCH_ARM64
|
||||
|
||||
#include <vapours/crypto/impl/crypto_memory_compare.arch.arm64.hpp>
|
||||
|
||||
#else
|
||||
|
||||
#error "Unknown architecture for crypto::IsSameBytes"
|
||||
|
||||
#endif
|
||||
|
||||
namespace ams::crypto {
|
||||
|
||||
bool IsSameBytes(const void *lhs, const void *rhs, size_t size) {
|
||||
return impl::IsSameBytes(lhs, rhs, size);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,60 @@
|
|||
/*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <vapours/defines.hpp>
|
||||
#include <vapours/util.hpp>
|
||||
|
||||
namespace ams::crypto::impl {
|
||||
|
||||
bool IsSameBytes(const void *lhs, const void *rhs, size_t size) {
|
||||
bool result;
|
||||
u8 xor_acc, ltmp, rtmp;
|
||||
size_t index;
|
||||
|
||||
__asm__ __volatile__(
|
||||
/* Clear registers and prepare for comparison. */
|
||||
" mov %w[xor_acc], #0\n"
|
||||
" mov %w[index], #0\n"
|
||||
" b 1f\n"
|
||||
|
||||
/* Compare one byte in constant time. */
|
||||
"0:\n"
|
||||
" ldrb %w[ltmp], [%[lhs]]\n"
|
||||
" ldrb %w[rtmp], [%[rhs]]\n"
|
||||
" adds %[lhs], %[lhs], #1\n"
|
||||
" adds %[rhs], %[rhs], #1\n"
|
||||
" eor %w[ltmp], %w[ltmp], %w[rtmp]\n"
|
||||
" orr %w[xor_acc], %w[xor_acc], %w[ltmp]\n"
|
||||
" adds %[index], %[index], #1\n"
|
||||
|
||||
/* Check if there is still data to compare. */
|
||||
"1:\n"
|
||||
" cmp %[index], %[size]\n"
|
||||
" bcc 0b\n"
|
||||
|
||||
/* We're done, set result. */
|
||||
" cmp %w[xor_acc], #0\n"
|
||||
" cset %w[result], eq\n"
|
||||
: [result]"=r"(result), [lhs]"+r"(lhs), [rhs]"+r"(rhs), [xor_acc]"=&r"(xor_acc), [index]"=&r"(index), [ltmp]"=&r"(ltmp), [rtmp]"=&r"(rtmp)
|
||||
: [size]"r"(size)
|
||||
: "cc"
|
||||
);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
|
@ -14,7 +14,7 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include "includes.hpp"
|
||||
#include <vapours/includes.hpp>
|
||||
|
||||
/* Any broadly useful language defines should go here. */
|
||||
|
||||
|
|
|
@ -60,4 +60,4 @@
|
|||
#endif /* ATMOSPHERE_IS_STRATOSPHERE */
|
||||
|
||||
/* Atmosphere meta. */
|
||||
#include "ams_version.h"
|
||||
#include <vapours/ams_version.h>
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include "defines.hpp"
|
||||
#include <vapours/defines.hpp>
|
||||
|
||||
namespace ams { inline namespace literals {
|
||||
|
||||
|
|
|
@ -15,36 +15,36 @@
|
|||
*/
|
||||
|
||||
#pragma once
|
||||
#include "defines.hpp"
|
||||
#include "util.hpp"
|
||||
#include <vapours/defines.hpp>
|
||||
#include <vapours/util.hpp>
|
||||
|
||||
/* Utilities. */
|
||||
#include "results/results_common.hpp"
|
||||
#include <vapours/results/results_common.hpp>
|
||||
|
||||
/* Official. */
|
||||
#include "results/cal_results.hpp"
|
||||
#include "results/creport_results.hpp"
|
||||
#include "results/debug_results.hpp"
|
||||
#include "results/dmnt_results.hpp"
|
||||
#include "results/err_results.hpp"
|
||||
#include "results/fatal_results.hpp"
|
||||
#include "results/fs_results.hpp"
|
||||
#include "results/hipc_results.hpp"
|
||||
#include "results/i2c_results.hpp"
|
||||
#include "results/kvdb_results.hpp"
|
||||
#include "results/loader_results.hpp"
|
||||
#include "results/lr_results.hpp"
|
||||
#include "results/os_results.hpp"
|
||||
#include "results/ncm_results.hpp"
|
||||
#include "results/pm_results.hpp"
|
||||
#include "results/ro_results.hpp"
|
||||
#include "results/settings_results.hpp"
|
||||
#include "results/sf_results.hpp"
|
||||
#include "results/sm_results.hpp"
|
||||
#include "results/spl_results.hpp"
|
||||
#include "results/svc_results.hpp"
|
||||
#include "results/updater_results.hpp"
|
||||
#include "results/vi_results.hpp"
|
||||
#include <vapours/results/cal_results.hpp>
|
||||
#include <vapours/results/creport_results.hpp>
|
||||
#include <vapours/results/debug_results.hpp>
|
||||
#include <vapours/results/dmnt_results.hpp>
|
||||
#include <vapours/results/err_results.hpp>
|
||||
#include <vapours/results/fatal_results.hpp>
|
||||
#include <vapours/results/fs_results.hpp>
|
||||
#include <vapours/results/hipc_results.hpp>
|
||||
#include <vapours/results/i2c_results.hpp>
|
||||
#include <vapours/results/kvdb_results.hpp>
|
||||
#include <vapours/results/loader_results.hpp>
|
||||
#include <vapours/results/lr_results.hpp>
|
||||
#include <vapours/results/os_results.hpp>
|
||||
#include <vapours/results/ncm_results.hpp>
|
||||
#include <vapours/results/pm_results.hpp>
|
||||
#include <vapours/results/ro_results.hpp>
|
||||
#include <vapours/results/settings_results.hpp>
|
||||
#include <vapours/results/sf_results.hpp>
|
||||
#include <vapours/results/sm_results.hpp>
|
||||
#include <vapours/results/spl_results.hpp>
|
||||
#include <vapours/results/svc_results.hpp>
|
||||
#include <vapours/results/updater_results.hpp>
|
||||
#include <vapours/results/vi_results.hpp>
|
||||
|
||||
/* Unofficial. */
|
||||
#include "results/exosphere_results.hpp"
|
||||
#include <vapours/results/exosphere_results.hpp>
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
*/
|
||||
|
||||
#pragma once
|
||||
#include "results_common.hpp"
|
||||
#include <vapours/results/results_common.hpp>
|
||||
|
||||
namespace ams::cal {
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
*/
|
||||
|
||||
#pragma once
|
||||
#include "results_common.hpp"
|
||||
#include <vapours/results/results_common.hpp>
|
||||
|
||||
namespace ams::creport {
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
*/
|
||||
|
||||
#pragma once
|
||||
#include "results_common.hpp"
|
||||
#include <vapours/results/results_common.hpp>
|
||||
|
||||
namespace ams::dbg {
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
*/
|
||||
|
||||
#pragma once
|
||||
#include "results_common.hpp"
|
||||
#include <vapours/results/results_common.hpp>
|
||||
|
||||
namespace ams::dmnt {
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
*/
|
||||
|
||||
#pragma once
|
||||
#include "results_common.hpp"
|
||||
#include <vapours/results/results_common.hpp>
|
||||
|
||||
namespace ams::err {
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
*/
|
||||
|
||||
#pragma once
|
||||
#include "results_common.hpp"
|
||||
#include <vapours/results/results_common.hpp>
|
||||
|
||||
namespace ams::exosphere {
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
*/
|
||||
|
||||
#pragma once
|
||||
#include "results_common.hpp"
|
||||
#include <vapours/results/results_common.hpp>
|
||||
|
||||
namespace ams::fatal {
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
*/
|
||||
|
||||
#pragma once
|
||||
#include "results_common.hpp"
|
||||
#include <vapours/results/results_common.hpp>
|
||||
|
||||
namespace ams::fs {
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
*/
|
||||
|
||||
#pragma once
|
||||
#include "results_common.hpp"
|
||||
#include <vapours/results/results_common.hpp>
|
||||
|
||||
namespace ams::sf::hipc {
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
*/
|
||||
|
||||
#pragma once
|
||||
#include "results_common.hpp"
|
||||
#include <vapours/results/results_common.hpp>
|
||||
|
||||
namespace ams::i2c {
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
*/
|
||||
|
||||
#pragma once
|
||||
#include "results_common.hpp"
|
||||
#include <vapours/results/results_common.hpp>
|
||||
|
||||
namespace ams::kvdb {
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
*/
|
||||
|
||||
#pragma once
|
||||
#include "results_common.hpp"
|
||||
#include <vapours/results/results_common.hpp>
|
||||
|
||||
namespace ams::ldr {
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
*/
|
||||
|
||||
#pragma once
|
||||
#include "results_common.hpp"
|
||||
#include <vapours/results/results_common.hpp>
|
||||
|
||||
namespace ams::lr {
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
*/
|
||||
|
||||
#pragma once
|
||||
#include "results_common.hpp"
|
||||
#include <vapours/results/results_common.hpp>
|
||||
|
||||
namespace ams::ncm {
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
*/
|
||||
|
||||
#pragma once
|
||||
#include "results_common.hpp"
|
||||
#include <vapours/results/results_common.hpp>
|
||||
|
||||
namespace ams::os {
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
*/
|
||||
|
||||
#pragma once
|
||||
#include "results_common.hpp"
|
||||
#include <vapours/results/results_common.hpp>
|
||||
|
||||
namespace ams::pm {
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
*/
|
||||
|
||||
#pragma once
|
||||
#include "../defines.hpp"
|
||||
#include <vapours/defines.hpp>
|
||||
|
||||
namespace ams {
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
*/
|
||||
|
||||
#pragma once
|
||||
#include "results_common.hpp"
|
||||
#include <vapours/results/results_common.hpp>
|
||||
|
||||
namespace ams::ro {
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
*/
|
||||
|
||||
#pragma once
|
||||
#include "results_common.hpp"
|
||||
#include <vapours/results/results_common.hpp>
|
||||
|
||||
namespace ams::settings {
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
*/
|
||||
|
||||
#pragma once
|
||||
#include "results_common.hpp"
|
||||
#include <vapours/results/results_common.hpp>
|
||||
|
||||
namespace ams::sf {
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
*/
|
||||
|
||||
#pragma once
|
||||
#include "results_common.hpp"
|
||||
#include <vapours/results/results_common.hpp>
|
||||
|
||||
namespace ams::sm {
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
*/
|
||||
|
||||
#pragma once
|
||||
#include "results_common.hpp"
|
||||
#include <vapours/results/results_common.hpp>
|
||||
|
||||
namespace ams::spl {
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
*/
|
||||
|
||||
#pragma once
|
||||
#include "results_common.hpp"
|
||||
#include <vapours/results/results_common.hpp>
|
||||
|
||||
namespace ams::svc {
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
*/
|
||||
|
||||
#pragma once
|
||||
#include "results_common.hpp"
|
||||
#include <vapours/results/results_common.hpp>
|
||||
|
||||
namespace ams::updater {
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
*/
|
||||
|
||||
#pragma once
|
||||
#include "results_common.hpp"
|
||||
#include <vapours/results/results_common.hpp>
|
||||
|
||||
namespace ams::vi {
|
||||
|
||||
|
|
|
@ -15,8 +15,8 @@
|
|||
*/
|
||||
|
||||
#pragma once
|
||||
#include "defines.hpp"
|
||||
#include "results.hpp"
|
||||
#include <vapours/defines.hpp>
|
||||
#include <vapours/results.hpp>
|
||||
|
||||
#include "svc/svc_types.hpp"
|
||||
#include "svc/svc_definitions.hpp"
|
||||
#include <vapours/svc/svc_types.hpp>
|
||||
#include <vapours/svc/svc_definitions.hpp>
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
*/
|
||||
|
||||
#pragma once
|
||||
#include "defines.hpp"
|
||||
#include <vapours/defines.hpp>
|
||||
#include <chrono>
|
||||
|
||||
namespace ams {
|
||||
|
|
|
@ -15,17 +15,17 @@
|
|||
*/
|
||||
|
||||
#pragma once
|
||||
#include "defines.hpp"
|
||||
#include <vapours/defines.hpp>
|
||||
|
||||
#include "util/util_alignment.hpp"
|
||||
#include "util/util_size.hpp"
|
||||
#include "util/util_fourcc.hpp"
|
||||
#include "util/util_bitpack.hpp"
|
||||
#include "util/util_bitset.hpp"
|
||||
#include "util/util_scope_guard.hpp"
|
||||
#include "util/util_specialization_of.hpp"
|
||||
#include "util/util_typed_storage.hpp"
|
||||
#include "util/util_intrusive_list.hpp"
|
||||
#include "util/util_intrusive_red_black_tree.hpp"
|
||||
#include "util/util_tinymt.hpp"
|
||||
#include "util/util_bitutil.hpp"
|
||||
#include <vapours/util/util_alignment.hpp>
|
||||
#include <vapours/util/util_size.hpp>
|
||||
#include <vapours/util/util_fourcc.hpp>
|
||||
#include <vapours/util/util_bitpack.hpp>
|
||||
#include <vapours/util/util_bitset.hpp>
|
||||
#include <vapours/util/util_scope_guard.hpp>
|
||||
#include <vapours/util/util_specialization_of.hpp>
|
||||
#include <vapours/util/util_typed_storage.hpp>
|
||||
#include <vapours/util/util_intrusive_list.hpp>
|
||||
#include <vapours/util/util_intrusive_red_black_tree.hpp>
|
||||
#include <vapours/util/util_tinymt.hpp>
|
||||
#include <vapours/util/util_bitutil.hpp>
|
||||
|
|
Loading…
Reference in a new issue