libsrtp/libsrtp-srtp_aes_encrypt.patch
Tom Callaway dd5f0f5d88 1.5.0
2014-11-14 10:27:08 -05:00

130 lines
4.8 KiB
Diff

diff -rup a/crypto/cipher/aes.c b/crypto/cipher/aes.c
--- a/crypto/cipher/aes.c 2014-10-13 10:35:33.000000000 -0400
+++ b/crypto/cipher/aes.c 2014-10-31 09:25:20.603597823 -0400
@@ -2002,7 +2002,7 @@ aes_inv_final_round(v128_t *state, const
void
-aes_encrypt(v128_t *plaintext, const aes_expanded_key_t *exp_key) {
+srtp_aes_encrypt(v128_t *plaintext, const aes_expanded_key_t *exp_key) {
/* add in the subkey */
v128_xor_eq(plaintext, &exp_key->round[0]);
diff -rup a/crypto/cipher/aes_cbc.c b/crypto/cipher/aes_cbc.c
--- a/crypto/cipher/aes_cbc.c 2014-10-13 10:35:33.000000000 -0400
+++ b/crypto/cipher/aes_cbc.c 2014-10-31 09:25:20.604597828 -0400
@@ -192,7 +192,7 @@ aes_cbc_encrypt(aes_cbc_ctx_t *c,
debug_print(mod_aes_cbc, "inblock: %s",
v128_hex_string(&c->state));
- aes_encrypt(&c->state, &c->expanded_key);
+ srtp_aes_encrypt(&c->state, &c->expanded_key);
debug_print(mod_aes_cbc, "outblock: %s",
v128_hex_string(&c->state));
diff -rup a/crypto/cipher/aes_icm.c b/crypto/cipher/aes_icm.c
--- a/crypto/cipher/aes_icm.c 2014-10-13 10:35:33.000000000 -0400
+++ b/crypto/cipher/aes_icm.c 2014-10-31 09:25:20.604597828 -0400
@@ -260,7 +260,7 @@ aes_icm_set_octet(aes_icm_ctx_t *c,
/* fill keystream buffer, if needed */
if (tail_num) {
v128_copy(&c->keystream_buffer, &c->counter);
- aes_encrypt(&c->keystream_buffer, &c->expanded_key);
+ srtp_aes_encrypt(&c->keystream_buffer, &c->expanded_key);
c->bytes_in_buffer = sizeof(v128_t);
debug_print(mod_aes_icm, "counter: %s",
@@ -316,7 +316,7 @@ static inline void
aes_icm_advance_ismacryp(aes_icm_ctx_t *c, uint8_t forIsmacryp) {
/* fill buffer with new keystream */
v128_copy(&c->keystream_buffer, &c->counter);
- aes_encrypt(&c->keystream_buffer, &c->expanded_key);
+ srtp_aes_encrypt(&c->keystream_buffer, &c->expanded_key);
c->bytes_in_buffer = sizeof(v128_t);
debug_print(mod_aes_icm, "counter: %s",
diff -rup a/crypto/include/aes.h b/crypto/include/aes.h
--- a/crypto/include/aes.h 2014-10-13 10:35:33.000000000 -0400
+++ b/crypto/include/aes.h 2014-10-31 09:25:20.604597828 -0400
@@ -68,7 +68,7 @@ aes_expand_decryption_key(const uint8_t
aes_expanded_key_t *expanded_key);
void
-aes_encrypt(v128_t *plaintext, const aes_expanded_key_t *exp_key);
+srtp_aes_encrypt(v128_t *plaintext, const aes_expanded_key_t *exp_key);
void
aes_decrypt(v128_t *plaintext, const aes_expanded_key_t *exp_key);
diff -rup a/crypto/rng/prng.c b/crypto/rng/prng.c
--- a/crypto/rng/prng.c 2014-10-13 10:35:33.000000000 -0400
+++ b/crypto/rng/prng.c 2014-10-31 09:25:20.605597833 -0400
@@ -112,7 +112,7 @@ x917_prng_get_octet_string(uint8_t *dest
v128_copy(&buffer, &x917_prng.state);
/* apply aes to buffer */
- aes_encrypt(&buffer, &x917_prng.key);
+ srtp_aes_encrypt(&buffer, &x917_prng.key);
/* write data to output */
*dest++ = buffer.v8[0];
@@ -136,7 +136,7 @@ x917_prng_get_octet_string(uint8_t *dest
buffer.v32[0] ^= t;
/* encrypt buffer */
- aes_encrypt(&buffer, &x917_prng.key);
+ srtp_aes_encrypt(&buffer, &x917_prng.key);
/* copy buffer into state */
v128_copy(&x917_prng.state, &buffer);
@@ -154,7 +154,7 @@ x917_prng_get_octet_string(uint8_t *dest
v128_copy(&buffer, &x917_prng.state);
/* apply aes to buffer */
- aes_encrypt(&buffer, &x917_prng.key);
+ srtp_aes_encrypt(&buffer, &x917_prng.key);
/* write data to output */
for (i=0; i < tail_len; i++) {
@@ -167,7 +167,7 @@ x917_prng_get_octet_string(uint8_t *dest
buffer.v32[0] ^= t;
/* encrypt buffer */
- aes_encrypt(&buffer, &x917_prng.key);
+ srtp_aes_encrypt(&buffer, &x917_prng.key);
/* copy buffer into state */
v128_copy(&x917_prng.state, &buffer);
diff -rup a/crypto/test/aes_calc.c b/crypto/test/aes_calc.c
--- a/crypto/test/aes_calc.c 2014-10-13 10:35:33.000000000 -0400
+++ b/crypto/test/aes_calc.c 2014-10-31 09:25:20.605597833 -0400
@@ -109,7 +109,7 @@ main (int argc, char *argv[]) {
exit(1);
}
- aes_encrypt(&data, &exp_key);
+ srtp_aes_encrypt(&data, &exp_key);
/* write ciphertext to output */
if (verbose) {
diff -rup a/tables/aes_tables.c b/tables/aes_tables.c
--- a/tables/aes_tables.c 2014-10-13 10:35:33.000000000 -0400
+++ b/tables/aes_tables.c 2014-10-31 09:25:20.605597833 -0400
@@ -298,7 +298,7 @@ main(void) {
#if AES_INVERSE_TEST
/*
- * test that aes_encrypt and aes_decrypt are actually
+ * test that srtp_aes_encrypt and aes_decrypt are actually
* inverses of each other
*/
@@ -335,7 +335,7 @@ aes_test_inverse(void) {
v128_copy_octet_string(&x, plaintext);
aes_expand_encryption_key(k, expanded_key);
aes_expand_decryption_key(k, decrypt_key);
- aes_encrypt(&x, expanded_key);
+ srtp_aes_encrypt(&x, expanded_key);
aes_decrypt(&x, decrypt_key);
/* compare to expected value then report */