[openssl-users] Non const input for EVP_EncryptUpdate and EVP_DecryptUpdate

Matt Caswell matt at openssl.org
Wed Nov 22 15:46:39 UTC 2017


This is a bug in the docs. In the header files they are declared as const:

int EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl,
                      const unsigned char *in, int inl);

int EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl,
                      const unsigned char *in, int inl);

Please file a bug report!

https://github.com/openssl/openssl/issues

Matt


On 22/11/17 14:42, Edward Diener wrote:
> When calling EVP_EncryptUpdate with some plaintext to be encrypted the
> parameter for the plaintext is a pointer to a non-const array of
> unsigned char, as in the function prototype:
> 
> int EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out,
>          int *outl, unsigned char *in, int inl);
> 
> Similarly when calling EVP_DecryptUpdate with some ciphertext to be
> decrypted the parameter for the ciphertext is a pointer to a non-const
> array of unsigned char, as in the function prototype:
> 
> int EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out,
>          int *outl, unsigned char *in, int inl);
> 
> I have taken both these function prototypes from the OpenSSL
> documentation at
> https://wiki.openssl.org/index.php/Manual:EVP_EncryptInit(3).
> 
> Does this mean that the input array in both cases actually is modified
> in any way by the functions ? Or is this just an error in that if the
> input remains unmodified the functions do not specify the parameter as
> 'const unsigned char * in' instead ?
> 
> 


More information about the openssl-users mailing list