[vlc-devel] [PATCH] Add Apple AirTunes stream output plugin

Michael Hanselmann public at hansmi.ch
Sun Dec 14 18:49:02 CET 2008


Hello again

2008/12/13 Michael Hanselmann <public at hansmi.ch>:
> 2008/12/11 Rémi Denis-Courmont <rem at videolan.org>:
>> Le jeudi 11 décembre 2008 02:46:48 Michael Hanselmann, vous avez écrit :
>>> +static const char psz_airtunes_rsa_pubkey[] =
>> […]
>>> +    "562d412956f8989e18a6355bd81597825e0fc875343ec782117625cdbf98447b";
>>
>> Does MPI accept binary data? That would take half as much space in the binary.
>> Not a big deal though.
>
> I tried using binary data, but didn't get it to work. That was before
> I fully grasped what the actual problem was, though. Should I try
> again with binary data or can we just leave it as it is?

I managed to get it working with binary data:

--- a/modules/stream_out/airtunes.c
+++ b/modules/stream_out/airtunes.c
@@ -46,17 +46,25 @@
 #define AIRTUNES_USER_AGENT "VLC " VERSION


-static const char psz_airtunes_rsa_pubkey[] =
-    "e7d744f2a2e2788b6c1f55a08eb70544a8fa7945aa8be6c62ce5f51cbdd4dc68"
-    "42fe3d1083dd2edec1bfd4252dc02e6f398bdf0e6148ea84855e2e442da6d626"
-    "64f674a1f304929ade4f6893ef2df6e711a8c77a0d91c9d980822e50d12922af"
-    "ea40ea9f0e14c0f76938c5f3882fc0323dd9fe55155f51bb5921c201629fd733"
-    "52d5e2efaabf9ba048d7b813a2b6767f6c3ccf1eb4ce673d037b0d2ea30c5fff"
-    "eb06f8d08adde409571a9c689fef10728855dd8cfb9a8bef5c8943ef3b5faa15"
-    "dde698beddf3599603eb3e6f61372bb628f6559f599a78bf500687aa7f4976c0"
-    "562d412956f8989e18a6355bd81597825e0fc875343ec782117625cdbf98447b";
-
-static const char psz_airtunes_rsa_exp[] = "010001";
+static const char ps_airtunes_rsa_pubkey[] =
+    "\xe7\xd7\x44\xf2\xa2\xe2\x78\x8b\x6c\x1f\x55\xa0\x8e\xb7\x05\x44"
+    "\xa8\xfa\x79\x45\xaa\x8b\xe6\xc6\x2c\xe5\xf5\x1c\xbd\xd4\xdc\x68"
+    "\x42\xfe\x3d\x10\x83\xdd\x2e\xde\xc1\xbf\xd4\x25\x2d\xc0\x2e\x6f"
+    "\x39\x8b\xdf\x0e\x61\x48\xea\x84\x85\x5e\x2e\x44\x2d\xa6\xd6\x26"
+    "\x64\xf6\x74\xa1\xf3\x04\x92\x9a\xde\x4f\x68\x93\xef\x2d\xf6\xe7"
+    "\x11\xa8\xc7\x7a\x0d\x91\xc9\xd9\x80\x82\x2e\x50\xd1\x29\x22\xaf"
+    "\xea\x40\xea\x9f\x0e\x14\xc0\xf7\x69\x38\xc5\xf3\x88\x2f\xc0\x32"
+    "\x3d\xd9\xfe\x55\x15\x5f\x51\xbb\x59\x21\xc2\x01\x62\x9f\xd7\x33"
+    "\x52\xd5\xe2\xef\xaa\xbf\x9b\xa0\x48\xd7\xb8\x13\xa2\xb6\x76\x7f"
+    "\x6c\x3c\xcf\x1e\xb4\xce\x67\x3d\x03\x7b\x0d\x2e\xa3\x0c\x5f\xff"
+    "\xeb\x06\xf8\xd0\x8a\xdd\xe4\x09\x57\x1a\x9c\x68\x9f\xef\x10\x72"
+    "\x88\x55\xdd\x8c\xfb\x9a\x8b\xef\x5c\x89\x43\xef\x3b\x5f\xaa\x15"
+    "\xdd\xe6\x98\xbe\xdd\xf3\x59\x96\x03\xeb\x3e\x6f\x61\x37\x2b\xb6"
+    "\x28\xf6\x55\x9f\x59\x9a\x78\xbf\x50\x06\x87\xaa\x7f\x49\x76\xc0"
+    "\x56\x2d\x41\x29\x56\xf8\x98\x9e\x18\xa6\x35\x5b\xd8\x15\x97\x82"
+    "\x5e\x0f\xc8\x75\x34\x3e\xc7\x82\x11\x76\x25\xcd\xbf\x98\x44\x7b";
+
+static const char ps_airtunes_rsa_exp[] = "\x01\x00\x01";

 static const char psz_delim_space[] = " ";
 static const char psz_delim_colon[] = ":";
@@ -429,8 +437,9 @@ static int EncryptAesKeyBase64( vlc_object_t
*p_this, char **result )
         goto error;

     /* Read public key */
-    i_gcrypt_err = gcry_mpi_scan( &mpi_pubkey, GCRYMPI_FMT_HEX,
-                                  psz_airtunes_rsa_pubkey, 0, NULL );
+    i_gcrypt_err = gcry_mpi_scan( &mpi_pubkey, GCRYMPI_FMT_USG,
+                                  ps_airtunes_rsa_pubkey,
+                                  sizeof( ps_airtunes_rsa_pubkey ) - 1, NULL );
     if ( CheckForGcryptError( p_stream, i_gcrypt_err ) )
     {
         i_err = VLC_EGENERIC;
@@ -438,9 +447,9 @@ static int EncryptAesKeyBase64( vlc_object_t
*p_this, char **result )
     }

     /* Read exponent */
-    i_gcrypt_err = gcry_mpi_scan( &mpi_exp, GCRYMPI_FMT_HEX,
-                                  psz_airtunes_rsa_exp, 0,
-                                  NULL );
+    i_gcrypt_err = gcry_mpi_scan( &mpi_exp, GCRYMPI_FMT_USG,
+                                  ps_airtunes_rsa_exp,
+                                  sizeof( ps_airtunes_rsa_exp ) - 1, NULL );
     if ( CheckForGcryptError( p_stream, i_gcrypt_err ) )
     {
         i_err = VLC_EGENERIC;


And another bug was fixed in the process:

--- a/modules/stream_out/airtunes.c
+++ b/modules/stream_out/airtunes.c
@@ -961,7 +970,7 @@ static int SendSetup( vlc_object_t *p_this )
         if ( strcmp( psz_value, "analog" ) == 0 )
             p_sys->i_jack_type = JACK_TYPE_ANALOG;

-        else if ( strcmp( psz_value, "analog" ) == 0 )
+        else if ( strcmp( psz_value, "digital" ) == 0 )
             p_sys->i_jack_type = JACK_TYPE_DIGITAL;

         break;

Regards,
Michael

-- 
http://hansmi.ch/



More information about the vlc-devel mailing list