[vlc-devel] [PATCH 2/2] Add Apple AirTunes access output plugin
Michael Hanselmann
public at hansmi.ch
Wed Dec 3 01:00:27 CET 2008
2008/12/2 Rémi Denis-Courmont <rdenis at simphalempin.com>:
> On Tue, 2 Dec 2008 01:06:01 +0100, Michael Hanselmann <public at hansmi.ch>
> wrote:
>> VLC uses libgcrypt for encryption. Unfortunately, libgcrypt doesn't
>> support the OAEP standard as defined in RFC2437 and AirTunes demands
>> OAEP padding for RSA encrypted data. OAEP has been reimplemented from
>> scratch based on the specification for this plugin. Maybe these
>> functions, MGF1 and AddOaepPadding, could be moved to libvlc at a
>> later point.
>
> To gcrypt rather than to libvlc.
True, but that'll involve more work. I was already looking into it,
but since it'll take a while for users/packagers to upgrade the
library, we'll have to carry around VLC's version for a while anyway.
I changed the patch description to say "These functions, MGF1 and
AddOaepPadding, can be adopted for libgcrypt at a later time." and
will resend it for Christophe's comments.
> (...)
>> + i_gcrypt_err = gcry_md_open( &md_handle, Hash, 0 );
>> + if ( CheckForGcryptError( p_access, i_gcrypt_err ) )
>> + {
>> + i_err = VLC_EGENERIC;
>> + goto error;
>> + }
>
> You should not call gcry_md_close() if gcry_md_open() failed, I believe.
> (...)
>> +error:
>> + gcry_md_close( md_handle );
> ^^^^
gcry_md_hd_t is a typedef for a pointer. It doesn't hurt to call
gcry_md_close as md_handle will be NULL (also see below).
>> +error:
>> + gcry_sexp_release( sexp_rsa_params );
>> + gcry_sexp_release( sexp_input );
>> + gcry_sexp_release( sexp_encrypted );
>> + gcry_sexp_release( sexp_token_a );
>> + gcry_mpi_release( mpi_pubkey );
>> + gcry_mpi_release( mpi_exp );
>> + gcry_mpi_release( mpi_input );
>> + gcry_mpi_release( mpi_output );
>> +
>> + return i_err;
>> +}
>
> I wonder if gcrypt allows releasing 'NULL'?
Yes, it checks for a value evaluating to true before freeing memory.
Regards,
Michael
--
http://hansmi.ch/
More information about the vlc-devel
mailing list