File tree Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -26,8 +26,12 @@ static int cryptosha256_init(void)
26
26
struct shash_desc * shash ;
27
27
28
28
sha256 = crypto_alloc_shash ("sha256" , 0 , 0 );
29
- if (IS_ERR (sha256 ))
29
+ if (IS_ERR (sha256 )) {
30
+ pr_err (
31
+ "%s(): Failed to allocate sha256 algorithm, enable CONFIG_CRYPTO_SHA256 and try again.\n" ,
32
+ __func__ );
30
33
return -1 ;
34
+ }
31
35
32
36
shash = kmalloc (sizeof (struct shash_desc ) + crypto_shash_descsize (sha256 ),
33
37
GFP_KERNEL );
Original file line number Diff line number Diff line change @@ -1891,6 +1891,7 @@ \subsection{Hash functions}
1891
1891
1892
1892
Calculating and checking the hashes of things is a common operation.
1893
1893
Here is a demonstration of how to calculate a sha256 hash within a kernel module.
1894
+ To provide the sha256 algorithm support, make sure \cpp |CONFIG_CRYPTO_SHA256| is enabled in kernel.
1894
1895
1895
1896
\samplec {examples/cryptosha256.c}
1896
1897
You can’t perform that action at this time.
0 commit comments