I'm working on implementing elliptic curve cryptography using OpenSSL and I borrowed a lot of code from ciphers.go. While testing my own project, I noticed that while initializing the decryption context using the NewDecryptionCipherCtx function and "aes-256-cbc" as the cipher, it wouldn't do the decryption properly even though the IV, key and the ciphertext were as expected. Further investigation revealed that this was because of EVP_EncryptInit_ex function on line 156 of ciphers.go.
My solution to the problem was adding a new variable called do to the function which would determine whether the intended operation is encryption or decryption and do everything accordingly. More here: https://github.com/ishbir/elliptic/blob/master/ciphers.go#L123
I think that the same fix should be made in this package.
I'm working on implementing elliptic curve cryptography using OpenSSL and I borrowed a lot of code from ciphers.go. While testing my own project, I noticed that while initializing the decryption context using the NewDecryptionCipherCtx function and "aes-256-cbc" as the cipher, it wouldn't do the decryption properly even though the IV, key and the ciphertext were as expected. Further investigation revealed that this was because of EVP_EncryptInit_ex function on line 156 of ciphers.go.
My solution to the problem was adding a new variable called do to the function which would determine whether the intended operation is encryption or decryption and do everything accordingly. More here: https://github.com/ishbir/elliptic/blob/master/ciphers.go#L123
I think that the same fix should be made in this package.