]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
use bool types when needed.
authorNikos Mavrogiannopoulos <nmav@redhat.com>
Wed, 19 Feb 2014 15:40:54 +0000 (16:40 +0100)
committerNikos Mavrogiannopoulos <nmav@redhat.com>
Wed, 19 Feb 2014 15:40:54 +0000 (16:40 +0100)
lib/x509/common.h
lib/x509/verify.c
lib/x509/x509_int.h

index 358dc072c0db924dd5eb69012dc1b20b9ce68ad0..30ff3a5d630a44f200b234765eaa3448785376de 100644 (file)
@@ -26,6 +26,7 @@
 #include <algorithms.h>
 #include <abstract_int.h>
 #include <x509/x509_int.h>
+#include <stdbool.h>
 #include <fips.h>
 
 #define MAX_STRING_LEN 512
@@ -171,11 +172,11 @@ int
 _gnutls_x509_get_raw_dn2(ASN1_TYPE c2, gnutls_datum_t * raw,
                         const char *whom, gnutls_datum_t * dn);
 
-int
+bool
 _gnutls_check_if_same_cert(gnutls_x509_crt_t cert1,
                           gnutls_x509_crt_t cert2);
 
-int
+bool
 _gnutls_check_if_same_cert2(gnutls_x509_crt_t cert1,
                            gnutls_datum_t * cert2bin);
 
@@ -192,4 +193,6 @@ int set_extension(ASN1_TYPE asn, const char *root,
 int _gnutls_strdatum_to_buf(gnutls_datum_t * d, void *buf,
                            size_t * sizeof_buf);
 
+bool _gnutls_is_same_dn(gnutls_x509_crt_t cert1, gnutls_x509_crt_t cert2);
+
 #endif
index bde6c930c146e210a84954ac2d528117a5b7aaa9..1bb71a7ca70547d0ecc61c96cc02386d28ebb12a 100644 (file)
 #include <x509_int.h>
 #include <common.h>
 #include <gnutls_pk.h>
+#include <stdbool.h>
 
 /* Checks if two certs are identical.  Return 1 on match. */
-int
+bool
 _gnutls_check_if_same_cert(gnutls_x509_crt_t cert1,
                           gnutls_x509_crt_t cert2)
 {
@@ -77,7 +78,7 @@ _gnutls_check_if_same_cert(gnutls_x509_crt_t cert1,
        return result;
 }
 
-int
+bool
 _gnutls_check_if_same_cert2(gnutls_x509_crt_t cert1,
                            gnutls_datum_t * cert2bin)
 {
@@ -109,7 +110,7 @@ _gnutls_check_if_same_cert2(gnutls_x509_crt_t cert1,
  * Returns true or false, if the issuer is a CA,
  * or not.
  */
-static int
+static bool
 check_if_ca(gnutls_x509_crt_t cert, gnutls_x509_crt_t issuer,
            unsigned int *max_path, unsigned int flags)
 {
@@ -225,7 +226,7 @@ check_if_ca(gnutls_x509_crt_t cert, gnutls_x509_crt_t issuer,
  *
  * Returns 1 if they match and (0) if they don't match. 
  */
-static int is_issuer(gnutls_x509_crt_t cert, gnutls_x509_crt_t issuer)
+static bool is_issuer(gnutls_x509_crt_t cert, gnutls_x509_crt_t issuer)
 {
        uint8_t id1[MAX_KEY_ID_SIZE];
        uint8_t id2[MAX_KEY_ID_SIZE];
@@ -276,7 +277,7 @@ static int is_issuer(gnutls_x509_crt_t cert, gnutls_x509_crt_t issuer)
 /* Check if the given certificate is the issuer of the CRL.
  * Returns 1 on success and 0 otherwise.
  */
-static int is_crl_issuer(gnutls_x509_crl_t crl, gnutls_x509_crt_t issuer)
+static bool is_crl_issuer(gnutls_x509_crl_t crl, gnutls_x509_crt_t issuer)
 {
        if (_gnutls_x509_compare_raw_dn
            (&crl->raw_issuer_dn, &issuer->raw_dn) != 0)
@@ -289,7 +290,7 @@ static int is_crl_issuer(gnutls_x509_crl_t crl, gnutls_x509_crt_t issuer)
  * Returns 1 if they match and (0) if they don't match. Otherwise
  * a negative error code is returned to indicate error.
  */
-int _gnutls_is_same_dn(gnutls_x509_crt_t cert1, gnutls_x509_crt_t cert2)
+bool _gnutls_is_same_dn(gnutls_x509_crt_t cert1, gnutls_x509_crt_t cert2)
 {
        if (_gnutls_x509_compare_raw_dn(&cert1->raw_dn, &cert2->raw_dn) !=
            0)
@@ -399,7 +400,7 @@ int is_broken_allowed(gnutls_sign_algorithm_t sig, unsigned int flags)
  * @sigalg: the signature algorithm used
  * @flags: the specified verification flags
  */
-static int is_level_acceptable(
+static bool is_level_acceptable(
        gnutls_x509_crt_t crt, gnutls_x509_crt_t issuer,
        gnutls_sign_algorithm_t sigalg, unsigned flags)
 {
@@ -527,7 +528,7 @@ int hash;
  * Output will hold some extra information about the verification
  * procedure. Issuer will hold the actual issuer from the trusted list.
  */
-static int
+static bool
 verify_crt(gnutls_x509_crt_t cert,
                            const gnutls_x509_crt_t * trusted_cas,
                            int tcas_size, unsigned int flags,
index 0389de8133a497b5a250c46bb7ef58e188927671..568bf3c19ace15b46808401f9d05784a98c39d4a 100644 (file)
@@ -397,8 +397,6 @@ _gnutls_pkcs11_verify_certificate(const char* url,
                                gnutls_verify_output_function func);
 #endif
 
-int _gnutls_is_same_dn(gnutls_x509_crt_t cert1, gnutls_x509_crt_t cert2);
-
 int
 _gnutls_x509_crt_check_revocation(gnutls_x509_crt_t cert,
                                  const gnutls_x509_crl_t * crl_list,