[vlc-devel] [PATCH] dcp: read encrypted DCPs

Simona-Marinela P. simona.marinela.prodea at gmail.com
Tue Apr 1 15:22:29 CEST 2014


Hi, TypX!
Thank you for the comments!

>
> >      /* video frame */
> > +
> > +    /* initialize AES context, if reel is encrypted */
> > +    if( p_sys->p_dcp->video_reels[p_sys->i_video_reel].p_key ) {
> > +        p_video_aes_ctx = new (nothrow) AESDecContext;
> Isn't it possible to just store your AESDecContext in the p_sys and only
> call p_video_aes_ctx->InitKey() when needed? It would avoid to
> allocate/free at each iteration.
>
Well, I tried doing that, in more than one way, but everytime I separated
the InitKey of the ReadFrame, I got un ugly seg fault.
I know this is less probably to be a bug in the asdcplib, still, I wrote to
the authors. Got no answer.
I will retry separating them (maybe I did smth wrong), and if the problem
persists, I will spam their emails until they answer me...
Up until then, this version is functional enough... right?



> > +
> > +    // read first node and check if it is a KDM
> > +    // TODO is this always the name of the tag?
> > +    if( ! ( ( XML_READER_STARTELEM == ReadNextNode( this->p_xmlReader,
> node ) ) && ( node == s_root_node ) ) )
> > +    {
> > +        msg_Err( this->p_demux, "not a valid XML KDM" );
> > +        goto error;
> > +    }
> > +
> > +    while( ( type = ReadNextNode( this->p_xmlReader, node ) ) > 0 )
> > +        if( type == XML_READER_STARTELEM && node ==
> "AuthenticatedPrivate" )
> > +        {
> > +            _p_key_list = new (nothrow) AESKeyList;
> > +            if( unlikely( _p_key_list == NULL ) )
> > +            {
> > +                msg_Err( p_demux, "could not alloc memory" );
> Avoid traces when you have memory allocation issues.
> > +                goto error;
> > +            }
> > +            p_dcp->p_key_list = _p_key_list;
> I assume that this node can happen only once (or it will leak).
>
Yes, AuthenticatedPrivate appears only once in any KDM. Anyway, I break
after finding it (see below).

> > +            if( this->ParsePrivate( node, type ) )
> > +                goto error;
> > +
> > +            /* keys found so break */
> > +            break;
> > +        }
> > +
>



> > +
> > +    /* get private key file path */
> > +    if( ! ( psz_config_dir = config_GetUserDir( VLC_CONFIG_DIR ) ) )
> config dir? looks tedious

What do you mean?
We need a place were to keep the private key. In current Digital Cinema it
is well hidden in the projector. In our case it should be well hidden
somewhere in the computer. We don't know exactly how it would be the best
to do that for now, but for the beginning we thought of this config dir of
VLC.


> > +
> > +    /* extract the AES key UUID */
> > +    if( ( this->s_key_id = createUUID( strndup( ( const char*
> )psz_plain_text + pos, 16 ) ) ).empty() )
> why duplicating the string and freeing it in createUUID?
>
The createUUID function came after the strndup, didn't notice the overhead.
Thanks.


> >
> >      vector<PKL *> pkls;
> >      AssetList *p_asset_list;
> > +    AESKeyList *p_key_list;
> why storing list pointers instead of lists?
>
good question. BuxiNess must know, I just followed the model :D. I'll ask
and modify accordingly.

Thanks!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20140401/5659b830/attachment.html>


More information about the vlc-devel mailing list