avutil/aes_ctr: Add method to set 16-byte IV.
Signed-off-by: Jacob Trimble <modmaker@google.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
committed by
Michael Niedermayer
parent
9b1ec24835
commit
9f07cf7c00
@ -15,6 +15,9 @@ libavutil: 2017-10-21
|
|||||||
|
|
||||||
API changes, most recent first:
|
API changes, most recent first:
|
||||||
|
|
||||||
|
2018-xx-xx - xxxxxxx - lavu 56.9.100 - aes_ctr.h
|
||||||
|
Add method to set the 16-byte IV.
|
||||||
|
|
||||||
2018-01-xx - xxxxxxx - lavf 58.5.100 - avformat.h
|
2018-01-xx - xxxxxxx - lavf 58.5.100 - avformat.h
|
||||||
Explicitly make avformat_network_init() and avformat_network_deinit() optional.
|
Explicitly make avformat_network_init() and avformat_network_deinit() optional.
|
||||||
If these are not called, network initialization and deinitialization is
|
If these are not called, network initialization and deinitialization is
|
||||||
|
@ -45,6 +45,12 @@ void av_aes_ctr_set_iv(struct AVAESCTR *a, const uint8_t* iv)
|
|||||||
a->block_offset = 0;
|
a->block_offset = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void av_aes_ctr_set_full_iv(struct AVAESCTR *a, const uint8_t* iv)
|
||||||
|
{
|
||||||
|
memcpy(a->counter, iv, sizeof(a->counter));
|
||||||
|
a->block_offset = 0;
|
||||||
|
}
|
||||||
|
|
||||||
const uint8_t* av_aes_ctr_get_iv(struct AVAESCTR *a)
|
const uint8_t* av_aes_ctr_get_iv(struct AVAESCTR *a)
|
||||||
{
|
{
|
||||||
return a->counter;
|
return a->counter;
|
||||||
|
@ -67,10 +67,15 @@ const uint8_t* av_aes_ctr_get_iv(struct AVAESCTR *a);
|
|||||||
void av_aes_ctr_set_random_iv(struct AVAESCTR *a);
|
void av_aes_ctr_set_random_iv(struct AVAESCTR *a);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Forcefully change the iv
|
* Forcefully change the 8-byte iv
|
||||||
*/
|
*/
|
||||||
void av_aes_ctr_set_iv(struct AVAESCTR *a, const uint8_t* iv);
|
void av_aes_ctr_set_iv(struct AVAESCTR *a, const uint8_t* iv);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Forcefully change the "full" 16-byte iv, including the counter
|
||||||
|
*/
|
||||||
|
void av_aes_ctr_set_full_iv(struct AVAESCTR *a, const uint8_t* iv);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Increment the top 64 bit of the iv (performed after each frame)
|
* Increment the top 64 bit of the iv (performed after each frame)
|
||||||
*/
|
*/
|
||||||
|
@ -45,7 +45,7 @@ int main (void)
|
|||||||
|
|
||||||
av_aes_ctr_set_random_iv(ae);
|
av_aes_ctr_set_random_iv(ae);
|
||||||
iv = av_aes_ctr_get_iv(ae);
|
iv = av_aes_ctr_get_iv(ae);
|
||||||
av_aes_ctr_set_iv(ad, iv);
|
av_aes_ctr_set_full_iv(ad, iv);
|
||||||
|
|
||||||
av_aes_ctr_crypt(ae, tmp, plain, sizeof(tmp));
|
av_aes_ctr_crypt(ae, tmp, plain, sizeof(tmp));
|
||||||
av_aes_ctr_crypt(ad, tmp, tmp, sizeof(tmp));
|
av_aes_ctr_crypt(ad, tmp, tmp, sizeof(tmp));
|
||||||
|
Reference in New Issue
Block a user