summaryrefslogtreecommitdiff
path: root/lib/stek.c
diff options
context:
space:
mode:
authorDaiki Ueno <ueno@gnu.org>2020-06-02 21:45:17 +0200
committerDaiki Ueno <ueno@gnu.org>2020-06-03 09:04:53 +0200
commit3d7fae761e65e9d0f16d7247ee8a464d4fe002da (patch)
treeda56f736bf3cedc75d95f6c5c2ba924ff7c2e496 /lib/stek.c
parentc2646aeee94e71cb15c90a3147cf3b5b0ca158ca (diff)
downloadgnutls-3d7fae761e65e9d0f16d7247ee8a464d4fe002da.tar.gz
valgrind: check if session ticket key is used without initializationtmp-totp-init
This adds a valgrind client request for session->key.session_ticket_key to make sure that it is not used without initialization. Signed-off-by: Daiki Ueno <ueno@gnu.org>
Diffstat (limited to 'lib/stek.c')
-rw-r--r--lib/stek.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/stek.c b/lib/stek.c
index 5ab9e7d2d1..316555b49a 100644
--- a/lib/stek.c
+++ b/lib/stek.c
@@ -21,6 +21,9 @@
*/
#include "gnutls_int.h"
#include "stek.h"
+#ifdef HAVE_VALGRIND_MEMCHECK_H
+#include <valgrind/memcheck.h>
+#endif
#define NAME_POS (0)
#define KEY_POS (TICKET_KEY_NAME_SIZE)
@@ -143,6 +146,11 @@ static int rotate(gnutls_session_t session)
call_rotation_callback(session, key, t);
session->key.totp.last_result = t;
memcpy(session->key.session_ticket_key, key, sizeof(key));
+#ifdef HAVE_VALGRIND_MEMCHECK_H
+ if (RUNNING_ON_VALGRIND)
+ VALGRIND_MAKE_MEM_DEFINED(session->key.session_ticket_key,
+ TICKET_MASTER_KEY_SIZE);
+#endif
session->key.totp.was_rotated = 1;
} else if (t < 0) {