Changeset 48c2ac8c879a83c4f8737b978ca9c3232bb2e70d

Show
Ignore:
Timestamp:
14/12/07 18:53:27 (10 months ago)
Author:
Rafaël Carré <funman@videolan.org>
git-committer:
Rafaël Carré <funman@videolan.org> 1197654807 +0000
git-parent:

[2f06355e0303965a82189b1d9b0aedc4ef9aa9fc]

git-author:
Rafaël Carré <funman@videolan.org> 1197654807 +0000
Message:

Disable update checking per default, re-enable with --enable-update-check
Add OpenPGP code, still unused as there is no download of binaries at the moment

We will need to define (and write) the files (and their location) we will use in the update system:

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • configure.ac

    r1f94c93 r48c2ac8  
    55905590AM_CONDITIONAL([HAVE_LIBGCRYPT], [test "${have_libgcrypt}" = "yes"]) 
    55915591 
     5592dnl 
     5593dnl update checking system 
     5594dnl 
     5595AC_ARG_ENABLE(update-check, 
     5596  [  --enable-update-check   update checking system (default disabled)]) 
     5597if test "${enable_update_check}" = "yes" 
     5598then 
     5599  if test "${have_libgcrypt}" != "yes" 
     5600  then 
     5601    AC_MSG_ERROR([libgcrypt is required for update checking system]) 
     5602  fi 
     5603  VLC_ADD_LIBS([libvlc], [-lgcrypt]) 
     5604  AC_DEFINE([UPDATE_CHECK], [1], [Define if you want to use the VLC update mechanism]) 
     5605fi 
    55925606 
    55935607dnl 
  • doc/release-howto.txt

    raaac24c r48c2ac8  
    1616     · update the milestones info on https://trac.videolan.org/vlc 
    1717   - Add a note about the matching contrib package in INSTALL.win32 
     18   - Make sure that the gpg key embedded in include/vlc_update.h is the last one 
    1819 
    1920 * Commit 
     
    3334 * BeOS Packages 
    3435    Information on building: http://developers.videolan.org/vlc/beos-compile.html 
     36    Configure with --enable-update-check 
    3537    Build in the "buildbeos" chroot on altair. 
    3638    # add the .zip files to /opt/ftp/pub/videolan/testing/vlc-X.X.X/beos/ 
     39   generate md5 hashes and gpg signature of these files 
    3740 
    3841 * Win32 Packages 
    39     make the packages using the nightly builds configure/options/... 
     42    make the packages using the nightly builds configure/options/... , don't forget --enable-update-check 
    4043    don't forget to test the installer and uninstaller (the first 0.8.4 uninstaller was broken ... 
    4144    kind of suxxs) 
     
    4447 
    4548 * OS X packages 
    46     At the moment, only FK can do them (so they can be compatible with OS X 10.2) 
    47     Later: on the G5 
     49   configure with --enable-update-check 
    4850   generate md5 hashes and gpg signature of these files 
    4951 
  • include/vlc_update.h

    r09b9702 r48c2ac8  
    22 * vlc_update.h: VLC update and plugins download 
    33 ***************************************************************************** 
    4  * Copyright (C) 2005 the VideoLAN team 
     4 * Copyright © 2005-2007 the VideoLAN team 
    55 * $Id$ 
    66 * 
    77 * Authors: Antoine Cellerier <dionoea -at- videolan -dot- org> 
     8 *          Rafaël Carré <funman@videolanorg> 
    89 * 
    910 * This program is free software; you can redistribute it and/or modify 
     
    2627#endif 
    2728 
     29#ifdef UPDATE_CHECK 
     30 
    2831#ifndef _VLC_UPDATE_H 
    2932#define _VLC_UPDATE_H 
     
    3134#include <vlc/vlc.h> 
    3235 
     36#include <vlc_stream.h>     /* key & signature downloading */ 
     37#include <vlc_strings.h>    /* b64 decoding */ 
     38#include <vlc_charset.h>    /* utf8_fopen() */ 
     39#include <gcrypt.h>         /* cryptography and digest algorithms */ 
     40 
    3341/** 
    3442 * \defgroup update Update 
     
    3644 * @{ 
    3745 */ 
     46 
     47enum    /* Public key algorithms */ 
     48{ 
     49    /* we will only use DSA public keys */ 
     50    PUBLIC_KEY_ALGO_DSA = 0x11 
     51}; 
     52 
     53enum    /* Digest algorithms */ 
     54{ 
     55    /* and DSA use SHA-1 digest */ 
     56    DIGEST_ALGO_SHA1    = 0x02 
     57}; 
     58 
     59enum    /* Packet types */ 
     60{ 
     61    SIGNATURE_PACKET    = 0x02, 
     62    PUBLIC_KEY_PACKET   = 0x06, 
     63    USER_ID_PACKET      = 0x0d 
     64}; 
     65 
     66enum    /* Signature types */ 
     67{ 
     68    BINARY_SIGNATURE        = 0x00, 
     69    TEXT_SIGNATURE          = 0x01, 
     70 
     71    /* Public keys signatures */ 
     72    GENERIC_KEY_SIGNATURE   = 0x10, /* No assumption of verification */ 
     73    PERSONA_KEY_SIGNATURE   = 0x11, /* No verification has been made */ 
     74    CASUAL_KEY_SIGNATURE    = 0x12, /* Some casual verification */ 
     75    POSITIVE_KEY_SIGNATURE  = 0x13  /* Substantial verification */ 
     76}; 
     77 
     78 
     79enum    /* Signature subpacket types */ 
     80{ 
     81    ISSUER_SUBPACKET    = 0x10 
     82}; 
     83 
     84 
     85 
     86struct public_key_packet_t 
     87{ /* a public key packet (DSA/SHA-1) is 418 bytes */ 
     88 
     89    uint8_t version;      /* we use only version 4 */ 
     90    uint8_t timestamp[4]; /* creation time of the key */ 
     91    uint8_t algo;         /* we only use DSA */ 
     92    /* the multi precision integers, with their 2 bytes length header */ 
     93    uint8_t p[2+128]; 
     94    uint8_t q[2+20]; 
     95    uint8_t g[2+128]; 
     96    uint8_t y[2+128]; 
     97}; 
     98 
     99/* used for public key signatures */ 
     100struct signature_packet_v4_t 
     101{ /* hashed_data or unhashed_data can be empty, so the signature packet is 
     102   * theorically at least 54 bytes long, but always more than that. */ 
     103 
     104    uint8_t version; 
     105    uint8_t type; 
     106    uint8_t public_key_algo; 
     107    uint8_t digest_algo; 
     108    uint8_t hashed_data_len[2]; 
     109    uint8_t *hashed_data; 
     110    uint8_t unhashed_data_len[2]; 
     111    uint8_t *unhashed_data; 
     112    uint8_t hash_verification[2]; 
     113 
     114    /* The part below is made of consecutive MPIs, their number and size being 
     115     * public-key-algorithm dependant. 
     116     * But since we use DSA signatures only, we fix it. */ 
     117    uint8_t r[2+20]; 
     118    uint8_t s[2+20]; 
     119}; 
     120 
     121/* Used for binary document signatures (to be compatible with older software) 
     122 * DSA/SHA-1 is always 65 bytes */ 
     123struct signature_packet_v3_t 
     124{ 
     125    uint8_t header[2]; 
     126    uint8_t version;            /* 3 */ 
     127    uint8_t hashed_data_len;    /* MUST be 5 */ 
     128    uint8_t type; 
     129    uint8_t timestamp[4];       /* 4 bytes scalar number */ 
     130    uint8_t issuer_longid[8];  /* The key which signed the document */ 
     131    uint8_t public_key_algo;    /* we only know about DSA */ 
     132    uint8_t digest_algo;        /* and his little sister SHA-1 */ 
     133    uint8_t hash_verification[2];/* the 2 1st bytes of the SHA-1 hash */ 
     134 
     135    /* The part below is made of consecutive MPIs, their number and size being 
     136     * public-key-algorithm dependant. 
     137     * But since we use DSA signatures only, we fix it. */ 
     138    uint8_t r[2+20]; 
     139    uint8_t s[2+20]; 
     140}; 
     141 
     142typedef struct public_key_packet_t public_key_packet_t; 
     143typedef struct signature_packet_v4_t signature_packet_v4_t; 
     144typedef struct signature_packet_v3_t signature_packet_v3_t; 
     145 
     146struct public_key_t 
     147{ 
     148    uint8_t longid[8];       /* Long id */ 
     149    uint8_t *psz_username;    /* USER ID */ 
     150 
     151    public_key_packet_t key;       /* Public key packet */ 
     152 
     153    signature_packet_v4_t sig;     /* Signature packet, by the embedded key */ 
     154}; 
     155 
     156typedef struct public_key_t public_key_t; 
     157 
     158/* We trust this public key, and by extension, also keys signed by it. */ 
     159 
     160//#define OLD 1 //Define OLD to use Videolan Key 2006, to test public key download 
     161 
     162static uint8_t videolan_public_key_longid[8] = { 
     163#ifdef OLD 
     164  0xC3, 0x67, 0xD8, 0xB9, 0x81, 0xCA, 0xCA, 0x84 
     165#else 
     166  0x90, 0x28, 0x17, 0xE4, 0xAA, 0x5F, 0x4D, 0xE6  
     167#endif 
     168}; 
     169 
     170static uint8_t videolan_public_key[] = { 
     171#ifdef OLD 
     172"-----BEGIN PGP PUBLIC KEY BLOCK-----\n" 
     173"Version: GnuPG v2.0.4 (FreeBSD)\n" 
     174"\n" 
     175"mQGiBEPBV9IRBADqm3i6AnMyZ2/iowBPZJrP3bwhcqx9EhJR5/N8Pz+QjhvLsY5P\n" 
     176"efH1381RlEk33dl0vEvKULFstqT2GO+vtdoE+35tf1YlYFvxy23qn3Gsn2IMM6pl\n" 
     177"e0AatBnxzD1Vtlh7+Xhm0PvGJilZeg/MamEK2A8hgwhj3aGxVfzdtkQ1HwCg9XIo\n" 
     178"PZ8x5W0r6sfRXYmCDR06NFEEANRY98cFWJdvBmutLzoSC9y7eLxyGzKofs7ikxKg\n" 
     179"myT1o3eraeCoZc+mIbZG4cZA9UqL/fmqZa/3gvnvDEzoI8u7u7gL6bu499XAnzVd\n" 
     180"VV4cwvzgAPnMiqhi0jNWlXbt4dyZ+sWDhkL+ivrg3HsRU9xQUvYv54YQT0FxmR+E\n" 
     181"yTnjA/9KoPRPwAWy7Q4R24CNSjMz5+075J2LUz0QDjTzcLh6Y/gI7oxNGsgsmLQ8\n" 
     182"LMgtPZPbNw1FP6c6LMdUsLBCuCBKr7K3qOMubZc4694kB28bnpvP9EiHqvF8XiuY\n" 
     183"lNNHzqFVCufAuSceg4B+INczF46i0KUT0xhsIkw0KMfofac+g7Q9VmlkZW9MQU4g\n" 
     184"QXV0b21hdGljIFNpZ25pbmcgS2V5ICgyMDA2KSA8dmlkZW9sYW5AdmlkZW9sYW4u\n" 
     185"b3JnPohGBBARAgAGBQJDwVhJAAoJEK0m7YKmyAW5enUAoKomp97VmvhcxzFFAWVq\n" 
     186"nVmgR5o1AJ9pDxHnR987+WpQJEb29fOGRCv9mIhGBBARAgAGBQJDwvoRAAoJEKe9\n" 
     187"h1GAZnhb3x0AnjPZNWxOxcgCm3pYNqvvoEG4Yn6lAKC25Llg8SZZ2ClPNK5a43Lm\n" 
     188"QSLm8ohGBBMRAgAGBQJDwqW1AAoJEMPsbb7dbRK9zUIAoMxt11NpDs2I6PWn5rs3\n" 
     189"kv2ERS/jAJ4lzBh03apWuHGRVTpa7JUwcuRrTIhGBBMRAgAGBQJDwveAAAoJEDlN\n" 
     190"xZEO1wTqjN8Ani62eTBkOmn48PiGgDxlv0HDKGY+AKCT8dJrDIvWRbioeVoZ2q32\n" 
     191"ro6nBohGBBMRAgAGBQJECI5aAAoJEMcpqsa+jGsuS4AAnRF5BHE4I5+x6LxpXwqI\n" 
     192"rJYaJlr6AKCDpSflz+eOARGyMVNZ+tfN7zuYP4hJBBARAgAJBQJEiFlSAgcAAAoJ\n" 
     193"EJ7/Di3F33VbbR8An2SLqQLhyCrSivMvhkY5y09u/JVyAJ9jLnR/JR/tP0bsaKSz\n" 
     194"+unF3Tb7YohlBBMRAgAmBQJDwVfSAhsDBQkB3+IABgsJCAcDAgQVAggDBBYCAwEC\n" 
     195"HgECF4AACgkQw2fYuYHKyoSRdACfcNQ3qoDA0PXABrljF5CctywanhoAmMZ9tbyn\n" 
     196"LFy4ELbzCCglS8aJrYS5Ag0EQ8FX4xAIAICyMekh4upMZcq/x3krQAQ8bVTzOd1h\n" 
     197"tcI4UV2voBEapdA7DA/xRpEjNO05o1LM/oq9Rzh8oQtEWf75vNeOLJfiVR1Vy3cz\n" 
     198"0+a45GR4xFSTHg9zl13OM/oLI5hXrp5O5Zwu6yIZqBRiQNoCifKNvM3nrPhkjszr\n" 
     199"TNMx2gH84DkoTDGh7th4Iar/t05Q9Ni3HS86LHOAJS4aEimPl/zqM3NyJnZDtlu1\n" 
     200"dQ0DT13ykHmofrEb4cLNBwER2KfhmR/o9f/ybpPwpUaL3Wo1jJYYEQscBHH0o1Rl\n" 
     201"OvLKwZrrkwEAuIJRGMWYYtFSecqr/kuSHKc5XQtx/mUnOy+Nrt7ooPcAAwUH+wWM\n" 
     202"Ce3G4L4dASjTeZlmd8ETUV5Y7iP9GUJrGHek1S5JJeiMKqjfoMVsshBTJlZPkUYq\n" 
     203"OwnJZzI5lxGD9SbkE2n9LUWGXll3GDbV0zXdzaG5/Efzq5BpISkpqyDszDxb9LPi\n" 
     204"XQD/EiYP9pqlivgCTIqtcxN0Pdr0ArW0q7/yBfqWe0Fw9JrxHFN8dzmBnZk/sUis\n" 
     205"ZIxcRWlK/mdfxgcbRSKsaqucToubwJvIONaW3y/zURjG/Ehdkh/NR7yEnMJN6/SY\n" 
     206"E8VgjwL9Wx1KfC8nuqkFhmSMoIVKOck+0lAU3iTpThyYlU0M1luJvkYT2+Enlc1P\n" 
     207"eqMK0FlDmF60NbnPuzOITwQYEQIADwUCQ8FX4wIbDAUJAd/iAAAKCRDDZ9i5gcrK\n" 
     208"hCMLAKDB2xwcJT9OFM6G/seEnVMWGBfzrACg8UyCfxX2mNWNPTE4MQ/xiaQ6VBM=\n" 
     209"=tVe2\n" 
     210"-----END PGP PUBLIC KEY BLOCK-----\n" 
     211#else 
     212"-----BEGIN PGP PUBLIC KEY BLOCK-----\n" 
     213"Version: GnuPG v2.0.4 (FreeBSD)\n" 
     214"\n" 
     215"mQGiBEWbjf8RBAC+4m2yYYzuA0+D5JQatKmoxG4z3+bat08tMz0YvBUp1UU+95i4\n" 
     216"cP9ndklv3yzhtZ4MIx5yy64FXtPi0/NQiikEVYPYn2KMO4LCfZCwYBEizVWzABya\n" 
     217"LZcffCP/3VhoR90NUluWyi+zVAn9KNIRlnhnYpDDlI76fCrTTHDCtgpImwCg7VzB\n" 
     218"4L6O0JpUJBCZOCAPJNYirUkD/3uCZe4vK4kLW+W3HB+grMCI1uFULmVSKMBQZc+p\n" 
     219"dqDq++u3zYGqiMNaVrLg/J4GSH/P0ossXEtmTVjLHF4nJ7HXfIjqkqdkxq7g9odY\n" 
     220"/dkA/aC7z4JBgcYfRnDMqfL12C+3b+KSwxQSzPcbvsFYm2KTgteLwG3mRlpL7Dh5\n" 
     221"S70nBAC1PkIl7mP4OL7vpQk9dkdQCARJLgyn5pu/pZV7He4fDLHkUr/atnYaIHk1\n" 
     222"15xl/ziHcBql2WmF0Uff9SuuNOi/hFCuWZSwPKsgtIhYZ5ut4FrBAVkqHV2CgxFp\n" 
     223"aSiA7+FTG91++LDsg2xrHyTRW+fQnPdpf5a4H1fF15azo40h17QjVmlkZW9MQU4g\n" 
     224"UmVsZWFzZSBTaWduaW5nIEtleSAoMjAwNymIRgQQEQIABgUCRZ41PgAKCRDDZ9i5\n" 
     225"gcrKhPmUAJ49Krgt6ZPZZ2YkW7fWFwTvSgGongCePDjnFh1g4078f7lycT4wFk/c\n" 
     226"vPiIRgQQEQIABgUCRZ71NQAKCRD9Ibw7rD4IebztAKCxuyWCjF2JPAe1hdZqNNbE\n" 
     227"/gWDRACfaBw6mpHh3+jZuNnRk6NctFMbTzWIRgQTEQIABgUCRZuOiQAKCRDD7G2+\n" 
     228"3W0SvRkEAJ9cCPrbfzoTHKUVlGLAKbx5pcoutQCdENlo4nwXbQHaREDqm+ISBU3p\n" 
     229"iXeIZgQTEQIAJgUCRZuN/wIbAwUJAeEzgAYLCQgHAwIEFQIIAwQWAgMBAh4BAheA\n" 
     230"AAoJEJAoF+SqX03m4ZQAoOSj3JzzUuY+n/oS0Y4/yZ4tThNNAJ4h+9FacWApQdNJ\n" 
     231"+PcydRFEEm203LkCDQRFm44DEAgAlNLlnyIkLJ/Uyncsd5nB46LqQpJDLJ3AalfN\n" 
     232"44Vy3aOG+aA7JsNL5T5r5WRGnAf41qSOFiuZHwjfrtKb4TWkcfWlpsi8t5uasII9\n" 
     233"WAVX2aVIbiPMNWUnhQIn8rjCRLm2t/0Hch0HDbXaI/hvub5qhmSHfmqzlkuEUyVu\n" 
     234"H+beivX8pQwxqpcWXrmwuNzhISR1DsWBn5u0WcOSqUDtFG5Me8AuPFR1oxdYTtvC\n" 
     235"vqlVnw6ag3QuNqaAgWDU5Ug/U10ZxCZTn5TAcp+1ZDlM/dXIwh8wKXDjiKqHgYg1\n" 
     236"VLQ4fOsscTJoUDOaobeaVwTcDaSB4yQ3bhB2q5fLKqj+bNrY9wADBQf/Rw92M9b/\n" 
     237"JRs5IpX3fcrgHetVLHPiRuW8btD6EkmlgyRFOwOCzOSlSzFW6DKFrbOvd01EWkaP\n" 
     238"4PWJNW7b7OZqzK+UWzlWTgtV/2iUJtHg3+euZRdc5V9gqW17+HIAxjJVE53Syn8u\n" 
     239"kiJpk7HebtQo/v/pk3jtxdeJU3fY8ZAKJFl8V9aAj7ATFaAhYohzyKTRYc04F0n6\n" 
     240"VJDtwQkobdhq2//+5hSVrJ9wXRRF6XFVxc32NinqDEYrJUvTVayYu28Ivg4CTlts\n" 
     241"a+R7x92aDVT2KT+voPIGZxPYjALGa/I2hrlEYD9CiRFNBKAzRiNGAOo67SNI4hDu\n" 
     242"rFWRmMNOONWpIIhPBBgRAgAPBQJFm44DAhsMBQkB4TOAAAoJEJAoF+SqX03m57kA\n" 
     243"oMPb2o2D9gSwQFKXhamx2YdrykHOAKDqQ1tHH3ULY5cLLAKVaQtsNhVEtQ==\n" 
     244"=qrc1\n" 
     245"-----END PGP PUBLIC KEY BLOCK-----\n" 
     246#endif 
     247}; 
    38248 
    39249enum 
     
    68278}; 
    69279 
    70  
    71280#define update_New( a ) __update_New( VLC_OBJECT( a ) ) 
    72281 
     
    81290 
    82291#endif 
     292 
     293#endif 
  • modules/control/rc.c

    r09b9702 r48c2ac8  
    9797static int  Menu         ( vlc_object_t *, char const *, 
    9898                           vlc_value_t, vlc_value_t, void * ); 
     99#ifdef UPDATE_CHECK 
    99100static void checkUpdates( intf_thread_t *p_intf ); 
     101#endif 
    100102 
    101103/* Status Callbacks */ 
     
    751753            Help( p_intf, b_longhelp ); 
    752754        } 
     755#ifdef UPDATE_CHECK 
    753756        else if( !strcmp( psz_cmd, "check-updates" ) ) 
    754757        { 
    755758            checkUpdates( p_intf ); 
    756759        } 
     760#endif 
    757761        else if( !strcmp( psz_cmd, "key" ) || !strcmp( psz_cmd, "hotkey" ) ) 
    758762        { 
     
    923927        msg_rc(_("| @name mosaic-order id(,id)* . . . . order of pictures ")); 
    924928        msg_rc(_("| @name mosaic-keep-aspect-ratio {0,1} . . .aspect ratio")); 
     929#ifdef UPDATE_CHECK 
    925930        msg_rc(  "| "); 
    926931        msg_rc(_("| check-updates [newer] [equal] [older]\n" 
    927932                 "|               [undef] [info] [source] [binary] [plugin]")); 
     933#endif 
    928934        msg_rc(  "| "); 
    929935    } 
     
    16351641    input_thread_t *p_input = NULL; 
    16361642    vout_thread_t * p_vout; 
    1637     const char * psz_variable
     1643    const char * psz_variable = NULL
    16381644    int i_error; 
    16391645 
     
    21062112 * checkUpdates : check for updates 
    21072113 ****************************************************************************/ 
     2114#ifdef UPDATE_CHECK 
    21082115static void checkUpdates( intf_thread_t *p_intf ) 
    21092116{ 
     
    21232130    update_Delete( p_u ); 
    21242131} 
     2132#endif 
  • modules/gui/macosx/intf.h

    r0a7f703 r48c2ac8  
    102102    id o_interaction_list;      /* VLCInteractionList*/ 
    103103    id o_sfilters;              /* VLCsFilters    */ 
     104#ifdef UPDATE_CHECK 
    104105    id o_update;                /* VLCUpdate      */ 
     106#endif 
    105107    id o_eyetv;                 /* VLCEyeTVController */ 
    106108    BOOL nib_main_loaded;       /* main nibfile */ 
  • modules/gui/macosx/intf.m

    r0a7f703 r48c2ac8  
    394394    o_interaction_list = [[VLCInteractionList alloc] init]; 
    395395    o_sfilters = nil; 
     396#ifdef UPDATE_CHECK 
    396397    //FIXME o_update = [[VLCUpdate alloc] init]; 
     398#endif 
    397399 
    398400    i_lastShownVolume = -1; 
     
    786788- (void)applicationDidFinishLaunching:(NSNotification *)aNotification 
    787789{ 
     790#ifdef UPDATE_CHECK 
    788791    /* Check for update silently on startup */ 
    789792    if ( !nib_update_loaded ) 
     
    793796    //if([o_update shouldCheckForUpdate]) 
    794797    //    [NSThread detachNewThreadSelector:@selector(checkForUpdate) toTarget:o_update withObject:NULL]; 
    795   
     798#endif 
     799 
    796800    /* Handle sleep notification */ 
    797801    [[[NSWorkspace sharedWorkspace] notificationCenter] addObserver:self selector:@selector(computerWillSleep:) 
     
    19101914} 
    19111915 
     1916#ifdef UPDATE_CHECK 
    19121917- (IBAction)checkForUpdate:(id)sender 
    19131918{/* FIXME 
     
    19171922    [o_update showUpdateWindow]; 
    19181923*/} 
     1924#endif 
    19191925 
    19201926- (IBAction)viewHelp:(id)sender 
  • modules/gui/macosx/update.h

    r2010d13 r48c2ac8  
    2222 *****************************************************************************/ 
    2323 
     24#ifdef UPDATE_CHECK 
    2425#import <Cocoa/Cocoa.h> 
    2526#import <vlc_update.h> 
     
    5657 
    5758@end 
     59#endif 
  • modules/gui/macosx/update.m

    rf25e0c7 r48c2ac8  
    2828 *****************************************************************************/ 
    2929 
     30#ifdef UPDATE_CHECK 
    3031 
    3132/***************************************************************************** 
     
    352353 
    353354@end 
     355 
     356#endif 
  • modules/gui/qt4/dialogs/help.cpp

    r09b9702 r48c2ac8  
    2323 *****************************************************************************/ 
    2424 
     25#include <vlc/vlc.h> 
     26 
    2527#include "dialogs/help.hpp" 
    2628#include <vlc_about.h> 
     29 
     30#ifdef UPDATE_CHECK 
    2731#include <vlc_update.h> 
     32#endif 
    2833 
    2934#include "dialogs_provider.hpp" 
     
    160165} 
    161166 
    162  
     167#ifdef UPDATE_CHECK 
    163168UpdateDialog *UpdateDialog::instance = NULL; 
    164169 
     
    218223    } 
    219224} 
     225 
     226#endif 
  • modules/gui/qt4/dialogs/help.hpp

    r09b9702 r48c2ac8  
    2525#define _HELP_DIALOG_H_ 
    2626 
    27 #include <vlc_update.h> 
     27#include <vlc/vlc.h> 
    2828 
    2929#include "util/qvlcframe.hpp" 
     
    7171}; 
    7272 
    73  
     73#ifdef UPDATE_CHECK 
    7474class UpdateDialog : public QVLCFrame 
    7575{ 
     
    9393    void updateOrUpload(); 
    9494}; 
    95  
     95#endif 
    9696 
    9797#endif 
  • modules/gui/qt4/dialogs_provider.cpp

    r099d977 r48c2ac8  
    173173} 
    174174 
     175#ifdef UPDATE_CHECK 
    175176void DialogsProvider::updateDialog() 
    176177{ 
    177178    UpdateDialog::getInstance( p_intf )->toggleVisible(); 
    178179} 
     180#endif 
    179181 
    180182void DialogsProvider::aboutDialog() 
  • modules/gui/qt4/dialogs_provider.hpp

    r9473050 r48c2ac8  
    147147    void vlmDialog(); 
    148148    void helpDialog(); 
     149#ifdef UPDATE_CHECK 
    149150    void updateDialog(); 
     151#endif 
    150152    void aboutDialog(); 
    151153    void gotoTimeDialog(); 
  • modules/gui/qt4/menus.cpp

    r099d977 r48c2ac8  
    2323 *****************************************************************************/ 
    2424 
     25#include <vlc/vlc.h> 
     26 
    2527#include <vlc_intf_strings.h> 
    2628 
     
    458460    addDPStaticEntry( menu, qtr( "Help..." ) , "", 
    459461        ":/pixmaps/menus_help_16px.png", SLOT( helpDialog() ), "F1" ); 
     462#ifdef UPDATE_CHECK 
    460463    addDPStaticEntry( menu, qtr( "Update" ) , "", "", SLOT( updateDialog() ), ""); 
     464#endif 
    461465    menu->addSeparator(); 
    462466    addDPStaticEntry( menu, qtr( I_MENU_ABOUT ), "", "", SLOT( aboutDialog() ), 
  • modules/gui/wxwidgets/dialogs.cpp

    r6ee1e19 r48c2ac8  
    6464 
    6565    /* Event handlers (these functions should _not_ be virtual) */ 
     66#ifdef UPDATE_CHECK 
    6667    void OnUpdateVLC( wxCommandEvent& event ); 
     68#endif 
    6769    //void OnVLM( wxCommandEvent& event ); 
    6870    void OnInteraction( wxCommandEvent& event ); 
     
    109111    wxFrame             *p_bookmarks_dialog; 
    110112    wxFileDialog        *p_file_generic_dialog; 
     113#ifdef UPDATE_CHECK 
    111114    UpdateVLC           *p_updatevlc_dialog; 
     115#endif 
    112116    //VLMFrame            *p_vlm_dialog; 
    113117}; 
     
    157161    EVT_COMMAND(INTF_DIALOG_EXIT, wxEVT_DIALOG, 
    158162                DialogsProvider::OnExitThread) 
     163#ifdef UPDATE_CHECK 
    159164    EVT_COMMAND(INTF_DIALOG_UPDATEVLC, wxEVT_DIALOG, 
    160165                DialogsProvider::OnUpdateVLC) 
     166#endif 
    161167#if 0 
    162168    EVT_COMMAND(INTF_DIALOG_VLM, wxEVT_DIALOG, 
     
    550556} 
    551557 
     558#ifdef UPDATE_CHECK 
    552559void DialogsProvider::OnUpdateVLC( wxCommandEvent& WXUNUSED(event) ) 
    553560{ 
     
    561568    } 
    562569} 
     570#endif 
    563571 
    564572#if 0 
  • modules/gui/wxwidgets/dialogs/updatevlc.cpp

    r36cb61a r48c2ac8  
    2121 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. 
    2222 *****************************************************************************/ 
     23 
     24#ifdef UPDATE_CHECK 
    2325 
    2426/***************************************************************************** 
     
    121123    Layout(); 
    122124} 
     125#endif 
  • modules/gui/wxwidgets/dialogs/updatevlc.hpp

    r36cb61a r48c2ac8  
    2121 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. 
    2222 *****************************************************************************/ 
     23 
     24#ifdef UPDATE_CHECK 
    2325 
    2426#ifndef _WXVLC_UPDATEVLC_H_ 
     
    5557 
    5658#endif 
     59 
     60#endif 
  • modules/gui/wxwidgets/interface.cpp

    r1dc3807 r48c2ac8  
    301301    OnWebLink_Event, 
    302302    OnWebHelp_Event, 
     303#ifdef UPDATE_CHECK 
    303304    UpdateVLC_Event, 
     305#endif 
    304306    //VLM_Event, 
    305307 
     
    315317    EVT_MENU(OnWebLink_Event, Interface::OnWebLink) 
    316318    EVT_MENU(OnWebHelp_Event, Interface::OnWebHelp) 
     319#ifdef UPDATE_CHECK 
    317320    EVT_MENU(UpdateVLC_Event, Interface::OnShowDialog) 
     321#endif 
    318322    //EVT_MENU(VLM_Event, Interface::OnShowDialog) 
    319323 
     
    618622    help_menu->AppendSeparator(); 
    619623    help_menu->Append( About_Event, wxU(_("About...")) ); 
     624#ifdef UPDATE_CHECK 
    620625    help_menu->AppendSeparator(); 
    621626    help_menu->Append( UpdateVLC_Event, wxU(_("Check for Updates...")) ); 
     627#endif 
    622628 
    623629    /* Append the freshly created menus to the menu bar... */ 
     
    10251031            i_id = INTF_DIALOG_BOOKMARKS; 
    10261032            break; 
     1033#ifdef UPDATE_CHECK 
    10271034        case UpdateVLC_Event: 
    10281035            i_id = INTF_DIALOG_UPDATEVLC; 
    10291036            break; 
     1037#endif 
    10301038#if 0 
    10311039        case VLM_Event: 
  • src/misc/update.c

    r7bca27a r48c2ac8  
    2727 */ 
    2828 
     29/* 
     30 * TODO:  * pgp verification of the update file 
     31          * binary download, and pgp verification 
     32 */ 
     33 
    2934/***************************************************************************** 
    3035 * Preamble 
     
    3237 
    3338#include <vlc/vlc.h> 
     39 
     40#ifdef UPDATE_CHECK 
    3441 
    3542#include <ctype.h>                                              /* tolower() */ 
     
    7784                            const struct update_release_t *p2 ); 
    7885 
     86/***************************************************************************** 
     87 * OpenPGP functions 
     88 *****************************************************************************/ 
     89 
     90#define packet_type( c ) ( ( c & 0x3c ) >> 2 )      /* 0x3C = 00111100 */ 
     91#define packet_header_len( c ) ( ( c & 0x03 ) + 1 ) /* number of bytes in a packet header */ 
     92 
     93static inline int scalar_number( uint8_t *p, int header_len ) 
     94{ 
     95    if( header_len == 1 ) 
     96        return( p[0] ); 
     97    else if( header_len == 2 ) 
     98        return( (p[0] << 8) + p[1] ); 
     99    else if( header_len == 4 ) 
     100        return( (p[0] << 24) + (p[1] << 16) + (p[2] << 8) + p[3] ); 
     101    else 
     102        abort(); 
     103} 
     104 
     105/* number of data bytes in a MPI */ 
     106#define mpi_len( mpi ) ( ( scalar_number( mpi, 2 ) + 7 ) / 8 ) 
     107 
     108/*  
     109 * fill a public_key_packet_t structure from public key packet data 
     110 * verify that it is a version 4 public key packet, using DSA 
     111 */ 
     112static int parse_public_key_packet( public_key_packet_t *p_key, uint8_t *p_buf, 
     113                                    size_t i_packet_len ) 
     114{ 
     115    if( i_packet_len != 418 ) 
     116        return VLC_EGENERIC; 
     117 
     118    p_key->version   = *p_buf++; 
     119    if( p_key->version != 4 ) 
     120        return VLC_EGENERIC; 
     121 
     122    /* warn when timestamp is > date ? */ 
     123    memcpy( p_key->timestamp, p_buf, 4 ); p_buf += 4; 
     124 
     125    p_key->algo      = *p_buf++; 
     126    if( p_key->algo != PUBLIC_KEY_ALGO_DSA ) 
     127        return VLC_EGENERIC; 
     128 
     129    memcpy( p_key->p, p_buf, 2+128 ); p_buf += 2+128; 
     130    if( mpi_len( p_key->p ) != 128 ) 
     131        return VLC_EGENERIC; 
     132 
     133    memcpy( p_key->q, p_buf, 2+20 );  p_buf += 2+20; 
     134    if( mpi_len( p_key->q ) != 20 ) 
     135        return VLC_EGENERIC; 
     136 
     137    memcpy( p_key->g, p_buf, 2+128 ); p_buf += 2+128; 
     138    if( mpi_len( p_key->g ) != 128 ) 
     139        return VLC_EGENERIC; 
     140 
     141    memcpy( p_key->y, p_buf, 2+128 ); p_buf += 2+128; 
     142    if( mpi_len( p_key->y ) != 128 ) 
     143        return VLC_EGENERIC; 
     144 
     145    return VLC_SUCCESS; 
     146} 
     147 
     148/* 
     149 * fill a signature_packet_v4_t from signature packet data 
     150 * verify that it was used with a DSA public key, using SHA-1 digest 
     151 */ 
     152static int parse_signature_v4_packet( signature_packet_v4_t *p_sig, 
     153                                      uint8_t *p_buf, size_t i_sig_len ) 
     154{ 
     155    if( i_sig_len < 54 ) 
     156        return VLC_EGENERIC; 
     157 
     158    p_sig->version = *p_buf++; 
     159    if( p_sig->version != 4 ) 
     160        return VLC_EGENERIC; 
     161 
     162    p_sig->type = *p_buf++; 
     163    if( p_sig->type < GENERIC_KEY_SIGNATURE || 
     164        p_sig->type > POSITIVE_KEY_SIGNATURE ) 
     165        return VLC_EGENERIC; 
     166 
     167    p_sig->public_key_algo = *p_buf++; 
     168    if( p_sig->public_key_algo != PUBLIC_KEY_ALGO_DSA ) 
     169        return VLC_EGENERIC; 
     170 
     171    p_sig->digest_algo = *p_buf++; 
     172    if( p_sig->digest_algo != DIGEST_ALGO_SHA1 ) 
     173        return VLC_EGENERIC; 
     174 
     175    memcpy( p_sig->hashed_data_len, p_buf, 2 ); p_buf += 2; 
     176 
     177    size_t i_pos = 6; 
     178    size_t i_hashed_data_len = scalar_number( p_sig->hashed_data_len, 2 ); 
     179    i_pos += i_hashed_data_len; 
     180    if( i_pos > i_sig_len - 48 ) /* r & s are 44 bytes in total,  
     181                              * + the unhashed data length (2 bytes) 
     182                              * + the hash verification (2 bytes) */ 
     183        return VLC_EGENERIC; 
     184 
     185    p_sig->hashed_data = (uint8_t*) malloc( i_hashed_data_len ); 
     186    if( !p_sig->hashed_data ) 
     187        return VLC_ENOMEM; 
     188    memcpy( p_sig->hashed_data, p_buf, i_hashed_data_len ); 
     189    p_buf += i_hashed_data_len; 
     190 
     191    memcpy( p_sig->unhashed_data_len, p_buf, 2 ); p_buf += 2; 
     192 
     193    size_t i_unhashed_data_len = scalar_number( p_sig->unhashed_data_len, 2 ); 
     194    i_pos += 2 + i_unhashed_data_len; 
     195    if( i_pos != i_sig_len - 46 ) 
     196    { 
     197        free( p_sig->hashed_data ); 
     198        return VLC_EGENERIC; 
     199    } 
     200 
     201    p_sig->unhashed_data = (uint8_t*) malloc( i_unhashed_data_len ); 
     202    if( !p_sig->unhashed_data ) 
     203    { 
     204        free( p_sig->hashed_data ); 
     205        return VLC_ENOMEM; 
     206    } 
     207    memcpy( p_sig->unhashed_data, p_buf, i_unhashed_data_len ); 
     208    p_buf += i_unhashed_data_len; 
     209 
     210    memcpy( p_sig->hash_verification, p_buf, 2 ); p_buf += 2; 
     211 
     212    memcpy( p_sig->r, p_buf, 22 ); p_buf += 22; 
     213    if( mpi_len( p_sig->r ) != 20 ) 
     214    { 
     215        free( p_sig->hashed_data ); 
     216        free( p_sig->unhashed_data ); 
     217        return VLC_EGENERIC; 
     218    } 
     219 
     220    memcpy( p_sig->s, p_buf, 22 ); 
     221    if( mpi_len( p_sig->s ) != 20 ) 
     222    { 
     223        free( p_sig->hashed_data ); 
     224        free( p_sig->unhashed_data ); 
     225        return VLC_EGENERIC; 
     226    } 
     227 
     228    return VLC_SUCCESS; 
     229} 
     230 
     231/* 
     232 * crc_octets() was lamely copied from rfc 2440 
     233 * Copyright (C) The Internet Society (1998).  All Rights Reserved. 
     234 */ 
     235#define CRC24_INIT 0xB704CEL 
     236#define CRC24_POLY 0x1864CFBL 
     237 
     238static long crc_octets( uint8_t *octets, size_t len ) 
     239{ 
     240    long crc = CRC24_INIT; 
     241    int i; 
     242    while (len--) 
     243    { 
     244        crc ^= (*octets++) << 16; 
     245        for (i = 0; i < 8; i++) 
     246        { 
     247            crc <<= 1; 
     248            if (crc & 0x1000000) 
     249                crc ^= CRC24_POLY; 
     250        } 
     251    } 
     252    return crc & 0xFFFFFFL; 
     253} 
     254 
     255/* 
     256 * Transform an armored document in binary format 
     257 * Used on public keys and signatures 
     258 */ 
     259static int pgp_unarmor( char *p_ibuf, size_t i_ibuf_len, 
     260                        uint8_t *p_obuf, size_t i_obuf_len ) 
     261{ 
     262    char *p_ipos = p_ibuf; 
     263    uint8_t *p_opos = p_obuf; 
     264    int i_end = 0; 
     265 
     266    int i_header_skipped = 0; 
     267 
     268    while( !i_end && p_ipos < p_ibuf + i_ibuf_len ) 
     269    { 
     270        if( *p_ipos == '\r' || *p_ipos == '\n' ) 
     271        { 
     272            p_ipos++; 
     273            continue; 
     274        } 
     275 
     276        size_t i_line_len = strcspn( p_ipos, "\r\n" ); 
     277        if( i_line_len == 0 ) 
     278            continue; 
     279 
     280        if( !i_header_skipped ) 
     281        { 
     282            if( !strncmp( p_ipos, "-----BEGIN PGP", 14 ) ) 
     283                i_header_skipped = 1; 
     284 
     285            p_ipos += i_line_len + 1; 
     286            continue; 
     287        } 
     288         
     289        if( !strncmp( p_ipos, "Version:", 8 ) ) 
     290        { 
     291            p_ipos += i_line_len + 1; 
     292            continue; 
     293        } 
     294 
     295        if( p_ipos[i_line_len - 1] == '=' ) 
     296        { 
     297            i_end = 1; 
     298            p_ipos[i_line_len - 1] = '\0'; 
     299        } 
     300        else 
     301            p_ipos[i_line_len] = '\0'; 
     302 
     303        p_opos += vlc_b64_decode_binary_to_buffer(  p_opos, 
     304                                                    p_obuf - p_opos + i_obuf_len, 
     305                                                    p_ipos ); 
     306 
     307        p_ipos += i_line_len + 1; 
     308    } 
     309 
     310    /* XXX: the CRC is OPTIONAL, really require it ? */ 
     311    if( p_ipos + 5 > p_ibuf + i_ibuf_len || *p_ipos++ != '=' ) 
     312        return 0; 
     313 
     314    uint8_t p_crc[3]; 
     315    if( vlc_b64_decode_binary_to_buffer( p_crc, 3, p_ipos ) != 3 ) 
     316        return 0; 
     317 
     318    long l_crc = crc_octets( p_obuf, p_opos - p_obuf ); 
     319    long l_crc2 = ( 0 << 24 ) + ( p_crc[0] << 16 ) + ( p_crc[1] << 8 ) + p_crc[2]; 
     320 
     321    return l_crc2 == l_crc ? p_opos - p_obuf : 0; 
     322} 
     323 
     324/* 
     325 * Download the signature associated to a document or a binary file. 
     326 * We're given the file's url, we just append ".asc" to it and download  
     327 */ 
     328static int download_signature(  vlc_object_t *p_this, 
     329                                signature_packet_v3_t *p_sig, char *psz_url ) 
     330{ 
     331    char *psz_sig = (char*) malloc( strlen( psz_url ) + 4 + 1 ); /* ".asc" + \0 */ 
     332    if( !psz_sig ) 
     333        return VLC_ENOMEM; 
     334 
     335    strcpy( psz_sig, psz_url ); 
     336    strcat( psz_sig, ".asc" ); 
     337 
     338    stream_t *p_stream = stream_UrlNew( p_this, psz_sig ); 
     339    free( psz_sig ); 
     340 
     341    if( !p_stream ) 
     342        return VLC_ENOMEM; 
     343 
     344    int64_t i_size = stream_Size( p_stream ); 
     345    if( i_size < 65 ) 
     346    { 
     347        stream_Delete( p_stream ); 
     348        return VLC_EGENERIC; 
     349    } 
     350    else if( i_size == 65 ) /* binary format signature */ 
     351    { 
     352        int i_read = stream_Read( p_stream, p_sig, (int)i_size ); 
     353        stream_Delete( p_stream ); 
     354        if( i_read != i_size ) 
     355            return VLC_EGENERIC; 
     356        else 
     357            return VLC_SUCCESS;