+ char *psz_desc = p_update->release.psz_desc;
+ while( *psz_desc )
+ {
+ size_t i_len = strcspn( psz_desc, "\r\n" );
+ if( !i_len )
+ break;
+
+ gcry_md_write( hd, psz_desc, i_len );
+ if( sign.type == TEXT_SIGNATURE )
+ gcry_md_putc( hd, '\r' );
+ gcry_md_putc( hd, '\n' );
+
+ psz_desc += i_len;
+ while( *psz_desc == '\r' || *psz_desc == '\n' )
+ psz_desc++;
+ }
+
+ if( sign.version == 3 )
+ {
+ gcry_md_putc( hd, sign.type );
+ gcry_md_write( hd, &sign.specific.v3.timestamp, 4 );
+ }
+ else if( sign.version == 4 )
+ {
+ gcry_md_putc( hd, sign.version );
+ gcry_md_putc( hd, sign.type );
+ gcry_md_putc( hd, sign.public_key_algo );
+ gcry_md_putc( hd, sign.digest_algo );
+ gcry_md_write( hd, sign.specific.v4.hashed_data_len, 2 );
+ size_t i_len = scalar_number( sign.specific.v4.hashed_data_len, 2 );
+ gcry_md_write( hd, sign.specific.v4.hashed_data, i_len );
+ gcry_md_putc( hd, 0x04 );
+ gcry_md_putc( hd, 0xFF );
+
+ i_len += 6; /* hashed data + 6 bytes header */
+
+ gcry_md_putc( hd, (i_len << 24) & 0xff);
+ gcry_md_putc( hd, (i_len << 16) &0xff );
+ gcry_md_putc( hd, (i_len << 8) & 0xff );
+ gcry_md_putc( hd, (i_len) & 0xff );
+ }
+ else
+ { /* RFC 4880 only tells about versions 3 and 4 */
+ msg_Warn( p_update->p_libvlc, "Invalid signature version %d",
+ sign.version);
+ goto error_hd;
+ }