summaryrefslogtreecommitdiff
path: root/lib/gnutls_cert.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gnutls_cert.c')
-rw-r--r--lib/gnutls_cert.c174
1 files changed, 87 insertions, 87 deletions
diff --git a/lib/gnutls_cert.c b/lib/gnutls_cert.c
index bd55de5553..8b27b631f8 100644
--- a/lib/gnutls_cert.c
+++ b/lib/gnutls_cert.c
@@ -62,9 +62,9 @@ gnutls_certificate_free_keys (gnutls_certificate_credentials_t sc)
for (i = 0; i < sc->ncerts; i++)
{
for (j = 0; j < sc->cert_list_length[i]; j++)
- {
- _gnutls_gcert_deinit (&sc->cert_list[i][j]);
- }
+ {
+ _gnutls_gcert_deinit (&sc->cert_list[i][j]);
+ }
gnutls_free (sc->cert_list[i]);
}
@@ -125,8 +125,8 @@ gnutls_certificate_free_cas (gnutls_certificate_credentials_t sc)
**/
void
gnutls_certificate_get_x509_cas (gnutls_certificate_credentials_t sc,
- gnutls_x509_crt_t ** x509_ca_list,
- unsigned int *ncas)
+ gnutls_x509_crt_t ** x509_ca_list,
+ unsigned int *ncas)
{
*x509_ca_list = sc->x509_ca_list;
*ncas = sc->x509_ncas;
@@ -145,8 +145,8 @@ gnutls_certificate_get_x509_cas (gnutls_certificate_credentials_t sc,
**/
void
gnutls_certificate_get_x509_crls (gnutls_certificate_credentials_t sc,
- gnutls_x509_crl_t ** x509_crl_list,
- unsigned int *ncrls)
+ gnutls_x509_crl_t ** x509_crl_list,
+ unsigned int *ncrls)
{
*x509_crl_list = sc->x509_crl_list;
*ncrls = sc->x509_ncrls;
@@ -166,7 +166,7 @@ gnutls_certificate_get_x509_crls (gnutls_certificate_credentials_t sc,
**/
void
gnutls_certificate_get_openpgp_keyring (gnutls_certificate_credentials_t sc,
- gnutls_openpgp_keyring_t * keyring)
+ gnutls_openpgp_keyring_t * keyring)
{
*keyring = sc->keyring;
}
@@ -203,8 +203,8 @@ gnutls_certificate_free_ca_names (gnutls_certificate_credentials_t sc)
-*/
gnutls_rsa_params_t
_gnutls_certificate_get_rsa_params (gnutls_rsa_params_t rsa_params,
- gnutls_params_function * func,
- gnutls_session_t session)
+ gnutls_params_function * func,
+ gnutls_session_t session)
{
gnutls_params_st params;
int ret;
@@ -222,10 +222,10 @@ _gnutls_certificate_get_rsa_params (gnutls_rsa_params_t rsa_params,
{
ret = func (session, GNUTLS_PARAMS_RSA_EXPORT, &params);
if (ret == 0 && params.type == GNUTLS_PARAMS_RSA_EXPORT)
- {
- session->internals.params.rsa_params = params.params.rsa_export;
- session->internals.params.free_rsa_params = params.deinit;
- }
+ {
+ session->internals.params.rsa_params = params.params.rsa_export;
+ session->internals.params.free_rsa_params = params.deinit;
+ }
}
return session->internals.params.rsa_params;
@@ -272,7 +272,7 @@ gnutls_certificate_free_credentials (gnutls_certificate_credentials_t sc)
**/
int
gnutls_certificate_allocate_credentials (gnutls_certificate_credentials_t *
- res)
+ res)
{
*res = gnutls_calloc (1, sizeof (certificate_credentials_st));
@@ -294,8 +294,8 @@ gnutls_certificate_allocate_credentials (gnutls_certificate_credentials_t *
*/
int
_gnutls_selected_cert_supported_kx (gnutls_session_t session,
- gnutls_kx_algorithm_t ** alg,
- int *alg_size)
+ gnutls_kx_algorithm_t ** alg,
+ int *alg_size)
{
gnutls_kx_algorithm_t kx;
gnutls_pk_algorithm_t pk;
@@ -317,14 +317,14 @@ _gnutls_selected_cert_supported_kx (gnutls_session_t session,
{
pk = _gnutls_map_pk_get_pk (kx);
if (pk == cert->subject_pk_algorithm)
- {
- /* then check key usage */
- if (_gnutls_check_key_usage (cert, kx) == 0)
- {
- kxlist[i] = kx;
- i++;
- }
- }
+ {
+ /* then check key usage */
+ if (_gnutls_check_key_usage (cert, kx) == 0)
+ {
+ kxlist[i] = kx;
+ i++;
+ }
+ }
}
if (i == 0)
@@ -358,7 +358,7 @@ _gnutls_selected_cert_supported_kx (gnutls_session_t session,
**/
void
gnutls_certificate_server_set_request (gnutls_session_t session,
- gnutls_certificate_request_t req)
+ gnutls_certificate_request_t req)
{
session->internals.send_cert_req = req;
}
@@ -577,7 +577,7 @@ _gnutls_x509_get_raw_crt_expiration_time (const gnutls_datum_t * cert)
-*/
static int
_gnutls_openpgp_crt_verify_peers (gnutls_session_t session,
- unsigned int *status)
+ unsigned int *status)
{
cert_auth_info_t info;
gnutls_certificate_credentials_t cred;
@@ -618,7 +618,7 @@ _gnutls_openpgp_crt_verify_peers (gnutls_session_t session,
*/
ret =
_gnutls_openpgp_verify_key (cred, &info->raw_certificate_list[0],
- peer_certificate_list_size, status);
+ peer_certificate_list_size, status);
if (ret < 0)
{
@@ -653,7 +653,7 @@ _gnutls_openpgp_crt_verify_peers (gnutls_session_t session,
**/
int
gnutls_certificate_verify_peers2 (gnutls_session_t session,
- unsigned int *status)
+ unsigned int *status)
{
cert_auth_info_t info;
@@ -747,13 +747,13 @@ gnutls_certificate_expiration_time_peers (gnutls_session_t session)
{
case GNUTLS_CRT_X509:
return
- _gnutls_x509_get_raw_crt_expiration_time (&info->raw_certificate_list
- [0]);
+ _gnutls_x509_get_raw_crt_expiration_time (&info->raw_certificate_list
+ [0]);
#ifdef ENABLE_OPENPGP
case GNUTLS_CRT_OPENPGP:
return
- _gnutls_openpgp_get_raw_key_expiration_time
- (&info->raw_certificate_list[0]);
+ _gnutls_openpgp_get_raw_key_expiration_time
+ (&info->raw_certificate_list[0]);
#endif
default:
return (time_t) - 1;
@@ -794,13 +794,13 @@ gnutls_certificate_activation_time_peers (gnutls_session_t session)
{
case GNUTLS_CRT_X509:
return
- _gnutls_x509_get_raw_crt_activation_time (&info->raw_certificate_list
- [0]);
+ _gnutls_x509_get_raw_crt_activation_time (&info->raw_certificate_list
+ [0]);
#ifdef ENABLE_OPENPGP
case GNUTLS_CRT_OPENPGP:
return
- _gnutls_openpgp_get_raw_key_creation_time (&info->raw_certificate_list
- [0]);
+ _gnutls_openpgp_get_raw_key_creation_time (&info->raw_certificate_list
+ [0]);
#endif
default:
return (time_t) - 1;
@@ -812,22 +812,22 @@ gnutls_certificate_activation_time_peers (gnutls_session_t session)
*/
int
_gnutls_get_auth_info_gcert (gnutls_cert * gcert,
- gnutls_certificate_type_t type,
- cert_auth_info_t info,
- int flags /* OR of ConvFlags */ )
+ gnutls_certificate_type_t type,
+ cert_auth_info_t info,
+ int flags /* OR of ConvFlags */ )
{
switch (type)
{
case GNUTLS_CRT_X509:
return _gnutls_x509_raw_cert_to_gcert (gcert,
- &info->raw_certificate_list[0],
- flags);
+ &info->raw_certificate_list[0],
+ flags);
#ifdef ENABLE_OPENPGP
case GNUTLS_CRT_OPENPGP:
return _gnutls_openpgp_raw_crt_to_gcert (gcert,
- &info->raw_certificate_list[0],
- info->use_subkey ? info->
- subkey_id : NULL);
+ &info->raw_certificate_list[0],
+ info->use_subkey ? info->
+ subkey_id : NULL);
#endif
default:
gnutls_assert ();
@@ -846,8 +846,8 @@ _gnutls_get_auth_info_gcert (gnutls_cert * gcert,
*/
int
_gnutls_x509_raw_cert_to_gcert (gnutls_cert * gcert,
- const gnutls_datum_t * derCert,
- int flags /* OR of ConvFlags */ )
+ const gnutls_datum_t * derCert,
+ int flags /* OR of ConvFlags */ )
{
int ret;
gnutls_x509_crt_t cert;
@@ -877,7 +877,7 @@ _gnutls_x509_raw_cert_to_gcert (gnutls_cert * gcert,
*/
int
_gnutls_x509_crt_to_gcert (gnutls_cert * gcert,
- gnutls_x509_crt_t cert, unsigned int flags)
+ gnutls_x509_crt_t cert, unsigned int flags)
{
int ret = 0;
@@ -896,39 +896,39 @@ _gnutls_x509_crt_to_gcert (gnutls_cert * gcert,
*/
der = gnutls_malloc (SMALL_DER);
if (der == NULL)
- {
- gnutls_assert ();
- return GNUTLS_E_MEMORY_ERROR;
- }
+ {
+ gnutls_assert ();
+ return GNUTLS_E_MEMORY_ERROR;
+ }
ret =
- gnutls_x509_crt_export (cert, GNUTLS_X509_FMT_DER, der, &der_size);
+ gnutls_x509_crt_export (cert, GNUTLS_X509_FMT_DER, der, &der_size);
if (ret < 0 && ret != GNUTLS_E_SHORT_MEMORY_BUFFER)
- {
- gnutls_assert ();
- gnutls_free (der);
- return ret;
- }
+ {
+ gnutls_assert ();
+ gnutls_free (der);
+ return ret;
+ }
if (ret == GNUTLS_E_SHORT_MEMORY_BUFFER)
- {
- der = gnutls_realloc (der, der_size);
- if (der == NULL)
- {
- gnutls_assert ();
- return GNUTLS_E_MEMORY_ERROR;
- }
-
- ret =
- gnutls_x509_crt_export (cert, GNUTLS_X509_FMT_DER, der,
- &der_size);
- if (ret < 0)
- {
- gnutls_assert ();
- gnutls_free (der);
- return ret;
- }
- }
+ {
+ der = gnutls_realloc (der, der_size);
+ if (der == NULL)
+ {
+ gnutls_assert ();
+ return GNUTLS_E_MEMORY_ERROR;
+ }
+
+ ret =
+ gnutls_x509_crt_export (cert, GNUTLS_X509_FMT_DER, der,
+ &der_size);
+ if (ret < 0)
+ {
+ gnutls_assert ();
+ gnutls_free (der);
+ return ret;
+ }
+ }
gcert->raw.data = der;
gcert->raw.size = der_size;
@@ -942,12 +942,12 @@ _gnutls_x509_crt_to_gcert (gnutls_cert * gcert,
{
ret = gnutls_x509_crt_get_key_usage (cert, &gcert->key_usage, NULL);
if (ret == GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE)
- gcert->key_usage = 0;
+ gcert->key_usage = 0;
else if (ret < 0)
- {
- gnutls_assert ();
- return ret;
- }
+ {
+ gnutls_assert ();
+ return ret;
+ }
gcert->version = gnutls_x509_crt_get_version (cert);
}
gcert->subject_pk_algorithm = gnutls_x509_crt_get_pk_algorithm (cert, NULL);
@@ -956,12 +956,12 @@ _gnutls_x509_crt_to_gcert (gnutls_cert * gcert,
{
gcert->params_size = MAX_PUBLIC_PARAMS_SIZE;
ret =
- _gnutls_x509_crt_get_mpis (cert, gcert->params, &gcert->params_size);
+ _gnutls_x509_crt_get_mpis (cert, gcert->params, &gcert->params_size);
if (ret < 0)
- {
- gnutls_assert ();
- return ret;
- }
+ {
+ gnutls_assert ();
+ return ret;
+ }
}
return 0;
@@ -1005,7 +1005,7 @@ _gnutls_gcert_deinit (gnutls_cert * cert)
**/
void
gnutls_sign_callback_set (gnutls_session_t session,
- gnutls_sign_func sign_func, void *userdata)
+ gnutls_sign_func sign_func, void *userdata)
{
session->internals.sign_func = sign_func;
session->internals.sign_func_userdata = userdata;