summaryrefslogtreecommitdiff
path: root/lib/gnutls_ui.c
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2005-11-16 11:27:54 +0000
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2005-11-16 11:27:54 +0000
commitff9d41344c4173ac266bde54b539ac567dae4fad (patch)
tree5e56839c29447bf8d145c29165a8a5396df9da39 /lib/gnutls_ui.c
parente7aa562b565766608dc3a246b2112fc9b5374cf4 (diff)
downloadgnutls-ff9d41344c4173ac266bde54b539ac567dae4fad.tar.gz
Completed the DHE-PSK ciphersuite additions.
Diffstat (limited to 'lib/gnutls_ui.c')
-rw-r--r--lib/gnutls_ui.c57
1 files changed, 52 insertions, 5 deletions
diff --git a/lib/gnutls_ui.c b/lib/gnutls_ui.c
index 2a03586588..e0250f126d 100644
--- a/lib/gnutls_ui.c
+++ b/lib/gnutls_ui.c
@@ -30,6 +30,7 @@
#include <auth_srp.h>
#include <auth_anon.h>
#include <auth_cert.h>
+#include <auth_psk.h>
#include <gnutls_errors.h>
#include <gnutls_auth_int.h>
#include <gnutls_state.h>
@@ -80,8 +81,9 @@ gnutls_dh_get_group (gnutls_session_t session,
{
dh_info_st *dh;
int ret;
- anon_server_auth_info_t anon_info;
+ anon_auth_info_t anon_info;
cert_auth_info_t cert_info;
+ psk_auth_info_t psk_info;
switch (gnutls_auth_get_type (session))
{
@@ -91,6 +93,12 @@ gnutls_dh_get_group (gnutls_session_t session,
return GNUTLS_E_INTERNAL_ERROR;
dh = &anon_info->dh;
break;
+ case GNUTLS_CRD_PSK:
+ psk_info = _gnutls_get_auth_info (session);
+ if (psk_info == NULL)
+ return GNUTLS_E_INTERNAL_ERROR;
+ dh = &psk_info->dh;
+ break;
case GNUTLS_CRD_CERTIFICATE:
cert_info = _gnutls_get_auth_info (session);
if (cert_info == NULL)
@@ -136,8 +144,9 @@ int
gnutls_dh_get_pubkey (gnutls_session_t session, gnutls_datum_t * raw_key)
{
dh_info_st *dh;
- anon_server_auth_info_t anon_info;
+ anon_auth_info_t anon_info;
cert_auth_info_t cert_info;
+ cert_auth_info_t psk_info;
switch (gnutls_auth_get_type (session))
{
@@ -149,6 +158,14 @@ gnutls_dh_get_pubkey (gnutls_session_t session, gnutls_datum_t * raw_key)
dh = &anon_info->dh;
break;
}
+ case GNUTLS_CRD_PSK:
+ {
+ psk_info = _gnutls_get_auth_info (session);
+ if (psk_info == NULL)
+ return GNUTLS_E_INTERNAL_ERROR;
+ dh = &psk_info->dh;
+ break;
+ }
case GNUTLS_CRD_CERTIFICATE:
{
@@ -234,7 +251,16 @@ gnutls_dh_get_secret_bits (gnutls_session_t session)
{
case GNUTLS_CRD_ANON:
{
- anon_server_auth_info_t info;
+ anon_auth_info_t info;
+
+ info = _gnutls_get_auth_info (session);
+ if (info == NULL)
+ return GNUTLS_E_INTERNAL_ERROR;
+ return info->dh.secret_bits;
+ }
+ case GNUTLS_CRD_PSK:
+ {
+ psk_auth_info_t info;
info = _gnutls_get_auth_info (session);
if (info == NULL)
@@ -276,7 +302,17 @@ gnutls_dh_get_prime_bits (gnutls_session_t session)
{
case GNUTLS_CRD_ANON:
{
- anon_server_auth_info_t info;
+ anon_auth_info_t info;
+
+ info = _gnutls_get_auth_info (session);
+ if (info == NULL)
+ return GNUTLS_E_INTERNAL_ERROR;
+ dh = &info->dh;
+ break;
+ }
+ case GNUTLS_CRD_PSK:
+ {
+ psk_auth_info_t info;
info = _gnutls_get_auth_info (session);
if (info == NULL)
@@ -343,7 +379,18 @@ gnutls_dh_get_peers_public_bits (gnutls_session_t session)
{
case GNUTLS_CRD_ANON:
{
- anon_server_auth_info_t info;
+ anon_auth_info_t info;
+
+ info = _gnutls_get_auth_info (session);
+ if (info == NULL)
+ return GNUTLS_E_INTERNAL_ERROR;
+
+ dh = &info->dh;
+ break;
+ }
+ case GNUTLS_CRD_PSK:
+ {
+ psk_auth_info_t info;
info = _gnutls_get_auth_info (session);
if (info == NULL)