Re: AES and EVP_CIPHER question

2022-05-18 Thread Matt Caswell
On 17/05/2022 16:25, Philip Prindeville wrote: Thanks, and for 1.1.x? There's nothing equivalent in 1.1.x AFAIK. Matt

Re: AES and EVP_CIPHER question

2022-05-17 Thread Philip Prindeville
> On May 17, 2022, at 4:32 AM, Matt Caswell wrote: > > > > On 16/05/2022 23:48, Philip Prindeville wrote: >> Sorry, I shouldn't have phrased that inartfully. >> There is no EVP_CIPHER_CTX_get_padding(), so how does one achieve something >> analogous? > > > From 3.0, assuming you are

Re: AES and EVP_CIPHER question

2022-05-17 Thread Matt Caswell
On 16/05/2022 23:48, Philip Prindeville wrote: Sorry, I shouldn't have phrased that inartfully. There is no EVP_CIPHER_CTX_get_padding(), so how does one achieve something analogous? From 3.0, assuming you are using provided ciphers (i.e. not engine ones), then OSSL_CIPHER_PARAM_PADDING

Re: AES and EVP_CIPHER question

2022-05-16 Thread Philip Prindeville
Sorry, I shouldn't have phrased that inartfully. There is no EVP_CIPHER_CTX_get_padding(), so how does one achieve something analogous? > On May 16, 2022, at 1:00 PM, Philip Prindeville > wrote: > > Thanks. That fixed the return value of EVP_CipherFinal(). > > Is there a reciprocal

Re: AES and EVP_CIPHER question

2022-05-16 Thread Philip Prindeville
Thanks. That fixed the return value of EVP_CipherFinal(). Is there a reciprocal EVP_CIPHER_CTX_get_padding() method to find out what the default padding method is for ECB? > On May 16, 2022, at 12:41 AM, Tomas Mraz wrote: > > The EVP_CIPHER_CTX_set_padding(ctx, 0) must be called after the

Re: AES and EVP_CIPHER question

2022-05-16 Thread Tomas Mraz
The EVP_CIPHER_CTX_set_padding(ctx, 0) must be called after the EVP_CipherInit() to have an effect. Also what is the AST_CRYPTO_AES_BLOCKSIZE value? Is it in bits (i.e, 128)? Also res should be initialized to -1 so you do not return uninitialized value on error. Tomas Mraz On Fri, 2022-05-13

Re: AES and EVP_CIPHER question

2022-05-13 Thread Philip Prindeville
Here's a simple/stupid test program and its output, running on Ubuntu 20.04 LTS: OpenSSL 1.1.1f 31 Mar 2020 EVP_CIPHER_CTX_new returns 0x5627171042a0 EVP_CipherInit returns 1 EVP_CipherUpdate returns 1, outlen = 0 buf: 'Mary had a littl' EVP_CipherFinal returns 0, finallen = 0 buf: 'Mary had a

Re: AES and EVP_CIPHER question

2022-05-13 Thread Philip Prindeville
> On May 13, 2022, at 10:55 AM, Philip Prindeville > wrote: > > > >> On May 13, 2022, at 10:34 AM, Matt Caswell wrote: >> >> >> >> On 13/05/2022 16:49, Philip Prindeville wrote: >>> Hi, >>> I'm trying to rewrite some legacy AES_* code to use EVP_CIPHER_* so it's >>> forward compatible

Re: AES and EVP_CIPHER question

2022-05-13 Thread Philip Prindeville
> On May 13, 2022, at 10:34 AM, Matt Caswell wrote: > > > > On 13/05/2022 16:49, Philip Prindeville wrote: >> Hi, >> I'm trying to rewrite some legacy AES_* code to use EVP_CIPHER_* so it's >> forward compatible into 3.x. >> My code, in a nutshell, looks like: >> static int

Re: AES and EVP_CIPHER question

2022-05-13 Thread Matt Caswell
On 13/05/2022 16:49, Philip Prindeville wrote: Hi, I'm trying to rewrite some legacy AES_* code to use EVP_CIPHER_* so it's forward compatible into 3.x. My code, in a nutshell, looks like: static int evp_cipher_aes_decrypt(const unsigned char *in, unsigned char *out, unsigned inlen,