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
1515
1616 API changes, most recent first:
1717
18+2018-xx-xx - xxxxxxx - lavu 56.9.100 - aes_ctr.h
19+ Add method to set the 16-byte IV.
20+
1821 2018-01-xx - xxxxxxx - lavf 58.5.100 - avformat.h
1922 Explicitly make avformat_network_init() and avformat_network_deinit() optional.
2023 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
4545 a->block_offset = 0;
4646 }
4747
48+void 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+
4854 const uint8_t* av_aes_ctr_get_iv(struct AVAESCTR *a)
4955 {
5056 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
6767 void av_aes_ctr_set_random_iv(struct AVAESCTR *a);
6868
6969 /**
70− * Forcefully change the iv
70+ * Forcefully change the 8-byte iv
7171 */
7272 void av_aes_ctr_set_iv(struct AVAESCTR *a, const uint8_t* iv);
7373
74+/**
75+ * Forcefully change the "full" 16-byte iv, including the counter
76+ */
77+void av_aes_ctr_set_full_iv(struct AVAESCTR *a, const uint8_t* iv);
78+
7479 /**
7580 * Increment the top 64 bit of the iv (performed after each frame)
7681 */
libavutil/tests/aes_ctr.c+1−1
@@ -45,7 +45,7 @@ int main (void) · 44 unmodified lines
4545
4646 av_aes_ctr_set_random_iv(ae);
4747 iv = av_aes_ctr_get_iv(ae);
48− av_aes_ctr_set_iv(ad, iv);
48+ av_aes_ctr_set_full_iv(ad, iv);
4949
5050 av_aes_ctr_crypt(ae, tmp, plain, sizeof(tmp));
5151 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