@@ -227,6 +227,26 @@ static PKCS7 *pkcs7_get_sigfile(FILE_FORMAT_CTX *ctx);
227
227
228
228
static int blob_has_nl = 0 ;
229
229
230
+ static void print_proxy (char * proxy )
231
+ {
232
+ if (proxy ) {
233
+ printf ("Using configured proxy: %s\n" , proxy );
234
+ } else {
235
+ char * http_proxy , * https_proxy ;
236
+
237
+ http_proxy = getenv ("http_proxy" );
238
+ if (!http_proxy )
239
+ http_proxy = getenv ("HTTP_PROXY" );
240
+ if (http_proxy && * http_proxy != '\0' )
241
+ printf ("Using environmental HTTP proxy: %s\n" , http_proxy );
242
+ https_proxy = getenv ("https_proxy" );
243
+ if (!https_proxy )
244
+ https_proxy = getenv ("HTTPS_PROXY" );
245
+ if (https_proxy && * https_proxy != '\0' )
246
+ printf ("Using environmental HTTPS proxy: %s\n" , https_proxy );
247
+ }
248
+ }
249
+
230
250
/*
231
251
* Callback for writing received data
232
252
*/
@@ -527,6 +547,7 @@ static BIO *bio_get_http(long *http_code, char *url, BIO *bout, char *proxy,
527
547
if (!url ) {
528
548
return NULL ; /* FAILED */
529
549
}
550
+ print_proxy (proxy );
530
551
/* Start a libcurl easy session and set options for a curl easy handle */
531
552
printf ("Connecting to %s\n" , url );
532
553
curl = curl_easy_init ();
@@ -1591,16 +1612,17 @@ static char *clrdp_url_get_x509(X509 *cert)
1591
1612
/*
1592
1613
* Get Certificate Revocation List from a CRL distribution point
1593
1614
* and write it into the X509_CRL structure.
1615
+ * [in] proxy: proxy to getting CRL through
1594
1616
* [in] url: URL of the CRL distribution point server
1595
1617
* [returns] X509 Certificate Revocation List
1596
1618
*/
1597
- static X509_CRL * x509_crl_get (char * url )
1619
+ static X509_CRL * x509_crl_get (char * proxy , char * url )
1598
1620
{
1599
1621
X509_CRL * crl ;
1600
1622
BIO * bio ;
1601
1623
long http_code = -1 ;
1602
1624
1603
- bio = bio_get_http (& http_code , url , NULL , NULL , 0 , 1 , 0 );
1625
+ bio = bio_get_http (& http_code , url , NULL , proxy , 0 , 1 , 0 );
1604
1626
if (!bio ) {
1605
1627
printf ("Warning: Faild to get CRL from %s\n\n" , url );
1606
1628
return NULL ; /* FAILED */
@@ -1798,11 +1820,12 @@ static int verify_timestamp(FILE_FORMAT_CTX *ctx, PKCS7 *p7, CMS_ContentInfo *ti
1798
1820
printf ("Ignored TSA's CRL distribution point: %s\n" , url );
1799
1821
} else {
1800
1822
printf ("TSA's CRL distribution point: %s\n" , url );
1801
- crl = x509_crl_get (url );
1823
+ crl = x509_crl_get (ctx -> options -> proxy , url );
1802
1824
}
1803
1825
OPENSSL_free (url );
1804
1826
if (!crl && !ctx -> options -> tsa_crlfile ) {
1805
1827
printf ("Use the \"-TSA-CRLfile\" option to add one or more Time-Stamp Authority CRLs in PEM format.\n" );
1828
+ goto out ;
1806
1829
}
1807
1830
}
1808
1831
#endif /* ENABLE_CURL */
@@ -1923,7 +1946,7 @@ static int verify_authenticode(FILE_FORMAT_CTX *ctx, PKCS7 *p7, time_t time, X50
1923
1946
printf ("Ignored CRL distribution point: %s\n" , url );
1924
1947
} else {
1925
1948
printf ("CRL distribution point: %s\n" , url );
1926
- crl = x509_crl_get (url );
1949
+ crl = x509_crl_get (ctx -> options -> proxy , url );
1927
1950
}
1928
1951
OPENSSL_free (url );
1929
1952
if (!crl && !ctx -> options -> crlfile ) {
@@ -3037,6 +3060,7 @@ static void usage(const char *argv0, const char *cmd)
3037
3060
printf ("%12s[ -CRLfile <infile> ]\n" , "" );
3038
3061
printf ("%12s[ -TSA-CAfile <infile> ]\n" , "" );
3039
3062
printf ("%12s[ -TSA-CRLfile <infile> ]\n" , "" );
3063
+ printf ("%12s[ -p <proxy> ]\n" , "" );
3040
3064
printf ("%12s[ -index <index> ]\n" , "" );
3041
3065
printf ("%12s[ -ignore-timestamp ]\n" , "" );
3042
3066
printf ("%12s[ -ignore-cdp ]\n" , "" );
@@ -3090,7 +3114,7 @@ static void help_for(const char *argv0, const char *cmd)
3090
3114
const char * cmds_out [] = {"add" , "attach-signature" , "extract-signature" ,
3091
3115
"remove-signature" , "sign" , "extract-data" , NULL };
3092
3116
#ifdef ENABLE_CURL
3093
- const char * cmds_p [] = {"add" , "sign" , NULL };
3117
+ const char * cmds_p [] = {"add" , "sign" , "verify" , NULL };
3094
3118
#endif /* ENABLE_CURL */
3095
3119
const char * cmds_pass [] = {"sign" , NULL };
3096
3120
const char * cmds_pem [] = {"sign" , "extract-data" , "extract-signature" , NULL };
@@ -3223,7 +3247,7 @@ static void help_for(const char *argv0, const char *cmd)
3223
3247
printf ("%-24s= output file\n" , "-out" );
3224
3248
#ifdef ENABLE_CURL
3225
3249
if (on_list (cmd , cmds_p ))
3226
- printf ("%-24s= proxy to connect to the desired Time-Stamp Authority server\n" , "-p" );
3250
+ printf ("%-24s= proxy to connect to the desired Time-Stamp Authority server or CRL distribution point \n" , "-p" );
3227
3251
#endif /* ENABLE_CURL */
3228
3252
if (on_list (cmd , cmds_pass ))
3229
3253
printf ("%-24s= the private key password\n" , "-pass" );
@@ -4129,7 +4153,7 @@ static int main_configure(int argc, char **argv, GLOBAL_OPTIONS *options)
4129
4153
return 0 ; /* FAILED */
4130
4154
}
4131
4155
options -> tsurl [options -> ntsurl ++ ] = * (++ argv );
4132
- } else if ((cmd == CMD_SIGN || cmd == CMD_ADD ) && !strcmp (* argv , "-p" )) {
4156
+ } else if ((cmd == CMD_SIGN || cmd == CMD_ADD || cmd == CMD_VERIFY ) && !strcmp (* argv , "-p" )) {
4133
4157
if (-- argc < 1 ) {
4134
4158
usage (argv0 , "all" );
4135
4159
return 0 ; /* FAILED */
0 commit comments