summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/ct/ct_oct.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/lib/libcrypto/ct/ct_oct.c28
1 files changed, 4 insertions, 24 deletions
diff --git a/src/lib/libcrypto/ct/ct_oct.c b/src/lib/libcrypto/ct/ct_oct.c
index 773e62a254..3dae7d8456 100644
--- a/src/lib/libcrypto/ct/ct_oct.c
+++ b/src/lib/libcrypto/ct/ct_oct.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ct_oct.c,v 1.6 2021/12/18 16:34:52 tb Exp $ */ 1/* $OpenBSD: ct_oct.c,v 1.7 2021/12/20 17:19:19 jsing Exp $ */
2/* 2/*
3 * Written by Rob Stradling (rob@comodo.com) and Stephen Henson 3 * Written by Rob Stradling (rob@comodo.com) and Stephen Henson
4 * (steve@openssl.org) for the OpenSSL project 2014. 4 * (steve@openssl.org) for the OpenSSL project 2014.
@@ -72,8 +72,8 @@
72#include "bytestring.h" 72#include "bytestring.h"
73#include "ct_local.h" 73#include "ct_local.h"
74 74
75static int 75int
76o2i_SCT_signature_internal(SCT *sct, CBS *cbs) 76o2i_SCT_signature(SCT *sct, CBS *cbs)
77{ 77{
78 uint8_t hash_alg, sig_alg; 78 uint8_t hash_alg, sig_alg;
79 CBS signature; 79 CBS signature;
@@ -119,26 +119,6 @@ o2i_SCT_signature_internal(SCT *sct, CBS *cbs)
119 return 0; 119 return 0;
120} 120}
121 121
122int
123o2i_SCT_signature(SCT *sct, const unsigned char **in, size_t len)
124{
125 size_t sig_len;
126 CBS cbs;
127
128 CBS_init(&cbs, *in, len);
129
130 if (!o2i_SCT_signature_internal(sct, &cbs))
131 return -1;
132
133 sig_len = len - CBS_len(&cbs);
134 if (sig_len > INT_MAX)
135 return -1;
136
137 *in = CBS_data(&cbs);
138
139 return sig_len;
140}
141
142static int 122static int
143o2i_SCT_internal(SCT **out_sct, CBS *cbs) 123o2i_SCT_internal(SCT **out_sct, CBS *cbs)
144{ 124{
@@ -182,7 +162,7 @@ o2i_SCT_internal(SCT **out_sct, CBS *cbs)
182 if (!CBS_stow(&extensions, &sct->ext, &sct->ext_len)) 162 if (!CBS_stow(&extensions, &sct->ext, &sct->ext_len))
183 goto err; 163 goto err;
184 164
185 if (!o2i_SCT_signature_internal(sct, cbs)) 165 if (!o2i_SCT_signature(sct, cbs))
186 goto err; 166 goto err;
187 167
188 if (CBS_len(cbs) != 0) 168 if (CBS_len(cbs) != 0)