From 96a387aa79534030b5f4e06cefb74062f01c4f87 Mon Sep 17 00:00:00 2001 From: tb <> Date: Wed, 5 Jan 2022 20:33:49 +0000 Subject: Prepare to provide DSA_get0_{p,q,g,{priv,pub}_key}() ok inoguchi jsing --- src/lib/libcrypto/dsa/dsa.h | 9 ++++++++- src/lib/libcrypto/dsa/dsa_lib.c | 32 +++++++++++++++++++++++++++++++- 2 files changed, 39 insertions(+), 2 deletions(-) diff --git a/src/lib/libcrypto/dsa/dsa.h b/src/lib/libcrypto/dsa/dsa.h index 15536f63e2..391f02c5a4 100644 --- a/src/lib/libcrypto/dsa/dsa.h +++ b/src/lib/libcrypto/dsa/dsa.h @@ -1,4 +1,4 @@ -/* $OpenBSD: dsa.h,v 1.31 2021/11/29 20:13:25 tb Exp $ */ +/* $OpenBSD: dsa.h,v 1.32 2022/01/05 20:33:49 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -267,6 +267,13 @@ void DSA_get0_pqg(const DSA *d, const BIGNUM **p, const BIGNUM **q, int DSA_set0_pqg(DSA *d, BIGNUM *p, BIGNUM *q, BIGNUM *g); void DSA_get0_key(const DSA *d, const BIGNUM **pub_key, const BIGNUM **priv_key); int DSA_set0_key(DSA *d, BIGNUM *pub_key, BIGNUM *priv_key); +#if defined(LIBRESSL_OPAQUE_DSA) || defined(LIBRESSL_CRYPTO_INTERNAL) +const BIGNUM *DSA_get0_p(const DSA *d); +const BIGNUM *DSA_get0_q(const DSA *d); +const BIGNUM *DSA_get0_g(const DSA *d); +const BIGNUM *DSA_get0_pub_key(const DSA *d); +const BIGNUM *DSA_get0_priv_key(const DSA *d); +#endif void DSA_clear_flags(DSA *d, int flags); int DSA_test_flags(const DSA *d, int flags); void DSA_set_flags(DSA *d, int flags); diff --git a/src/lib/libcrypto/dsa/dsa_lib.c b/src/lib/libcrypto/dsa/dsa_lib.c index d5fdd6e78e..146d2cc5e0 100644 --- a/src/lib/libcrypto/dsa/dsa_lib.c +++ b/src/lib/libcrypto/dsa/dsa_lib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dsa_lib.c,v 1.29 2018/04/14 07:09:21 tb Exp $ */ +/* $OpenBSD: dsa_lib.c,v 1.30 2022/01/05 20:33:49 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -361,6 +361,36 @@ DSA_set0_key(DSA *d, BIGNUM *pub_key, BIGNUM *priv_key) return 1; } +const BIGNUM * +DSA_get0_p(const DSA *d) +{ + return d->p; +} + +const BIGNUM * +DSA_get0_q(const DSA *d) +{ + return d->q; +} + +const BIGNUM * +DSA_get0_g(const DSA *d) +{ + return d->g; +} + +const BIGNUM * +DSA_get0_pub_key(const DSA *d) +{ + return d->pub_key; +} + +const BIGNUM * +DSA_get0_priv_key(const DSA *d) +{ + return d->priv_key; +} + void DSA_clear_flags(DSA *d, int flags) { -- cgit v1.2.3-55-g6feb