forked from contrun/libecc
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsha512_core.h
45 lines (37 loc) · 1.32 KB
/
sha512_core.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/*
* Copyright (C) 2017 - This file is part of libecc project
*
* Authors:
* Ryad BENADJILA <[email protected]>
* Arnaud EBALARD <[email protected]>
* Jean-Pierre FLORI <[email protected]>
*
* Contributors:
* Nicolas VIVET <[email protected]>
* Karim KHALFALLAH <[email protected]>
*
* This software is licensed under a dual BSD and GPL v2 license.
* See LICENSE file at the root folder of the project.
*/
#include "../lib_ecc_config.h"
#if defined(WITH_HASH_SHA512) || defined(WITH_HASH_SHA512_224) || defined(WITH_HASH_SHA512_256)
#ifndef __SHA512_CORE_H__
#define __SHA512_CORE_H__
#include "../words/words.h"
#include "../utils/utils.h"
#include "sha2.h"
#define SHA512_CORE_STATE_SIZE 8
#define SHA512_CORE_BLOCK_SIZE 128
#define SHA512_CORE_DIGEST_SIZE 64
typedef struct {
/* Number of bytes processed on 128 bits */
u64 sha512_total[2];
/* Internal state */
u64 sha512_state[SHA512_CORE_STATE_SIZE];
/* Internal buffer to handle updates in a block */
u8 sha512_buffer[SHA512_CORE_BLOCK_SIZE];
} sha512_core_context;
void sha512_core_update(sha512_core_context *ctx, const u8 *input, u32 ilen);
void sha512_core_final(sha512_core_context *ctx, u8 *output, u32 output_size);
#endif /* __SHA512_CORE_H__ */
#endif /* WITH_HASH_SHA512 */