Skip to content

Commit fc8d088

Browse files
committed
fix dsa selection
1 parent d64d722 commit fc8d088

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

dsa.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -260,23 +260,22 @@ func newDSA3(params DSAParameters, X, Y BigInt) (C.GO_EVP_PKEY_PTR, error) {
260260
C.go_openssl_OSSL_PARAM_BLD_push_BN(bld, paramG, g) != 1 {
261261
return nil, newOpenSSLError("OSSL_PARAM_BLD_push_BN")
262262
}
263-
selection := C.int(C.GO_EVP_PKEY_KEYPAIR)
263+
selection := C.int(C.GO_EVP_PKEY_KEY_PARAMETERS)
264264
if Y != nil {
265265
pub := bigToBN(Y)
266266
defer C.go_openssl_BN_free(pub)
267267
if C.go_openssl_OSSL_PARAM_BLD_push_BN(bld, paramPubKey, pub) != 1 {
268268
return nil, newOpenSSLError("OSSL_PARAM_BLD_push_BN")
269269
}
270-
if X == nil {
271-
selection = C.int(C.GO_EVP_PKEY_PUBLIC_KEY)
272-
}
270+
selection = C.int(C.GO_EVP_PKEY_PUBLIC_KEY)
273271
}
274272
if X != nil {
275273
priv := bigToBN(X)
276274
defer C.go_openssl_BN_clear_free(priv)
277275
if C.go_openssl_OSSL_PARAM_BLD_push_BN(bld, paramPrivKey, priv) != 1 {
278276
return nil, newOpenSSLError("OSSL_PARAM_BLD_push_BN")
279277
}
278+
selection = C.int(C.GO_EVP_PKEY_KEYPAIR)
280279
}
281280
bldparams := C.go_openssl_OSSL_PARAM_BLD_to_param(bld)
282281
if bldparams == nil {
@@ -297,7 +296,6 @@ func newDSA3(params DSAParameters, X, Y BigInt) (C.GO_EVP_PKEY_PTR, error) {
297296
if ctx == nil {
298297
return nil, newOpenSSLError("EVP_PKEY_CTX_new_from_pkey")
299298
}
300-
defer C.go_openssl_EVP_PKEY_CTX_free(ctx)
301299
if C.go_openssl_EVP_PKEY_keygen_init(ctx) != 1 {
302300
return nil, newOpenSSLError("EVP_PKEY_keygen_init")
303301
}

0 commit comments

Comments
 (0)