/*
- * Copyright 2017-2020 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2017-2022 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
#include <openssl/objects.h>
#include "internal/nelem.h"
#include "crypto/dh.h"
-#include "e_os.h" /* strcasecmp */
static DH *dh_param_init(OSSL_LIB_CTX *libctx, const DH_NAMED_GROUP *group)
{
- DH *dh = dh_new_ex(libctx);
+ DH *dh = ossl_dh_new_ex(libctx);
if (dh == NULL)
return NULL;
- ossl_ffc_named_group_set_pqg(&dh->params, group);
+ ossl_ffc_named_group_set(&dh->params, group);
dh->params.nid = ossl_ffc_named_group_get_uid(group);
- dh->length = BN_num_bits(dh->params.q);
dh->dirty_cnt++;
return dh;
}
-DH *dh_new_by_nid_ex(OSSL_LIB_CTX *libctx, int nid)
+DH *ossl_dh_new_by_nid_ex(OSSL_LIB_CTX *libctx, int nid)
{
const DH_NAMED_GROUP *group;
DH *DH_new_by_nid(int nid)
{
- return dh_new_by_nid_ex(NULL, nid);
+ return ossl_dh_new_by_nid_ex(NULL, nid);
}
-void dh_cache_named_group(DH *dh)
+void ossl_dh_cache_named_group(DH *dh)
{
const DH_NAMED_GROUP *group;
dh->params.g)) != NULL) {
if (dh->params.q == NULL)
dh->params.q = (BIGNUM *)ossl_ffc_named_group_get_q(group);
- /* cache the nid */
+ /* cache the nid and default key length */
dh->params.nid = ossl_ffc_named_group_get_uid(group);
- dh->length = BN_num_bits(dh->params.q);
+ dh->params.keylength = ossl_ffc_named_group_get_keylength(group);
dh->dirty_cnt++;
}
}