[MPlayer-dev-eng] what happened to the blu-ray support

Alexander Roalter alex at roalter.it
Mon Jun 28 19:46:41 CEST 2010


On 28.06.2010 17:39, Reimar Döffinger wrote:
> On Mon, Jun 28, 2010 at 12:32:13PM +0200, Alexander Roalter wrote:
>> On 27.06.2010 21:26, Alexander Roalter wrote:
>>> On 06/27/2010 08:11 PM, Reimar Döffinger wrote:
>>>> On Sun, Jun 27, 2010 at 07:35:34PM +0200, Alexander Roalter wrote:
>>>>> Jonathan had an update to this patch posted, which I cannot get to work,
>>>>> so I'm sticking with this...
>>>>
>>>> I'd appreciate it if you could get the last one posted to work,
>>>> I can try to help debugging any issues.
>>>> IIRC the other one was fairly close to ok, whereas this one
>>>> hasn't really a chance.
>>> I saw in the older thread your notes on the updated patch, trying to
>>> integrate these, when I'm trying to get the update running.
>>>
>>> Problem with it is that in bd_stream_open of the new version where
>>> bd_get_uks(bd) gets called, where the decoding is done with
>>> av_aes_crypt, I get from the input buffer the value
>>> acb194e94f3c5d69a7d8cfa05b180b22, which then decodes to 0xbf6203fc108f44....
>>>
>>> whereas the original reads the input as
>>> acb194e94f3c5d69a7d8cfa05b180b22 and decodes to
>>> e7317ac00ee7c13f8363da07e0e42a38
>>>
>>>
>>> The old (working, with openssl) is
>>>
>>>
>>> pos=buf[0]<<24|buf[1]<<16|buf[2]<<8|(buf[3]&0xff);
>>> bd->uks.count=buf[pos]<<8|(buf[pos+1]&0xff);
>>> bd->uks.keys=malloc(sizeof(struct uk)*bd->uks.count);
>>>
>>> for(i=0;i<bd->uks.count;i++) {
>>>     int key_pos=pos+i*48+48;
>>>     if(key_pos+16<=file_size) {
>>>         memcpy( bd->uks.keys[i].enc_key,&buf[key_pos],16);
>>>         // dec unit key
>>>         AES_KEY aes_key;
>>>         AES_set_decrypt_key(bd->vuk, 128, &aes_key);
>>>         AES_decrypt(bd->uks.keys[i].enc_key, bd->uks.keys[i].dec_key,
>>> &aes_key);
>>>     }
>>> }
>>>
>>>
>>> the new, non working is
>>>
>>> pos = AV_RB32(buf);
>>> if (pos < file_size) {
>>>     bd->uks.count = AV_RB16(&buf[pos]);
>>>     bd->uks.keys = calloc(bd->uks.count,sizeof(struct uk));
>>>
>>>     a = av_malloc(av_aes_size);
>>>     av_aes_init(a, bd->vuk, 128 , 1);
>>>
>>>     for (i = 0; i < bd->uks.count; i++) {
>>>         int key_pos = pos + i * 48 + 48;
>>>         if (key_pos + 16 <= file_size) {
>>>             av_aes_crypt(a, bd->uks.keys[i].key, &buf[key_pos], 1, NULL,
>>> 1);  // decrypt unit key
>>>         }
>>>     }
>>> }
>>>
>>>
>>> pos and bd->uks.count is in both cases 128 and 1, respectively, the VUK
>>> is also identical on both.
>>>
>>>
>> Even if I enter the key C204905B20C64F997BC855A8353DF9AA and the code
>> acb194e94f3c5d69a7d8cfa05b180b22 in some randomly chose
>> online-aes-decrypter, I get the correct result:
>>
>> http://www.hanewin.net/encrypt/aes/aes-test.htm
>>
>> outputs e7317ac00ee7c13f8363da07e0e42a38
>>
>> But I don't know how to parametrize the av_aes_crypt to do what they are
>> supposed to do... from the docs I don't see anything wrong with it...
> 
> Must be something in the surrounding code, below code gives the same
> result as you say is correct:
> #include <stdio.h>
> #include "libavutil/aes.h"
> 
> int main(void)
> {
>     int i;
>     const uint8_t key[] = {0xC2, 0x04, 0x90, 0x5B, 0x20, 0xC6, 0x4F, 0x99, 0x7B, 0xC8, 0x55, 0xA8, 0x35, 0x3D, 0xF9, 0xAA};
>     const uint8_t code[] = {0xac, 0xb1, 0x94, 0xe9, 0x4f, 0x3c, 0x5d, 0x69, 0xa7, 0xd8, 0xcf, 0xa0, 0x5b, 0x18, 0x0b, 0x22};
>     uint8_t dst[16];
>     struct AVAES *a = av_malloc(av_aes_size);
>     av_aes_init(a, key, 128, 1);
>     av_aes_crypt(a, dst, code, 1, NULL, 1);
>     for (i = 0; i < 16; i++)
>         printf("%x ", dst[i]);
>     return 0;
> }
Ok, here at work with a bit artificial code I get the correct results on
both 32bit and 64 bit systems... Will have to see what's different on my
home machine...

-- 
cheers,
Alex



More information about the MPlayer-dev-eng mailing list