diff options
Diffstat (limited to 'src/daemon/https/x509/mpi.c')
-rw-r--r-- | src/daemon/https/x509/mpi.c | 54 |
1 files changed, 0 insertions, 54 deletions
diff --git a/src/daemon/https/x509/mpi.c b/src/daemon/https/x509/mpi.c index e8563967..43f1a633 100644 --- a/src/daemon/https/x509/mpi.c +++ b/src/daemon/https/x509/mpi.c | |||
@@ -211,57 +211,3 @@ cleanup:MHD__asn1_delete_structure (&spk); | |||
211 | return result; | 211 | return result; |
212 | } | 212 | } |
213 | 213 | ||
214 | /* this function reads a (small) unsigned integer | ||
215 | * from asn1 structs. Combines the read and the convertion | ||
216 | * steps. | ||
217 | */ | ||
218 | int | ||
219 | MHD__gnutls_x509_read_uint (ASN1_TYPE node, const char *value, | ||
220 | unsigned int *ret) | ||
221 | { | ||
222 | int len, result; | ||
223 | opaque *tmpstr; | ||
224 | |||
225 | len = 0; | ||
226 | result = MHD__asn1_read_value (node, value, NULL, &len); | ||
227 | if (result != ASN1_MEM_ERROR) | ||
228 | { | ||
229 | MHD_gnutls_assert (); | ||
230 | return MHD_gtls_asn2err (result); | ||
231 | } | ||
232 | |||
233 | tmpstr = MHD_gnutls_alloca (len); | ||
234 | if (tmpstr == NULL) | ||
235 | { | ||
236 | MHD_gnutls_assert (); | ||
237 | return GNUTLS_E_MEMORY_ERROR; | ||
238 | } | ||
239 | |||
240 | result = MHD__asn1_read_value (node, value, tmpstr, &len); | ||
241 | |||
242 | if (result != ASN1_SUCCESS) | ||
243 | { | ||
244 | MHD_gnutls_assert (); | ||
245 | MHD_gnutls_afree (tmpstr); | ||
246 | return MHD_gtls_asn2err (result); | ||
247 | } | ||
248 | |||
249 | if (len == 1) | ||
250 | *ret = tmpstr[0]; | ||
251 | else if (len == 2) | ||
252 | *ret = MHD_gtls_read_uint16 (tmpstr); | ||
253 | else if (len == 3) | ||
254 | *ret = MHD_gtls_read_uint24 (tmpstr); | ||
255 | else if (len == 4) | ||
256 | *ret = MHD_gtls_read_uint32 (tmpstr); | ||
257 | else | ||
258 | { | ||
259 | MHD_gnutls_assert (); | ||
260 | MHD_gnutls_afree (tmpstr); | ||
261 | return GNUTLS_E_INTERNAL_ERROR; | ||
262 | } | ||
263 | |||
264 | MHD_gnutls_afree (tmpstr); | ||
265 | |||
266 | return 0; | ||
267 | } | ||