[erlang-questions] crypto:block_decrypt doesn't return ivec
Thu Jun 5 17:15:52 CEST 2014
On 05/09/2014 04:48 PM, Max Lapshin wrote:
> I'm implementing Apple HLS SAMPLE-AES decryption and according to their
> spec, it is required to decrypt different blocks independently.
> But specs are written for fun, so it is required to take ivec from decrypt
> process and use it in next decrypt.
> crypto:block_decrypt(aes_cbc128,....) returns only decrypted text and
> looses ivec:
> ret_ptr = enif_make_new_binary(env, data_bin.size, &ret);
> memcpy(ivec, ivec_bin.data, 16); /* writable copy */
> AES_cbc_encrypt(data_bin.data, ret_ptr, data_bin.size, &aes_key, ivec,
> return ret;
> modified ivec is lost. So I cannot reuse it and I need to cut all parts for
> decrypting, glue them together and then split back.
> Why modified ivec is ignored? Is it possible to modify api in some way that
> it would be possible to fix it and return ivec also?
There is an api for this that could be amended with more cipher modes:
More information about the erlang-questions