diff options
author | Nicolai Stange <nstange@suse.de> | 2022-02-21 13:10:57 +0100 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2022-03-03 10:47:51 +1200 |
commit | c8e8236cf71f1e808120804339d2c23dc304f9cd (patch) | |
tree | ba6fe743095564f7754416c9f38a500d7af75964 /crypto/testmgr.c | |
parent | 209b7fc9c9249c400610cec1cbfba848f293f2e9 (diff) | |
download | linux-c8e8236cf71f1e808120804339d2c23dc304f9cd.tar.gz linux-c8e8236cf71f1e808120804339d2c23dc304f9cd.tar.bz2 linux-c8e8236cf71f1e808120804339d2c23dc304f9cd.zip |
crypto: dh - allow for passing NULL to the ffdheXYZ(dh)s' ->set_secret()
Ephemeral key generation can be requested from any of the ffdheXYZ(dh)
variants' common ->set_secret() by passing it an (encoded) struct dh
with the key parameter being unset, i.e. with ->key_size == 0. As the
whole purpose of the ffdheXYZ(dh) templates is to fill in the group
parameters as appropriate, they expect ->p and ->g to be unset in any
input struct dh as well. This means that a user would have to encode an
all-zeroes struct dh instance via crypto_dh_encode_key() when requesting
ephemeral key generation from a ffdheXYZ(dh) instance, which is kind of
pointless.
Make dh_safe_prime_set_secret() to decode a struct dh from the supplied
buffer only if the latter is non-NULL and initialize it with all zeroes
otherwise.
That is, it is now possible to call
crypto_kpp_set_secret(tfm, NULL, 0);
on any ffdheXYZ(dh) tfm for requesting ephemeral key generation.
Signed-off-by: Nicolai Stange <nstange@suse.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto/testmgr.c')
0 files changed, 0 insertions, 0 deletions