2 * Copyright 2011-2020 The OpenSSL Project Authors. All Rights Reserved.
4 * Licensed under the Apache License 2.0 (the "License"). You may not use
5 * this file except in compliance with the License. You can obtain a copy
6 * in the file LICENSE in the source distribution or at
7 * https://www.openssl.org/source/license.html
11 * DH low level APIs are deprecated for public use, but still ok for
14 #include "internal/deprecated.h"
17 #include "internal/cryptlib.h"
19 #include <openssl/bn.h>
20 #include "crypto/bn_dh.h"
23 * Macro to make a DH structure from BIGNUM data. NB: although just copying
24 * the BIGNUM static pointers would be more efficient, we can't do that
25 * because they get wiped using BN_clear_free() when DH_free() is called.
29 DH *DH_get_##x(void) \
35 dh->params.p = BN_dup(&_bignum_dh##x##_p); \
36 dh->params.g = BN_dup(&_bignum_dh##x##_g); \
37 dh->params.q = BN_dup(&_bignum_dh##x##_q); \
38 if (dh->params.p == NULL || dh->params.q == NULL || dh->params.g == NULL) {\