VirtualBox

source: vbox/trunk/src/VBox/Runtime/common/asn1/asn1-cursor.cpp@ 52533

Last change on this file since 52533 was 52533, checked in by vboxsync, 11 years ago

ASN.1 decoding: limit nesting.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
  • Property svn:mergeinfo set to (toggle deleted branches)
    /branches/VBox-3.0/src/VBox/Runtime/common/asn1/asn1-basics.cpp58652,​70973
    /branches/VBox-3.2/src/VBox/Runtime/common/asn1/asn1-basics.cpp66309,​66318
    /branches/VBox-4.0/src/VBox/Runtime/common/asn1/asn1-basics.cpp70873
    /branches/VBox-4.1/src/VBox/Runtime/common/asn1/asn1-basics.cpp74233,​78414,​78691,​81841,​82127,​85941,​85944-85947,​85949-85950,​85953,​86701,​86728,​87009
    /branches/VBox-4.2/src/VBox/Runtime/common/asn1/asn1-basics.cpp86229-86230,​86234,​86529,​91503-91504,​91506-91508,​91510,​91514-91515,​91521
    /branches/VBox-4.3/src/VBox/Runtime/common/asn1/asn1-basics.cpp91223
    /branches/VBox-4.3/trunk/src/VBox/Runtime/common/asn1/asn1-basics.cpp91223
    /branches/andy/draganddrop/src/VBox/Runtime/common/asn1/asn1-basics.cpp90781-91268
    /branches/andy/guestctrl20/src/VBox/Runtime/common/asn1/asn1-basics.cpp78916,​78930
    /branches/dsen/gui/src/VBox/Runtime/common/asn1/asn1-basics.cpp79076-79078,​79089,​79109-79110,​79112-79113,​79127-79130,​79134,​79141,​79151,​79155,​79157-79159,​79193,​79197
    /branches/dsen/gui2/src/VBox/Runtime/common/asn1/asn1-basics.cpp79224,​79228,​79233,​79235,​79258,​79262-79263,​79273,​79341,​79345,​79354,​79357,​79387-79388,​79559-79569,​79572-79573,​79578,​79581-79582,​79590-79591,​79598-79599,​79602-79603,​79605-79606,​79632,​79635,​79637,​79644
    /branches/dsen/gui3/src/VBox/Runtime/common/asn1/asn1-basics.cpp79645-79692
