libstrat: enable -Wextra, -Werror

This caught an embarrassingly large number of bugs.
This commit is contained in:
Michael Scire
2021-10-06 15:20:48 -07:00
parent e1fbf27398
commit 7ca83c9d3b
160 changed files with 691 additions and 152 deletions

View File

@@ -36,6 +36,7 @@ namespace ams::crypto::impl {
void AesImpl<KeySize>::Initialize(const void *key, size_t key_size, bool is_encrypt) {
static_assert(IsSupportedKeySize(KeySize));
AMS_ASSERT(key_size == KeySize);
AMS_UNUSED(key_size);
if constexpr (KeySize == 16) {
/* Aes 128. */
@@ -60,6 +61,7 @@ namespace ams::crypto::impl {
static_assert(IsSupportedKeySize(KeySize));
AMS_ASSERT(src_size >= BlockSize);
AMS_ASSERT(dst_size >= BlockSize);
AMS_UNUSED(src_size, dst_size);
if constexpr (KeySize == 16) {
/* Aes 128. */
@@ -84,6 +86,7 @@ namespace ams::crypto::impl {
static_assert(IsSupportedKeySize(KeySize));
AMS_ASSERT(src_size >= BlockSize);
AMS_ASSERT(dst_size >= BlockSize);
AMS_UNUSED(src_size, dst_size);
if constexpr (KeySize == 16) {
/* Aes 128. */

View File

@@ -32,6 +32,7 @@ namespace ams::crypto::impl {
void Sha1Impl::GetHash(void *dst, size_t size) {
static_assert(sizeof(this->state) == sizeof(::Sha1Context));
AMS_ASSERT(size >= HashSize);
AMS_UNUSED(size);
::sha1ContextGetHash(reinterpret_cast<::Sha1Context *>(std::addressof(this->state)), dst);
}

View File

@@ -32,6 +32,8 @@ namespace ams::crypto::impl {
void Sha256Impl::GetHash(void *dst, size_t size) {
static_assert(sizeof(this->state) == sizeof(::Sha256Context));
AMS_ASSERT(size >= HashSize);
AMS_UNUSED(size);
::sha256ContextGetHash(reinterpret_cast<::Sha256Context *>(std::addressof(this->state)), dst);
}

View File

@@ -50,6 +50,8 @@ namespace ams::crypto::impl {
template<typename Cipher, typename Self>
size_t UpdateImpl(Self *self, void *dst, size_t dst_size, const void *src, size_t src_size) {
AMS_UNUSED(dst_size);
const size_t BlockSize = self->GetBlockSize();
const u8 *src_u8 = static_cast<const u8 *>(src);