mirror of
https://github.com/switchbrew/libnx.git
synced 2025-06-21 12:32:40 +02:00
crypto: guard #defines with #ifndef
This commit is contained in:
parent
c3a94f5bce
commit
16f8255fd5
@ -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 {
|
||||
|
@ -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);
|
||||
|
@ -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 {
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user