Mercurial > pidgin
comparison libpurple/plugins/ssl/ssl-gnutls.c @ 19492:447470c8111a
- More TODO whacking
- Added errorchecking to x509_sha1sum
author | William Ehlhardt <williamehlhardt@gmail.com> |
---|---|
date | Mon, 20 Aug 2007 03:10:21 +0000 |
parents | 4f472eef762c |
children | e147c3a821dd |
comparison
equal
deleted
inserted
replaced
19491:4f472eef762c | 19492:447470c8111a |
---|---|
607 * | 607 * |
608 */ | 608 */ |
609 static void | 609 static void |
610 x509_destroy_certificate(PurpleCertificate * crt) | 610 x509_destroy_certificate(PurpleCertificate * crt) |
611 { | 611 { |
612 /* TODO: Issue a warning here? */ | |
613 if (NULL == crt) return; | 612 if (NULL == crt) return; |
614 | 613 |
615 /* Check that the scheme is x509_gnutls */ | 614 /* Check that the scheme is x509_gnutls */ |
616 if ( crt->scheme != &x509_gnutls ) { | 615 if ( crt->scheme != &x509_gnutls ) { |
617 purple_debug_error("gnutls", | 616 purple_debug_error("gnutls", |
619 crt->scheme->name, | 618 crt->scheme->name, |
620 SCHEME_NAME); | 619 SCHEME_NAME); |
621 return; | 620 return; |
622 } | 621 } |
623 | 622 |
624 /* TODO: Different error checking? */ | |
625 g_return_if_fail(crt->data != NULL); | 623 g_return_if_fail(crt->data != NULL); |
626 g_return_if_fail(crt->scheme != NULL); | 624 g_return_if_fail(crt->scheme != NULL); |
627 | 625 |
628 /* Use the reference counting system to free (or not) the | 626 /* Use the reference counting system to free (or not) the |
629 underlying data */ | 627 underlying data */ |
648 gnutls_x509_crt_t crt_dat; | 646 gnutls_x509_crt_t crt_dat; |
649 gnutls_x509_crt_t issuer_dat; | 647 gnutls_x509_crt_t issuer_dat; |
650 unsigned int verify; /* used to store result from GnuTLS verifier */ | 648 unsigned int verify; /* used to store result from GnuTLS verifier */ |
651 int ret; | 649 int ret; |
652 | 650 |
653 /* TODO: Change this error checking? */ | |
654 g_return_val_if_fail(crt, FALSE); | 651 g_return_val_if_fail(crt, FALSE); |
655 g_return_val_if_fail(issuer, FALSE); | 652 g_return_val_if_fail(issuer, FALSE); |
656 | 653 |
657 /* Verify that both certs are the correct scheme */ | 654 /* Verify that both certs are the correct scheme */ |
658 g_return_val_if_fail(crt->scheme == &x509_gnutls, FALSE); | 655 g_return_val_if_fail(crt->scheme == &x509_gnutls, FALSE); |
740 g_return_val_if_fail(crt, NULL); | 737 g_return_val_if_fail(crt, NULL); |
741 | 738 |
742 crt_dat = X509_GET_GNUTLS_DATA(crt); | 739 crt_dat = X509_GET_GNUTLS_DATA(crt); |
743 | 740 |
744 /* Extract the fingerprint */ | 741 /* Extract the fingerprint */ |
745 /* TODO: Errorcheck? */ | 742 g_return_val_if_fail( |
746 gnutls_x509_crt_get_fingerprint(crt_dat, GNUTLS_MAC_SHA, | 743 0 == gnutls_x509_crt_get_fingerprint(crt_dat, GNUTLS_MAC_SHA, |
747 hashbuf, &tmpsz); | 744 hashbuf, &tmpsz), |
745 NULL); | |
748 | 746 |
749 /* This shouldn't happen */ | 747 /* This shouldn't happen */ |
750 g_return_val_if_fail(tmpsz == hashlen, NULL); | 748 g_return_val_if_fail(tmpsz == hashlen, NULL); |
751 | 749 |
752 /* Okay, now create and fill hash array */ | 750 /* Okay, now create and fill hash array */ |