.. | .. |
---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-only */ |
---|
1 | 2 | /* |
---|
2 | 3 | * sha256_base.h - core logic for SHA-256 implementations |
---|
3 | 4 | * |
---|
4 | 5 | * Copyright (C) 2015 Linaro Ltd <ard.biesheuvel@linaro.org> |
---|
5 | | - * |
---|
6 | | - * This program is free software; you can redistribute it and/or modify |
---|
7 | | - * it under the terms of the GNU General Public License version 2 as |
---|
8 | | - * published by the Free Software Foundation. |
---|
9 | 6 | */ |
---|
| 7 | + |
---|
| 8 | +#ifndef _CRYPTO_SHA256_BASE_H |
---|
| 9 | +#define _CRYPTO_SHA256_BASE_H |
---|
10 | 10 | |
---|
11 | 11 | #include <crypto/internal/hash.h> |
---|
12 | 12 | #include <crypto/sha.h> |
---|
.. | .. |
---|
22 | 22 | { |
---|
23 | 23 | struct sha256_state *sctx = shash_desc_ctx(desc); |
---|
24 | 24 | |
---|
25 | | - sctx->state[0] = SHA224_H0; |
---|
26 | | - sctx->state[1] = SHA224_H1; |
---|
27 | | - sctx->state[2] = SHA224_H2; |
---|
28 | | - sctx->state[3] = SHA224_H3; |
---|
29 | | - sctx->state[4] = SHA224_H4; |
---|
30 | | - sctx->state[5] = SHA224_H5; |
---|
31 | | - sctx->state[6] = SHA224_H6; |
---|
32 | | - sctx->state[7] = SHA224_H7; |
---|
33 | | - sctx->count = 0; |
---|
34 | | - |
---|
| 25 | + sha224_init(sctx); |
---|
35 | 26 | return 0; |
---|
36 | 27 | } |
---|
37 | 28 | |
---|
.. | .. |
---|
39 | 30 | { |
---|
40 | 31 | struct sha256_state *sctx = shash_desc_ctx(desc); |
---|
41 | 32 | |
---|
42 | | - sctx->state[0] = SHA256_H0; |
---|
43 | | - sctx->state[1] = SHA256_H1; |
---|
44 | | - sctx->state[2] = SHA256_H2; |
---|
45 | | - sctx->state[3] = SHA256_H3; |
---|
46 | | - sctx->state[4] = SHA256_H4; |
---|
47 | | - sctx->state[5] = SHA256_H5; |
---|
48 | | - sctx->state[6] = SHA256_H6; |
---|
49 | | - sctx->state[7] = SHA256_H7; |
---|
50 | | - sctx->count = 0; |
---|
51 | | - |
---|
| 33 | + sha256_init(sctx); |
---|
52 | 34 | return 0; |
---|
53 | 35 | } |
---|
54 | 36 | |
---|
.. | .. |
---|
126 | 108 | *sctx = (struct sha256_state){}; |
---|
127 | 109 | return 0; |
---|
128 | 110 | } |
---|
| 111 | + |
---|
| 112 | +#endif /* _CRYPTO_SHA256_BASE_H */ |
---|