diff options
author | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2012-09-30 10:21:53 +0200 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2012-09-30 10:22:33 +0200 |
commit | bcd53f59d2630243aac2fe4ea6ae6742856903f8 (patch) | |
tree | 61f7c56bfcc4a1a8aacf6e6ac10b895063c5a931 /lib | |
parent | 33e6e795e4d53f13b53b5e4a310a7c1404177207 (diff) | |
download | gnutls-bcd53f59d2630243aac2fe4ea6ae6742856903f8.tar.gz |
removed unused functions.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/auth/psk.c | 15 | ||||
-rw-r--r-- | lib/gnutls_datum.c | 34 | ||||
-rw-r--r-- | lib/gnutls_datum.h | 5 | ||||
-rw-r--r-- | lib/gnutls_x509.c | 8 |
4 files changed, 17 insertions, 45 deletions
diff --git a/lib/auth/psk.c b/lib/auth/psk.c index 34d95decce..858f2f9978 100644 --- a/lib/auth/psk.c +++ b/lib/auth/psk.c @@ -68,6 +68,7 @@ _gnutls_set_psk_session_key (gnutls_session_t session, { gnutls_datum_t pwd_psk = { NULL, 0 }; size_t dh_secret_size; + uint8_t * p; int ret; if (dh_secret == NULL) @@ -92,12 +93,18 @@ _gnutls_set_psk_session_key (gnutls_session_t session, * (uint16_t) psk_size * the psk */ - _gnutls_write_uint16 (dh_secret_size, session->key->key.data); + p = session->key->key.data; + _gnutls_write_uint16 (dh_secret_size, p); + p+=2; if (dh_secret == NULL) - memset (&session->key->key.data[2], 0, dh_secret_size); + memset (p, 0, dh_secret_size); else - memcpy (&session->key->key.data[2], dh_secret->data, dh_secret->size); - _gnutls_write_datum16 (&session->key->key.data[dh_secret_size + 2], *ppsk); + memcpy (p, dh_secret->data, dh_secret->size); + + p += dh_secret_size; + _gnutls_write_uint16 (ppsk->size, p); + if (ppsk->data != NULL) + memcpy (p+2, ppsk->data, ppsk->size); ret = 0; diff --git a/lib/gnutls_datum.c b/lib/gnutls_datum.c index 9a6d55d09c..acbde1f0aa 100644 --- a/lib/gnutls_datum.c +++ b/lib/gnutls_datum.c @@ -30,40 +30,6 @@ #include <gnutls_datum.h> #include <gnutls_errors.h> - -void -_gnutls_write_datum16 (uint8_t * dest, gnutls_datum_t dat) -{ - _gnutls_write_uint16 (dat.size, dest); - if (dat.data != NULL) - memcpy (&dest[2], dat.data, dat.size); -} - -void -_gnutls_write_datum24 (uint8_t * dest, gnutls_datum_t dat) -{ - _gnutls_write_uint24 (dat.size, dest); - if (dat.data != NULL) - memcpy (&dest[3], dat.data, dat.size); -} - -void -_gnutls_write_datum32 (uint8_t * dest, gnutls_datum_t dat) -{ - _gnutls_write_uint32 (dat.size, dest); - if (dat.data != NULL) - memcpy (&dest[4], dat.data, dat.size); -} - -void -_gnutls_write_datum8 (uint8_t * dest, gnutls_datum_t dat) -{ - dest[0] = (uint8_t) dat.size; - if (dat.data != NULL) - memcpy (&dest[1], dat.data, dat.size); -} - - int _gnutls_set_datum (gnutls_datum_t * dat, const void *data, size_t data_size) diff --git a/lib/gnutls_datum.h b/lib/gnutls_datum.h index bf8e6502e6..5442c2bf20 100644 --- a/lib/gnutls_datum.h +++ b/lib/gnutls_datum.h @@ -23,11 +23,6 @@ #ifndef GNUTLS_DATUM_H #define GNUTLS_DATUM_H -void _gnutls_write_datum16 (uint8_t * dest, gnutls_datum_t dat); -void _gnutls_write_datum24 (uint8_t * dest, gnutls_datum_t dat); -void _gnutls_write_datum32 (uint8_t * dest, gnutls_datum_t dat); -void _gnutls_write_datum8 (uint8_t * dest, gnutls_datum_t dat); - int _gnutls_set_datum (gnutls_datum_t * dat, const void *data, size_t data_size); diff --git a/lib/gnutls_x509.c b/lib/gnutls_x509.c index 3806a76a68..49ac9b1ff2 100644 --- a/lib/gnutls_x509.c +++ b/lib/gnutls_x509.c @@ -1176,7 +1176,7 @@ add_new_crt_to_rdn_seq (gnutls_certificate_credentials_t res, gnutls_x509_crt_t* gnutls_datum_t tmp; int ret; size_t newsize; - unsigned char *newdata; + unsigned char *newdata, *p; unsigned i; /* Add DN of the last added CAs to the RDN sequence @@ -1216,7 +1216,11 @@ add_new_crt_to_rdn_seq (gnutls_certificate_credentials_t res, gnutls_x509_crt_t* return GNUTLS_E_MEMORY_ERROR; } - _gnutls_write_datum16 (newdata + res->x509_rdn_sequence.size, tmp); + p = newdata + res->x509_rdn_sequence.size; + _gnutls_write_uint16 (tmp.size, p); + if (tmp.data != NULL) + memcpy (p+2, tmp.data, tmp.size); + _gnutls_free_datum (&tmp); res->x509_rdn_sequence.size = newsize; |