asn1-ut-objid.cpp revision 597418a165dce3e1c1330096dff7ac95c90d7099
9968d7771a8d493de063d80f5ccae1815356a08cvboxsync * IPRT - ASN.1, OBJECT IDENTIFIER Type.
9968d7771a8d493de063d80f5ccae1815356a08cvboxsync * Copyright (C) 2006-2014 Oracle Corporation
9968d7771a8d493de063d80f5ccae1815356a08cvboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
9968d7771a8d493de063d80f5ccae1815356a08cvboxsync * available from http://www.virtualbox.org. This file is free software;
9968d7771a8d493de063d80f5ccae1815356a08cvboxsync * you can redistribute it and/or modify it under the terms of the GNU
9968d7771a8d493de063d80f5ccae1815356a08cvboxsync * General Public License (GPL) as published by the Free Software
9968d7771a8d493de063d80f5ccae1815356a08cvboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
9968d7771a8d493de063d80f5ccae1815356a08cvboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
9968d7771a8d493de063d80f5ccae1815356a08cvboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
9968d7771a8d493de063d80f5ccae1815356a08cvboxsync * The contents of this file may alternatively be used under the terms
9968d7771a8d493de063d80f5ccae1815356a08cvboxsync * of the Common Development and Distribution License Version 1.0
9968d7771a8d493de063d80f5ccae1815356a08cvboxsync * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
9968d7771a8d493de063d80f5ccae1815356a08cvboxsync * VirtualBox OSE distribution, in which case the provisions of the
9968d7771a8d493de063d80f5ccae1815356a08cvboxsync * CDDL are applicable instead of those of the GPL.
9968d7771a8d493de063d80f5ccae1815356a08cvboxsync * You may elect to license modified versions of this file under the
9968d7771a8d493de063d80f5ccae1815356a08cvboxsync * terms and conditions of either the GPL or the CDDL or both.
9968d7771a8d493de063d80f5ccae1815356a08cvboxsync/*******************************************************************************
9968d7771a8d493de063d80f5ccae1815356a08cvboxsync* Header Files *
9968d7771a8d493de063d80f5ccae1815356a08cvboxsync*******************************************************************************/
9968d7771a8d493de063d80f5ccae1815356a08cvboxsync/*******************************************************************************
9968d7771a8d493de063d80f5ccae1815356a08cvboxsync* Global Variables *
9968d7771a8d493de063d80f5ccae1815356a08cvboxsync*******************************************************************************/
9968d7771a8d493de063d80f5ccae1815356a08cvboxsyncstatic char const g_szDefault[] = "2.16.840.1.113894";
9968d7771a8d493de063d80f5ccae1815356a08cvboxsyncstatic uint32_t const g_auDefault[] = { 2, 16, 840, 1, 113894 };
9968d7771a8d493de063d80f5ccae1815356a08cvboxsync 2*40 + 16, 0x80 | (840 >> 7), 840 & 0x7f, 1, 0x80 | (113894 >> 14), 0x80 | ((113894 >> 7) & 0x7f), 113894 & 0x7f
9968d7771a8d493de063d80f5ccae1815356a08cvboxsync/*******************************************************************************
9968d7771a8d493de063d80f5ccae1815356a08cvboxsync* Internal Functions *
9968d7771a8d493de063d80f5ccae1815356a08cvboxsync*******************************************************************************/
9968d7771a8d493de063d80f5ccae1815356a08cvboxsyncDECLHIDDEN(int) rtAsn1ObjId_InternalFormatComponent(uint32_t uValue, char **ppszObjId, size_t *pcbObjId); /* asn1-ut-objid.cpp */
9968d7771a8d493de063d80f5ccae1815356a08cvboxsync/** @todo check if we really need this. */
AssertReturn(pauComponents[1] <= (pauComponents[0] < 2 ? 39 : UINT32_MAX - 80), VERR_ASN1_INTERNAL_ERROR_1);
return VERR_BUFFER_OVERFLOW;
return VERR_BUFFER_OVERFLOW;
return VERR_BUFFER_OVERFLOW;
return VERR_BUFFER_OVERFLOW;
return VERR_BUFFER_OVERFLOW;
if (i >= cComponents)
return VINF_SUCCESS;
RTDECL(int) RTAsn1ObjId_InitFromString(PRTASN1OBJID pThis, const char *pszObjId, PCRTASN1ALLOCATORVTABLE pAllocator)
cComponents++;
psz--;
psz++;
cComponents++;
int rc;
#if 0 /** @todo breaks with arrays of ObjIds or structs containing them. They get resized and repositioned in memory, thus invalidating the pointer. Add recall-pointers callback, or just waste memory? Or maybe make all arrays pointer-arrays? */
pThis->pauComponents = (uint32_t *)&pThis->szObjId[sizeof(pThis->szObjId) - cComponents * sizeof(uint32_t)];
rc = RTAsn1MemAllocZ(&pThis->Allocation, (void **)&pThis->pauComponents, cComponents * sizeof(uint32_t));
psz++;
#if 0 /** @todo breaks with arrays of ObjIds or structs containing them. They get resized and repositioned in memory, thus invalidating the pointer. Add recall-pointers callback, or just waste memory? Or maybe make all arrays pointer-arrays? */
pThis->Asn1Core.uData.pv = memmove(&pThis->szObjId[cbObjId], &pThis->szObjId[0], pThis->Asn1Core.cb);
return VINF_SUCCESS;
return rc;
return UINT32_MAX;
sizeof(RTASN1OBJID),
NULL,
NULL,
return VINF_SUCCESS;
RTDECL(int) RTAsn1ObjId_Clone(PRTASN1OBJID pThis, PCRTASN1OBJID pSrc, PCRTASN1ALLOCATORVTABLE pAllocator)
int rc;
#if 0 /** @todo breaks with arrays of ObjIds or structs containing them. They get resized and repositioned in memory, thus invalidating the pointer. Add recall-pointers callback, or just waste memory? Or maybe make all arrays pointer-arrays? */
pThis->pauComponents = (uint32_t *)&pThis->szObjId[sizeof(pThis->szObjId) - pSrc->cComponents * sizeof(uint32_t)];
memcpy((uint32_t *)pThis->pauComponents, pSrc->pauComponents, pSrc->cComponents * sizeof(uint32_t));
#if 0 /** @todo breaks with arrays of ObjIds or structs containing them. They get resized and repositioned in memory, thus invalidating the pointer. Add recall-pointers callback, or just waste memory? Or maybe make all arrays pointer-arrays? */
return VINF_SUCCESS;
return VINF_SUCCESS;
return rc;
return VINF_SUCCESS;
if ( pThis
RTDECL(int) RTAsn1ObjId_Enum(PRTASN1OBJID pThis, PFNRTASN1ENUMCALLBACK pfnCallback, uint32_t uDepth, void *pvUser)
return VINF_SUCCESS;
RTDECL(int) RTAsn1ObjId_CheckSanity(PCRTASN1OBJID pThis, uint32_t fFlags, PRTERRINFO pErrInfo, const char *pszErrorTag)
return VINF_SUCCESS;