summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorTomas Mraz <tomas@openssl.org>2022-06-06 10:22:00 +0200
committerHugo Landau <hlandau@openssl.org>2022-07-18 08:06:17 +0100
commitddb13b283be84d771deba1e964610b1670641f03 (patch)
treebb021170034f9fcbafbbfd8e46a48b7884aa3d9d /include
parent358103b4a651ab3f392f088d86cd30469dccce2e (diff)
Use as small dh key size as possible to support the security
Longer private key sizes unnecessarily raise the cycles needed to compute the shared secret without any increase of the real security. We use minimum key sizes as defined in RFC7919. For arbitrary parameters we cannot know whether they are safe primes (we could test but that would be too inefficient) we have to keep generating large keys. However we now set a small dh->length when we are generating safe prime parameters because we know it is safe to use small keys with them. That means users need to regenerate the parameters if they want to take the performance advantage of small private key. Reviewed-by: Kurt Roeckx <kurt@roeckx.be> Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Hugo Landau <hlandau@openssl.org> (Merged from https://github.com/openssl/openssl/pull/18480)
Diffstat (limited to 'include')
-rw-r--r--include/internal/ffc.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/include/internal/ffc.h b/include/internal/ffc.h
index 79cb06aba3..50673efb89 100644
--- a/include/internal/ffc.h
+++ b/include/internal/ffc.h
@@ -112,6 +112,8 @@ typedef struct ffc_params_st {
*/
const char *mdname;
const char *mdprops;
+ /* Default key length for known named groups according to RFC7919 */
+ int keylength;
} FFC_PARAMS;
void ossl_ffc_params_init(FFC_PARAMS *params);
@@ -205,8 +207,9 @@ const DH_NAMED_GROUP *ossl_ffc_numbers_to_dh_named_group(const BIGNUM *p,
int ossl_ffc_named_group_get_uid(const DH_NAMED_GROUP *group);
const char *ossl_ffc_named_group_get_name(const DH_NAMED_GROUP *);
#ifndef OPENSSL_NO_DH
+int ossl_ffc_named_group_get_keylength(const DH_NAMED_GROUP *group);
const BIGNUM *ossl_ffc_named_group_get_q(const DH_NAMED_GROUP *group);
-int ossl_ffc_named_group_set_pqg(FFC_PARAMS *ffc, const DH_NAMED_GROUP *group);
+int ossl_ffc_named_group_set(FFC_PARAMS *ffc, const DH_NAMED_GROUP *group);
#endif
#endif /* OSSL_INTERNAL_FFC_H */