hc
2024-01-31 f9004dbfff8a3fbbd7e2a88c8a4327c7f2f8e5b2
kernel/include/crypto/sha256_base.h
....@@ -1,12 +1,12 @@
1
+/* SPDX-License-Identifier: GPL-2.0-only */
12 /*
23 * sha256_base.h - core logic for SHA-256 implementations
34 *
45 * 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.
96 */
7
+
8
+#ifndef _CRYPTO_SHA256_BASE_H
9
+#define _CRYPTO_SHA256_BASE_H
1010
1111 #include <crypto/internal/hash.h>
1212 #include <crypto/sha.h>
....@@ -22,16 +22,7 @@
2222 {
2323 struct sha256_state *sctx = shash_desc_ctx(desc);
2424
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);
3526 return 0;
3627 }
3728
....@@ -39,16 +30,7 @@
3930 {
4031 struct sha256_state *sctx = shash_desc_ctx(desc);
4132
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);
5234 return 0;
5335 }
5436
....@@ -126,3 +108,5 @@
126108 *sctx = (struct sha256_state){};
127109 return 0;
128110 }
111
+
112
+#endif /* _CRYPTO_SHA256_BASE_H */