Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040 #include <vlc_update.h>
00041
00042 enum
00043 {
00044
00045 PUBLIC_KEY_ALGO_DSA = 0x11
00046 };
00047
00048 enum
00049 {
00050
00051 DIGEST_ALGO_SHA1 = 0x02
00052 };
00053
00054 enum
00055 {
00056 SIGNATURE_PACKET = 0x02,
00057 PUBLIC_KEY_PACKET = 0x06,
00058 USER_ID_PACKET = 0x0d
00059 };
00060
00061 enum
00062 {
00063 BINARY_SIGNATURE = 0x00,
00064 TEXT_SIGNATURE = 0x01,
00065
00066
00067 GENERIC_KEY_SIGNATURE = 0x10,
00068 PERSONA_KEY_SIGNATURE = 0x11,
00069 CASUAL_KEY_SIGNATURE = 0x12,
00070 POSITIVE_KEY_SIGNATURE = 0x13
00071 };
00072
00073 enum
00074 {
00075 ISSUER_SUBPACKET = 0x10
00076 };
00077
00078 struct public_key_packet_t
00079 {
00080
00081 uint8_t version;
00082 uint8_t timestamp[4];
00083 uint8_t algo;
00084
00085 uint8_t p[2+128];
00086 uint8_t q[2+20];
00087 uint8_t g[2+128];
00088 uint8_t y[2+128];
00089 };
00090
00091
00092 struct signature_packet_t
00093 {
00094 uint8_t version;
00095
00096 uint8_t type;
00097 uint8_t public_key_algo;
00098 uint8_t digest_algo;
00099
00100 uint8_t hash_verification[2];
00101 uint8_t issuer_longid[8];
00102
00103 union
00104 {
00105 struct
00106 {
00107 uint8_t hashed_data_len[2];
00108 uint8_t *hashed_data;
00109 uint8_t unhashed_data_len[2];
00110 uint8_t *unhashed_data;
00111 } v4;
00112 struct
00113 {
00114 uint8_t hashed_data_len;
00115 uint8_t timestamp[4];
00116 } v3;
00117 } specific;
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128 uint8_t r[2+20];
00129 uint8_t s[2+20];
00130 };
00131
00132 typedef struct public_key_packet_t public_key_packet_t;
00133 typedef struct signature_packet_t signature_packet_t;
00134
00135 struct public_key_t
00136 {
00137 uint8_t longid[8];
00138 uint8_t *psz_username;
00139
00140 public_key_packet_t key;
00141
00142 signature_packet_t sig;
00143 };
00144
00145 typedef struct public_key_t public_key_t;
00146
00147
00148
00149
00150 typedef struct
00151 {
00152 VLC_COMMON_MEMBERS
00153
00154 vlc_thread_t thread;
00155 update_t *p_update;
00156 char *psz_destdir;
00157 } update_download_thread_t;
00158
00159
00160
00161
00162 typedef struct
00163 {
00164 vlc_thread_t thread;
00165
00166 update_t *p_update;
00167 void (*pf_callback)( void *, bool );
00168 void *p_data;
00169 } update_check_thread_t;
00170
00171
00172
00173
00174 struct update_t
00175 {
00176 libvlc_int_t *p_libvlc;
00177 vlc_mutex_t lock;
00178 struct update_release_t release;
00179 public_key_t *p_pkey;
00180 update_download_thread_t *p_download;
00181 update_check_thread_t *p_check;
00182 };
00183
00184
00185
00186
00187 public_key_t *
00188 download_key(
00189 vlc_object_t *p_this, const uint8_t *p_longid,
00190 const uint8_t *p_signature_issuer );
00191
00192
00193
00194
00195
00196
00197
00198 int
00199 parse_public_key(
00200 const uint8_t *p_key_data, size_t i_key_len, public_key_t *p_key,
00201 const uint8_t *p_sig_issuer );
00202
00203
00204
00205
00206 int
00207 verify_signature(
00208 uint8_t *p_r, uint8_t *p_s, public_key_packet_t *p_key,
00209 uint8_t *p_hash );
00210
00211
00212
00213
00214
00215 int
00216 download_signature(
00217 vlc_object_t *p_this, signature_packet_t *p_sig, const char *psz_url );
00218
00219
00220
00221
00222 uint8_t *
00223 hash_sha1_from_text(
00224 const char *psz_text, signature_packet_t *p_sig );
00225
00226
00227
00228
00229 uint8_t *
00230 hash_sha1_from_file(
00231 const char *psz_file, signature_packet_t *p_sig );
00232
00233
00234
00235
00236 uint8_t *
00237 hash_sha1_from_public_key( public_key_t *p_pkey );
00238