[erlang-questions] crypto:block_decrypt doesn't return ivec

Max Lapshin max.lapshin@REDACTED
Fri May 9 16:48:35 CEST 2014


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,
i);
    CONSUME_REDS(env,data_bin);
    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?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20140509/1b7c3706/attachment.htm>


More information about the erlang-questions mailing list