Changeset 57572 in vbox for trunk/include/iprt
- Timestamp:
- Aug 28, 2015 1:31:29 AM (9 years ago)
- Location:
- trunk/include/iprt
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/cdefs.h
r57433 r57572 1452 1452 * 1453 1453 * @param a_szConst String constant. 1454 * @sa RTSTRTUPLE 1454 1455 */ 1455 1456 #define RT_STR_TUPLE(a_szConst) a_szConst, (sizeof(a_szConst) - 1) -
trunk/include/iprt/crypto/pem.h
r56291 r57572 117 117 * @returns IPRT status code. 118 118 * @param pszFilename The path to the file to read. 119 * @param fFlags Flags reserved for future hacks.119 * @param fFlags RTCRPEMREADFILE_F_XXX. 120 120 * @param paMarkers Array of one or more section markers to look for. 121 121 * @param cMarkers Number of markers in the array. … … 125 125 RTDECL(int) RTCrPemReadFile(const char *pszFilename, uint32_t fFlags, PCRTCRPEMMARKER paMarkers, size_t cMarkers, 126 126 PCRTCRPEMSECTION *ppSectionHead, PRTERRINFO pErrInfo); 127 /** @name RTCRPEMREADFILE_F_XXX - Flags for RTCrPemReadFile 128 * @{ */ 129 /** Continue on encoding error. */ 130 #define RTCRPEMREADFILE_F_CONTINUE_ON_ENCODING_ERROR RT_BIT(0) 131 /** @} */ 127 132 128 133 /** @} */ -
trunk/include/iprt/crypto/store.h
r56291 r57572 58 58 59 59 60 /** 61 * Standard store identifiers. 62 * 63 * This is a least common denominator approach to system specific certificate 64 * stores, could be extended to include things other than certificates later if 65 * we need it. 66 * 67 * Windows has lots of different stores, they'll be combined by the 68 * implementation, possibly leading to duplicates. The user stores on Windows 69 * seems to be unioned with the system (machine) stores. 70 * 71 * Linux may have different stores depending on the distro/version/installation, 72 * in which case we'll combine them, which will most likely lead to 73 * duplicates just like on windows. Haven't found any easily accessible 74 * per-user certificate stores on linux yet, so they'll all be empty. 75 * 76 * Mac OS X seems a lot simpler, at least from the GUI point of view. Each 77 * keychains as a "Certificates" folder (the "My Certificates" folder seems to 78 * only be a matching of "Keys" and "Certificates"). However, there are two 79 * system keychains that we need to combine, "System" and "System Roots". As 80 * with Windows and Linux, there is a possibility for duplicates here. 81 * 82 * On solaris we have currently no idea where to look for a certificate store, 83 * so that doesn't yet work. 84 * 85 * Because of the OS X setup, we do not provide any purpose specific 86 */ 87 typedef enum RTCRSTOREID 88 { 89 /** Mandatory invalid zero value. */ 90 RTCRSTOREID_INVALID = 0, 91 /** Open the certificate store of the current user containing trusted 92 * CAs and certificates. 93 * @remarks This may or may not include all the certificates in the system 94 * store, that's host dependent. So, you better look in both. */ 95 RTCRSTOREID_USER_TRUSTED_CAS_AND_CERTIFICATES, 96 /** Open the certificate store of the system containg trusted CAs 97 * and certificates. */ 98 RTCRSTOREID_SYSTEM_TRUSTED_CAS_AND_CERTIFICATES, 99 /** End of valid values. */ 100 RTCRSTOREID_END, 101 /** Traditional enum type compression prevention hack. */ 102 RTCRSTOREID_32BIT_HACK = 0x7fffffff 103 } RTCRSTOREID; 104 105 /** 106 * Creates a snapshot of a standard store. 107 * 108 * This will return an in-memory store containing all data from the given store. 109 * There will be no duplicates in this one. 110 * 111 * @returns IPRT status code. 112 * @retval VWRN_ALREADY_EXISTS if the certificate is already present and 113 * RTCRCERTCTX_F_ADD_IF_NOT_FOUND was specified. 114 * @param phStore Where to return the store handle. Use 115 * RTCrStoreRelease to release it. 116 * @param enmStoreId The store to snapshot. 117 * @param pErrInfo Where to return additional error/warning info. 118 * Optional. 119 */ 120 RTDECL(int) RTCrStoreCreateSnapshotById(PRTCRSTORE phStore, RTCRSTOREID enmStoreId, PRTERRINFO pErrInfo); 121 60 122 RTDECL(int) RTCrStoreCreateInMem(PRTCRSTORE phStore, uint32_t cSizeHint); 61 123 … … 63 125 RTDECL(uint32_t) RTCrStoreRelease(RTCRSTORE hStore); 64 126 RTDECL(PCRTCRCERTCTX) RTCrStoreCertByIssuerAndSerialNo(RTCRSTORE hStore, PCRTCRX509NAME pIssuer, PCRTASN1INTEGER pSerialNo); 127 128 /** 129 * Add a certificate to the store. 130 * 131 * @returns IPRT status code. 132 * @retval VWRN_ALREADY_EXISTS if the certificate is already present and 133 * RTCRCERTCTX_F_ADD_IF_NOT_FOUND was specified. 134 * @retval VERR_WRITE_PROTECT if the store doesn't support adding. 135 * @param hStore The store to add the certificate to. 136 * @param fFlags RTCRCERTCTX_F_XXX. Encoding must be specified. 137 * RTCRCERTCTX_F_ADD_IF_NOT_FOUND is supported. 138 * @param pvSrc The encoded certificate bytes. 139 * @param cbSrc The size of the encoded certificate. 140 * @param pErrInfo Where to return additional error/warning info. 141 * Optional. 142 */ 65 143 RTDECL(int) RTCrStoreCertAddEncoded(RTCRSTORE hStore, uint32_t fFlags, void const *pvSrc, size_t cbSrc, PRTERRINFO pErrInfo); 144 145 /** 146 * Adds certificates from the specified file. 147 * 148 * @returns IPRT status code. Even when RTCRCERTCTX_F_ADD_CONTINUE_ON_ERROR is 149 * used, an error is returned as an error (and not a warning). 150 * 151 * @param hStore The store to add the certificate(s) to. 152 * @param fFlags RTCRCERTCTX_F_ADD_IF_NOT_FOUND and/or 153 * RTCRCERTCTX_F_ADD_CONTINUE_ON_ERROR. 154 * @param pszFilename The filename. 155 * @param pErrInfo Where to return additional error/warning info. 156 * Optional. 157 */ 66 158 RTDECL(int) RTCrStoreCertAddFromFile(RTCRSTORE hStore, uint32_t fFlags, const char *pszFilename, PRTERRINFO pErrInfo); 159 160 /** 161 * Adds certificates from files in the specified directory. 162 * 163 * @returns IPRT status code. Even when RTCRCERTCTX_F_ADD_CONTINUE_ON_ERROR is 164 * used, an error is returned as an error (and not a warning). 165 * 166 * @param hStore The store to add the certificate(s) to. 167 * @param fFlags RTCRCERTCTX_F_ADD_IF_NOT_FOUND and/or 168 * RTCRCERTCTX_F_ADD_CONTINUE_ON_ERROR. 169 * @param pszDir The path to the directory. 170 * @param paSuffixes List of suffixes of files to process. 171 * @param cSuffixes Number of suffixes. If this is 0, all files are 172 * processed. 173 * @param pErrInfo Where to return additional error/warning info. 174 * Optional. 175 */ 176 RTDECL(int) RTCrStoreCertAddFromDir(RTCRSTORE hStore, uint32_t fFlags, const char *pszDir, 177 PCRTSTRTUPLE paSuffixes, size_t cSuffixes, PRTERRINFO pErrInfo); 178 179 /** 180 * Adds all certificates from @a hStoreSrc into @a hStore. 181 * 182 * @returns IPRT status code. Even when RTCRCERTCTX_F_ADD_CONTINUE_ON_ERROR is 183 * used, an error is returned as an error (and not a warning). 184 * 185 * @param hStore The destination store. 186 * @param fFlags RTCRCERTCTX_F_ADD_IF_NOT_FOUND and/or 187 * RTCRCERTCTX_F_ADD_CONTINUE_ON_ERROR. 188 * @param hStoreSrc The source store. 189 */ 190 RTDECL(int) RTCrStoreCertAddFromStore(RTCRSTORE hStore, uint32_t fFlags, RTCRSTORE hStoreSrc); 191 192 /** 193 * Exports the certificates in the store to a PEM file 194 * 195 * @returns IPRT status code. 196 * @param hStore The store which certificates should be exported. 197 * @param fFlags Reserved for the future, MBZ. 198 * @param pszFilename The name of the destination PEM file. This will 199 * be truncated. 200 */ 201 RTDECL(int) RTCrStoreCertExportAsPem(RTCRSTORE hStore, uint32_t fFlags, const char *pszFilename); 67 202 68 203 RTDECL(int) RTCrStoreCertFindAll(RTCRSTORE hStore, PRTCRSTORECERTSEARCH pSearch); … … 119 254 #define RTCRCERTCTX_F_ENC_PKCS6_DER UINT32_C(0x00000002) 120 255 #endif 256 /** Mask containing the flags that ends up in the certificate context. */ 257 #define RTCRCERTCTX_F_MASK UINT32_C(0x000000ff) 258 259 /** Add APIs: Add the certificate if not found. */ 260 #define RTCRCERTCTX_F_ADD_IF_NOT_FOUND UINT32_C(0x00010000) 261 /** Add APIs: Continue on error when possible. */ 262 #define RTCRCERTCTX_F_ADD_CONTINUE_ON_ERROR UINT32_C(0x00020000) 121 263 /** @} */ 122 264 -
trunk/include/iprt/crypto/x509.h
r56291 r57572 165 165 166 166 /** 167 * Matches the directory name against a comma separated list of the com onent167 * Matches the directory name against a comma separated list of the component 168 168 * strings (case sensitive). 169 169 * -
trunk/include/iprt/mangling.h
r57079 r57572 1050 1050 # define RTPathCopyComponents RT_MANGLER(RTPathCopyComponents) 1051 1051 # define RTPathCountComponents RT_MANGLER(RTPathCountComponents) 1052 # define RTPathEnsureTrailingSeparator RT_MANGLER(RTPathEnsureTrailingSeparator) 1052 1053 # define RTPathExecDir RT_MANGLER(RTPathExecDir) 1053 1054 # define RTPathExists RT_MANGLER(RTPathExists) … … 1344 1345 # define RTSgBufGetNextSegment RT_MANGLER(RTSgBufGetNextSegment) 1345 1346 # define RTSha1 RT_MANGLER(RTSha1) 1347 # define RTSha1Check RT_MANGLER(RTSha1Check) 1346 1348 # define RTSha1Digest RT_MANGLER(RTSha1Digest) 1347 1349 # define RTSha1DigestFromFile RT_MANGLER(RTSha1DigestFromFile) … … 1352 1354 # define RTSha1Update RT_MANGLER(RTSha1Update) 1353 1355 # define RTSha224 RT_MANGLER(RTSha224) 1356 # define RTSha224Check RT_MANGLER(RTSha224Check) 1354 1357 # define RTSha224Final RT_MANGLER(RTSha224Final) 1355 1358 # define RTSha224FromString RT_MANGLER(RTSha224FromString) … … 1360 1363 # define RTSha224DigestFromFile RT_MANGLER(RTSha224DigestFromFile) 1361 1364 # define RTSha256 RT_MANGLER(RTSha256) 1365 # define RTSha256Check RT_MANGLER(RTSha256Check) 1362 1366 # define RTSha256Final RT_MANGLER(RTSha256Final) 1363 1367 # define RTSha256FromString RT_MANGLER(RTSha256FromString) … … 1368 1372 # define RTSha256DigestFromFile RT_MANGLER(RTSha256DigestFromFile) 1369 1373 # define RTSha384 RT_MANGLER(RTSha384) 1374 # define RTSha384Check RT_MANGLER(RTSha384Check) 1370 1375 # define RTSha384Final RT_MANGLER(RTSha384Final) 1371 1376 # define RTSha384FromString RT_MANGLER(RTSha384FromString) … … 1374 1379 # define RTSha384Update RT_MANGLER(RTSha384Update) 1375 1380 # define RTSha512 RT_MANGLER(RTSha512) 1381 # define RTSha512Check RT_MANGLER(RTSha512Check) 1376 1382 # define RTSha512Final RT_MANGLER(RTSha512Final) 1377 1383 # define RTSha512FromString RT_MANGLER(RTSha512FromString) … … 1380 1386 # define RTSha512Update RT_MANGLER(RTSha512Update) 1381 1387 # define RTSha512t224 RT_MANGLER(RTSha512t224) 1388 # define RTSha512t224Check RT_MANGLER(RTSha512t224Check) 1382 1389 # define RTSha512t224Final RT_MANGLER(RTSha512t224Final) 1383 1390 # define RTSha512t224FromString RT_MANGLER(RTSha512t224FromString) … … 1386 1393 # define RTSha512t224Update RT_MANGLER(RTSha512t224Update) 1387 1394 # define RTSha512t256 RT_MANGLER(RTSha512t256) 1395 # define RTSha512t256Check RT_MANGLER(RTSha512t256Check) 1388 1396 # define RTSha512t256Final RT_MANGLER(RTSha512t256Final) 1389 1397 # define RTSha512t256FromString RT_MANGLER(RTSha512t256FromString) … … 2892 2900 # define RTCrStoreRetain RT_MANGLER(RTCrStoreRetain) 2893 2901 # define RTCrStoreCreateInMem RT_MANGLER(RTCrStoreCreateInMem) 2902 # define RTCrStoreCreateSnapshotById RT_MANGLER(RTCrStoreCreateSnapshotById) 2894 2903 # define RTCrStoreCertAddFromFile RT_MANGLER(RTCrStoreCertAddFromFile) 2904 # define RTCrStoreCertAddFromDir RT_MANGLER(RTCrStoreCertAddFromDir) 2905 # define RTCrStoreCertAddFromStore RT_MANGLER(RTCrStoreCertAddFromStore) 2906 # define RTCrStoreCertExportAsPem RT_MANGLER(RTCrStoreCertExportAsPem) 2895 2907 # define RTErrInfoAdd RT_MANGLER(RTErrInfoAdd) 2896 2908 # define RTErrInfoAddF RT_MANGLER(RTErrInfoAddF) -
trunk/include/iprt/path.h
r56291 r57572 357 357 */ 358 358 RTDECL(size_t) RTPathStripTrailingSlash(char *pszPath); 359 360 /** 361 * Ensures that the path has a trailing path separator such that file names can 362 * be appended without further work. 363 * 364 * This can be helpful when preparing for efficiently combining a directory path 365 * with the filenames returned by RTDirRead. The return value gives you the 366 * position at which you copy the RTDIRENTRY::szName to construct a valid path 367 * to it. 368 * 369 * @returns The length of the path, 0 on buffer overflow. 370 * @param pszPath The path. 371 * @param cbPath The length of the path buffer @a pszPath points to. 372 */ 373 RTDECL(size_t) RTPathEnsureTrailingSeparator(char *pszPath, size_t cbPath); 359 374 360 375 /** -
trunk/include/iprt/sha.h
r56291 r57572 69 69 70 70 /** 71 * Computes the SHA-1 hash for the given data comparing it with the one given. 72 * 73 * @returns true on match, false on mismatch. 74 * @param pvBuf Pointer to the data. 75 * @param cbBuf The amount of data (in bytes). 76 * @param pabHash The hash to verify. (What is passed is a pointer to the 77 * caller's buffer.) 78 */ 79 RTDECL(bool) RTSha1Check(const void *pvBuf, size_t cbBuf, uint8_t const pabDigest[RTSHA1_HASH_SIZE]); 80 81 /** 71 82 * Initializes the SHA-1 context. 72 83 * … … 177 188 178 189 /** 190 * Computes the SHA-256 hash for the given data comparing it with the one given. 191 * 192 * @returns true on match, false on mismatch. 193 * @param pvBuf Pointer to the data. 194 * @param cbBuf The amount of data (in bytes). 195 * @param pabHash The hash to verify. (What is passed is a pointer to the 196 * caller's buffer.) 197 */ 198 RTDECL(bool) RTSha256Check(const void *pvBuf, size_t cbBuf, uint8_t const pabDigest[RTSHA256_HASH_SIZE]); 199 200 /** 179 201 * Initializes the SHA-256 context. 180 202 * … … 275 297 276 298 /** 299 * Computes the SHA-224 hash for the given data comparing it with the one given. 300 * 301 * @returns true on match, false on mismatch. 302 * @param pvBuf Pointer to the data. 303 * @param cbBuf The amount of data (in bytes). 304 * @param pabHash The hash to verify. (What is passed is a pointer to the 305 * caller's buffer.) 306 */ 307 RTDECL(bool) RTSha224Check(const void *pvBuf, size_t cbBuf, uint8_t const pabDigest[RTSHA224_HASH_SIZE]); 308 309 /** 277 310 * Initializes the SHA-224 context. 278 311 * … … 383 416 384 417 /** 418 * Computes the SHA-512 hash for the given data comparing it with the one given. 419 * 420 * @returns true on match, false on mismatch. 421 * @param pvBuf Pointer to the data. 422 * @param cbBuf The amount of data (in bytes). 423 * @param pabHash The hash to verify. (What is passed is a pointer to the 424 * caller's buffer.) 425 */ 426 RTDECL(bool) RTSha512Check(const void *pvBuf, size_t cbBuf, uint8_t const pabDigest[RTSHA512_HASH_SIZE]); 427 428 /** 385 429 * Initializes the SHA-512 context. 386 430 * … … 438 482 typedef RTSHA512CONTEXT *RT_CONCAT3(PRTSHA,a_UName,CONTEXT); \ 439 483 RTDECL(void) RT_CONCAT(RTSha,a_Name)(const void *pvBuf, size_t cbBuf, uint8_t pabDigest[RT_CONCAT3(RTSHA,a_UName,_HASH_SIZE)]); \ 484 RTDECL(bool) RT_CONCAT3(RTSha,a_Name,Check)(const void *pvBuf, size_t cbBuf, uint8_t const pabDigest[RT_CONCAT3(RTSHA,a_UName,_HASH_SIZE)]); \ 440 485 RTDECL(void) RT_CONCAT3(RTSha,a_Name,Init)(RT_CONCAT3(PRTSHA,a_UName,CONTEXT) pCtx); \ 441 486 RTDECL(void) RT_CONCAT3(RTSha,a_Name,Update)(RT_CONCAT3(PRTSHA,a_UName,CONTEXT) pCtx, const void *pvBuf, size_t cbBuf); \ -
trunk/include/iprt/types.h
r57004 r57572 2176 2176 2177 2177 /** 2178 * String tuple to go with the RT_STR_TUPLE macro. 2179 */ 2180 typedef struct RTSTRTUPLE 2181 { 2182 /** The string. */ 2183 const char *psz; 2184 /** The string length. */ 2185 size_t cch; 2186 } RTSTRTUPLE; 2187 /** Pointer to a string tuple. */ 2188 typedef RTSTRTUPLE *PRTSTRTUPLE; 2189 /** Pointer to a const string tuple. */ 2190 typedef RTSTRTUPLE const *PCRTSTRTUPLE; 2191 2192 /** 2178 2193 * Wait for ever if we have to. 2179 2194 */
Note:
See TracChangeset
for help on using the changeset viewer.