summaryrefslogtreecommitdiff
path: root/src/input/libreal/real.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/input/libreal/real.c')
-rw-r--r--src/input/libreal/real.c106
1 files changed, 53 insertions, 53 deletions
diff --git a/src/input/libreal/real.c b/src/input/libreal/real.c
index dcb90bcd0..9b72c7e57 100644
--- a/src/input/libreal/real.c
+++ b/src/input/libreal/real.c
@@ -55,20 +55,20 @@ static const unsigned char xor_table[] = {
static void hash(char *field, char *param) {
uint32_t a, b, c, d;
-
+
/* fill variables */
a = _X_LE_32(field);
b = _X_LE_32(field+4);
c = _X_LE_32(field+8);
d = _X_LE_32(field+12);
-
+
lprintf("hash input: %x %x %x %x\n", a, b, c, d);
lprintf("hash parameter:\n");
#ifdef LOG
xine_hexdump(param, 64);
#endif
-
+
a = ((b & c) | (~b & d)) + _X_LE_32((param+0x00)) + a - 0x28955B88;
a = ((a << 0x07) | (a >> 0x19)) + b;
d = ((a & b) | (~a & c)) + _X_LE_32((param+0x04)) + d - 0x173848AA;
@@ -101,7 +101,7 @@ static void hash(char *field, char *param) {
c = ((c << 0x11) | (c >> 0x0f)) + d;
b = ((c & d) | (~c & a)) + _X_LE_32((param+0x3c)) + b + 0x49B40821;
b = ((b << 0x16) | (b >> 0x0a)) + c;
-
+
a = ((b & d) | (~d & c)) + _X_LE_32((param+0x04)) + a - 0x09E1DA9E;
a = ((a << 0x05) | (a >> 0x1b)) + b;
d = ((a & c) | (~c & b)) + _X_LE_32((param+0x18)) + d - 0x3FBF4CC0;
@@ -134,7 +134,7 @@ static void hash(char *field, char *param) {
c = ((c << 0x0e) | (c >> 0x12)) + d;
b = ((c & a) | (~a & d)) + _X_LE_32((param+0x30)) + b - 0x72D5B376;
b = ((b << 0x14) | (b >> 0x0c)) + c;
-
+
a = (b ^ c ^ d) + _X_LE_32((param+0x14)) + a - 0x0005C6BE;
a = ((a << 0x04) | (a >> 0x1c)) + b;
d = (a ^ b ^ c) + _X_LE_32((param+0x20)) + d - 0x788E097F;
@@ -167,42 +167,42 @@ static void hash(char *field, char *param) {
c = ((c << 0x10) | (c >> 0x10)) + d;
b = (c ^ d ^ a) + _X_LE_32((param+0x08)) + b - 0x3B53A99B;
b = ((b << 0x17) | (b >> 0x09)) + c;
-
+
a = ((~d | b) ^ c) + _X_LE_32((param+0x00)) + a - 0x0BD6DDBC;
- a = ((a << 0x06) | (a >> 0x1a)) + b;
+ a = ((a << 0x06) | (a >> 0x1a)) + b;
d = ((~c | a) ^ b) + _X_LE_32((param+0x1c)) + d + 0x432AFF97;
- d = ((d << 0x0a) | (d >> 0x16)) + a;
+ d = ((d << 0x0a) | (d >> 0x16)) + a;
c = ((~b | d) ^ a) + _X_LE_32((param+0x38)) + c - 0x546BDC59;
- c = ((c << 0x0f) | (c >> 0x11)) + d;
+ c = ((c << 0x0f) | (c >> 0x11)) + d;
b = ((~a | c) ^ d) + _X_LE_32((param+0x14)) + b - 0x036C5FC7;
- b = ((b << 0x15) | (b >> 0x0b)) + c;
+ b = ((b << 0x15) | (b >> 0x0b)) + c;
a = ((~d | b) ^ c) + _X_LE_32((param+0x30)) + a + 0x655B59C3;
- a = ((a << 0x06) | (a >> 0x1a)) + b;
+ a = ((a << 0x06) | (a >> 0x1a)) + b;
d = ((~c | a) ^ b) + _X_LE_32((param+0x0C)) + d - 0x70F3336E;
- d = ((d << 0x0a) | (d >> 0x16)) + a;
+ d = ((d << 0x0a) | (d >> 0x16)) + a;
c = ((~b | d) ^ a) + _X_LE_32((param+0x28)) + c - 0x00100B83;
- c = ((c << 0x0f) | (c >> 0x11)) + d;
+ c = ((c << 0x0f) | (c >> 0x11)) + d;
b = ((~a | c) ^ d) + _X_LE_32((param+0x04)) + b - 0x7A7BA22F;
- b = ((b << 0x15) | (b >> 0x0b)) + c;
+ b = ((b << 0x15) | (b >> 0x0b)) + c;
a = ((~d | b) ^ c) + _X_LE_32((param+0x20)) + a + 0x6FA87E4F;
- a = ((a << 0x06) | (a >> 0x1a)) + b;
+ a = ((a << 0x06) | (a >> 0x1a)) + b;
d = ((~c | a) ^ b) + _X_LE_32((param+0x3c)) + d - 0x01D31920;
- d = ((d << 0x0a) | (d >> 0x16)) + a;
+ d = ((d << 0x0a) | (d >> 0x16)) + a;
c = ((~b | d) ^ a) + _X_LE_32((param+0x18)) + c - 0x5CFEBCEC;
- c = ((c << 0x0f) | (c >> 0x11)) + d;
+ c = ((c << 0x0f) | (c >> 0x11)) + d;
b = ((~a | c) ^ d) + _X_LE_32((param+0x34)) + b + 0x4E0811A1;
- b = ((b << 0x15) | (b >> 0x0b)) + c;
+ b = ((b << 0x15) | (b >> 0x0b)) + c;
a = ((~d | b) ^ c) + _X_LE_32((param+0x10)) + a - 0x08AC817E;
- a = ((a << 0x06) | (a >> 0x1a)) + b;
+ a = ((a << 0x06) | (a >> 0x1a)) + b;
d = ((~c | a) ^ b) + _X_LE_32((param+0x2c)) + d - 0x42C50DCB;
- d = ((d << 0x0a) | (d >> 0x16)) + a;
+ d = ((d << 0x0a) | (d >> 0x16)) + a;
c = ((~b | d) ^ a) + _X_LE_32((param+0x08)) + c + 0x2AD7D2BB;
- c = ((c << 0x0f) | (c >> 0x11)) + d;
+ c = ((c << 0x0f) | (c >> 0x11)) + d;
b = ((~a | c) ^ d) + _X_LE_32((param+0x24)) + b - 0x14792C6F;
- b = ((b << 0x15) | (b >> 0x0b)) + c;
+ b = ((b << 0x15) | (b >> 0x0b)) + c;
lprintf("hash output: %x %x %x %x\n", a, b, c, d);
-
+
a += _X_LE_32(field);
b += _X_LE_32(field+4);
c += _X_LE_32(field+8);
@@ -218,15 +218,15 @@ static void call_hash (char *key, char *challenge, unsigned int len) {
char *ptr1, *ptr2;
uint32_t a, b, c, d, tmp;
-
+
ptr1=(key+16);
ptr2=(key+20);
-
+
a = _X_LE_32(ptr1);
b = (a >> 3) & 0x3f;
a += len * 8;
_X_LE_32C(ptr1, a);
-
+
if (a < (len << 3))
{
lprintf("not verified: (len << 3) > a true\n");
@@ -236,7 +236,7 @@ static void call_hash (char *key, char *challenge, unsigned int len) {
tmp = _X_LE_32(ptr2) + (len >> 0x1d);
_X_LE_32C(ptr2, tmp);
a = 64 - b;
- c = 0;
+ c = 0;
if (a <= len)
{
@@ -244,7 +244,7 @@ static void call_hash (char *key, char *challenge, unsigned int len) {
hash(key, key+24);
c = a;
d = c + 0x3f;
-
+
while ( d < len ) {
lprintf("not verified: while ( d < len )\n");
hash(key, challenge+d-0x3f);
@@ -253,7 +253,7 @@ static void call_hash (char *key, char *challenge, unsigned int len) {
}
b = 0;
}
-
+
memcpy(key+b+24, challenge+c, len-c);
}
@@ -265,11 +265,11 @@ static void calc_response (char *result, char *field) {
memset (buf1, 0, 64);
*buf1 = 128;
-
+
memcpy (buf2, field+16, 8);
-
+
i = ( _X_LE_32((buf2)) >> 3 ) & 0x3f;
-
+
if (i < 56) {
i = 56 - i;
} else {
@@ -286,7 +286,7 @@ static void calc_response (char *result, char *field) {
static void calc_response_string (char *result, char *challenge) {
-
+
char field[128] = {
0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF,
0xFE, 0xDC, 0xBA, 0x98, 0x76, 0x54, 0x32, 0x10,
@@ -295,15 +295,15 @@ static void calc_response_string (char *result, char *challenge) {
};
char zres[20];
int i;
-
+
/* calculate response */
call_hash(field, challenge, 64);
calc_response(zres,field);
-
+
/* convert zres to ascii string */
for (i=0; i<16; i++ ) {
char a, b;
-
+
a = (zres[i] >> 4) & 15;
b = zres[i] & 15;
@@ -342,11 +342,11 @@ void real_calc_response_and_checksum (char *response, char *chksum, char *challe
ch_len=32;
}
if ( ch_len > 56 ) ch_len=56;
-
+
/* copy challenge to buf */
memcpy(ptr, challenge, ch_len);
}
-
+
/* xor challenge bytewise with xor_table */
for (i=0; i<XOR_TABLE_LEN; i++)
ptr[i] = ptr[i] ^ xor_table[i];
@@ -372,7 +372,7 @@ static int select_mlti_data(const char *mlti_chunk, int mlti_size, int selection
int numrules, codec, size;
int i;
-
+
/* MLTI chunk should begin with MLTI */
if ((mlti_chunk[0] != 'M')
@@ -410,13 +410,13 @@ static int select_mlti_data(const char *mlti_chunk, int mlti_size, int selection
}
mlti_chunk+=2;
-
+
/* now seek to selected codec */
for (i=0; i<codec; i++) {
size=_X_BE_32(mlti_chunk);
mlti_chunk+=size+4;
}
-
+
size=_X_BE_32(mlti_chunk);
#ifdef LOG
@@ -441,14 +441,14 @@ rmff_header_t *real_parse_sdp(char *data, char **stream_rules, uint32_t bandwidt
int max_packet_size=0;
int avg_packet_size=0;
int duration=0;
-
+
if (!data) return NULL;
desc=sdpplin_parse(data);
if (!desc) return NULL;
-
+
buf=xine_buffer_init(2048);
header = calloc(1, sizeof(rmff_header_t));
@@ -484,7 +484,7 @@ rmff_header_t *real_parse_sdp(char *data, char **stream_rules, uint32_t bandwidt
}
else
len=select_mlti_data(desc->stream[i]->mlti_data, desc->stream[i]->mlti_data_size, rulematches[0], &buf);
-
+
header->streams[i]=rmff_new_mdpr(
desc->stream[i]->stream_id,
desc->stream[i]->max_bit_rate,
@@ -508,7 +508,7 @@ rmff_header_t *real_parse_sdp(char *data, char **stream_rules, uint32_t bandwidt
else
avg_packet_size=desc->stream[i]->avg_packet_size;
}
-
+
if (*stream_rules && strlen(*stream_rules) && (*stream_rules)[strlen(*stream_rules)-1] == ',')
(*stream_rules)[strlen(*stream_rules)-1]=0; /* delete last ',' in stream_rules */
@@ -577,12 +577,12 @@ int real_get_rdt_chunk(rtsp_t *rtsp_session, unsigned char **buffer) {
n=rtsp_read_data(rtsp_session, header, 6);
if (n<6) return 0;
ts=_X_BE_32(header);
-
- lprintf("ts: %u size: %u, flags: 0x%02x, unknown values: %u 0x%02x 0x%02x\n",
+
+ lprintf("ts: %u size: %u, flags: 0x%02x, unknown values: %u 0x%02x 0x%02x\n",
ts, size, flags1, unknown1, header[4], header[5]);
size+=2;
-
+
ph.object_version=0;
ph.length=size;
ph.stream_number=(flags1>>1)&1;
@@ -593,7 +593,7 @@ int real_get_rdt_chunk(rtsp_t *rtsp_session, unsigned char **buffer) {
rmff_dump_pheader(&ph, *buffer);
size-=12;
n=rtsp_read_data(rtsp_session, (*buffer)+12, size);
-
+
return (n <= 0) ? 0 : n+12;
}
@@ -612,11 +612,11 @@ rmff_header_t *real_setup_and_get_header(rtsp_t *rtsp_session, uint32_t bandwid
char *mrl=rtsp_get_mrl(rtsp_session);
unsigned int size;
int status;
-
+
/* get challenge */
challenge1=strdup(rtsp_search_answers(rtsp_session,"RealChallenge1"));
lprintf("Challenge1: %s\n", challenge1);
-
+
/* request stream description */
rtsp_schedule_field(rtsp_session, "Accept: application/sdp");
sprintf(buf, "Bandwidth: %u", bandwidth);
@@ -658,7 +658,7 @@ rmff_header_t *real_setup_and_get_header(rtsp_t *rtsp_session, uint32_t bandwid
lprintf("real: got no ETag!\n");
else
session_id=strdup(rtsp_search_answers(rtsp_session,"ETag"));
-
+
lprintf("Stream description size: %i\n", size);
description = malloc(size+1);
@@ -682,7 +682,7 @@ rmff_header_t *real_setup_and_get_header(rtsp_t *rtsp_session, uint32_t bandwid
lprintf("Title: %s\nCopyright: %s\nAuthor: %s\nStreams: %i\n",
h->cont->title, h->cont->copyright, h->cont->author, h->prop->num_streams);
-
+
/* setup our streams */
real_calc_response_and_checksum (challenge2, checksum, challenge1);
xine_buffer_ensure_size(buf, strlen(challenge2) + strlen(checksum) + 32);