return ret;
}
+
+/* Frees the rsa_info_st structure.
+ */
+void _gnutls_free_rsa_info( rsa_info_st* rsa)
+{
+ _gnutls_free_datum( &rsa->modulus);
+ _gnutls_free_datum( &rsa->exponent);
+}
+
typedef struct cert_auth_info_st cert_auth_info_st;
+void _gnutls_free_rsa_info( rsa_info_st* rsa);
+
/* AUTH X509 functions */
int _gnutls_gen_cert_server_certificate(gnutls_session_t, opaque **);
int _gnutls_gen_cert_client_certificate(gnutls_session_t, opaque **);
#include <gnutls_state.h>
#include <auth_dh_common.h>
+/* Frees the dh_info_st structure.
+ */
+void _gnutls_free_dh_info( dh_info_st* dh)
+{
+ dh->secret_bits = 0;
+ _gnutls_free_datum( &dh->prime);
+ _gnutls_free_datum( &dh->generator);
+ _gnutls_free_datum( &dh->public_key);
+}
+
int _gnutls_proc_dh_common_client_kx(gnutls_session_t session,
opaque * data, size_t _data_size,
mpi_t g, mpi_t p)
gnutls_datum_t public_key;
} dh_info_st;
+void _gnutls_free_dh_info( dh_info_st* dh);
int _gnutls_gen_dh_common_client_kx(gnutls_session_t, opaque **);
int _gnutls_proc_dh_common_client_kx(gnutls_session_t session,
opaque * data, size_t _data_size,
-*/
void _gnutls_free_auth_info(gnutls_session_t session)
{
+dh_info_st *dh_info;
+rsa_info_st * rsa_info;
+
if (session == NULL || session->key == NULL) {
gnutls_assert();
return;
switch (session->key->auth_info_type) {
case GNUTLS_CRD_SRP:
- case GNUTLS_CRD_ANON:
+ break;
+ case GNUTLS_CRD_ANON: {
+ anon_auth_info_t info = _gnutls_get_auth_info(session);
+
+ if (info == NULL)
+ break;
+ dh_info = &info->dh;
+ _gnutls_free_dh_info( dh_info);
+ }
break;
case GNUTLS_CRD_CERTIFICATE:{
unsigned int i;
if (info == NULL)
break;
+
+ dh_info = &info->dh;
+ rsa_info = &info->rsa_export;
for (i = 0; i < info->ncerts; i++) {
_gnutls_free_datum(&info->raw_certificate_list[i]);
}
gnutls_free(info->raw_certificate_list);
info->raw_certificate_list = NULL;
info->ncerts = 0;
+
+ _gnutls_free_dh_info( dh_info);
+ _gnutls_free_rsa_info( rsa_info);
}
* If the EINTR is returned by the internal push function (the default is recv())
* then GNUTLS_E_INTERRUPTED will be returned. If GNUTLS_E_INTERRUPTED or
* GNUTLS_E_AGAIN is returned, you must call this function again, with the
- * same parameters; cf. gnutls_record_get_direction(). Alternatively
- * you could provide a NULL pointer for data, and 0 for size.
- * Otherwise the write operation will be corrupted and the connection
- * will be terminated.
+ * same parameters; alternatively you could provide a NULL pointer for data,
+ * and 0 for size. cf. gnutls_record_get_direction().
*
* Returns the number of bytes sent, or a negative error code. The number
* of bytes sent might be less than @sizeofdata. The maximum number of bytes
/* Delete the DH parameters. (this might need to be moved to a function)
*/
info = session->key->auth_info;
+ _gnutls_free_dh_info( &info->dh);
memset(&info->dh, 0, sizeof(dh_info_st));
}
break;
/* Delete the dh_info_st and rsa_info_st fields.
*/
+ _gnutls_free_dh_info( &info->dh);
+ _gnutls_free_rsa_info( &info->rsa_export);
memset(&info->dh, 0, sizeof(dh_info_st));
memset(&info->rsa_export, 0, sizeof(rsa_info_st));