[vlc-commits] update: use the digest algo specified in the signature

Rafaël Carré git at videolan.org
Sat May 10 12:34:19 CEST 2014


vlc | branch: master | Rafaël Carré <funman at videolan.org> | Sat May 10 12:33:08 2014 +0200| [cdd3630b71a3b5bd1355c5690fc854b661ba1f19] | committer: Rafaël Carré

update: use the digest algo specified in the signature

We already check that it is SHA1

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=cdd3630b71a3b5bd1355c5690fc854b661ba1f19
---

 src/misc/update_crypto.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/misc/update_crypto.c b/src/misc/update_crypto.c
index ae0d1be..d0d4f7f 100644
--- a/src/misc/update_crypto.c
+++ b/src/misc/update_crypto.c
@@ -654,7 +654,7 @@ static uint8_t *hash_finish( gcry_md_hd_t hd, signature_packet_t *p_sig )
 
     gcry_md_final( hd );
 
-    uint8_t *p_tmp = (uint8_t*) gcry_md_read( hd, GCRY_MD_SHA1);
+    uint8_t *p_tmp = (uint8_t*) gcry_md_read( hd, p_sig->digest_algo) ;
     uint8_t *p_hash = malloc( 20 );
     if( p_hash )
         memcpy( p_hash, p_tmp, 20 );
@@ -670,7 +670,7 @@ uint8_t *hash_sha1_from_text( const char *psz_string,
         signature_packet_t *p_sig )
 {
     gcry_md_hd_t hd;
-    if( gcry_md_open( &hd, GCRY_MD_SHA1, 0 ) )
+    if( gcry_md_open( &hd, p_sig->digest_algo, 0 ) )
         return NULL;
 
     if( p_sig->type == TEXT_SIGNATURE )
@@ -704,7 +704,7 @@ uint8_t *hash_sha1_from_text( const char *psz_string,
 uint8_t *hash_sha1_from_file( const char *psz_file, signature_packet_t *p_sig )
 {
     gcry_md_hd_t hd;
-    if( gcry_md_open( &hd, GCRY_MD_SHA1, 0 ) )
+    if( gcry_md_open( &hd, p_sig->digest_algo, 0 ) )
         return NULL;
 
     if( hash_from_binary_file( psz_file, hd ) < 0 )
@@ -733,7 +733,7 @@ uint8_t *hash_sha1_from_public_key( public_key_t *p_pkey )
     gcry_error_t error = 0;
     gcry_md_hd_t hd;
 
-    error = gcry_md_open( &hd, GCRY_MD_SHA1, 0 );
+    error = gcry_md_open( &hd, p_pkey->sig.digest_algo, 0 );
     if( error )
         return NULL;
 



More information about the vlc-commits mailing list