Skip to content

Commit bc4ab9f

Browse files
qmuntaldagood
andauthored
Update cipher.go
Co-authored-by: Davis Goodin <[email protected]>
1 parent 2ebd923 commit bc4ab9f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

cipher.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,8 @@ func newCipherCtx(kind cipherKind, mode cipherMode, encrypt cipherOp, key, iv []
507507
if C.go_openssl_EVP_CIPHER_CTX_set_key_length(ctx, C.int(len(key))) != 1 {
508508
return nil, newOpenSSLError("EVP_CIPHER_CTX_set_key_length")
509509
}
510-
cipher = nil // don't reset the cipher
510+
// Pass nil to the next call to EVP_CipherInit_ex to avoid resetting ctx's cipher.
511+
cipher = nil
511512
}
512513
if C.go_openssl_EVP_CipherInit_ex(ctx, cipher, nil, base(key), base(iv), C.int(encrypt)) != 1 {
513514
return nil, fail("unable to initialize EVP cipher ctx")

0 commit comments

Comments
 (0)