forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
crypto: ghash - add comment and improve help text
To help avoid confusion, add a comment to ghash-generic.c which explains the convention that the kernel's implementation of GHASH uses. Also update the Kconfig help text and module descriptions to call GHASH a "hash function" rather than a "message digest", since the latter normally means a real cryptographic hash function, which GHASH is not. Cc: Pascal Van Leeuwen <[email protected]> Signed-off-by: Eric Biggers <[email protected]> Reviewed-by: Ard Biesheuvel <[email protected]> Acked-by: Pascal Van Leeuwen <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
- Loading branch information
Showing
7 changed files
with
41 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,7 @@ | |
#include <linux/crypto.h> | ||
#include <linux/module.h> | ||
|
||
MODULE_DESCRIPTION("GHASH secure hash using ARMv8 Crypto Extensions"); | ||
MODULE_DESCRIPTION("GHASH hash function using ARMv8 Crypto Extensions"); | ||
MODULE_AUTHOR("Ard Biesheuvel <[email protected]>"); | ||
MODULE_LICENSE("GPL v2"); | ||
MODULE_ALIAS_CRYPTO("ghash"); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,37 @@ | ||
// SPDX-License-Identifier: GPL-2.0-only | ||
/* | ||
* GHASH: digest algorithm for GCM (Galois/Counter Mode). | ||
* GHASH: hash function for GCM (Galois/Counter Mode). | ||
* | ||
* Copyright (c) 2007 Nokia Siemens Networks - Mikko Herranen <[email protected]> | ||
* Copyright (c) 2009 Intel Corp. | ||
* Author: Huang Ying <[email protected]> | ||
*/ | ||
|
||
/* | ||
* GHASH is a keyed hash function used in GCM authentication tag generation. | ||
* | ||
* The original GCM paper [1] presents GHASH as a function GHASH(H, A, C) which | ||
* takes a 16-byte hash key H, additional authenticated data A, and a ciphertext | ||
* C. It formats A and C into a single byte string X, interprets X as a | ||
* polynomial over GF(2^128), and evaluates this polynomial at the point H. | ||
* | ||
* However, the NIST standard for GCM [2] presents GHASH as GHASH(H, X) where X | ||
* is the already-formatted byte string containing both A and C. | ||
* | ||
* "ghash" in the Linux crypto API uses the 'X' (pre-formatted) convention, | ||
* since the API supports only a single data stream per hash. Thus, the | ||
* formatting of 'A' and 'C' is done in the "gcm" template, not in "ghash". | ||
* | ||
* The reason "ghash" is separate from "gcm" is to allow "gcm" to use an | ||
* accelerated "ghash" when a standalone accelerated "gcm(aes)" is unavailable. | ||
* It is generally inappropriate to use "ghash" for other purposes, since it is | ||
* an "ε-almost-XOR-universal hash function", not a cryptographic hash function. | ||
* It can only be used securely in crypto modes specially designed to use it. | ||
* | ||
* The algorithm implementation is copied from gcm.c. | ||
* [1] The Galois/Counter Mode of Operation (GCM) | ||
* (http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.694.695&rep=rep1&type=pdf) | ||
* [2] Recommendation for Block Cipher Modes of Operation: Galois/Counter Mode (GCM) and GMAC | ||
* (https://csrc.nist.gov/publications/detail/sp/800-38d/final) | ||
*/ | ||
|
||
#include <crypto/algapi.h> | ||
|
@@ -156,6 +181,6 @@ subsys_initcall(ghash_mod_init); | |
module_exit(ghash_mod_exit); | ||
|
||
MODULE_LICENSE("GPL"); | ||
MODULE_DESCRIPTION("GHASH Message Digest Algorithm"); | ||
MODULE_DESCRIPTION("GHASH hash function"); | ||
MODULE_ALIAS_CRYPTO("ghash"); | ||
MODULE_ALIAS_CRYPTO("ghash-generic"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters