diff options
Diffstat (limited to 'src/lib/libssl/ssl_transcript.c')
-rw-r--r-- | src/lib/libssl/ssl_transcript.c | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/src/lib/libssl/ssl_transcript.c b/src/lib/libssl/ssl_transcript.c index 47aa15adc2..c54cdb22cb 100644 --- a/src/lib/libssl/ssl_transcript.c +++ b/src/lib/libssl/ssl_transcript.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ssl_transcript.c,v 1.5 2021/05/16 14:10:43 jsing Exp $ */ | 1 | /* $OpenBSD: ssl_transcript.c,v 1.6 2022/02/05 14:54:10 jsing Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2017 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2017 Joel Sing <jsing@openbsd.org> |
4 | * | 4 | * |
@@ -33,11 +33,11 @@ tls1_transcript_hash_init(SSL *s) | |||
33 | goto err; | 33 | goto err; |
34 | } | 34 | } |
35 | 35 | ||
36 | if ((S3I(s)->handshake_hash = EVP_MD_CTX_new()) == NULL) { | 36 | if ((s->s3->handshake_hash = EVP_MD_CTX_new()) == NULL) { |
37 | SSLerror(s, ERR_R_MALLOC_FAILURE); | 37 | SSLerror(s, ERR_R_MALLOC_FAILURE); |
38 | goto err; | 38 | goto err; |
39 | } | 39 | } |
40 | if (!EVP_DigestInit_ex(S3I(s)->handshake_hash, md, NULL)) { | 40 | if (!EVP_DigestInit_ex(s->s3->handshake_hash, md, NULL)) { |
41 | SSLerror(s, ERR_R_EVP_LIB); | 41 | SSLerror(s, ERR_R_EVP_LIB); |
42 | goto err; | 42 | goto err; |
43 | } | 43 | } |
@@ -62,10 +62,10 @@ tls1_transcript_hash_init(SSL *s) | |||
62 | int | 62 | int |
63 | tls1_transcript_hash_update(SSL *s, const unsigned char *buf, size_t len) | 63 | tls1_transcript_hash_update(SSL *s, const unsigned char *buf, size_t len) |
64 | { | 64 | { |
65 | if (S3I(s)->handshake_hash == NULL) | 65 | if (s->s3->handshake_hash == NULL) |
66 | return 1; | 66 | return 1; |
67 | 67 | ||
68 | return EVP_DigestUpdate(S3I(s)->handshake_hash, buf, len); | 68 | return EVP_DigestUpdate(s->s3->handshake_hash, buf, len); |
69 | } | 69 | } |
70 | 70 | ||
71 | int | 71 | int |
@@ -76,17 +76,17 @@ tls1_transcript_hash_value(SSL *s, const unsigned char *out, size_t len, | |||
76 | unsigned int mdlen; | 76 | unsigned int mdlen; |
77 | int ret = 0; | 77 | int ret = 0; |
78 | 78 | ||
79 | if (S3I(s)->handshake_hash == NULL) | 79 | if (s->s3->handshake_hash == NULL) |
80 | goto err; | 80 | goto err; |
81 | 81 | ||
82 | if (EVP_MD_CTX_size(S3I(s)->handshake_hash) > len) | 82 | if (EVP_MD_CTX_size(s->s3->handshake_hash) > len) |
83 | goto err; | 83 | goto err; |
84 | 84 | ||
85 | if ((mdctx = EVP_MD_CTX_new()) == NULL) { | 85 | if ((mdctx = EVP_MD_CTX_new()) == NULL) { |
86 | SSLerror(s, ERR_R_MALLOC_FAILURE); | 86 | SSLerror(s, ERR_R_MALLOC_FAILURE); |
87 | goto err; | 87 | goto err; |
88 | } | 88 | } |
89 | if (!EVP_MD_CTX_copy_ex(mdctx, S3I(s)->handshake_hash)) { | 89 | if (!EVP_MD_CTX_copy_ex(mdctx, s->s3->handshake_hash)) { |
90 | SSLerror(s, ERR_R_EVP_LIB); | 90 | SSLerror(s, ERR_R_EVP_LIB); |
91 | goto err; | 91 | goto err; |
92 | } | 92 | } |
@@ -108,17 +108,17 @@ tls1_transcript_hash_value(SSL *s, const unsigned char *out, size_t len, | |||
108 | void | 108 | void |
109 | tls1_transcript_hash_free(SSL *s) | 109 | tls1_transcript_hash_free(SSL *s) |
110 | { | 110 | { |
111 | EVP_MD_CTX_free(S3I(s)->handshake_hash); | 111 | EVP_MD_CTX_free(s->s3->handshake_hash); |
112 | S3I(s)->handshake_hash = NULL; | 112 | s->s3->handshake_hash = NULL; |
113 | } | 113 | } |
114 | 114 | ||
115 | int | 115 | int |
116 | tls1_transcript_init(SSL *s) | 116 | tls1_transcript_init(SSL *s) |
117 | { | 117 | { |
118 | if (S3I(s)->handshake_transcript != NULL) | 118 | if (s->s3->handshake_transcript != NULL) |
119 | return 0; | 119 | return 0; |
120 | 120 | ||
121 | if ((S3I(s)->handshake_transcript = BUF_MEM_new()) == NULL) | 121 | if ((s->s3->handshake_transcript = BUF_MEM_new()) == NULL) |
122 | return 0; | 122 | return 0; |
123 | 123 | ||
124 | tls1_transcript_reset(s); | 124 | tls1_transcript_reset(s); |
@@ -129,8 +129,8 @@ tls1_transcript_init(SSL *s) | |||
129 | void | 129 | void |
130 | tls1_transcript_free(SSL *s) | 130 | tls1_transcript_free(SSL *s) |
131 | { | 131 | { |
132 | BUF_MEM_free(S3I(s)->handshake_transcript); | 132 | BUF_MEM_free(s->s3->handshake_transcript); |
133 | S3I(s)->handshake_transcript = NULL; | 133 | s->s3->handshake_transcript = NULL; |
134 | } | 134 | } |
135 | 135 | ||
136 | void | 136 | void |
@@ -143,7 +143,7 @@ tls1_transcript_reset(SSL *s) | |||
143 | * or if it failed (and returned zero)... our implementation never | 143 | * or if it failed (and returned zero)... our implementation never |
144 | * fails with a length of zero, so we trust all is okay... | 144 | * fails with a length of zero, so we trust all is okay... |
145 | */ | 145 | */ |
146 | (void)BUF_MEM_grow_clean(S3I(s)->handshake_transcript, 0); | 146 | (void)BUF_MEM_grow_clean(s->s3->handshake_transcript, 0); |
147 | 147 | ||
148 | tls1_transcript_unfreeze(s); | 148 | tls1_transcript_unfreeze(s); |
149 | } | 149 | } |
@@ -153,22 +153,22 @@ tls1_transcript_append(SSL *s, const unsigned char *buf, size_t len) | |||
153 | { | 153 | { |
154 | size_t olen, nlen; | 154 | size_t olen, nlen; |
155 | 155 | ||
156 | if (S3I(s)->handshake_transcript == NULL) | 156 | if (s->s3->handshake_transcript == NULL) |
157 | return 1; | 157 | return 1; |
158 | 158 | ||
159 | if (s->s3->flags & TLS1_FLAGS_FREEZE_TRANSCRIPT) | 159 | if (s->s3->flags & TLS1_FLAGS_FREEZE_TRANSCRIPT) |
160 | return 1; | 160 | return 1; |
161 | 161 | ||
162 | olen = S3I(s)->handshake_transcript->length; | 162 | olen = s->s3->handshake_transcript->length; |
163 | nlen = olen + len; | 163 | nlen = olen + len; |
164 | 164 | ||
165 | if (nlen < olen) | 165 | if (nlen < olen) |
166 | return 0; | 166 | return 0; |
167 | 167 | ||
168 | if (BUF_MEM_grow(S3I(s)->handshake_transcript, nlen) == 0) | 168 | if (BUF_MEM_grow(s->s3->handshake_transcript, nlen) == 0) |
169 | return 0; | 169 | return 0; |
170 | 170 | ||
171 | memcpy(S3I(s)->handshake_transcript->data + olen, buf, len); | 171 | memcpy(s->s3->handshake_transcript->data + olen, buf, len); |
172 | 172 | ||
173 | return 1; | 173 | return 1; |
174 | } | 174 | } |
@@ -176,11 +176,11 @@ tls1_transcript_append(SSL *s, const unsigned char *buf, size_t len) | |||
176 | int | 176 | int |
177 | tls1_transcript_data(SSL *s, const unsigned char **data, size_t *len) | 177 | tls1_transcript_data(SSL *s, const unsigned char **data, size_t *len) |
178 | { | 178 | { |
179 | if (S3I(s)->handshake_transcript == NULL) | 179 | if (s->s3->handshake_transcript == NULL) |
180 | return 0; | 180 | return 0; |
181 | 181 | ||
182 | *data = S3I(s)->handshake_transcript->data; | 182 | *data = s->s3->handshake_transcript->data; |
183 | *len = S3I(s)->handshake_transcript->length; | 183 | *len = s->s3->handshake_transcript->length; |
184 | 184 | ||
185 | return 1; | 185 | return 1; |
186 | } | 186 | } |