[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[SCM] GNU gnutls branch, master, updated. gnutls_3_0_17-44-gd096705
From: |
Nikos Mavrogiannopoulos |
Subject: |
[SCM] GNU gnutls branch, master, updated. gnutls_3_0_17-44-gd096705 |
Date: |
Sat, 31 Mar 2012 18:42:02 +0000 |
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU gnutls".
http://git.savannah.gnu.org/cgit/gnutls.git/commit/?id=d096705e9e0dd896db917b610707b830534e003c
The branch, master has been updated
via d096705e9e0dd896db917b610707b830534e003c (commit)
via 05eee078353374ca917d0df6adeee3567aa16386 (commit)
via b62ea11f02a748d413edc1341e46aef45b8fb7e6 (commit)
from 2734e50bd15800eb70fcebc764aafbf7e4d54c0e (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit d096705e9e0dd896db917b610707b830534e003c
Author: Nikos Mavrogiannopoulos <address@hidden>
Date: Sat Mar 31 19:57:34 2012 +0200
Make sure that GNUTLS_E_PREMATURE_TERMINATION is returned if there is
premature termination.
commit 05eee078353374ca917d0df6adeee3567aa16386
Author: Nikos Mavrogiannopoulos <address@hidden>
Date: Sat Mar 31 19:39:03 2012 +0200
do not build test with timers when posix timers are not present.
commit b62ea11f02a748d413edc1341e46aef45b8fb7e6
Author: Nikos Mavrogiannopoulos <address@hidden>
Date: Sat Mar 24 13:52:58 2012 +0100
corrected types
-----------------------------------------------------------------------
Summary of changes:
.gitignore | 1 +
NEWS | 3 +
lib/gnutls_record.c | 8 ++-
lib/opencdk/keydb.c | 2 +-
lib/opencdk/literal.c | 2 +-
tests/Makefile.am | 3 +-
tests/dtls/dtls-stress.c | 11 +++
tests/mini-dtls-rehandshake.c | 2 +
tests/mini-record.c | 2 +
tests/{mini-record.c => mini-termination.c} | 100 ++++-----------------------
10 files changed, 41 insertions(+), 93 deletions(-)
copy tests/{mini-record.c => mini-termination.c} (79%)
diff --git a/.gitignore b/.gitignore
index 7647d2d..f5dc3a7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -596,3 +596,4 @@ doc/stamp_functions
doc/latex/cha-upgrade.tex
doc/functions/
gl/glthread/.dirstamp
+tests/mini-termination
diff --git a/NEWS b/NEWS
index c8fded3..e035f75 100644
--- a/NEWS
+++ b/NEWS
@@ -7,6 +7,9 @@ See the end for copying conditions.
** certtool: Avoid a Y2K38 bug when generating certificates.
Patch by Robert Millan.
+** libgnutls: Make sure that GNUTLS_E_PREMATURE_TERMINATION
+is returned on premature termination (and added unit test).
+
** libgnutls: Fixes for W64 API. Patch by B. Scott Michel.
** libgnutls: Corrected VIA padlock detection for old
diff --git a/lib/gnutls_record.c b/lib/gnutls_record.c
index 28d0ee8..01c4fb0 100644
--- a/lib/gnutls_record.c
+++ b/lib/gnutls_record.c
@@ -868,9 +868,11 @@ gnutls_datum_t raw; /* raw headers */
if (ret < 0 && gnutls_error_is_fatal (ret) == 0)
return ret;
- if (ret >= 0)
+ if (ret > 0)
ret = GNUTLS_E_UNEXPECTED_PACKET_LENGTH;
-
+ else if (ret == 0)
+ ret = GNUTLS_E_PREMATURE_TERMINATION;
+
return gnutls_assert_val(ret);
}
@@ -1151,7 +1153,7 @@ recv_error:
session_unresumable (session);
if (ret == 0)
- return GNUTLS_E_PREMATURE_TERMINATION;
+ return GNUTLS_E_UNEXPECTED_PACKET_LENGTH;
else
return ret;
}
diff --git a/lib/opencdk/keydb.c b/lib/opencdk/keydb.c
index b8fe062..b74feda 100644
--- a/lib/opencdk/keydb.c
+++ b/lib/opencdk/keydb.c
@@ -117,7 +117,7 @@ keydb_idx_build (const char *file)
rc = cdk_pkt_read (inp, pkt);
if (rc)
{
- _cdk_log_debug ("index build failed packet off=%lu\n", pos);
+ _cdk_log_debug ("index build failed packet off=%lu\n", (unsigned
long)pos);
/* FIXME: The index is incomplete */
break;
}
diff --git a/lib/opencdk/literal.c b/lib/opencdk/literal.c
index bb86ec9..eb16188 100644
--- a/lib/opencdk/literal.c
+++ b/lib/opencdk/literal.c
@@ -120,7 +120,7 @@ literal_decode (void *data, FILE * in, FILE * out)
while (!feof (in))
{
_cdk_log_debug ("literal_decode: part on %d size %lu\n",
- (int) pfx->blkmode.on, pfx->blkmode.size);
+ (int) pfx->blkmode.on, (unsigned long)pfx->blkmode.size);
if (pfx->blkmode.on)
bufsize = pfx->blkmode.size;
else
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 2d78c8c..d16d8ea 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -67,7 +67,8 @@ ctests = mini-deflate simple gc set_pkcs12_cred certder
certuniqueid \
nul-in-x509-names x509_altname pkcs12_encode mini-x509 \
mini-rehandshake rng-fork mini-eagain-dtls resume-dtls \
x509cert x509cert-tl infoaccess rsa-encrypt-decrypt \
- mini-loss-time mini-tdb mini-dtls-rehandshake mini-record
+ mini-loss-time mini-tdb mini-dtls-rehandshake mini-record \
+ mini-termination
if ENABLE_OCSP
ctests += ocsp
diff --git a/tests/dtls/dtls-stress.c b/tests/dtls/dtls-stress.c
index 8eab309..6e85a80 100644
--- a/tests/dtls/dtls-stress.c
+++ b/tests/dtls/dtls-stress.c
@@ -96,6 +96,8 @@
#include <time.h>
#include <sys/wait.h>
+#if _POSIX_TIMERS && (_POSIX_TIMERS - 200112L) >= 0
+
// {{{ types
typedef struct {
@@ -1141,3 +1143,12 @@ int main(int argc, const char* argv[])
}
// vim: foldmethod=marker
+
+#else /* NO POSIX TIMERS */
+
+int main(int argc, const char* argv[])
+{
+ exit(77);
+}
+
+#endif
diff --git a/tests/mini-dtls-rehandshake.c b/tests/mini-dtls-rehandshake.c
index bc64e65..496d2f7 100644
--- a/tests/mini-dtls-rehandshake.c
+++ b/tests/mini-dtls-rehandshake.c
@@ -383,6 +383,7 @@ static void start (int server_initiated)
{
int status;
/* parent */
+ close(fd[1]);
server (fd[0], server_initiated);
wait (&status);
if (WEXITSTATUS(status) != 0)
@@ -390,6 +391,7 @@ static void start (int server_initiated)
}
else
{
+ close(fd[0]);
client (fd[1], server_initiated);
exit(0);
}
diff --git a/tests/mini-record.c b/tests/mini-record.c
index 2f05a54..5ed8551 100644
--- a/tests/mini-record.c
+++ b/tests/mini-record.c
@@ -385,11 +385,13 @@ static void start (const char* prio)
if (child)
{
/* parent */
+ close(fd[1]);
server (fd[0], prio);
kill(child, SIGTERM);
}
else
{
+ close(fd[0]);
client (fd[1], prio);
exit(0);
}
diff --git a/tests/mini-record.c b/tests/mini-termination.c
similarity index 79%
copy from tests/mini-record.c
copy to tests/mini-termination.c
index 2f05a54..1830ccd 100644
--- a/tests/mini-record.c
+++ b/tests/mini-termination.c
@@ -114,45 +114,6 @@ const gnutls_datum_t server_key = { server_key_pem,
#define MAX_BUF 1024
-static int to_send = -1;
-
-static ssize_t
-push (gnutls_transport_ptr_t tr, const void *data, size_t len)
-{
-int fd = (long int)tr;
-
- return send(fd, data, len, 0);
-}
-
-#define RECORD_HEADER_SIZE (5+8)
-
-static ssize_t
-push_crippled (gnutls_transport_ptr_t tr, const void *data, size_t len)
-{
-int fd = (long int)tr;
-int _len, ret;
-uint8_t* _data = (void*)data;
-
- if (to_send == -1)
- return send(fd, data, len, 0);
- else
- {
-// _len = ((uint8_t*)data)[11] << 8 | ((uint8_t*)data)[12];
-//fprintf(stderr, "len : %d\n", (int)_len);
-
- _len = to_send;
- _data[11] = _len >> 8;
- _data[12] = _len;
-
- /* correct len */
- ret = send(fd, data, RECORD_HEADER_SIZE+_len, 0);
-
- if (ret < 0) return ret;
-
- return len;
- }
-}
-
static void
client (int fd, const char* prio)
{
@@ -176,8 +137,7 @@ client (int fd, const char* prio)
/* Initialize TLS session
*/
- gnutls_init (&session, GNUTLS_CLIENT|GNUTLS_DATAGRAM);
- gnutls_dtls_set_mtu( session, 1500);
+ gnutls_init (&session, GNUTLS_CLIENT);
/* Use default priorities */
gnutls_priority_set_direct (session, prio, NULL);
@@ -188,7 +148,6 @@ client (int fd, const char* prio)
gnutls_credentials_set (session, GNUTLS_CRD_CERTIFICATE, x509_cred);
gnutls_transport_set_ptr (session, (gnutls_transport_ptr_t) fd);
- gnutls_transport_set_push_function (session, push);
/* Perform the TLS handshake
*/
@@ -214,32 +173,25 @@ client (int fd, const char* prio)
success ("client: TLS version is: %s\n",
gnutls_protocol_get_name (gnutls_protocol_get_version
(session)));
-
do {
do {
ret = gnutls_record_recv (session, buffer, MAX_BUF);
} while (ret == GNUTLS_E_AGAIN || ret == GNUTLS_E_INTERRUPTED);
} while( ret > 0);
- if (ret == 0)
+ if (ret == GNUTLS_E_PREMATURE_TERMINATION)
{
if (debug)
success ("client: Peer has closed the TLS connection\n");
goto end;
}
- else if (ret < 0)
+ else
{
- if (ret != 0)
- {
- fail ("client: Error: %s\n", gnutls_strerror (ret));
- exit(1);
- }
+ fail ("client: Unexpected error: %d (%s)\n", ret, gnutls_strerror (ret));
+ exit(1);
}
- gnutls_bye (session, GNUTLS_SHUT_WR);
-
end:
-
close (fd);
gnutls_deinit (session);
@@ -261,8 +213,7 @@ initialize_tls_session (const char* prio)
{
gnutls_session_t session;
- gnutls_init (&session, GNUTLS_SERVER|GNUTLS_DATAGRAM);
- gnutls_dtls_set_mtu( session, 1500);
+ gnutls_init (&session, GNUTLS_SERVER);
/* avoid calling all the priority functions, since the defaults
* are adequate.
@@ -308,7 +259,6 @@ gnutls_session_t session;
session = initialize_tls_session (prio);
gnutls_transport_set_ptr (session, (gnutls_transport_ptr_t) fd);
- gnutls_transport_set_push_function (session, push_crippled);
do
{
@@ -329,28 +279,7 @@ gnutls_session_t session;
success ("server: TLS version is: %s\n",
gnutls_protocol_get_name (gnutls_protocol_get_version
(session)));
- do
- {
- do {
- ret = gnutls_record_send (session, buffer, sizeof (buffer));
- } while (ret == GNUTLS_E_AGAIN || ret == GNUTLS_E_INTERRUPTED);
- usleep(400*1000);
-
- if (ret < 0)
- {
- fail("Error sending %d byte packet\n", to_send);
- terminate();
- }
- to_send++;
- }
- while(to_send < 64);
-
- to_send = -1;
- /* do not wait for the peer to close the connection.
- */
- gnutls_bye (session, GNUTLS_SHUT_WR);
-
- close (fd);
+ close(fd);
gnutls_deinit (session);
gnutls_anon_free_server_credentials (anoncred);
@@ -367,7 +296,7 @@ static void start (const char* prio)
int fd[2];
int ret;
- ret = socketpair(AF_LOCAL, SOCK_DGRAM, 0, fd);
+ ret = socketpair(AF_LOCAL, SOCK_STREAM, 0, fd);
if (ret < 0)
{
perror("socketpair");
@@ -385,20 +314,19 @@ static void start (const char* prio)
if (child)
{
/* parent */
+ close(fd[1]);
server (fd[0], prio);
- kill(child, SIGTERM);
+ waitpid(-1, NULL, 0);
+ //kill(child, SIGTERM);
}
else
{
+ close(fd[0]);
client (fd[1], prio);
exit(0);
}
}
-#define AES_CBC
"NONE:+VERS-DTLS1.0:-CIPHER-ALL:+AES-128-CBC:+SHA1:+SIGN-ALL:+COMP-ALL:+ANON-ECDH:+CURVE-ALL"
-#define AES_CBC_SHA256
"NONE:+VERS-DTLS1.0:-CIPHER-ALL:+RSA:+AES-128-CBC:+AES-256-CBC:+SHA256:+SIGN-ALL:+COMP-ALL:+ANON-ECDH:+CURVE-ALL"
-#define AES_GCM
"NONE:+VERS-DTLS1.0:-CIPHER-ALL:+RSA:+AES-128-GCM:+MAC-ALL:+SIGN-ALL:+COMP-ALL:+ANON-ECDH:+CURVE-ALL"
-
static void ch_handler(int sig)
{
int status;
@@ -420,9 +348,7 @@ doit (void)
{
signal(SIGCHLD, ch_handler);
- start(AES_CBC);
- start(AES_CBC_SHA256);
- start(AES_GCM);
+ start("NORMAL");
}
#endif /* _WIN32 */
hooks/post-receive
--
GNU gnutls
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [SCM] GNU gnutls branch, master, updated. gnutls_3_0_17-44-gd096705,
Nikos Mavrogiannopoulos <=