File size: 21.1 KB
Line 
1/* $Id: asn1-cursor.cpp 52533 2014-08-29 22:51:39Z vboxsync $ */
2/** @file
3 * IPRT - ASN.1, Basic Operations.
4 */
5
6/*
7 * Copyright (C) 2006-2014 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 *
17 * The contents of this file may alternatively be used under the terms
18 * of the Common Development and Distribution License Version 1.0
19 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
20 * VirtualBox OSE distribution, in which case the provisions of the
21 * CDDL are applicable instead of those of the GPL.
22 *
23 * You may elect to license modified versions of this file under the
24 * terms and conditions of either the GPL or the CDDL or both.
25 */
26
27/*******************************************************************************
28* Header Files *
29*******************************************************************************/
30#include "internal/iprt.h"
31#include <iprt/asn1.h>
32
33#include <iprt/alloca.h>
34#include <iprt/err.h>
35#include <iprt/string.h>
36#include <iprt/ctype.h>
37
38#include <iprt/formats/asn1.h>
39
40
41/*******************************************************************************
42* Defined Constants And Macros *
43*******************************************************************************/
44/** @def RTASN1_MAX_NESTING
45 * The maximum nesting depth we allow. This limit is enforced to avoid running
46 * out of stack due to malformed ASN.1 input.
47 *
48 * For reference, 'RTSignTool verify-exe RTSignTool.exe', requires a value of 15
49 * to work without hitting the limit.
50 */
51#ifdef IN_RING3
52# define RTASN1_MAX_NESTING 64
53#else
54# define RTASN1_MAX_NESTING 32
55#endif
56
57
58/*******************************************************************************
59* Global Variables *
60*******************************************************************************/
61static char const g_achDigits[11] = "0123456789";
62
63
64
65RTDECL(PRTASN1CURSOR) RTAsn1CursorInitPrimary(PRTASN1CURSORPRIMARY pPrimaryCursor, void const *pvFirst, uint32_t cb,
66 PRTERRINFO pErrInfo, PCRTASN1ALLOCATORVTABLE pAllocator, uint32_t fFlags,
67 const char *pszErrorTag)
68{
69 pPrimaryCursor->Cursor.pbCur = (uint8_t const *)pvFirst;
70 pPrimaryCursor->Cursor.cbLeft = cb;
71 pPrimaryCursor->Cursor.fFlags = fFlags;
72 pPrimaryCursor->Cursor.cDepth = 0;
73 pPrimaryCursor->Cursor.abReserved[0] = 0;
74 pPrimaryCursor->Cursor.abReserved[1] = 0;
75 pPrimaryCursor->Cursor.pPrimary = pPrimaryCursor;
76 pPrimaryCursor->Cursor.pUp = NULL;
77 pPrimaryCursor->Cursor.pszErrorTag = pszErrorTag;
78 pPrimaryCursor->pErrInfo = pErrInfo;
79 pPrimaryCursor->pAllocator = pAllocator;
80 return &pPrimaryCursor->Cursor;
81}
82
83
84RTDECL(int) RTAsn1CursorInitSub(PRTASN1CURSOR pParent, uint32_t cb, PRTASN1CURSOR pChild, const char *pszErrorTag)
85{
86 AssertReturn(pParent->pPrimary, VERR_ASN1_INTERNAL_ERROR_1);
87 AssertReturn(pParent->pbCur, VERR_ASN1_INTERNAL_ERROR_2);
88
89 pChild->pbCur = pParent->pbCur;
90 pChild->cbLeft = cb;
91 pChild->fFlags = pParent->fFlags;
92 pChild->cDepth = pParent->cDepth + 1;
93 AssertReturn(pChild->cDepth < RTASN1_MAX_NESTING, VERR_ASN1_TOO_DEEPLY_NESTED);
94 pChild->abReserved[0] = 0;
95 pChild->abReserved[1] = 0;
96 pChild->pPrimary = pParent->pPrimary;
97 pChild->pUp = pParent;
98 pChild->pszErrorTag = pszErrorTag;
99
100 AssertReturn(pParent->cbLeft >= cb, VERR_ASN1_INTERNAL_ERROR_3);
101 pParent->pbCur += cb;
102 pParent->cbLeft -= cb;
103
104 return VINF_SUCCESS;
105}
106
107
108RTDECL(int) RTAsn1CursorInitSubFromCore(PRTASN1CURSOR pParent, PRTASN1CORE pAsn1Core,
109 PRTASN1CURSOR pChild, const char *pszErrorTag)
110{
111 AssertReturn(pParent->pPrimary, VERR_ASN1_INTERNAL_ERROR_1);
112 AssertReturn(pParent->pbCur, VERR_ASN1_INTERNAL_ERROR_2);
113
114 pChild->pbCur = pAsn1Core->uData.pu8;
115 pChild->cbLeft = pAsn1Core->cb;
116 pChild->fFlags = pParent->fFlags;
117 pChild->cDepth = pParent->cDepth + 1;
118 AssertReturn(pChild->cDepth < RTASN1_MAX_NESTING, VERR_ASN1_TOO_DEEPLY_NESTED);
119 pChild->abReserved[0] = 0;
120 pChild->abReserved[1] = 0;
121 pChild->pPrimary = pParent->pPrimary;
122 pChild->pUp = pParent;
123 pChild->pszErrorTag = pszErrorTag;
124
125 return VINF_SUCCESS;
126}
127
128
129RTDECL(int) RTAsn1CursorSetInfoV(PRTASN1CURSOR pCursor, int rc, const char *pszMsg, va_list va)
130{
131 PRTERRINFO pErrInfo = pCursor->pPrimary->pErrInfo;
132 if (pErrInfo)
133 {
134 /* Format the message. */
135 RTErrInfoSetV(pErrInfo, rc, pszMsg, va);
136
137 /* Add the prefixes. This isn't the fastest way, but it's the one
138 which eats the least stack. */
139 char *pszBuf = pErrInfo->pszMsg;
140 size_t cbBuf = pErrInfo->cbMsg;
141 if (pszBuf && cbBuf > 32)
142 {
143 size_t cbMove = strlen(pszBuf) + 1;
144
145 /* Make sure there is a ': '. */
146 bool fFirst = false;
147 if (pszMsg[0] != '%' || pszMsg[1] != 's' || pszMsg[2] != ':')
148 {
149 if (cbMove + 2 < cbBuf)
150 {
151 memmove(pszBuf + 2, pszBuf, cbMove);
152 pszBuf[0] = ':';
153 pszBuf[1] = ' ';
154 cbMove += 2;
155 fFirst = true;
156 }
157 }
158
159 /* Add the prefixes from the cursor chain. */
160 while (pCursor)
161 {
162 if (pCursor->pszErrorTag)
163 {
164 size_t cchErrorTag = strlen(pCursor->pszErrorTag);
165 if (cchErrorTag + !fFirst + cbMove > cbBuf)
166 break;
167 memmove(pszBuf + cchErrorTag + !fFirst, pszBuf, cbMove);
168 memcpy(pszBuf, pCursor->pszErrorTag, cchErrorTag);
169 if (!fFirst)
170 pszBuf[cchErrorTag] = '.';
171 cbMove += cchErrorTag + !fFirst;
172 fFirst = false;
173 }
174 pCursor = pCursor->pUp;
175 }
176 }
177 }
178
179 return rc;
180}
181
182
183RTDECL(int) RTAsn1CursorSetInfo(PRTASN1CURSOR pCursor, int rc, const char *pszMsg, ...)
184{
185 va_list va;
186 va_start(va, pszMsg);
187 rc = RTAsn1CursorSetInfoV(pCursor, rc, pszMsg, va);
188 va_end(va);
189 return rc;
190}
191
192
193RTDECL(int) RTAsn1CursorCheckEnd(PRTASN1CURSOR pCursor)
194{
195 if (pCursor->cbLeft == 0)
196 return VINF_SUCCESS;
197 return RTAsn1CursorSetInfo(pCursor, VERR_ASN1_CURSOR_NOT_AT_END,
198 "%u (%#x) bytes left over", pCursor->cbLeft, pCursor->cbLeft);
199}
200
201
202RTDECL(PRTASN1ALLOCATION) RTAsn1CursorInitAllocation(PRTASN1CURSOR pCursor, PRTASN1ALLOCATION pAllocation)
203{
204 pAllocation->cbAllocated = 0;
205 pAllocation->cReallocs = 0;
206 pAllocation->uReserved0 = 0;
207 pAllocation->pAllocator = pCursor->pPrimary->pAllocator;
208 return pAllocation;
209}
210
211
212RTDECL(int) RTAsn1CursorReadHdr(PRTASN1CURSOR pCursor, PRTASN1CORE pAsn1Core, const char *pszErrorTag)
213{
214 /*
215 * Initialize the return structure in case of failure.
216 */
217 pAsn1Core->uTag = 0;
218 pAsn1Core->fClass = 0;
219 pAsn1Core->uRealTag = 0;
220 pAsn1Core->fRealClass = 0;
221 pAsn1Core->cbHdr = 0;
222 pAsn1Core->cb = 0;
223 pAsn1Core->fFlags = 0;
224 pAsn1Core->uData.pv = NULL;
225 pAsn1Core->pOps = NULL;
226
227 /*
228 * The header has at least two bytes: Type & length.
229 */
230 if (pCursor->cbLeft >= 2)
231 {
232 uint32_t uTag = pCursor->pbCur[0];
233 uint32_t cb = pCursor->pbCur[1];
234 pCursor->cbLeft -= 2;
235 pCursor->pbCur += 2;
236
237 pAsn1Core->uRealTag = pAsn1Core->uTag = uTag & ASN1_TAG_MASK;
238 pAsn1Core->fRealClass = pAsn1Core->fClass = uTag & ~ASN1_TAG_MASK;
239 pAsn1Core->cbHdr = 2;
240 if ((uTag & ASN1_TAG_MASK) == ASN1_TAG_USE_LONG_FORM)
241 return RTAsn1CursorSetInfo(pCursor, VERR_ASN1_CURSOR_LONG_TAG,
242 "%s: Implement parsing of tags > 30: %#x (length=%#x)", pszErrorTag, uTag, cb);
243
244 /* Extended length field? */
245 if (cb & RT_BIT(7))
246 {
247 if (cb != RT_BIT(7))
248 {
249 /* Definite form. */
250 uint8_t cbEnc = cb & 0x7f;
251 if (cbEnc > pCursor->cbLeft)
252 return RTAsn1CursorSetInfo(pCursor, VERR_ASN1_CURSOR_BAD_LENGTH_ENCODING,
253 "%s: Extended BER length field longer than available data: %#x vs %#x (uTag=%#x)",
254 pszErrorTag, cbEnc, pCursor->cbLeft, uTag);
255 switch (cbEnc)
256 {
257 case 1:
258 cb = pCursor->pbCur[0];
259 break;
260 case 2:
261 cb = RT_MAKE_U16(pCursor->pbCur[1], pCursor->pbCur[0]);
262 break;
263 case 3:
264 cb = RT_MAKE_U32_FROM_U8(pCursor->pbCur[2], pCursor->pbCur[1], pCursor->pbCur[0], 0);
265 break;
266 case 4:
267 cb = RT_MAKE_U32_FROM_U8(pCursor->pbCur[3], pCursor->pbCur[2], pCursor->pbCur[1], pCursor->pbCur[0]);
268 break;
269 default:
270 return RTAsn1CursorSetInfo(pCursor, VERR_ASN1_CURSOR_BAD_LENGTH_ENCODING,
271 "%s: Too long/short extended BER length field: %#x (uTag=%#x)",
272 pszErrorTag, cbEnc, uTag);
273 }
274 pCursor->cbLeft -= cbEnc;
275 pCursor->pbCur += cbEnc;
276 pAsn1Core->cbHdr += cbEnc;
277
278 /* Check the length encoding efficiency (T-REC-X.690-200811 10.1, 9.1). */
279 if (pCursor->fFlags & (RTASN1CURSOR_FLAGS_DER | RTASN1CURSOR_FLAGS_CER))
280 {
281 if (cb <= 0x7f)
282 return RTAsn1CursorSetInfo(pCursor, VERR_ASN1_CURSOR_BAD_LENGTH_ENCODING,
283 "%s: Invalid DER/CER length encoding: cbEnc=%u cb=%#x uTag=%#x",
284 pszErrorTag, cbEnc, cb, uTag);
285 uint8_t cbNeeded;
286 if (cb <= 0x000000ff) cbNeeded = 1;
287 else if (cb <= 0x0000ffff) cbNeeded = 2;
288 else if (cb <= 0x00ffffff) cbNeeded = 3;
289 else cbNeeded = 4;
290 if (cbNeeded != cbEnc)
291 return RTAsn1CursorSetInfo(pCursor, VERR_ASN1_CURSOR_BAD_LENGTH_ENCODING,
292 "%s: Invalid DER/CER length encoding: cb=%#x uTag=%#x cbEnc=%u cbNeeded=%u",
293 pszErrorTag, cb, uTag, cbEnc, cbNeeded);
294 }
295 }
296 /* Indefinite form. */
297 else if (pCursor->fFlags & RTASN1CURSOR_FLAGS_DER)
298 return RTAsn1CursorSetInfo(pCursor, VERR_ASN1_CURSOR_ILLEGAL_IDEFINITE_LENGTH,
299 "%s: Indefinite length form not allowed in DER mode (uTag=%#x).", pszErrorTag, uTag);
300 else
301 return RTAsn1CursorSetInfo(pCursor, VERR_ASN1_CURSOR_IDEFINITE_LENGTH_NOT_SUP,
302 "%s: Indefinite BER/CER length not supported (uTag=%#x)", pszErrorTag, uTag);
303 }
304
305 /* Check if the length makes sense. */
306 if (cb > pCursor->cbLeft)
307 return RTAsn1CursorSetInfo(pCursor, VERR_ASN1_CURSOR_BAD_LENGTH,
308 "%s: BER value length out of bounds: %#x (max=%#x uTag=%#x)",
309 pszErrorTag, cb, pCursor->cbLeft, uTag);
310
311 pAsn1Core->fFlags |= RTASN1CORE_F_PRESENT | RTASN1CORE_F_DECODED_CONTENT;
312 pAsn1Core->cb = cb;
313 pAsn1Core->uData.pv = (void *)pCursor->pbCur;
314 return VINF_SUCCESS;
315 }
316
317 if (pCursor->cbLeft)
318 return RTAsn1CursorSetInfo(pCursor, VERR_ASN1_CURSOR_TOO_LITTLE_DATA_LEFT,
319 "%s: Too little data left to form a valid BER header", pszErrorTag);
320 return RTAsn1CursorSetInfo(pCursor, VERR_ASN1_CURSOR_NO_MORE_DATA,
321 "%s: No more data reading BER header", pszErrorTag);
322}
323
324
325RTDECL(int) RTAsn1CursorMatchTagClassFlagsEx(PRTASN1CURSOR pCursor, PRTASN1CORE pAsn1Core, uint32_t uTag, uint32_t fClass,
326 bool fString, uint32_t fFlags, const char *pszErrorTag, const char *pszWhat)
327{
328 if (pAsn1Core->uTag == uTag)
329 {
330 if (pAsn1Core->fClass == fClass)
331 return VINF_SUCCESS;
332 if ( fString
333 && pAsn1Core->fClass == (fClass | ASN1_TAGFLAG_CONSTRUCTED))
334 {
335 if (!(pCursor->fFlags & (RTASN1CURSOR_FLAGS_DER | RTASN1CURSOR_FLAGS_CER)))
336 return VINF_SUCCESS;
337 if (pCursor->fFlags & RTASN1CURSOR_FLAGS_CER)
338 {
339 if (pAsn1Core->cb > 1000)
340 return VINF_SUCCESS;
341 return RTAsn1CursorSetInfo(pCursor, VERR_ASN1_CURSOR_ILLEGAL_CONSTRUCTED_STRING,
342 "%s: Constructed %s only allowed for >1000 byte in CER encoding: cb=%#x uTag=%#x fClass=%#x",
343 pszErrorTag, pszWhat, pAsn1Core->cb, pAsn1Core->uTag, pAsn1Core->fClass);
344 }
345 return RTAsn1CursorSetInfo(pCursor, VERR_ASN1_CURSOR_ILLEGAL_CONSTRUCTED_STRING,
346 "%s: DER encoding does not allow constructed %s (cb=%#x uTag=%#x fClass=%#x)",
347 pszErrorTag, pszWhat, pAsn1Core->cb, pAsn1Core->uTag, pAsn1Core->fClass);
348 }
349 }
350
351 if (fFlags & RTASN1CURSOR_GET_F_IMPLICIT)
352 {
353 pAsn1Core->fFlags |= RTASN1CORE_F_TAG_IMPLICIT;
354 pAsn1Core->uRealTag = uTag;
355 pAsn1Core->fRealClass = fClass;
356 return VINF_SUCCESS;
357 }
358
359 return RTAsn1CursorSetInfo(pCursor, pAsn1Core->uTag != uTag ? VERR_ASN1_CURSOR_TAG_MISMATCH : VERR_ASN1_CURSOR_TAG_FLAG_CLASS_MISMATCH,
360 "%s: Unexpected %s type/flags: %#x/%#x (expected %#x/%#x)",
361 pszErrorTag, pszWhat, pAsn1Core->uTag, pAsn1Core->fClass, uTag, fClass);
362}
363
364
365
366static int rtAsn1CursorGetXxxxCursor(PRTASN1CURSOR pCursor, uint32_t fFlags, uint32_t uTag, uint8_t fClass,
367 PRTASN1CORE pAsn1Core, PRTASN1CURSOR pRetCursor,
368 const char *pszErrorTag, const char *pszWhat)
369{
370 int rc = RTAsn1CursorReadHdr(pCursor, pAsn1Core, pszErrorTag);
371 if (RT_SUCCESS(rc))
372 {
373 if ( pAsn1Core->uTag == uTag
374 && pAsn1Core->fClass == fClass)
375 rc = VINF_SUCCESS;
376 else if (fFlags & RTASN1CURSOR_GET_F_IMPLICIT)
377 {
378 pAsn1Core->fFlags |= RTASN1CORE_F_TAG_IMPLICIT;
379 pAsn1Core->uRealTag = uTag;
380 pAsn1Core->fRealClass = fClass;
381 rc = VINF_SUCCESS;
382 }
383 else
384 return RTAsn1CursorSetInfo(pCursor, VERR_ASN1_CURSOR_ILLEGAL_CONSTRUCTED_STRING,
385 "%s: Unexpected %s type/flags: %#x/%#x (expected %#x/%#x)",
386 pszErrorTag, pszWhat, pAsn1Core->uTag, pAsn1Core->fClass, uTag, fClass);
387 rc = RTAsn1CursorInitSub(pCursor, pAsn1Core->cb, pRetCursor, pszErrorTag);
388 if (RT_SUCCESS(rc))
389 {
390 pAsn1Core->fFlags |= RTASN1CORE_F_PRIMITE_TAG_STRUCT;
391 return VINF_SUCCESS;
392 }
393 }
394 return rc;
395}
396
397
398RTDECL(int) RTAsn1CursorGetSequenceCursor(PRTASN1CURSOR pCursor, uint32_t fFlags,
399 PRTASN1SEQUENCECORE pSeqCore, PRTASN1CURSOR pSeqCursor, const char *pszErrorTag)
400{
401 return rtAsn1CursorGetXxxxCursor(pCursor, fFlags, ASN1_TAG_SEQUENCE, ASN1_TAGCLASS_UNIVERSAL | ASN1_TAGFLAG_CONSTRUCTED,
402 &pSeqCore->Asn1Core, pSeqCursor, pszErrorTag, "sequence");
403}
404
405
406RTDECL(int) RTAsn1CursorGetSetCursor(PRTASN1CURSOR pCursor, uint32_t fFlags,
407 PRTASN1SETCORE pSetCore, PRTASN1CURSOR pSetCursor, const char *pszErrorTag)
408{
409 return rtAsn1CursorGetXxxxCursor(pCursor, fFlags, ASN1_TAG_SET, ASN1_TAGCLASS_UNIVERSAL | ASN1_TAGFLAG_CONSTRUCTED,
410 &pSetCore->Asn1Core, pSetCursor, pszErrorTag, "set");
411}
412
413
414RTDECL(int) RTAsn1CursorGetContextTagNCursor(PRTASN1CURSOR pCursor, uint32_t fFlags, uint32_t uExpectedTag,
415 PRTASN1CONTEXTTAG pCtxTag, PRTASN1CURSOR pCtxTagCursor, const char *pszErrorTag)
416{
417 return rtAsn1CursorGetXxxxCursor(pCursor, fFlags, uExpectedTag, ASN1_TAGCLASS_CONTEXT | ASN1_TAGFLAG_CONSTRUCTED,
418 &pCtxTag->Asn1Core, pCtxTagCursor, pszErrorTag, "ctx tag");
419}
420
421
422RTDECL(int) RTAsn1CursorPeek(PRTASN1CURSOR pCursor, PRTASN1CORE pAsn1Core)
423{
424 uint32_t cbSavedLeft = pCursor->cbLeft;
425 uint8_t const *pbSavedCur = pCursor->pbCur;
426 PRTERRINFO pErrInfo = pCursor->pPrimary->pErrInfo;
427 pCursor->pPrimary->pErrInfo = NULL;
428
429 int rc = RTAsn1CursorReadHdr(pCursor, pAsn1Core, "peek");
430
431 pCursor->pPrimary->pErrInfo = pErrInfo;
432 pCursor->pbCur = pbSavedCur;
433 pCursor->cbLeft = cbSavedLeft;
434 return rc;
435}
436
437
438RTDECL(bool) RTAsn1CursorIsNextEx(PRTASN1CURSOR pCursor, uint32_t uTag, uint8_t fClass)
439{
440 RTASN1CORE Asn1Core;
441 int rc = RTAsn1CursorPeek(pCursor, &Asn1Core);
442 if (RT_SUCCESS(rc))
443 return uTag == Asn1Core.uTag
444 && fClass == Asn1Core.fClass;
445 return false;
446}
447
448
449/** @name Legacy Interfaces.
450 * @{ */
451RTDECL(int) RTAsn1CursorGetCore(PRTASN1CURSOR pCursor, uint32_t fFlags, PRTASN1CORE pAsn1Core, const char *pszErrorTag)
452{
453 return RTAsn1Core_DecodeAsn1(pCursor, fFlags, pAsn1Core, pszErrorTag);
454}
455
456
457RTDECL(int) RTAsn1CursorGetNull(PRTASN1CURSOR pCursor, uint32_t fFlags, PRTASN1NULL pNull, const char *pszErrorTag)
458{
459 return RTAsn1Null_DecodeAsn1(pCursor, fFlags, pNull, pszErrorTag);
460}
461
462
463RTDECL(int) RTAsn1CursorGetInteger(PRTASN1CURSOR pCursor, uint32_t fFlags, PRTASN1INTEGER pInteger, const char *pszErrorTag)
464{
465 return RTAsn1Integer_DecodeAsn1(pCursor, fFlags, pInteger, pszErrorTag);
466}
467
468
469RTDECL(int) RTAsn1CursorGetBoolean(PRTASN1CURSOR pCursor, uint32_t fFlags, PRTASN1BOOLEAN pBoolean, const char *pszErrorTag)
470{
471 return RTAsn1Boolean_DecodeAsn1(pCursor, fFlags, pBoolean, pszErrorTag);
472}
473
474
475RTDECL(int) RTAsn1CursorGetObjId(PRTASN1CURSOR pCursor, uint32_t fFlags, PRTASN1OBJID pObjId, const char *pszErrorTag)
476{
477 return RTAsn1ObjId_DecodeAsn1(pCursor, fFlags, pObjId, pszErrorTag);
478}
479
480
481RTDECL(int) RTAsn1CursorGetTime(PRTASN1CURSOR pCursor, uint32_t fFlags, PRTASN1TIME pTime, const char *pszErrorTag)
482{
483 return RTAsn1Time_DecodeAsn1(pCursor, fFlags, pTime, pszErrorTag);
484}
485
486
487RTDECL(int) RTAsn1CursorGetBitStringEx(PRTASN1CURSOR pCursor, uint32_t fFlags, uint32_t cMaxBits, PRTASN1BITSTRING pBitString,
488 const char *pszErrorTag)
489{
490 return RTAsn1BitString_DecodeAsn1Ex(pCursor, fFlags, cMaxBits, pBitString, pszErrorTag);
491}
492
493
494RTDECL(int) RTAsn1CursorGetBitString(PRTASN1CURSOR pCursor, uint32_t fFlags, PRTASN1BITSTRING pBitString, const char *pszErrorTag)
495{
496 return RTAsn1BitString_DecodeAsn1(pCursor, fFlags, pBitString, pszErrorTag);
497}
498
499
500RTDECL(int) RTAsn1CursorGetOctetString(PRTASN1CURSOR pCursor, uint32_t fFlags, PRTASN1OCTETSTRING pOctetString,
501 const char *pszErrorTag)
502{
503 return RTAsn1OctetString_DecodeAsn1(pCursor, fFlags, pOctetString, pszErrorTag);
504}
505
506
507RTDECL(int) RTAsn1CursorGetString(PRTASN1CURSOR pCursor, uint32_t fFlags, PRTASN1STRING pString, const char *pszErrorTag)
508{
509 return RTAsn1String_DecodeAsn1(pCursor, fFlags, pString, pszErrorTag);
510}
511
512
513RTDECL(int) RTAsn1CursorGetIa5String(PRTASN1CURSOR pCursor, uint32_t fFlags, PRTASN1STRING pString, const char *pszErrorTag)
514{
515 return RTAsn1Ia5String_DecodeAsn1(pCursor, fFlags, pString, pszErrorTag);
516}
517
518
519RTDECL(int) RTAsn1CursorGetUtf8String(PRTASN1CURSOR pCursor, uint32_t fFlags, PRTASN1STRING pString, const char *pszErrorTag)
520{
521 return RTAsn1Utf8String_DecodeAsn1(pCursor, fFlags, pString, pszErrorTag);
522}
523
524
525RTDECL(int) RTAsn1CursorGetBmpString(PRTASN1CURSOR pCursor, uint32_t fFlags, PRTASN1STRING pString, const char *pszErrorTag)
526{
527 return RTAsn1BmpString_DecodeAsn1(pCursor, fFlags, pString, pszErrorTag);
528}
529
530
531RTDECL(int) RTAsn1CursorGetDynType(PRTASN1CURSOR pCursor, uint32_t fFlags, PRTASN1DYNTYPE pDynType, const char *pszErrorTag)
532{
533 return RTAsn1DynType_DecodeAsn1(pCursor, fFlags, pDynType, pszErrorTag);
534}
535/** @} */
536
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette