History

avutil/aes_ctr: Add method to set 16-byte IV.

Jacob Trimble committed 8 years ago

Commit 9f07cf71 parent 9b1ec244 files · +16 −2Browse files

Unified · Split

4 files
  1. doc/APIchanges +3 −0
  2. libavutil/aes_ctr.c +6 −0
  3. libavutil/aes_ctr.h +6 −1
  4. libavutil/tests/aes_ctr.c +1 −1
doc/APIchanges+3−0
@@ -15,6 +15,9 @@ libavutil: 2017-10-21 · 14 unmodified lines
15 15
16API changes, most recent first:16API changes, most recent first:
17 17
182018-xx-xx - xxxxxxx - lavu 56.9.100 - aes_ctr.h
19 Add method to set the 16-byte IV.
20
182018-01-xx - xxxxxxx - lavf 58.5.100 - avformat.h212018-01-xx - xxxxxxx - lavf 58.5.100 - avformat.h
19 Explicitly make avformat_network_init() and avformat_network_deinit() optional.22 Explicitly make avformat_network_init() and avformat_network_deinit() optional.
20 If these are not called, network initialization and deinitialization is23 If these are not called, network initialization and deinitialization is
libavutil/aes_ctr.c+6−0
@@ -45,6 +45,12 @@ void av_aes_ctr_set_iv(struct AVAESCTR *a, const uint8_t* iv) · 44 unmodified lines
45 a->block_offset = 0;45 a->block_offset = 0;
46}46}
47 47
48void av_aes_ctr_set_full_iv(struct AVAESCTR *a, const uint8_t* iv)
49{
50 memcpy(a->counter, iv, sizeof(a->counter));
51 a->block_offset = 0;
52}
53
48const uint8_t* av_aes_ctr_get_iv(struct AVAESCTR *a)54const uint8_t* av_aes_ctr_get_iv(struct AVAESCTR *a)
49{55{
50 return a->counter;56 return a->counter;
libavutil/aes_ctr.h+6−1
@@ -67,10 +67,15 @@ const uint8_t* av_aes_ctr_get_iv(struct AVAESCTR *a); · 66 unmodified lines
67void av_aes_ctr_set_random_iv(struct AVAESCTR *a);67void av_aes_ctr_set_random_iv(struct AVAESCTR *a);
68 68
69/**69/**
70 * Forcefully change the iv70 * Forcefully change the 8-byte iv
71 */71 */
72void av_aes_ctr_set_iv(struct AVAESCTR *a, const uint8_t* iv);72void av_aes_ctr_set_iv(struct AVAESCTR *a, const uint8_t* iv);
73 73
74/**
75 * Forcefully change the "full" 16-byte iv, including the counter
76 */
77void av_aes_ctr_set_full_iv(struct AVAESCTR *a, const uint8_t* iv);
78
74/**79/**
75 * Increment the top 64 bit of the iv (performed after each frame)80 * Increment the top 64 bit of the iv (performed after each frame)
76 */81 */
libavutil/tests/aes_ctr.c+1−1
@@ -45,7 +45,7 @@ int main (void) · 44 unmodified lines
45 45
46 av_aes_ctr_set_random_iv(ae);46 av_aes_ctr_set_random_iv(ae);
47 iv = av_aes_ctr_get_iv(ae);47 iv = av_aes_ctr_get_iv(ae);
48 av_aes_ctr_set_iv(ad, iv);48 av_aes_ctr_set_full_iv(ad, iv);
49 49
50 av_aes_ctr_crypt(ae, tmp, plain, sizeof(tmp));50 av_aes_ctr_crypt(ae, tmp, plain, sizeof(tmp));
51 av_aes_ctr_crypt(ad, tmp, tmp, sizeof(tmp));51 av_aes_ctr_crypt(ad, tmp, tmp, sizeof(tmp));

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t