diff options
Diffstat (limited to 'crypto/asymmetric_keys')
-rw-r--r-- | crypto/asymmetric_keys/Kconfig | 2 | ||||
-rw-r--r-- | crypto/asymmetric_keys/public_key.c | 8 | ||||
-rw-r--r-- | crypto/asymmetric_keys/x509_public_key.c | 11 |
3 files changed, 10 insertions, 11 deletions
diff --git a/crypto/asymmetric_keys/Kconfig b/crypto/asymmetric_keys/Kconfig index 6d2c2ea12559..862b01fe6172 100644 --- a/crypto/asymmetric_keys/Kconfig +++ b/crypto/asymmetric_keys/Kconfig | |||
@@ -12,6 +12,7 @@ if ASYMMETRIC_KEY_TYPE | |||
12 | config ASYMMETRIC_PUBLIC_KEY_SUBTYPE | 12 | config ASYMMETRIC_PUBLIC_KEY_SUBTYPE |
13 | tristate "Asymmetric public-key crypto algorithm subtype" | 13 | tristate "Asymmetric public-key crypto algorithm subtype" |
14 | select MPILIB | 14 | select MPILIB |
15 | select PUBLIC_KEY_ALGO_RSA | ||
15 | help | 16 | help |
16 | This option provides support for asymmetric public key type handling. | 17 | This option provides support for asymmetric public key type handling. |
17 | If signature generation and/or verification are to be used, | 18 | If signature generation and/or verification are to be used, |
@@ -20,7 +21,6 @@ config ASYMMETRIC_PUBLIC_KEY_SUBTYPE | |||
20 | 21 | ||
21 | config PUBLIC_KEY_ALGO_RSA | 22 | config PUBLIC_KEY_ALGO_RSA |
22 | tristate "RSA public-key algorithm" | 23 | tristate "RSA public-key algorithm" |
23 | depends on ASYMMETRIC_PUBLIC_KEY_SUBTYPE | ||
24 | select MPILIB_EXTRA | 24 | select MPILIB_EXTRA |
25 | help | 25 | help |
26 | This option enables support for the RSA algorithm (PKCS#1, RFC3447). | 26 | This option enables support for the RSA algorithm (PKCS#1, RFC3447). |
diff --git a/crypto/asymmetric_keys/public_key.c b/crypto/asymmetric_keys/public_key.c index b313df1bd253..796ce0802aa0 100644 --- a/crypto/asymmetric_keys/public_key.c +++ b/crypto/asymmetric_keys/public_key.c | |||
@@ -28,6 +28,14 @@ const char *const pkey_algo_name[PKEY_ALGO__LAST] = { | |||
28 | }; | 28 | }; |
29 | EXPORT_SYMBOL_GPL(pkey_algo_name); | 29 | EXPORT_SYMBOL_GPL(pkey_algo_name); |
30 | 30 | ||
31 | const struct public_key_algorithm *pkey_algo[PKEY_ALGO__LAST] = { | ||
32 | #if defined(CONFIG_PUBLIC_KEY_ALGO_RSA) || \ | ||
33 | defined(CONFIG_PUBLIC_KEY_ALGO_RSA_MODULE) | ||
34 | [PKEY_ALGO_RSA] = &RSA_public_key_algorithm, | ||
35 | #endif | ||
36 | }; | ||
37 | EXPORT_SYMBOL_GPL(pkey_algo); | ||
38 | |||
31 | const char *const pkey_hash_algo_name[PKEY_HASH__LAST] = { | 39 | const char *const pkey_hash_algo_name[PKEY_HASH__LAST] = { |
32 | [PKEY_HASH_MD4] = "md4", | 40 | [PKEY_HASH_MD4] = "md4", |
33 | [PKEY_HASH_MD5] = "md5", | 41 | [PKEY_HASH_MD5] = "md5", |
diff --git a/crypto/asymmetric_keys/x509_public_key.c b/crypto/asymmetric_keys/x509_public_key.c index afbbc362f85a..fe38628adae9 100644 --- a/crypto/asymmetric_keys/x509_public_key.c +++ b/crypto/asymmetric_keys/x509_public_key.c | |||
@@ -23,15 +23,6 @@ | |||
23 | #include "public_key.h" | 23 | #include "public_key.h" |
24 | #include "x509_parser.h" | 24 | #include "x509_parser.h" |
25 | 25 | ||
26 | static const | ||
27 | struct public_key_algorithm *x509_public_key_algorithms[PKEY_ALGO__LAST] = { | ||
28 | [PKEY_ALGO_DSA] = NULL, | ||
29 | #if defined(CONFIG_PUBLIC_KEY_ALGO_RSA) || \ | ||
30 | defined(CONFIG_PUBLIC_KEY_ALGO_RSA_MODULE) | ||
31 | [PKEY_ALGO_RSA] = &RSA_public_key_algorithm, | ||
32 | #endif | ||
33 | }; | ||
34 | |||
35 | /* | 26 | /* |
36 | * Check the signature on a certificate using the provided public key | 27 | * Check the signature on a certificate using the provided public key |
37 | */ | 28 | */ |
@@ -174,7 +165,7 @@ static int x509_key_preparse(struct key_preparsed_payload *prep) | |||
174 | goto error_free_cert; | 165 | goto error_free_cert; |
175 | } | 166 | } |
176 | 167 | ||
177 | cert->pub->algo = x509_public_key_algorithms[cert->pkey_algo]; | 168 | cert->pub->algo = pkey_algo[cert->pkey_algo]; |
178 | cert->pub->id_type = PKEY_ID_X509; | 169 | cert->pub->id_type = PKEY_ID_X509; |
179 | 170 | ||
180 | /* Check the signature on the key */ | 171 | /* Check the signature on the key */ |