@@ -303,10 +303,17 @@ static BIO *bio_encode_rfc3161_request(PKCS7 *p7, const EVP_MD *md)
303303 goto out ;
304304
305305 bhash = BIO_new (BIO_f_md ());
306+ #if defined(__GNUC__ )
307+ #pragma GCC diagnostic push
308+ #pragma GCC diagnostic ignored "-Wcast-qual"
309+ #endif
306310 if (!BIO_set_md (bhash , md )) {
307311 fprintf (stderr , "Unable to set the message digest of BIO\n" );
308312 goto out ;
309313 }
314+ #if defined(__GNUC__ )
315+ #pragma GCC diagnostic pop
316+ #endif
310317 BIO_push (bhash , BIO_new (BIO_s_null ()));
311318 BIO_write (bhash , si -> enc_digest -> data , si -> enc_digest -> length );
312319 BIO_gets (bhash , (char * )mdbuf , EVP_MD_size (md ));
@@ -1817,10 +1824,17 @@ static int trusted_cert(X509 *cert, int error) {
18171824 const EVP_MD * md = EVP_get_digestbynid (NID_sha256 );
18181825 BIO * bhash = BIO_new (BIO_f_md ());
18191826
1827+ #if defined(__GNUC__ )
1828+ #pragma GCC diagnostic push
1829+ #pragma GCC diagnostic ignored "-Wcast-qual"
1830+ #endif
18201831 if (!BIO_set_md (bhash , md )) {
18211832 BIO_free_all (bhash );
18221833 return 0 ; /* FAILED */
18231834 }
1835+ #if defined(__GNUC__ )
1836+ #pragma GCC diagnostic pop
1837+ #endif
18241838 BIO_push (bhash , BIO_new (BIO_s_null ()));
18251839 len = i2d_X509 (cert , NULL );
18261840 p = OPENSSL_malloc ((size_t )len );
@@ -2173,12 +2187,19 @@ static int verify_timestamp_token(PKCS7 *p7, CMS_ContentInfo *timestamp)
21732187
21742188 /* compute a hash from the encrypted message digest value of the file */
21752189 bhash = BIO_new (BIO_f_md ());
2190+ #if defined(__GNUC__ )
2191+ #pragma GCC diagnostic push
2192+ #pragma GCC diagnostic ignored "-Wcast-qual"
2193+ #endif
21762194 if (!BIO_set_md (bhash , md )) {
21772195 fprintf (stderr , "Unable to set the message digest of BIO\n" );
21782196 BIO_free_all (bhash );
21792197 TS_TST_INFO_free (token );
21802198 return 0 ; /* FAILED */
21812199 }
2200+ #if defined(__GNUC__ )
2201+ #pragma GCC diagnostic pop
2202+ #endif
21822203 BIO_push (bhash , BIO_new (BIO_s_null ()));
21832204 BIO_write (bhash , si -> enc_digest -> data , si -> enc_digest -> length );
21842205 BIO_gets (bhash , (char * )mdbuf , EVP_MD_size (md ));
@@ -2531,12 +2552,19 @@ static int verify_leaf_hash(X509 *cert, const char *leafhash)
25312552
25322553 /* compute the leaf certificate hash */
25332554 bhash = BIO_new (BIO_f_md ());
2555+ #if defined(__GNUC__ )
2556+ #pragma GCC diagnostic push
2557+ #pragma GCC diagnostic ignored "-Wcast-qual"
2558+ #endif
25342559 if (!BIO_set_md (bhash , md )) {
25352560 fprintf (stderr , "Unable to set the message digest of BIO\n" );
25362561 BIO_free_all (bhash );
25372562 OPENSSL_free (mdbuf );
25382563 return 0 ; /* FAILED */
25392564 }
2565+ #if defined(__GNUC__ )
2566+ #pragma GCC diagnostic pop
2567+ #endif
25402568 BIO_push (bhash , BIO_new (BIO_s_null ()));
25412569 certlen = (size_t )i2d_X509 (cert , NULL );
25422570 certbuf = OPENSSL_malloc (certlen );
@@ -3346,7 +3374,23 @@ static int PKCS7_compare(const PKCS7 *const *a, const PKCS7 *const *b)
33463374 long index_a , index_b ;
33473375 int ret = 0 ;
33483376
3377+ #if OPENSSL_VERSION_NUMBER < 0x30000000L
3378+ #if defined(__clang__ )
3379+ #pragma clang diagnostic push
3380+ #pragma clang diagnostic ignored "-Wincompatible-pointer-types-discards-qualifiers"
3381+ #elif defined(__GNUC__ )
3382+ #pragma GCC diagnostic push
3383+ #pragma GCC diagnostic ignored "-Wdiscarded-qualifiers"
3384+ #endif
3385+ #endif /* OPENSSL_VERSION_NUMBER<0x30000000L */
33493386 p7_a = PKCS7_dup (* a );
3387+ #if OPENSSL_VERSION_NUMBER < 0x30000000L
3388+ #if defined(__clang__ )
3389+ #pragma clang diagnostic pop
3390+ #elif defined(__GNUC__ )
3391+ #pragma GCC diagnostic pop
3392+ #endif
3393+ #endif /* OPENSSL_VERSION_NUMBER>=0x30000000L */
33503394 if (!p7_a )
33513395 goto out ;
33523396 signer_info = PKCS7_get_signer_info (p7_a );
@@ -3358,7 +3402,23 @@ static int PKCS7_compare(const PKCS7 *const *a, const PKCS7 *const *b)
33583402 time_a = asn1_time_get_si_time (si );
33593403 index_a = get_sequence_number (si );
33603404
3405+ #if OPENSSL_VERSION_NUMBER < 0x30000000L
3406+ #if defined(__clang__ )
3407+ #pragma clang diagnostic push
3408+ #pragma clang diagnostic ignored "-Wincompatible-pointer-types-discards-qualifiers"
3409+ #elif defined(__GNUC__ )
3410+ #pragma GCC diagnostic push
3411+ #pragma GCC diagnostic ignored "-Wdiscarded-qualifiers"
3412+ #endif
3413+ #endif /* OPENSSL_VERSION_NUMBER<0x30000000L */
33613414 p7_b = PKCS7_dup (* b );
3415+ #if OPENSSL_VERSION_NUMBER < 0x30000000L
3416+ #if defined(__clang__ )
3417+ #pragma clang diagnostic pop
3418+ #elif defined(__GNUC__ )
3419+ #pragma GCC diagnostic pop
3420+ #endif
3421+ #endif /* OPENSSL_VERSION_NUMBER>=0x30000000L */
33623422 if (!p7_b )
33633423 goto out ;
33643424 signer_info = PKCS7_get_signer_info (p7_b );
@@ -5011,9 +5071,16 @@ int main(int argc, char **argv)
50115071 if (options .cmd != CMD_VERIFY ) {
50125072 /* Create message digest BIO */
50135073 hash = BIO_new (BIO_f_md ());
5074+ #if defined(__GNUC__ )
5075+ #pragma GCC diagnostic push
5076+ #pragma GCC diagnostic ignored "-Wcast-qual"
5077+ #endif
50145078 if (!BIO_set_md (hash , options .md )) {
50155079 DO_EXIT_0 ("Unable to set the message digest of BIO\n" );
50165080 }
5081+ #if defined(__GNUC__ )
5082+ #pragma GCC diagnostic pop
5083+ #endif
50175084 /* Create outdata file */
50185085 outdata = BIO_new_file (options .outfile , "w+bx" );
50195086 if (!outdata && errno != EEXIST )
0 commit comments