diff options
Diffstat (limited to 'doc/examples/ex-cert-select.c')
-rw-r--r-- | doc/examples/ex-cert-select.c | 61 |
1 files changed, 32 insertions, 29 deletions
diff --git a/doc/examples/ex-cert-select.c b/doc/examples/ex-cert-select.c index 35a90b00ba..fe38ac2807 100644 --- a/doc/examples/ex-cert-select.c +++ b/doc/examples/ex-cert-select.c @@ -264,38 +264,41 @@ cert_callback (gnutls_session_t session, gnutls_sign_algorithm_t cert_algo, req_algo; int i, match = 0; - ret = gnutls_x509_crt_get_signature_algorithm(crt); + ret = gnutls_x509_crt_get_signature_algorithm (crt); if (ret < 0) - { - /* error reading signature algorithm - */ - return -1; - } + { + /* error reading signature algorithm + */ + return -1; + } cert_algo = ret; - - i=0; - do { - ret = gnutls_sign_algorithm_get_requested(session, i, &req_algo); - if (ret >= 0 && cert_algo == req_algo) - { - match = 1; - break; - } - - /* server has not requested anything specific */ - if (i==0 && ret == GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE) - { - match = 1; - break; - } - i++; - } while(ret >= 0); - + + i = 0; + do + { + ret = gnutls_sign_algorithm_get_requested (session, i, &req_algo); + if (ret >= 0 && cert_algo == req_algo) + { + match = 1; + break; + } + + /* server has not requested anything specific */ + if (i == 0 && ret == GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE) + { + match = 1; + break; + } + i++; + } + while (ret >= 0); + if (match == 0) - { - printf("- Could not find a suitable certificate to send to server\n"); - return -1; - } + { + printf + ("- Could not find a suitable certificate to send to server\n"); + return -1; + } st->type = type; st->ncerts = 1; |