Line | Branch | Exec | Source |
---|---|---|---|
1 | /* | ||
2 | * Copyright (c) 2015 Rodger Combs <rodger.combs@gmail.com> | ||
3 | * | ||
4 | * This file is part of FFmpeg. | ||
5 | * | ||
6 | * FFmpeg is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU Lesser General Public | ||
8 | * License as published by the Free Software Foundation; either | ||
9 | * version 2.1 of the License, or (at your option) any later version. | ||
10 | * | ||
11 | * FFmpeg is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
14 | * Lesser General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU Lesser General Public | ||
17 | * License along with FFmpeg; if not, write to the Free Software | ||
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
19 | */ | ||
20 | |||
21 | #include <stddef.h> | ||
22 | #include "libavutil/aes_internal.h" | ||
23 | #include "libavutil/x86/cpu.h" | ||
24 | |||
25 | void ff_aes_decrypt_10_aesni(AVAES *a, uint8_t *dst, const uint8_t *src, | ||
26 | int count, uint8_t *iv, int rounds); | ||
27 | void ff_aes_decrypt_12_aesni(AVAES *a, uint8_t *dst, const uint8_t *src, | ||
28 | int count, uint8_t *iv, int rounds); | ||
29 | void ff_aes_decrypt_14_aesni(AVAES *a, uint8_t *dst, const uint8_t *src, | ||
30 | int count, uint8_t *iv, int rounds); | ||
31 | void ff_aes_encrypt_10_aesni(AVAES *a, uint8_t *dst, const uint8_t *src, | ||
32 | int count, uint8_t *iv, int rounds); | ||
33 | void ff_aes_encrypt_12_aesni(AVAES *a, uint8_t *dst, const uint8_t *src, | ||
34 | int count, uint8_t *iv, int rounds); | ||
35 | void ff_aes_encrypt_14_aesni(AVAES *a, uint8_t *dst, const uint8_t *src, | ||
36 | int count, uint8_t *iv, int rounds); | ||
37 | |||
38 | 120 | void ff_init_aes_x86(AVAES *a, int decrypt) | |
39 | { | ||
40 | 120 | int cpu_flags = av_get_cpu_flags(); | |
41 | |||
42 |
2/2✓ Branch 0 taken 63 times.
✓ Branch 1 taken 57 times.
|
120 | if (EXTERNAL_AESNI(cpu_flags)) { |
43 |
2/2✓ Branch 0 taken 47 times.
✓ Branch 1 taken 16 times.
|
63 | if (a->rounds == 10) |
44 |
2/2✓ Branch 0 taken 6 times.
✓ Branch 1 taken 41 times.
|
47 | a->crypt = decrypt ? ff_aes_decrypt_10_aesni : ff_aes_encrypt_10_aesni; |
45 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 8 times.
|
16 | else if (a->rounds == 12) |
46 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 4 times.
|
8 | a->crypt = decrypt ? ff_aes_decrypt_12_aesni : ff_aes_encrypt_12_aesni; |
47 |
1/2✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
|
8 | else if (a->rounds == 14) |
48 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 4 times.
|
8 | a->crypt = decrypt ? ff_aes_decrypt_14_aesni : ff_aes_encrypt_14_aesni; |
49 | } | ||
50 | 120 | } | |
51 |