summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/dh
diff options
context:
space:
mode:
authortb <>2018-02-17 13:47:36 +0000
committertb <>2018-02-17 13:47:36 +0000
commite1b05f77869d986a0aee6aa4076f008274e98d27 (patch)
treef0cc2d3dd2a3842c40f792227fe86c133a668af2 /src/lib/libcrypto/dh
parent0c7165079d7f7c944f8c516a5bb23a71b674c170 (diff)
downloadopenbsd-e1b05f77869d986a0aee6aa4076f008274e98d27.tar.gz
openbsd-e1b05f77869d986a0aee6aa4076f008274e98d27.tar.bz2
openbsd-e1b05f77869d986a0aee6aa4076f008274e98d27.zip
Provide further parts of the OpenSSL 1.1 API: {DH,DSA}_get0_{key,pqg}(),
EVP_PKEY_get0_{DH,DSA,RSA}(), RSA_{g,s}et0_key(). ok jsing
Diffstat (limited to 'src/lib/libcrypto/dh')
-rw-r--r--src/lib/libcrypto/dh/dh.h6
-rw-r--r--src/lib/libcrypto/dh/dh_lib.c22
2 files changed, 26 insertions, 2 deletions
diff --git a/src/lib/libcrypto/dh/dh.h b/src/lib/libcrypto/dh/dh.h
index 920af3b92d..61c7d6c873 100644
--- a/src/lib/libcrypto/dh/dh.h
+++ b/src/lib/libcrypto/dh/dh.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: dh.h,v 1.18 2016/11/04 18:35:30 jsing Exp $ */ 1/* $OpenBSD: dh.h,v 1.19 2018/02/17 13:47:36 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -188,6 +188,10 @@ int DH_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
188int DH_set_ex_data(DH *d, int idx, void *arg); 188int DH_set_ex_data(DH *d, int idx, void *arg);
189void *DH_get_ex_data(DH *d, int idx); 189void *DH_get_ex_data(DH *d, int idx);
190 190
191void DH_get0_pqg(const DH *dh, const BIGNUM **p, const BIGNUM **q,
192 const BIGNUM **g);
193void DH_get0_key(const DH *dh, const BIGNUM **pub_key, const BIGNUM **priv_key);
194
191/* Deprecated version */ 195/* Deprecated version */
192#ifndef OPENSSL_NO_DEPRECATED 196#ifndef OPENSSL_NO_DEPRECATED
193DH * DH_generate_parameters(int prime_len,int generator, 197DH * DH_generate_parameters(int prime_len,int generator,
diff --git a/src/lib/libcrypto/dh/dh_lib.c b/src/lib/libcrypto/dh/dh_lib.c
index d45dc17168..5a54ca88da 100644
--- a/src/lib/libcrypto/dh/dh_lib.c
+++ b/src/lib/libcrypto/dh/dh_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: dh_lib.c,v 1.22 2017/01/29 17:49:22 beck Exp $ */ 1/* $OpenBSD: dh_lib.c,v 1.23 2018/02/17 13:47:36 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -239,3 +239,23 @@ DH_size(const DH *dh)
239{ 239{
240 return BN_num_bytes(dh->p); 240 return BN_num_bytes(dh->p);
241} 241}
242
243void
244DH_get0_pqg(const DH *dh, const BIGNUM **p, const BIGNUM **q, const BIGNUM **g)
245{
246 if (p != NULL)
247 *p = dh->p;
248 if (q != NULL)
249 *q = dh->q;
250 if (g != NULL)
251 *g = dh->g;
252}
253
254void
255DH_get0_key(const DH *dh, const BIGNUM **pub_key, const BIGNUM **priv_key)
256{
257 if (pub_key != NULL)
258 *pub_key = dh->pub_key;
259 if (priv_key != NULL)
260 *priv_key = dh->priv_key;
261}