diff --git a/nx/include/switch/crypto/aes.h b/nx/include/switch/crypto/aes.h index bd162cf8..adddfb89 100644 --- a/nx/include/switch/crypto/aes.h +++ b/nx/include/switch/crypto/aes.h @@ -6,16 +6,36 @@ #pragma once #include "../types.h" +#ifndef AES_BLOCK_SIZE #define AES_BLOCK_SIZE 0x10 +#endif +#ifndef AES_128_KEY_SIZE #define AES_128_KEY_SIZE 0x10 +#endif +#ifndef AES_128_U32_PER_KEY #define AES_128_U32_PER_KEY (AES_128_KEY_SIZE / sizeof(u32)) +#endif +#ifndef AES_128_NUM_ROUNDS #define AES_128_NUM_ROUNDS 10 +#endif +#ifndef AES_192_KEY_SIZE #define AES_192_KEY_SIZE 0x18 +#endif +#ifndef AES_192_U32_PER_KEY #define AES_192_U32_PER_KEY (AES_192_KEY_SIZE / sizeof(u32)) +#endif +#ifndef AES_192_NUM_ROUNDS #define AES_192_NUM_ROUNDS 12 +#endif +#ifndef AES_256_KEY_SIZE #define AES_256_KEY_SIZE 0x20 +#endif +#ifndef AES_256_U32_PER_KEY #define AES_256_U32_PER_KEY (AES_256_KEY_SIZE / sizeof(u32)) +#endif +#ifndef AES_256_NUM_ROUNDS #define AES_256_NUM_ROUNDS 14 +#endif /// Context for AES-128 operations. typedef struct { diff --git a/nx/include/switch/crypto/hmac.h b/nx/include/switch/crypto/hmac.h index fdf7364e..45ee662b 100644 --- a/nx/include/switch/crypto/hmac.h +++ b/nx/include/switch/crypto/hmac.h @@ -23,8 +23,12 @@ typedef struct { bool finalized; } HmacSha256Context; +#ifndef HMAC_SHA1_KEY_MAX #define HMAC_SHA1_KEY_MAX (sizeof(((HmacSha1Context *)NULL)->key)) +#endif +#ifndef HMAC_SHA256_KEY_MAX #define HMAC_SHA256_KEY_MAX (sizeof(((HmacSha256Context *)NULL)->key)) +#endif /// Initialize a HMAC-SHA256 context. void hmacSha256ContextCreate(HmacSha256Context *out, const void *key, size_t key_size); diff --git a/nx/include/switch/crypto/sha1.h b/nx/include/switch/crypto/sha1.h index f9075729..7bb6437f 100644 --- a/nx/include/switch/crypto/sha1.h +++ b/nx/include/switch/crypto/sha1.h @@ -6,8 +6,13 @@ #pragma once #include "../types.h" +#ifndef SHA1_HASH_SIZE #define SHA1_HASH_SIZE 0x14 +#endif + +#ifndef SHA1_BLOCK_SIZE #define SHA1_BLOCK_SIZE 0x40 +#endif /// Context for SHA1 operations. typedef struct { diff --git a/nx/include/switch/crypto/sha256.h b/nx/include/switch/crypto/sha256.h index bb6e5391..603d221e 100644 --- a/nx/include/switch/crypto/sha256.h +++ b/nx/include/switch/crypto/sha256.h @@ -6,8 +6,14 @@ #pragma once #include "../types.h" + +#ifndef SHA256_HASH_SIZE #define SHA256_HASH_SIZE 0x20 +#endif + +#ifndef SHA256_BLOCK_SIZE #define SHA256_BLOCK_SIZE 0x40 +#endif /// Context for SHA256 operations. typedef struct {