summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortb <>2022-01-14 08:25:44 +0000
committertb <>2022-01-14 08:25:44 +0000
commit3412d1fdfdf8698f7e998e555ec4ce73e1d6559f (patch)
treed6c6ce19fa7375833f16ea2ff149ef5fc40b0dcc /src
parent43d61e8f3bb584cd24df6647c53daae59953c795 (diff)
downloadopenbsd-3412d1fdfdf8698f7e998e555ec4ce73e1d6559f.tar.gz
openbsd-3412d1fdfdf8698f7e998e555ec4ce73e1d6559f.tar.bz2
openbsd-3412d1fdfdf8698f7e998e555ec4ce73e1d6559f.zip
Make structs in dh.h opaque
This moves the struct internals for DH and DH_METHOD to dh_local.h. ok inoguchi jsing
Diffstat (limited to 'src')
-rw-r--r--src/lib/libcrypto/dh/dh.h51
-rw-r--r--src/lib/libcrypto/dh/dh_local.h44
2 files changed, 44 insertions, 51 deletions
diff --git a/src/lib/libcrypto/dh/dh.h b/src/lib/libcrypto/dh/dh.h
index 4545035afb..ef10495029 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.31 2022/01/14 07:49:49 tb Exp $ */ 1/* $OpenBSD: dh.h,v 1.32 2022/01/14 08:25:44 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 *
@@ -98,55 +98,6 @@
98extern "C" { 98extern "C" {
99#endif 99#endif
100 100
101/* Already defined in ossl_typ.h */
102/* typedef struct dh_st DH; */
103/* typedef struct dh_method DH_METHOD; */
104
105struct dh_method
106 {
107 const char *name;
108 /* Methods here */
109 int (*generate_key)(DH *dh);
110 int (*compute_key)(unsigned char *key,const BIGNUM *pub_key,DH *dh);
111 int (*bn_mod_exp)(const DH *dh, BIGNUM *r, const BIGNUM *a,
112 const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx,
113 BN_MONT_CTX *m_ctx); /* Can be null */
114
115 int (*init)(DH *dh);
116 int (*finish)(DH *dh);
117 int flags;
118 char *app_data;
119 /* If this is non-NULL, it will be used to generate parameters */
120 int (*generate_params)(DH *dh, int prime_len, int generator, BN_GENCB *cb);
121 };
122
123struct dh_st
124 {
125 /* This first argument is used to pick up errors when
126 * a DH is passed instead of a EVP_PKEY */
127 int pad;
128 int version;
129 BIGNUM *p;
130 BIGNUM *g;
131 long length; /* optional */
132 BIGNUM *pub_key; /* g^x */
133 BIGNUM *priv_key; /* x */
134
135 int flags;
136 BN_MONT_CTX *method_mont_p;
137 /* Place holders if we want to do X9.42 DH */
138 BIGNUM *q;
139 BIGNUM *j;
140 unsigned char *seed;
141 int seedlen;
142 BIGNUM *counter;
143
144 int references;
145 CRYPTO_EX_DATA ex_data;
146 const DH_METHOD *meth;
147 ENGINE *engine;
148 };
149
150#define DH_GENERATOR_2 2 101#define DH_GENERATOR_2 2
151/* #define DH_GENERATOR_3 3 */ 102/* #define DH_GENERATOR_3 3 */
152#define DH_GENERATOR_5 5 103#define DH_GENERATOR_5 5
diff --git a/src/lib/libcrypto/dh/dh_local.h b/src/lib/libcrypto/dh/dh_local.h
index 21bc266a9c..928f2c0c8b 100644
--- a/src/lib/libcrypto/dh/dh_local.h
+++ b/src/lib/libcrypto/dh/dh_local.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: dh_local.h,v 1.2 2022/01/10 12:00:52 tb Exp $ */ 1/* $OpenBSD: dh_local.h,v 1.3 2022/01/14 08:25:44 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 *
@@ -61,6 +61,48 @@
61 61
62__BEGIN_HIDDEN_DECLS 62__BEGIN_HIDDEN_DECLS
63 63
64struct dh_method {
65 const char *name;
66 /* Methods here */
67 int (*generate_key)(DH *dh);
68 int (*compute_key)(unsigned char *key,const BIGNUM *pub_key,DH *dh);
69 int (*bn_mod_exp)(const DH *dh, BIGNUM *r, const BIGNUM *a,
70 const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx);
71 int (*init)(DH *dh);
72 int (*finish)(DH *dh);
73 int flags;
74 char *app_data;
75 /* If this is non-NULL, it will be used to generate parameters */
76 int (*generate_params)(DH *dh, int prime_len, int generator,
77 BN_GENCB *cb);
78};
79
80struct dh_st {
81 /* This first argument is used to pick up errors when
82 * a DH is passed instead of a EVP_PKEY */
83 int pad;
84 int version;
85 BIGNUM *p;
86 BIGNUM *g;
87 long length; /* optional */
88 BIGNUM *pub_key; /* g^x */
89 BIGNUM *priv_key; /* x */
90
91 int flags;
92 BN_MONT_CTX *method_mont_p;
93 /* Place holders if we want to do X9.42 DH */
94 BIGNUM *q;
95 BIGNUM *j;
96 unsigned char *seed;
97 int seedlen;
98 BIGNUM *counter;
99
100 int references;
101 CRYPTO_EX_DATA ex_data;
102 const DH_METHOD *meth;
103 ENGINE *engine;
104};
105
64/* 106/*
65 * Public API in OpenSSL that we only want to use internally. 107 * Public API in OpenSSL that we only want to use internally.
66 */ 108 */