1
0
Fork 0
mirror of https://github.com/Atmosphere-NX/Atmosphere.git synced 2024-12-25 03:36:02 +00:00
Atmosphere/stratosphere/loader/source/sha256.h

37 lines
795 B
C
Raw Normal View History

2018-07-24 09:26:37 +01:00
#pragma once
/* Based on linux source code */
#ifdef __cplusplus
extern "C" {
#endif
2018-07-24 09:26:37 +01:00
#include <switch/types.h>
2018-07-24 09:26:37 +01:00
#define SHA256_DIGEST_SIZE 32
#define SHA256_BLOCK_SIZE 64
2018-07-24 09:26:37 +01:00
#define SHA256_H0 0x6a09e667UL
#define SHA256_H1 0xbb67ae85UL
#define SHA256_H2 0x3c6ef372UL
#define SHA256_H3 0xa54ff53aUL
#define SHA256_H4 0x510e527fUL
#define SHA256_H5 0x9b05688cUL
#define SHA256_H6 0x1f83d9abUL
#define SHA256_H7 0x5be0cd19UL
2018-07-24 09:26:37 +01:00
struct sha256_state {
u32 state[SHA256_DIGEST_SIZE / 4];
u64 count;
u8 buf[SHA256_BLOCK_SIZE];
};
2018-07-24 09:26:37 +01:00
int sha256_init(struct sha256_state *sctx);
int sha256_update(struct sha256_state *sctx, const void *data, size_t len);
int sha256_finalize(struct sha256_state *sctx);
int sha256_finish(struct sha256_state *sctx, void *out);
2018-07-24 09:26:37 +01:00
#ifdef __cplusplus
}
2018-07-24 09:26:37 +01:00
#endif