Changeset 64817 in vbox
- Timestamp:
- Dec 8, 2016 9:44:02 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/asn1.h
r62473 r64817 2084 2084 RTDECL(int) RTAsn1Dump(PCRTASN1CORE pAsn1Core, uint32_t fFlags, uint32_t uLevel, PFNRTDUMPPRINTFV pfnPrintfV, void *pvUser); 2085 2085 2086 /** 2087 * Queries the name for an object identifier. 2088 * 2089 * This API is very simple due to how we store the data. 2090 * 2091 * @returns IPRT status code. 2092 * @retval VINF_SUCCESS on success. 2093 * @retval VERR_NOT_FOUND if not found. 2094 * @retval VERR_BUFFER_OVERFLOW if more buffer space is required. 2095 * 2096 * @param pauComponents The components making up the object ID. 2097 * @param cComponents The number of components. 2098 * @param pszDst Where to store the name if found. 2099 * @param cbDst The size of the destination buffer. 2100 */ 2101 RTDECL(int) RTAsn1QueryObjIdName(PCRTASN1OBJID pObjId, char *pszDst, size_t cbDst); 2102 2086 2103 /** @} */ 2087 2104 -
trunk/include/iprt/crypto/digest.h
r62474 r64817 205 205 RTDECL(const char *) RTCrDigestTypeToAlgorithmOid(RTDIGESTTYPE enmDigestType); 206 206 207 /** 208 * Translates an IPRT digest type value to a name/descriptive string. 209 * 210 * The purpose here is for human readable output rather than machine readable 211 * output, i.e. the names aren't set in stone. 212 * 213 * @returns Pointer to read-only string, NULL if unknown type. 214 * @param enmDigestType The IPRT digest type value to convert. 215 */ 216 RTDECL(const char *) RTCrDigestTypeToName(RTDIGESTTYPE enmDigestType); 217 207 218 /** @} */ 208 219 -
trunk/include/iprt/mangling.h
r64602 r64817 2442 2442 # define RTAsn1CursorSetInfoV RT_MANGLER(RTAsn1CursorSetInfoV) 2443 2443 # define RTAsn1Dump RT_MANGLER(RTAsn1Dump) 2444 # define RTAsn1QueryObjIdName RT_MANGLER(RTAsn1QueryObjIdName) 2444 2445 # define RTAsn1EncodePrepare RT_MANGLER(RTAsn1EncodePrepare) 2445 2446 # define RTAsn1EncodeRecalcHdrSize RT_MANGLER(RTAsn1EncodeRecalcHdrSize) … … 2776 2777 # define RTCrDigestFindByType RT_MANGLER(RTCrDigestFindByType) 2777 2778 # define RTCrDigestTypeToAlgorithmOid RT_MANGLER(RTCrDigestTypeToAlgorithmOid) 2779 # define RTCrDigestTypeToName RT_MANGLER(RTCrDigestTypeToName) 2778 2780 # define RTCrRsaDigestInfo_DecodeAsn1 RT_MANGLER(RTCrRsaDigestInfo_DecodeAsn1) 2779 2781 # define RTCrRsaOtherPrimeInfo_DecodeAsn1 RT_MANGLER(RTCrRsaOtherPrimeInfo_DecodeAsn1) -
trunk/src/VBox/Runtime/common/asn1/asn1-dump.cpp
r62477 r64817 142 142 } 143 143 else 144 return &g_aSmallOidTable[i Entry];144 return &g_aSmallOidTable[i]; 145 145 } 146 146 } … … 149 149 150 150 151 152 151 /** 153 152 * Queries the name for an object identifier. 154 153 * 155 * @returns true if found, false if not. 154 * @returns IPRT status code (VINF_SUCCESS, VERR_NOT_FOUND, 155 * VERR_BUFFER_OVERFLOW) 156 156 * @param pauComponents The components making up the object ID. 157 157 * @param cComponents The number of components. … … 159 159 * @param cbDst The size of the destination buffer. 160 160 */ 161 static bool rtOidDbQueryObjIdName(uint32_t const *pauComponents, uint8_t cComponents, char *pszDst, size_t cbDst) 162 { 161 static int rtOidDbQueryObjIdName(uint32_t const *pauComponents, uint8_t cComponents, char *pszDst, size_t cbDst) 162 { 163 int rc = VERR_NOT_FOUND; 163 164 if (cComponents > 0) 164 165 { … … 181 182 if (RTBldProgStrTabQueryString(&g_OidDbStrTab, pSmallHit->offString, 182 183 pSmallHit->cchString, pszDst, cbDst) >= 0) 183 return true; 184 return VINF_SUCCESS; 185 rc = VERR_BUFFER_OVERFLOW; 184 186 break; 185 187 } … … 202 204 if (RTBldProgStrTabQueryString(&g_OidDbStrTab, pBigHit->offString, 203 205 pBigHit->cchString, pszDst, cbDst) >= 0) 204 return true; 206 return VINF_SUCCESS; 207 rc = VERR_BUFFER_OVERFLOW; 205 208 break; 206 209 } … … 218 221 } 219 222 220 return false; 223 return rc; 224 } 225 226 227 /** 228 * Queries the name for an object identifier. 229 * 230 * This API is simple and more or less requires a 231 * 232 * @returns IPRT status code. 233 * @retval VINF_SUCCESS on success. 234 * @retval VERR_NOT_FOUND if not found. 235 * @retval VERR_BUFFER_OVERFLOW if more buffer space is required. 236 * 237 * @param pauComponents The components making up the object ID. 238 * @param cComponents The number of components. 239 * @param pszDst Where to store the name if found. 240 * @param cbDst The size of the destination buffer. 241 */ 242 RTDECL(int) RTAsn1QueryObjIdName(PCRTASN1OBJID pObjId, char *pszDst, size_t cbDst) 243 { 244 return rtOidDbQueryObjIdName(pObjId->pauComponents, pObjId->cComponents, pszDst, cbDst); 221 245 } 222 246 … … 422 446 PCRTASN1OBJID pObjId = (PCRTASN1OBJID)pAsn1Core; 423 447 char szName[64]; 424 if (rtOidDbQueryObjIdName(pObjId->pauComponents, pObjId->cComponents, szName, sizeof(szName)) )448 if (rtOidDbQueryObjIdName(pObjId->pauComponents, pObjId->cComponents, szName, sizeof(szName)) == VINF_SUCCESS) 425 449 rtAsn1DumpPrintf(pData, "OBJECT IDENTIFIER %s%s ('%s')\n", 426 450 pszDefault, szName, ((PCRTASN1OBJID)pAsn1Core)->szObjId); -
trunk/src/VBox/Runtime/common/crypto/digest-core.cpp
r62477 r64817 398 398 } 399 399 400 401 RTDECL(const char *) RTCrDigestTypeToName(RTDIGESTTYPE enmDigestType) 402 { 403 switch (enmDigestType) 404 { 405 case RTDIGESTTYPE_CRC32: return "CRC32"; 406 case RTDIGESTTYPE_CRC64: return "CRC64"; 407 case RTDIGESTTYPE_MD2: return "MD2"; 408 case RTDIGESTTYPE_MD4: return "MD4"; 409 case RTDIGESTTYPE_MD5: return "MD5"; 410 case RTDIGESTTYPE_SHA1: return "SHA-1"; 411 case RTDIGESTTYPE_SHA224: return "SHA-224"; 412 case RTDIGESTTYPE_SHA256: return "SHA-256"; 413 case RTDIGESTTYPE_SHA384: return "SHA-384"; 414 case RTDIGESTTYPE_SHA512: return "SHA-512"; 415 case RTDIGESTTYPE_SHA512T224: return "SHA-512/224"; 416 case RTDIGESTTYPE_SHA512T256: return "SHA-512/256"; 417 default: return NULL; 418 } 419 } 420
Note:
See TracChangeset
for help on using the changeset viewer.