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)
2626 struct shash_desc * shash ;
2727
2828 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__ );
3033 return -1 ;
34+ }
3135
3236 shash = kmalloc (sizeof (struct shash_desc ) + crypto_shash_descsize (sha256 ),
3337 GFP_KERNEL );
Original file line number Diff line number Diff line change @@ -1891,6 +1891,7 @@ \subsection{Hash functions}
18911891
18921892Calculating and checking the hashes of things is a common operation.
18931893Here 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.
18941895
18951896\samplec {examples/cryptosha256.c}
18961897
You can’t perform that action at this time.
0 commit comments