2222 GetPKeyDH((obj), _pkey); \
2323 (dh) = EVP_PKEY_get0_DH(_pkey); \
2424 if ((dh) == NULL) \
25- ossl_raise(eDHError , "failed to get DH from EVP_PKEY"); \
25+ ossl_raise(ePKeyError , "failed to get DH from EVP_PKEY"); \
2626} while (0)
2727
2828/*
2929 * Classes
3030 */
3131VALUE cDH ;
32- static VALUE eDHError ;
3332
3433/*
3534 * Private
@@ -94,7 +93,7 @@ ossl_dh_initialize(int argc, VALUE *argv, VALUE self)
9493#else
9594 dh = DH_new ();
9695 if (!dh )
97- ossl_raise (eDHError , "DH_new" );
96+ ossl_raise (ePKeyError , "DH_new" );
9897 goto legacy ;
9998#endif
10099 }
@@ -114,12 +113,12 @@ ossl_dh_initialize(int argc, VALUE *argv, VALUE self)
114113 pkey = ossl_pkey_read_generic (in , Qnil );
115114 BIO_free (in );
116115 if (!pkey )
117- ossl_raise (eDHError , "could not parse pkey" );
116+ ossl_raise (ePKeyError , "could not parse pkey" );
118117
119118 type = EVP_PKEY_base_id (pkey );
120119 if (type != EVP_PKEY_DH ) {
121120 EVP_PKEY_free (pkey );
122- rb_raise (eDHError , "incorrect pkey type: %s" , OBJ_nid2sn (type ));
121+ rb_raise (ePKeyError , "incorrect pkey type: %s" , OBJ_nid2sn (type ));
123122 }
124123 RTYPEDDATA_DATA (self ) = pkey ;
125124 return self ;
@@ -130,7 +129,7 @@ ossl_dh_initialize(int argc, VALUE *argv, VALUE self)
130129 if (!pkey || EVP_PKEY_assign_DH (pkey , dh ) != 1 ) {
131130 EVP_PKEY_free (pkey );
132131 DH_free (dh );
133- ossl_raise (eDHError , "EVP_PKEY_assign_DH" );
132+ ossl_raise (ePKeyError , "EVP_PKEY_assign_DH" );
134133 }
135134 RTYPEDDATA_DATA (self ) = pkey ;
136135 return self ;
@@ -152,7 +151,7 @@ ossl_dh_initialize_copy(VALUE self, VALUE other)
152151
153152 dh = DHparams_dup (dh_other );
154153 if (!dh )
155- ossl_raise (eDHError , "DHparams_dup" );
154+ ossl_raise (ePKeyError , "DHparams_dup" );
156155
157156 DH_get0_key (dh_other , & pub , & priv );
158157 if (pub ) {
@@ -162,7 +161,7 @@ ossl_dh_initialize_copy(VALUE self, VALUE other)
162161 if (!pub2 || (priv && !priv2 )) {
163162 BN_clear_free (pub2 );
164163 BN_clear_free (priv2 );
165- ossl_raise (eDHError , "BN_dup" );
164+ ossl_raise (ePKeyError , "BN_dup" );
166165 }
167166 DH_set0_key (dh , pub2 , priv2 );
168167 }
@@ -171,7 +170,7 @@ ossl_dh_initialize_copy(VALUE self, VALUE other)
171170 if (!pkey || EVP_PKEY_assign_DH (pkey , dh ) != 1 ) {
172171 EVP_PKEY_free (pkey );
173172 DH_free (dh );
174- ossl_raise (eDHError , "EVP_PKEY_assign_DH" );
173+ ossl_raise (ePKeyError , "EVP_PKEY_assign_DH" );
175174 }
176175 RTYPEDDATA_DATA (self ) = pkey ;
177176 return self ;
@@ -250,11 +249,11 @@ ossl_dh_export(VALUE self)
250249
251250 GetDH (self , dh );
252251 if (!(out = BIO_new (BIO_s_mem ()))) {
253- ossl_raise (eDHError , NULL );
252+ ossl_raise (ePKeyError , NULL );
254253 }
255254 if (!PEM_write_bio_DHparams (out , dh )) {
256255 BIO_free (out );
257- ossl_raise (eDHError , NULL );
256+ ossl_raise (ePKeyError , NULL );
258257 }
259258 str = ossl_membio2str (out );
260259
@@ -284,11 +283,11 @@ ossl_dh_to_der(VALUE self)
284283
285284 GetDH (self , dh );
286285 if ((len = i2d_DHparams (dh , NULL )) <= 0 )
287- ossl_raise (eDHError , NULL );
286+ ossl_raise (ePKeyError , NULL );
288287 str = rb_str_new (0 , len );
289288 p = (unsigned char * )RSTRING_PTR (str );
290289 if (i2d_DHparams (dh , & p ) < 0 )
291- ossl_raise (eDHError , NULL );
290+ ossl_raise (ePKeyError , NULL );
292291 ossl_str_adjust (str , p );
293292
294293 return str ;
@@ -315,7 +314,7 @@ ossl_dh_check_params(VALUE self)
315314 GetPKey (self , pkey );
316315 pctx = EVP_PKEY_CTX_new (pkey , /* engine */ NULL );
317316 if (!pctx )
318- ossl_raise (eDHError , "EVP_PKEY_CTX_new" );
317+ ossl_raise (ePKeyError , "EVP_PKEY_CTX_new" );
319318 ret = EVP_PKEY_param_check (pctx );
320319 EVP_PKEY_CTX_free (pctx );
321320#else
@@ -364,13 +363,6 @@ Init_ossl_dh(void)
364363 ePKeyError = rb_define_class_under (mPKey , "PKeyError" , eOSSLError );
365364#endif
366365
367- /* Document-class: OpenSSL::PKey::DHError
368- *
369- * Generic exception that is raised if an operation on a DH PKey
370- * fails unexpectedly or in case an instantiation of an instance of DH
371- * fails due to non-conformant input data.
372- */
373- eDHError = rb_define_class_under (mPKey , "DHError" , ePKeyError );
374366 /* Document-class: OpenSSL::PKey::DH
375367 *
376368 * An implementation of the Diffie-Hellman key exchange protocol based on
0 commit comments