add tests for examining audio decryption

This commit is contained in:
fduncanh
2021-12-17 14:25:03 -05:00
parent b56ad1062d
commit 42a6ac838f
2 changed files with 12 additions and 1 deletions

View File

@@ -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

View File

@@ -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) {