Index: srtp/crypto/ae_xfm/xfm.c |
diff --git a/srtp/crypto/ae_xfm/xfm.c b/srtp/crypto/ae_xfm/xfm.c |
index c3c08d9c7be4b781b56e4b1a647a768e5c0aef4b..997ccbc28224b34837ebd3fca49ce9ce27a7480b 100644 |
--- a/srtp/crypto/ae_xfm/xfm.c |
+++ b/srtp/crypto/ae_xfm/xfm.c |
@@ -6,41 +6,6 @@ |
* David A. McGrew |
* Cisco Systems, Inc. |
*/ |
-/* |
- * |
- * Copyright (c) 2001-2006, Cisco Systems, Inc. |
- * All rights reserved. |
- * |
- * Redistribution and use in source and binary forms, with or without |
- * modification, are permitted provided that the following conditions |
- * are met: |
- * |
- * Redistributions of source code must retain the above copyright |
- * notice, this list of conditions and the following disclaimer. |
- * |
- * Redistributions in binary form must reproduce the above |
- * copyright notice, this list of conditions and the following |
- * disclaimer in the documentation and/or other materials provided |
- * with the distribution. |
- * |
- * Neither the name of the Cisco Systems, Inc. nor the names of its |
- * contributors may be used to endorse or promote products derived |
- * from this software without specific prior written permission. |
- * |
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
- * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, |
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, |
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
- * OF THE POSSIBILITY OF SUCH DAMAGE. |
- * |
- */ |
#include "cryptoalg.h" |
#include "aes_cbc.h" |
@@ -212,7 +177,7 @@ aes_128_cbc_hmac_sha1_96_inv(void *key, |
#define ENC 1 |
-#define DEBUG 0 |
+#define DEBUG_PRINT 0 |
err_status_t |
aes_128_cbc_hmac_sha1_96_enc(void *key, |
@@ -243,7 +208,7 @@ aes_128_cbc_hmac_sha1_96_enc(void *key, |
} else { |
-#if DEBUG |
+#if DEBUG_PRINT |
printf("ENC using key %s\n", octet_string_hex_string(key, KEY_LEN)); |
#endif |
@@ -271,7 +236,7 @@ aes_128_cbc_hmac_sha1_96_enc(void *key, |
status = aes_cbc_set_iv(&aes_ctx, iv); |
if (status) return status; |
-#if DEBUG |
+#if DEBUG_PRINT |
printf("plaintext len: %d\n", *opaque_len); |
printf("iv: %s\n", octet_string_hex_string(iv, IV_LEN)); |
printf("plaintext: %s\n", octet_string_hex_string(opaque, *opaque_len)); |
@@ -283,7 +248,7 @@ aes_128_cbc_hmac_sha1_96_enc(void *key, |
if (status) return status; |
#endif |
-#if DEBUG |
+#if DEBUG_PRINT |
printf("ciphertext len: %d\n", *opaque_len); |
printf("ciphertext: %s\n", octet_string_hex_string(opaque, *opaque_len)); |
#endif |
@@ -301,7 +266,7 @@ aes_128_cbc_hmac_sha1_96_enc(void *key, |
status = hmac_update(&hmac_ctx, clear, clear_len); |
if (status) return status; |
-#if DEBUG |
+#if DEBUG_PRINT |
printf("hmac input: %s\n", |
octet_string_hex_string(clear, clear_len)); |
#endif |
@@ -309,14 +274,14 @@ aes_128_cbc_hmac_sha1_96_enc(void *key, |
auth_tag += *opaque_len; |
status = hmac_compute(&hmac_ctx, opaque, *opaque_len, TAG_LEN, auth_tag); |
if (status) return status; |
-#if DEBUG |
+#if DEBUG_PRINT |
printf("hmac input: %s\n", |
octet_string_hex_string(opaque, *opaque_len)); |
#endif |
/* bump up the opaque_len to reflect the authentication tag */ |
*opaque_len += TAG_LEN; |
-#if DEBUG |
+#if DEBUG_PRINT |
printf("prot data len: %d\n", *opaque_len); |
printf("prot data: %s\n", octet_string_hex_string(opaque, *opaque_len)); |
#endif |
@@ -356,7 +321,7 @@ aes_128_cbc_hmac_sha1_96_dec(void *key, |
return err_status_fail; |
} else { |
-#if DEBUG |
+#if DEBUG_PRINT |
printf("DEC using key %s\n", octet_string_hex_string(key, KEY_LEN)); |
#endif |
@@ -371,7 +336,7 @@ aes_128_cbc_hmac_sha1_96_dec(void *key, |
status = hmac_compute(&hmac_ctx, "MAC", 3, MAC_KEY_LEN, mac_key); |
if (status) return status; |
-#if DEBUG |
+#if DEBUG_PRINT |
printf("prot data len: %d\n", *opaque_len); |
printf("prot data: %s\n", octet_string_hex_string(opaque, *opaque_len)); |
#endif |
@@ -382,7 +347,7 @@ aes_128_cbc_hmac_sha1_96_dec(void *key, |
*/ |
ciphertext_len = *opaque_len - TAG_LEN; |
-#if DEBUG |
+#if DEBUG_PRINT |
printf("ciphertext len: %d\n", ciphertext_len); |
#endif |
/* verify the authentication tag */ |
@@ -400,7 +365,7 @@ aes_128_cbc_hmac_sha1_96_dec(void *key, |
status = hmac_update(&hmac_ctx, clear, clear_len); |
if (status) return status; |
-#if DEBUG |
+#if DEBUG_PRINT |
printf("hmac input: %s\n", |
octet_string_hex_string(clear, clear_len)); |
#endif |
@@ -408,7 +373,7 @@ aes_128_cbc_hmac_sha1_96_dec(void *key, |
status = hmac_compute(&hmac_ctx, opaque, ciphertext_len, TAG_LEN, tmp_tag); |
if (status) return status; |
-#if DEBUG |
+#if DEBUG_PRINT |
printf("hmac input: %s\n", |
octet_string_hex_string(opaque, ciphertext_len)); |
#endif |
@@ -419,7 +384,7 @@ aes_128_cbc_hmac_sha1_96_dec(void *key, |
*/ |
auth_tag = (unsigned char *)opaque; |
auth_tag += ciphertext_len; |
-#if DEBUG |
+#if DEBUG_PRINT |
printf("auth_tag: %s\n", octet_string_hex_string(auth_tag, TAG_LEN)); |
printf("tmp_tag: %s\n", octet_string_hex_string(tmp_tag, TAG_LEN)); |
#endif |
@@ -437,7 +402,7 @@ aes_128_cbc_hmac_sha1_96_dec(void *key, |
status = aes_cbc_set_iv(&aes_ctx, iv); |
if (status) return status; |
-#if DEBUG |
+#if DEBUG_PRINT |
printf("ciphertext: %s\n", octet_string_hex_string(opaque, *opaque_len)); |
printf("iv: %s\n", octet_string_hex_string(iv, IV_LEN)); |
#endif |
@@ -447,7 +412,7 @@ aes_128_cbc_hmac_sha1_96_dec(void *key, |
if (status) return status; |
#endif |
-#if DEBUG |
+#if DEBUG_PRINT |
printf("plaintext len: %d\n", ciphertext_len); |
printf("plaintext: %s\n", |
octet_string_hex_string(opaque, ciphertext_len)); |
@@ -499,14 +464,14 @@ null_enc(void *key, |
} else { |
-#if DEBUG |
+#if DEBUG_PRINT |
printf("NULL ENC using key %s\n", octet_string_hex_string(key, KEY_LEN)); |
printf("NULL_TAG_LEN: %d\n", NULL_TAG_LEN); |
printf("plaintext len: %d\n", *opaque_len); |
#endif |
for (i=0; i < IV_LEN; i++) |
init_vec[i] = i + (i * 16); |
-#if DEBUG |
+#if DEBUG_PRINT |
printf("iv: %s\n", |
octet_string_hex_string(iv, IV_LEN)); |
printf("plaintext: %s\n", |
@@ -517,7 +482,7 @@ null_enc(void *key, |
for (i=0; i < NULL_TAG_LEN; i++) |
auth_tag[i] = i + (i * 16); |
*opaque_len += NULL_TAG_LEN; |
-#if DEBUG |
+#if DEBUG_PRINT |
printf("protected data len: %d\n", *opaque_len); |
printf("protected data: %s\n", |
octet_string_hex_string(opaque, *opaque_len)); |
@@ -552,7 +517,7 @@ null_dec(void *key, |
} else { |
-#if DEBUG |
+#if DEBUG_PRINT |
printf("NULL DEC using key %s\n", octet_string_hex_string(key, KEY_LEN)); |
printf("protected data len: %d\n", *opaque_len); |
@@ -561,11 +526,11 @@ null_dec(void *key, |
#endif |
auth_tag = opaque; |
auth_tag += (*opaque_len - NULL_TAG_LEN); |
-#if DEBUG |
+#if DEBUG_PRINT |
printf("iv: %s\n", octet_string_hex_string(iv, IV_LEN)); |
#endif |
*opaque_len -= NULL_TAG_LEN; |
-#if DEBUG |
+#if DEBUG_PRINT |
printf("plaintext len: %d\n", *opaque_len); |
printf("plaintext: %s\n", |
octet_string_hex_string(opaque, *opaque_len)); |