diff options
author | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2014-01-14 13:59:50 +0100 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2014-01-14 14:01:14 +0100 |
commit | d6c4c2d5778d066e9a3f5c7bf576023c6c233d45 (patch) | |
tree | aaea497a7114b6b21412526cad9a4c17891e79c4 /doc/examples/ex-cert-select-pkcs11.c | |
parent | 19eef2f07625649f9674e911d3811c0eaaa13a9a (diff) | |
download | gnutls-d6c4c2d5778d066e9a3f5c7bf576023c6c233d45.tar.gz |
use default priorities based on version number in examples, and add dependency on 3.1.0
Diffstat (limited to 'doc/examples/ex-cert-select-pkcs11.c')
-rw-r--r-- | doc/examples/ex-cert-select-pkcs11.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/doc/examples/ex-cert-select-pkcs11.c b/doc/examples/ex-cert-select-pkcs11.c index bf66b4fbbf..2f623872c3 100644 --- a/doc/examples/ex-cert-select-pkcs11.c +++ b/doc/examples/ex-cert-select-pkcs11.c @@ -19,6 +19,12 @@ #include <fcntl.h> #include <getpass.h> /* for getpass() */ +#if GNUTLS_VERSION_NUMBER >= 0x030300 +# define DEFAULT_PRIORITY "SYSTEM" +#else +# define DEFAULT_PRIORITY "NORMAL" +#endif + /* A TLS client that loads the certificate and key. */ @@ -79,6 +85,11 @@ int main(void) /* Allow connections to servers that have OpenPGP keys as well. */ + if (gnutls_check_version("3.1.4") == NULL) { + fprintf(stderr, "GnuTLS 3.1.4 is required for this example\n"); + exit(1); + } + gnutls_global_init(); /* PKCS11 private key operations might require PIN. * Register a callback. @@ -89,7 +100,7 @@ int main(void) gnutls_certificate_allocate_credentials(&xcred); /* priorities */ - gnutls_priority_init(&priorities_cache, "SYSTEM", NULL); + gnutls_priority_init(&priorities_cache, DEFAULT_PRIORITY, NULL); /* sets the trusted cas file */ |