summaryrefslogtreecommitdiff
path: root/lib/gnutls_anon_cred.c
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2004-03-11 11:32:37 +0000
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2004-03-11 11:32:37 +0000
commitcb738bc84a50a6815f6bbe291f5d0e38c39cf0bc (patch)
treed67773503b45d8e7877c8ce76193f518bf414918 /lib/gnutls_anon_cred.c
parent2ba9bd33a9aaaec9804bce2df1b1ab8a78c70329 (diff)
downloadgnutls-cb738bc84a50a6815f6bbe291f5d0e38c39cf0bc.tar.gz
Added gnutls_certificate_set_params_function() and
gnutls_anon_set_params_function() that set the RSA or DH parameters using a callback.
Diffstat (limited to 'lib/gnutls_anon_cred.c')
-rw-r--r--lib/gnutls_anon_cred.c30
1 files changed, 29 insertions, 1 deletions
diff --git a/lib/gnutls_anon_cred.c b/lib/gnutls_anon_cred.c
index 42b61bdf74..dbfc28c0aa 100644
--- a/lib/gnutls_anon_cred.c
+++ b/lib/gnutls_anon_cred.c
@@ -40,11 +40,39 @@ static const int anon_dummy;
* This structure is complex enough to manipulate directly thus
* this helper function is provided in order to free (deallocate) it.
**/
-void gnutls_anon_free_server_credentials( gnutls_anon_server_credentials sc) {
+void gnutls_anon_free_server_credentials( gnutls_anon_server_credentials sc)
+{
gnutls_free( sc);
}
+/*-
+ * _gnutls_anon_get_dh_params - Returns the DH parameters pointer
+ * @sc: is an &gnutls_certificate_credentials structure.
+ *
+ * This function will return the dh parameters pointer.
+ *
+ -*/
+gnutls_dh_params _gnutls_anon_get_dh_params(const gnutls_anon_server_credentials sc,
+ gnutls_session session)
+{
+gnutls_params_st params;
+int ret;
+
+ if (session->internals.anon_dh_params) return session->internals.anon_dh_params;
+
+ if (sc->dh_params) {
+ session->internals.anon_dh_params = sc->dh_params;
+ } else if (sc->params_func) {
+ ret = sc->params_func( session, GNUTLS_PARAMS_DH, &params);
+ if (ret == 0 && params.type == GNUTLS_PARAMS_DH) {
+ session->internals.anon_dh_params = params.params.dh;
+ }
+ }
+
+ return session->internals.anon_dh_params;
+}
+
/**
* gnutls_anon_allocate_server_credentials - Used to allocate an gnutls_anon_server_credentials structure
* @sc: is a pointer to an &gnutls_anon_server_credentials structure.