summaryrefslogtreecommitdiff
path: root/src/lib/libssl/t1_hash.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libssl/t1_hash.c')
-rw-r--r--src/lib/libssl/t1_hash.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/lib/libssl/t1_hash.c b/src/lib/libssl/t1_hash.c
index f514c5290e..50e0ad3ca0 100644
--- a/src/lib/libssl/t1_hash.c
+++ b/src/lib/libssl/t1_hash.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: t1_hash.c,v 1.4 2018/11/08 22:28:52 jsing Exp $ */ 1/* $OpenBSD: t1_hash.c,v 1.5 2018/11/21 15:13:29 jsing Exp $ */
2/* 2/*
3 * Copyright (c) 2017 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2017 Joel Sing <jsing@openbsd.org>
4 * 4 *
@@ -118,7 +118,7 @@ tls1_transcript_init(SSL *s)
118 if ((S3I(s)->handshake_transcript = BUF_MEM_new()) == NULL) 118 if ((S3I(s)->handshake_transcript = BUF_MEM_new()) == NULL)
119 return 0; 119 return 0;
120 120
121 s->s3->flags &= ~TLS1_FLAGS_FREEZE_TRANSCRIPT; 121 tls1_transcript_reset(s);
122 122
123 return 1; 123 return 1;
124} 124}
@@ -130,6 +130,21 @@ tls1_transcript_free(SSL *s)
130 S3I(s)->handshake_transcript = NULL; 130 S3I(s)->handshake_transcript = NULL;
131} 131}
132 132
133void
134tls1_transcript_reset(SSL *s)
135{
136 /*
137 * We should check the return value of BUF_MEM_grow_clean(), however
138 * due to yet another bad API design, when called with a length of zero
139 * it is impossible to tell if it succeeded (returning a length of zero)
140 * or if it failed (and returned zero)... our implementation never
141 * fails with a length of zero, so we trust all is okay...
142 */
143 (void)BUF_MEM_grow_clean(S3I(s)->handshake_transcript, 0);
144
145 s->s3->flags &= ~TLS1_FLAGS_FREEZE_TRANSCRIPT;
146}
147
133int 148int
134tls1_transcript_append(SSL *s, const unsigned char *buf, size_t len) 149tls1_transcript_append(SSL *s, const unsigned char *buf, size_t len)
135{ 150{