From 42a6ac838fe5ca40f9727a2808d458e1c9a92384 Mon Sep 17 00:00:00 2001 From: fduncanh Date: Fri, 17 Dec 2021 14:25:03 -0500 Subject: [PATCH] add tests for examining audio decryption --- lib/global.h | 2 ++ lib/raop_buffer.c | 11 ++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/global.h b/lib/global.h index 7d32757..af38e24 100755 --- a/lib/global.h +++ b/lib/global.h @@ -10,6 +10,8 @@ #define OLD_PROTOCOL_AUDIO_CLIENT_LIST "AirMyPC/2.0;xxx" #define OLD_PROTOCOL_VIDEO_CLIENT_LIST "AirMyPC/2.0;xxx" +#define DECRYPTION_TEST 0 + #define MAX_HWADDR_LEN 6 #endif diff --git a/lib/raop_buffer.c b/lib/raop_buffer.c index fc0f890..8181c46 100755 --- a/lib/raop_buffer.c +++ b/lib/raop_buffer.c @@ -26,6 +26,8 @@ #include "crypto.h" #include "compat.h" #include "stream.h" +#include "global.h" +#include "utils.h" #define RAOP_BUFFER_LENGTH 32 @@ -149,6 +151,10 @@ raop_buffer_decrypt(raop_buffer_t *raop_buffer, unsigned char *data, unsigned ch } #endif + if (DECRYPTION_TEST) { + printf("%s\n", OLD_PROTOCOL_AUDIO_CLIENT_LIST); + printf("%d before %s", payload_size, utils_data_to_string(&data[12],16,16 )); + } encryptedlen = payload_size / 16*16; memset(output, 0, payload_size); // Need to be initialized internally @@ -158,7 +164,10 @@ raop_buffer_decrypt(raop_buffer_t *raop_buffer, unsigned char *data, unsigned ch memcpy(output + encryptedlen, &data[12 + encryptedlen], payload_size - encryptedlen); *outputlen = payload_size; - + if (DECRYPTION_TEST){ + if ( !(output[0] == 0x8d || output[0] == 0x8e || output[0] == 0x20)) printf("***ERROR AUDIO FRAME IS NOT AAC_ELD OR ALAC\n"); + printf("%d after %s\n", payload_size, utils_data_to_string(output,16,16 )); + } #ifdef DUMP_AUDIO // Decrypted file if (file_aac != NULL) {