Non const input for EVP_EncryptUpdate and EVP_DecryptUpdate

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Non const input for EVP_EncryptUpdate and EVP_DecryptUpdate

Edward Diener
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 ?


--
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users
Reply | Threaded
Open this post in threaded view
|

Re: Non const input for EVP_EncryptUpdate and EVP_DecryptUpdate

Matt Caswell-2
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 ?
>
>
--
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users
Reply | Threaded
Open this post in threaded view
|

Re: Non const input for EVP_EncryptUpdate and EVP_DecryptUpdate

Edward Diener
On 11/22/2017 10:46 AM, Matt Caswell wrote:
> 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!

I filed an issue. It is now the 333th open issue. Thanks for the
information. I guess I should have looked myself.

>
> 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 ?
>>
>>


--
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users