Skip to content

Commit 21d0d4d

Browse files
committed
Trying to fix build with GNUTLS
1 parent c6cacb9 commit 21d0d4d

1 file changed

Lines changed: 15 additions & 7 deletions

File tree

cups/jwt.c

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -517,19 +517,27 @@ cupsJWTHasValidSignature(
517517
{
518518
gnutls_datum_t r, s; // Signature coordinates
519519

520-
text_datum.data = (unsigned char *)text;
521-
text_datum.size = (unsigned)text_len;
520+
text_datum.data = (unsigned char *)text;
521+
text_datum.size = (unsigned)text_len;
522522

523-
r.data = jwt->signature;
524-
r.size = (unsigned)jwt->sigsize / 2;
523+
r.data = jwt->signature;
524+
r.size = (unsigned)jwt->sigsize / 2;
525525
s.data = jwt->signature + jwt->sigsize / 2;
526-
s.size = (unsigned)jwt->sigsize / 2;
526+
s.size = (unsigned)jwt->sigsize / 2;
527527

528528
gnutls_encode_rs_value(&sig_datum, &r, &s);
529529

530-
ret = !gnutls_pubkey_verify_data2(key, algs[jwt->sigalg - CUPS_JWA_RS256], 0, &text_datum, &sig_datum);
530+
ret = !gnutls_pubkey_verify_data2(key, algs[jwt->sigalg - CUPS_JWA_RS256], 0, &text_datum, &sig_datum);
531+
532+
gnutls_pubkey_deinit(key);
533+
534+
if (!ret)
535+
{
536+
free(text);
537+
break;
538+
}
539+
531540
gnutls_free(sig_datum.data);
532-
gnutls_pubkey_deinit(key);
533541
}
534542
#endif // HAVE_OPENSSL
535543

0 commit comments

Comments
 (0)