1 /** 2 * This file is part of the mingw-w64 runtime package. 3 * No warranty is given; refer to the file DISCLAIMER within this package. 4 */ 5 6 #ifndef _INC_BCRYPT 7 #define _INC_BCRYPT 8 9 #include <winapifamily.h> 10 11 #ifdef __cplusplus 12 extern "C" { 13 #endif 14 15 #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) 16 17 #ifndef WINAPI 18 #define WINAPI __stdcall 19 #endif 20 21 #if !defined (_NTDEF_) && !defined (_NTSTATUS_PSDK) 22 #define _NTSTATUS_PSDK 23 typedef LONG NTSTATUS,*PNTSTATUS; 24 #endif 25 26 #ifndef BCRYPT_SUCCESS 27 #define BCRYPT_SUCCESS(Status) (((NTSTATUS)(Status)) >= 0) 28 #endif 29 30 #define BCRYPT_OBJECT_ALIGNMENT 16 31 #define BCRYPT_STRUCT_ALIGNMENT 32 33 #define BCRYPT_KDF_HASH L"HASH" 34 #define BCRYPT_KDF_HMAC L"HMAC" 35 #define BCRYPT_KDF_SP80056A_CONCAT L"SP800_56A_CONCAT" 36 #define BCRYPT_KDF_TLS_PRF L"TLS_PRF" 37 38 #define KDF_HASH_ALGORITHM 0 39 #define KDF_SECRET_PREPEND 1 40 #define KDF_SECRET_APPEND 2 41 #define KDF_HMAC_KEY 3 42 #define KDF_TLS_PRF_LABEL 4 43 #define KDF_TLS_PRF_SEED 5 44 #define KDF_SECRET_HANDL 6 45 #define KDF_TLS_PRF_PROTOCOL 7 46 #define KDF_ALGORITHMID 8 47 #define KDF_PARTYUINFO 9 48 #define KDF_PARTYVINFO 10 49 #define KDF_SUPPPUBINFO 11 50 #define KDF_SUPPPRIVINFO 12 51 #define KDF_LABEL 13 52 #define KDF_CONTEXT 14 53 #define KDF_SALT 15 54 #define KDF_ITERATION_COUNT 16 55 #define KDF_GENERIC_PARAMETER 17 56 #define KDF_KEYBITLENGTH 18 57 58 #define KDF_USE_SECRET_AS_HMAC_KEY_FLAG 1 59 60 #define BCRYPT_AUTHENTICATED_CIPHER_MODE_INFO_VERSION 1 61 62 #define BCRYPT_AUTH_MODE_CHAIN_CALLS_FLAG 1 63 #define BCRYPT_AUTH_MODE_IN_PROGRESS_FLAG 2 64 65 #define BCRYPT_INIT_AUTH_MODE_INFO(_AIS_) \ 66 RtlZeroMemory((&_AIS_), sizeof (BCRYPT_AUTHENTICATED_CIPHER_MODE_INFO)); \ 67 (_AIS_).cbSize = sizeof (BCRYPT_AUTHENTICATED_CIPHER_MODE_INFO); \ 68 (_AIS_).dwInfoVersion = BCRYPT_AUTHENTICATED_CIPHER_MODE_INFO_VERSION; 69 70 #define BCRYPT_OPAQUE_KEY_BLOB L"OpaqueKeyBlob" 71 #define BCRYPT_KEY_DATA_BLOB L"KeyDataBlob" 72 #define BCRYPT_AES_WRAP_KEY_BLOB L"Rfc3565KeyWrapBlob" 73 74 #define BCRYPT_ALGORITHM_NAME L"AlgorithmName" 75 #define BCRYPT_AUTH_TAG_LENGTH L"AuthTagLength" 76 #define BCRYPT_BLOCK_LENGTH L"BlockLength" 77 #define BCRYPT_BLOCK_SIZE_LIST L"BlockSizeList" 78 #define BCRYPT_CHAIN_MODE_CBC L"ChainingModeCBC" 79 #define BCRYPT_CHAIN_MODE_CCM L"ChainingModeCCM" 80 #define BCRYPT_CHAIN_MODE_CFB L"ChainingModeCFB" 81 #define BCRYPT_CHAIN_MODE_ECB L"ChainingModeECB" 82 #define BCRYPT_CHAIN_MODE_GCM L"ChainingModeGCM" 83 #define BCRYPT_CHAIN_MODE_NA L"ChainingModeN/A" 84 #define BCRYPT_CHAINING_MODE L"ChainingMode" 85 #define BCRYPT_EFFECTIVE_KEY_LENGTH L"EffectiveKeyLength" 86 #define BCRYPT_HASH_BLOCK_LENGTH L"HashBlockLength" 87 #define BCRYPT_HASH_LENGTH L"HashDigestLength" 88 #define BCRYPT_HASH_OID_LIST L"HashOIDList" 89 #define BCRYPT_INITIALIZATION_VECTOR L"IV" 90 #define BCRYPT_IS_KEYED_HASH L"IsKeyedHash" 91 #define BCRYPT_IS_REUSABLE_HASH L"IsReusableHash" 92 #define BCRYPT_KEY_LENGTH L"KeyLength" 93 #define BCRYPT_KEY_LENGTHS L"KeyLengths" 94 #define BCRYPT_KEY_OBJECT_LENGTH L"KeyObjectLength" 95 #define BCRYPT_KEY_STRENGTH L"KeyStrength" 96 #define BCRYPT_MESSAGE_BLOCK_LENGTH L"MessageBlockLength" 97 #define BCRYPT_OBJECT_LENGTH L"ObjectLength" 98 #define BCRYPT_PADDING_SCHEMES L"PaddingSchemes" 99 #define BCRYPT_PCP_PLATFORM_TYPE_PROPERTY L"PCP_PLATFORM_TYPE" 100 #define BCRYPT_PCP_PROVIDER_VERSION_PROPERTY L"PCP_PROVIDER_VERSION" 101 #define BCRYPT_PRIMITIVE_TYPE L"PrimitiveType" 102 #define BCRYPT_PROVIDER_HANDLE L"ProviderHandle" 103 #define BCRYPT_SIGNATURE_LENGTH L"SignatureLength" 104 105 #define BCRYPT_SUPPORTED_PAD_ROUTER 1 106 #define BCRYPT_SUPPORTED_PAD_PKCS1_ENC 2 107 #define BCRYPT_SUPPORTED_PAD_PKCS1_SIG 4 108 #define BCRYPT_SUPPORTED_PAD_OAEP 8 109 #define BCRYPT_SUPPORTED_PAD_PSS 16 110 111 #define BCRYPT_PROV_DISPATCH 1 112 #define BCRYPT_BLOCK_PADDING 1 113 114 #define BCRYPT_PAD_NONE 1 115 #define BCRYPT_PAD_PKCS1 2 116 #define BCRYPT_PAD_OAEP 4 117 #define BCRYPT_PAD_PSS 8 118 119 #define BCRYPTBUFFER_VERSION 0 120 121 typedef struct __BCRYPT_KEY_LENGTHS_STRUCT { 122 ULONG dwMinLength; 123 ULONG dwMaxLength; 124 ULONG dwIncrement; 125 } BCRYPT_KEY_LENGTHS_STRUCT, BCRYPT_AUTH_TAG_LENGTHS_STRUCT; 126 127 typedef struct _BCRYPT_OID { 128 ULONG cbOID; 129 PUCHAR pbOID; 130 } BCRYPT_OID; 131 132 typedef struct _BCRYPT_OID_LIST { 133 ULONG dwOIDCount; 134 BCRYPT_OID *pOIDs; 135 } BCRYPT_OID_LIST; 136 137 typedef struct _BCRYPT_PKCS1_PADDING_INFO { 138 LPCWSTR pszAlgId; 139 } BCRYPT_PKCS1_PADDING_INFO; 140 141 typedef struct _BCRYPT_PSS_PADDING_INFO { 142 LPCWSTR pszAlgId; 143 ULONG cbSalt; 144 } BCRYPT_PSS_PADDING_INFO; 145 146 typedef struct _BCRYPT_OAEP_PADDING_INFO { 147 LPCWSTR pszAlgId; 148 PUCHAR pbLabel; 149 ULONG cbLabel; 150 } BCRYPT_OAEP_PADDING_INFO; 151 152 typedef struct _BCRYPT_AUTHENTICATED_CIPHER_MODE_INFO { 153 ULONG cbSize; 154 ULONG dwInfoVersion; 155 PUCHAR pbNonce; 156 ULONG cbNonce; 157 PUCHAR pbAuthData; 158 ULONG cbAuthData; 159 PUCHAR pbTag; 160 ULONG cbTag; 161 PUCHAR pbMacContext; 162 ULONG cbMacContext; 163 ULONG cbAAD; 164 ULONGLONG cbData; 165 ULONG dwFlags; 166 } BCRYPT_AUTHENTICATED_CIPHER_MODE_INFO, *PBCRYPT_AUTHENTICATED_CIPHER_MODE_INFO; 167 168 #endif /* WINAPI_PARTITION_DESKTOP. */ 169 170 #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) 171 typedef struct _BCryptBuffer { 172 ULONG cbBuffer; 173 ULONG BufferType; 174 PVOID pvBuffer; 175 } BCryptBuffer, *PBCryptBuffer; 176 177 typedef struct _BCryptBufferDesc { 178 ULONG ulVersion; 179 ULONG cBuffers; 180 PBCryptBuffer pBuffers; 181 } BCryptBufferDesc, *PBCryptBufferDesc; 182 #endif /* WINAPI_PARTITION_APP. */ 183 184 #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) 185 186 #define BCRYPT_DSA_PRIVATE_BLOB L"DSAPRIVATEBLOB" 187 #define BCRYPT_DSA_PUBLIC_BLOB L"DSAPUBLICBLOB" 188 #define BCRYPT_PRIVATE_KEY_BLOB L"PRIVATEBLOB" 189 #define BCRYPT_PUBLIC_KEY_BLOB L"PUBLICBLOB" 190 #define BCRYPT_RSAFULLPRIVATE_BLOB L"RSAFULLPRIVATEBLOB" 191 #define BCRYPT_RSAPRIVATE_BLOB L"RSAPRIVATEBLOB" 192 #define BCRYPT_RSAPUBLIC_BLOB L"RSAPUBLICBLOB" 193 #define BCRYPT_ECCPRIVATE_BLOB L"ECCPRIVATEBLOB" 194 #define BCRYPT_ECCPUBLIC_BLOB L"ECCPUBLICBLOB" 195 #define BCRYPT_DH_PRIVATE_BLOB L"DHPRIVATEBLOB" 196 #define BCRYPT_DH_PUBLIC_BLOB L"DHPUBLICBLOB" 197 198 #define LEGACY_DH_PUBLIC_BLOB L"CAPIDHPUBLICBLOB" 199 #define LEGACY_DH_PRIVATE_BLOB L"CAPIDHPRIVATEBLOB" 200 #define LEGACY_DSA_PUBLIC_BLOB L"CAPIDSAPUBLICBLOB" 201 #define LEGACY_DSA_PRIVATE_BLOB L"CAPIDSAPRIVATEBLOB" 202 #define LEGACY_DSA_V2_PRIVATE_BLOB L"V2CAPIDSAPRIVATEBLOB" 203 #define LEGACY_DSA_V2_PUBLIC_BLOB L"V2CAPIDSAPUBLICBLOB" 204 #define LEGACY_RSAPUBLIC_BLOB L"CAPIPUBLICBLOB" 205 #define LEGACY_RSAPRIVATE_BLOB L"CAPIPRIVATEBLOB" 206 207 #define BCRYPT_DSA_PUBLIC_MAGIC 0x42505344 208 #define BCRYPT_DSA_PRIVATE_MAGIC 0x56505344 209 #define BCRYPT_DSA_PUBLIC_MAGIC_V2 0x32425044 210 #define BCRYPT_DSA_PRIVATE_MAGIC_V2 0x32565044 211 #define BCRYPT_DH_PUBLIC_MAGIC 0x42504844 212 #define BCRYPT_DH_PRIVATE_MAGIC 0x56504844 213 #define BCRYPT_RSAFULLPRIVATE_MAGIC 0x33415352 214 #define BCRYPT_ECDH_PUBLIC_P256_MAGIC 0x314B4345 215 #define BCRYPT_ECDH_PRIVATE_P256_MAGIC 0x324B4345 216 #define BCRYPT_ECDH_PUBLIC_P384_MAGIC 0x334B4345 217 #define BCRYPT_ECDH_PRIVATE_P384_MAGIC 0x344B4345 218 #define BCRYPT_ECDH_PUBLIC_P521_MAGIC 0x354B4345 219 #define BCRYPT_ECDH_PRIVATE_P521_MAGIC 0x364B4345 220 #define BCRYPT_ECDSA_PUBLIC_P256_MAGIC 0x31534345 221 #define BCRYPT_ECDSA_PRIVATE_P256_MAGIC 0x32534345 222 #define BCRYPT_ECDSA_PUBLIC_P384_MAGIC 0x33534345 223 #define BCRYPT_ECDSA_PRIVATE_P384_MAGIC 0x34534345 224 #define BCRYPT_ECDSA_PUBLIC_P521_MAGIC 0x35534345 225 #define BCRYPT_ECDSA_PRIVATE_P521_MAGIC 0x36534345 226 #define BCRYPT_RSAPUBLIC_MAGIC 0x31415352 227 #define BCRYPT_RSAPRIVATE_MAGIC 0x32415352 228 #define BCRYPT_DH_PARAMETERS_MAGIC 0x4d504844 229 #define BCRYPT_KEY_DATA_BLOB_MAGIC 0x4d42444b 230 #define BCRYPT_DSA_PARAMETERS_MAGIC 0x4d505344 231 #define BCRYPT_DSA_PARAMETERS_MAGIC_V2 0x324d5044 232 233 #define BCRYPT_KEY_DATA_BLOB_VERSION1 1 234 235 #define MS_PRIMITIVE_PROVIDER L"Microsoft Primitive Provider" 236 #define MS_PLATFORM_CRYPTO_PROVIDER L"Microsoft Platform Crypto Provider" 237 238 #define BCRYPT_3DES_ALGORITHM L"3DES" 239 #define BCRYPT_3DES_112_ALGORITHM L"3DES_112" 240 #define BCRYPT_AES_ALGORITHM L"AES" 241 #define BCRYPT_AES_GMAC_ALGORITHM L"AES-GMAC" 242 #define BCRYPT_AES_CMAC_ALGORITHM L"AES-CMAC" 243 #define BCRYPT_CAPI_KDF_ALGORITHM L"CAPI_KDF" 244 #define BCRYPT_DES_ALGORITHM L"DES" 245 #define BCRYPT_DESX_ALGORITHM L"DESX" 246 #define BCRYPT_DH_ALGORITHM L"DH" 247 #define BCRYPT_DH_PARAMETERS L"DHParameters" 248 #define BCRYPT_DSA_ALGORITHM L"DSA" 249 #define BCRYPT_DSA_PARAMETERS L"DSAParameters" 250 #define BCRYPT_ECDH_P256_ALGORITHM L"ECDH_P256" 251 #define BCRYPT_ECDH_P384_ALGORITHM L"ECDH_P384" 252 #define BCRYPT_ECDH_P521_ALGORITHM L"ECDH_P521" 253 #define BCRYPT_ECDSA_P256_ALGORITHM L"ECDSA_P256" 254 #define BCRYPT_ECDSA_P384_ALGORITHM L"ECDSA_P384" 255 #define BCRYPT_ECDSA_P521_ALGORITHM L"ECDSA_P521" 256 #define BCRYPT_GLOBAL_PARAMETERS L"SecretAgreementParam" 257 #define BCRYPT_MD2_ALGORITHM L"MD2" 258 #define BCRYPT_MD4_ALGORITHM L"MD4" 259 #define BCRYPT_MD5_ALGORITHM L"MD5" 260 #define BCRYPT_PBKDF2_ALGORITHM L"PBKDF2" 261 #define BCRYPT_PRIVATE_KEY L"PrivKeyVal" 262 #define BCRYPT_RC2_ALGORITHM L"RC2" 263 #define BCRYPT_RC4_ALGORITHM L"RC4" 264 #define BCRYPT_RNG_ALGORITHM L"RNG" 265 #define BCRYPT_RNG_FIPS186_DSA_ALGORITHM L"FIPS186DSARNG" 266 #define BCRYPT_RNG_DUAL_EC_ALGORITHM L"DUALECRNG" 267 #define BCRYPT_RSA_ALGORITHM L"RSA" 268 #define BCRYPT_RSA_SIGN_ALGORITHM L"RSA_SIGN" 269 #define BCRYPT_SHA1_ALGORITHM L"SHA1" 270 #define BCRYPT_SHA256_ALGORITHM L"SHA256" 271 #define BCRYPT_SHA384_ALGORITHM L"SHA384" 272 #define BCRYPT_SHA512_ALGORITHM L"SHA512" 273 #define BCRYPT_SP800108_CTR_HMAC_ALGORITHM L"SP800_108_CTR_HMAC" 274 #define BCRYPT_SP80056A_CONCAT_ALGORITHM L"SP800_56A_CONCAT" 275 276 #define BCRYPT_CIPHER_INTERFACE 1 277 #define BCRYPT_HASH_INTERFACE 2 278 #define BCRYPT_ASYMMETRIC_ENCRYPTION_INTERFACE 3 279 #define BCRYPT_SECRET_AGREEMENT_INTERFACE 4 280 #define BCRYPT_SIGNATURE_INTERFACE 5 281 #define BCRYPT_RNG_INTERFACE 6 282 #define BCRYPT_KEY_DERIVATION_INTERFACE 7 283 284 #define BCRYPT_ALG_HANDLE_HMAC_FLAG 0x8 285 #define BCRYPT_CAPI_AES_FLAG 0x10 286 #define BCRYPT_HASH_REUSABLE_FLAG 0x20 287 #define BCRYPT_BUFFERS_LOCKED_FLAG 0x40 288 289 #define BCRYPT_CIPHER_OPERATION 0x1 290 #define BCRYPT_HASH_OPERATION 0x2 291 #define BCRYPT_ASYMMETRIC_ENCRYPTION_OPERATION 0x4 292 #define BCRYPT_SECRET_AGREEMENT_OPERATION 0x8 293 #define BCRYPT_SIGNATURE_OPERATION 0x10 294 #define BCRYPT_RNG_OPERATION 0x20 295 #define BCRYPT_KEY_DERIVATION_OPERATION 0x40 296 297 #define BCRYPT_PUBLIC_KEY_FLAG 1 298 #define BCRYPT_PRIVATE_KEY_FLAG 2 299 300 #define BCRYPT_NO_KEY_VALIDATION 8 301 302 #define BCRYPT_RNG_USE_ENTROPY_IN_BUFFER 1 303 #define BCRYPT_USE_SYSTEM_PREFERRED_RNG 2 304 305 #define BCRYPT_MAKE_INTERFACE_VERSION(major,minor) { (USHORT) major, (USHORT) minor } 306 #define BCRYPT_IS_INTERFACE_VERSION_COMPATIBLE(a, b) ((a).MajorVersion <= (b).MajorVersion) 307 308 #define BCRYPT_ASYMMETRIC_ENCRYPTION_INTERFACE_VERSION_1 BCRYPT_MAKE_INTERFACE_VERSION(1,0) 309 #define BCRYPT_CIPHER_INTERFACE_VERSION_1 BCRYPT_MAKE_INTERFACE_VERSION(1,0) 310 #define BCRYPT_HASH_INTERFACE_VERSION_1 BCRYPT_MAKE_INTERFACE_VERSION(1,0) 311 #define BCRYPT_RNG_INTERFACE_VERSION_1 BCRYPT_MAKE_INTERFACE_VERSION(1,0) 312 #define BCRYPT_SECRET_AGREEMENT_INTERFACE_VERSION_1 BCRYPT_MAKE_INTERFACE_VERSION(1,0) 313 #define BCRYPT_SIGNATURE_INTERFACE_VERSION_1 BCRYPT_MAKE_INTERFACE_VERSION(1,0) 314 315 #define CRYPT_MIN_DEPENDENCIES (0x1) 316 #define CRYPT_PROCESS_ISOLATE (0x10000) 317 318 #define CRYPT_UM (1) 319 #define CRYPT_KM (2) 320 #define CRYPT_MM (3) 321 #define CRYPT_ANY (4) 322 323 #define CRYPT_OVERWRITE (1) 324 325 #define CRYPT_LOCAL (1) 326 #define CRYPT_DOMAIN (2) 327 328 #define CRYPT_EXCLUSIVE (0x1) 329 #define CRYPT_OVERRIDE (0x10000) 330 331 #define CRYPT_ALL_FUNCTIONS (1) 332 #define CRYPT_ALL_PROVIDERS (2) 333 334 #define CRYPT_PRIORITY_TOP (0) 335 #define CRYPT_PRIORITY_BOTTOM (0xffffffff) 336 337 #define CRYPT_DEFAULT_CONTEXT L"Default" 338 339 typedef PVOID BCRYPT_HANDLE; 340 typedef PVOID BCRYPT_ALG_HANDLE; 341 typedef PVOID BCRYPT_KEY_HANDLE; 342 typedef PVOID BCRYPT_HASH_HANDLE; 343 typedef PVOID BCRYPT_SECRET_HANDLE; 344 345 typedef struct _BCRYPT_KEY_BLOB { 346 ULONG Magic; 347 } BCRYPT_KEY_BLOB; 348 349 typedef struct _BCRYPT_RSAKEY_BLOB { 350 ULONG Magic; 351 ULONG BitLength; 352 ULONG cbPublicExp; 353 ULONG cbModulus; 354 ULONG cbPrime1; 355 ULONG cbPrime2; 356 } BCRYPT_RSAKEY_BLOB; 357 358 typedef struct _BCRYPT_ECCKEY_BLOB { 359 ULONG dwMagic; 360 ULONG cbKey; 361 } BCRYPT_ECCKEY_BLOB, *PBCRYPT_ECCKEY_BLOB; 362 363 typedef struct _BCRYPT_DH_KEY_BLOB { 364 ULONG dwMagic; 365 ULONG cbKey; 366 } BCRYPT_DH_KEY_BLOB, *PBCRYPT_DH_KEY_BLOB; 367 368 typedef struct _BCRYPT_DH_PARAMETER_HEADER { 369 ULONG cbLength; 370 ULONG dwMagic; 371 ULONG cbKeyLength; 372 } BCRYPT_DH_PARAMETER_HEADER; 373 374 typedef struct _BCRYPT_DSA_KEY_BLOB { 375 ULONG dwMagic; 376 ULONG cbKey; 377 UCHAR Count[4]; 378 UCHAR Seed[20]; 379 UCHAR q[20]; 380 } BCRYPT_DSA_KEY_BLOB, *PBCRYPT_DSA_KEY_BLOB; 381 382 typedef enum { 383 DSA_HASH_ALGORITHM_SHA1, 384 DSA_HASH_ALGORITHM_SHA256, 385 DSA_HASH_ALGORITHM_SHA512 386 } HASHALGORITHM_ENUM; 387 388 typedef enum { 389 DSA_FIPS186_2, 390 DSA_FIPS186_3 391 } DSAFIPSVERSION_ENUM; 392 393 typedef struct _BCRYPT_DSA_KEY_BLOB_V2 { 394 ULONG dwMagic; 395 ULONG cbKey; 396 HASHALGORITHM_ENUM hashAlgorithm; 397 DSAFIPSVERSION_ENUM standardVersion; 398 ULONG cbSeedLength; 399 ULONG cbGroupSize; 400 UCHAR Count[4]; 401 } BCRYPT_DSA_KEY_BLOB_V2, *PBCRYPT_DSA_KEY_BLOB_V2; 402 403 typedef struct _BCRYPT_KEY_DATA_BLOB_HEADER { 404 ULONG dwMagic; 405 ULONG dwVersion; 406 ULONG cbKeyData; 407 } BCRYPT_KEY_DATA_BLOB_HEADER, *PBCRYPT_KEY_DATA_BLOB_HEADER; 408 409 typedef struct _BCRYPT_DSA_PARAMETER_HEADER { 410 ULONG cbLength; 411 ULONG dwMagic; 412 ULONG cbKeyLength; 413 UCHAR Count[4]; 414 UCHAR Seed[20]; 415 UCHAR q[20]; 416 } BCRYPT_DSA_PARAMETER_HEADER; 417 418 typedef struct _BCRYPT_DSA_PARAMETER_HEADER_V2 { 419 ULONG cbLength; 420 ULONG dwMagic; 421 ULONG cbKeyLength; 422 HASHALGORITHM_ENUM hashAlgorithm; 423 DSAFIPSVERSION_ENUM standardVersion; 424 ULONG cbSeedLength; 425 ULONG cbGroupSize; 426 UCHAR Count[4]; 427 } BCRYPT_DSA_PARAMETER_HEADER_V2; 428 429 typedef struct _BCRYPT_ALGORITHM_IDENTIFIER { 430 LPWSTR pszName; 431 ULONG dwClass; 432 ULONG dwFlags; 433 } BCRYPT_ALGORITHM_IDENTIFIER; 434 435 typedef struct _BCRYPT_PROVIDER_NAME { 436 LPWSTR pszProviderName; 437 } BCRYPT_PROVIDER_NAME; 438 439 typedef struct _BCRYPT_INTERFACE_VERSION { 440 USHORT MajorVersion; 441 USHORT MinorVersion; 442 } BCRYPT_INTERFACE_VERSION, *PBCRYPT_INTERFACE_VERSION; 443 444 typedef struct _CRYPT_INTERFACE_REG { 445 ULONG dwInterface; 446 ULONG dwFlags; 447 ULONG cFunctions; 448 PWSTR *rgpszFunctions; 449 } CRYPT_INTERFACE_REG, *PCRYPT_INTERFACE_REG; 450 451 typedef struct _CRYPT_IMAGE_REG { 452 PWSTR pszImage; 453 ULONG cInterfaces; 454 PCRYPT_INTERFACE_REG *rgpInterfaces; 455 } CRYPT_IMAGE_REG, *PCRYPT_IMAGE_REG; 456 457 typedef struct _CRYPT_PROVIDER_REG { 458 ULONG cAliases; 459 PWSTR *rgpszAliases; 460 PCRYPT_IMAGE_REG pUM; 461 PCRYPT_IMAGE_REG pKM; 462 } CRYPT_PROVIDER_REG, *PCRYPT_PROVIDER_REG; 463 464 typedef struct _CRYPT_PROVIDERS { 465 ULONG cProviders; 466 PWSTR *rgpszProviders; 467 } CRYPT_PROVIDERS, *PCRYPT_PROVIDERS; 468 469 typedef struct _CRYPT_CONTEXT_CONFIG { 470 ULONG dwFlags; 471 ULONG dwReserved; 472 } CRYPT_CONTEXT_CONFIG, *PCRYPT_CONTEXT_CONFIG; 473 474 typedef struct _CRYPT_CONTEXT_FUNCTION_CONFIG { 475 ULONG dwFlags; 476 ULONG dwReserved; 477 } CRYPT_CONTEXT_FUNCTION_CONFIG, *PCRYPT_CONTEXT_FUNCTION_CONFIG; 478 479 typedef struct _CRYPT_CONTEXTS { 480 ULONG cContexts; 481 PWSTR *rgpszContexts; 482 } CRYPT_CONTEXTS, *PCRYPT_CONTEXTS; 483 484 typedef struct _CRYPT_CONTEXT_FUNCTIONS { 485 ULONG cFunctions; 486 PWSTR *rgpszFunctions; 487 } CRYPT_CONTEXT_FUNCTIONS, *PCRYPT_CONTEXT_FUNCTIONS; 488 489 typedef struct _CRYPT_CONTEXT_FUNCTION_PROVIDERS { 490 ULONG cProviders; 491 PWSTR *rgpszProviders; 492 } CRYPT_CONTEXT_FUNCTION_PROVIDERS, *PCRYPT_CONTEXT_FUNCTION_PROVIDERS; 493 494 typedef struct _CRYPT_PROPERTY_REF { 495 PWSTR pszProperty; 496 ULONG cbValue; 497 PUCHAR pbValue; 498 } CRYPT_PROPERTY_REF, *PCRYPT_PROPERTY_REF; 499 500 typedef struct _CRYPT_IMAGE_REF { 501 PWSTR pszImage; 502 ULONG dwFlags; 503 } CRYPT_IMAGE_REF, *PCRYPT_IMAGE_REF; 504 505 typedef struct _CRYPT_PROVIDER_REF { 506 ULONG dwInterface; 507 PWSTR pszFunction; 508 PWSTR pszProvider; 509 ULONG cProperties; 510 PCRYPT_PROPERTY_REF *rgpProperties; 511 PCRYPT_IMAGE_REF pUM; 512 PCRYPT_IMAGE_REF pKM; 513 } CRYPT_PROVIDER_REF, *PCRYPT_PROVIDER_REF; 514 515 typedef struct _CRYPT_PROVIDER_REFS { 516 ULONG cProviders; 517 PCRYPT_PROVIDER_REF *rgpProviders; 518 } CRYPT_PROVIDER_REFS, *PCRYPT_PROVIDER_REFS; 519 520 NTSTATUS WINAPI BCryptOpenAlgorithmProvider(BCRYPT_ALG_HANDLE *phAlgorithm, LPCWSTR pszAlgId, LPCWSTR pszImplementation, ULONG dwFlags); 521 NTSTATUS WINAPI BCryptEnumAlgorithms(ULONG dwAlgOperations, ULONG *pAlgCount, BCRYPT_ALGORITHM_IDENTIFIER **ppAlgList, ULONG dwFlags); 522 NTSTATUS WINAPI BCryptEnumProviders(LPCWSTR pszAlgId, ULONG *pImplCount, BCRYPT_PROVIDER_NAME **ppImplList, ULONG dwFlags); 523 NTSTATUS WINAPI BCryptGetProperty(BCRYPT_HANDLE hObject, LPCWSTR pszProperty, PUCHAR pbOutput, ULONG cbOutput, ULONG *pcbResult, ULONG dwFlags); 524 NTSTATUS WINAPI BCryptSetProperty(BCRYPT_HANDLE hObject, LPCWSTR pszProperty, PUCHAR pbInput, ULONG cbInput, ULONG dwFlags); 525 NTSTATUS WINAPI BCryptCloseAlgorithmProvider(BCRYPT_ALG_HANDLE hAlgorithm, ULONG dwFlags); 526 VOID WINAPI BCryptFreeBuffer(PVOID pvBuffer); 527 NTSTATUS WINAPI BCryptGenerateSymmetricKey(BCRYPT_ALG_HANDLE hAlgorithm, BCRYPT_KEY_HANDLE *phKey, PUCHAR pbKeyObject, ULONG cbKeyObject, PUCHAR pbSecret, ULONG cbSecret, ULONG dwFlags); 528 NTSTATUS WINAPI BCryptGenerateKeyPair(BCRYPT_ALG_HANDLE hAlgorithm, BCRYPT_KEY_HANDLE *phKey, ULONG dwLength, ULONG dwFlags); 529 NTSTATUS WINAPI BCryptEncrypt(BCRYPT_KEY_HANDLE hKey, PUCHAR pbInput, ULONG cbInput, VOID *pPaddingInfo, PUCHAR pbIV, ULONG cbIV, PUCHAR pbOutput, ULONG cbOutput, ULONG *pcbResult, ULONG dwFlags); 530 NTSTATUS WINAPI BCryptDecrypt(BCRYPT_KEY_HANDLE hKey, PUCHAR pbInput, ULONG cbInput, VOID *pPaddingInfo, PUCHAR pbIV, ULONG cbIV, PUCHAR pbOutput, ULONG cbOutput, ULONG *pcbResult, ULONG dwFlags); 531 NTSTATUS WINAPI BCryptExportKey(BCRYPT_KEY_HANDLE hKey, BCRYPT_KEY_HANDLE hExportKey, LPCWSTR pszBlobType, PUCHAR pbOutput, ULONG cbOutput, ULONG *pcbResult, ULONG dwFlags); 532 NTSTATUS WINAPI BCryptImportKey(BCRYPT_ALG_HANDLE hAlgorithm, BCRYPT_KEY_HANDLE hImportKey, LPCWSTR pszBlobType, BCRYPT_KEY_HANDLE *phKey, PUCHAR pbKeyObject, ULONG cbKeyObject, PUCHAR pbInput, ULONG cbInput, ULONG dwFlags); 533 NTSTATUS WINAPI BCryptImportKeyPair(BCRYPT_ALG_HANDLE hAlgorithm,BCRYPT_KEY_HANDLE hImportKey, LPCWSTR pszBlobType, BCRYPT_KEY_HANDLE *phKey, PUCHAR pbInput, ULONG cbInput, ULONG dwFlags); 534 NTSTATUS WINAPI BCryptDuplicateKey(BCRYPT_KEY_HANDLE hKey, BCRYPT_KEY_HANDLE *phNewKey, PUCHAR pbKeyObject, ULONG cbKeyObject, ULONG dwFlags); 535 NTSTATUS WINAPI BCryptFinalizeKeyPair(BCRYPT_KEY_HANDLE hKey, ULONG dwFlags); 536 NTSTATUS WINAPI BCryptDestroyKey(BCRYPT_KEY_HANDLE hKey); 537 NTSTATUS WINAPI BCryptDestroySecret(BCRYPT_SECRET_HANDLE hSecret); 538 NTSTATUS WINAPI BCryptSignHash(BCRYPT_KEY_HANDLE hKey, VOID *pPaddingInfo, PUCHAR pbInput, ULONG cbInput, PUCHAR pbOutput, ULONG cbOutput, ULONG *pcbResult, ULONG dwFlags); 539 NTSTATUS WINAPI BCryptVerifySignature(BCRYPT_KEY_HANDLE hKey,VOID *pPaddingInfo, PUCHAR pbHash, ULONG cbHash, PUCHAR pbSignature, ULONG cbSignature, ULONG dwFlags); 540 NTSTATUS WINAPI BCryptSecretAgreement(BCRYPT_KEY_HANDLE hPrivKey, BCRYPT_KEY_HANDLE hPubKey, BCRYPT_SECRET_HANDLE *phAgreedSecret, ULONG dwFlags); 541 NTSTATUS WINAPI BCryptDeriveKey(BCRYPT_SECRET_HANDLE hSharedSecret, LPCWSTR pwszKDF, BCryptBufferDesc *pParameterList, PUCHAR pbDerivedKey, ULONG cbDerivedKey, ULONG *pcbResult, ULONG dwFlags); 542 NTSTATUS WINAPI BCryptKeyDerivation(BCRYPT_KEY_HANDLE hKey, BCryptBufferDesc *pParameterList, PUCHAR pbDerivedKey, ULONG cbDerivedKey, ULONG *pcbResult, ULONG dwFlags); 543 NTSTATUS WINAPI BCryptCreateHash(BCRYPT_ALG_HANDLE hAlgorithm, BCRYPT_HASH_HANDLE *phHash, PUCHAR pbHashObject, ULONG cbHashObject, PUCHAR pbSecret, ULONG cbSecret, ULONG dwFlags); 544 NTSTATUS WINAPI BCryptHashData(BCRYPT_HASH_HANDLE hHash, PUCHAR pbInput, ULONG cbInput, ULONG dwFlags); 545 NTSTATUS WINAPI BCryptFinishHash(BCRYPT_HASH_HANDLE hHash, PUCHAR pbOutput, ULONG cbOutput, ULONG dwFlags); 546 NTSTATUS WINAPI BCryptDuplicateHash(BCRYPT_HASH_HANDLE hHash, BCRYPT_HASH_HANDLE *phNewHash, PUCHAR pbHashObject, ULONG cbHashObject, ULONG dwFlags); 547 NTSTATUS WINAPI BCryptDestroyHash(BCRYPT_HASH_HANDLE hHash); 548 NTSTATUS WINAPI BCryptGenRandom(BCRYPT_ALG_HANDLE hAlgorithm, PUCHAR pbBuffer, ULONG cbBuffer, ULONG dwFlags); 549 NTSTATUS WINAPI BCryptDeriveKeyCapi(BCRYPT_HASH_HANDLE hHash, BCRYPT_ALG_HANDLE hTargetAlg, PUCHAR pbDerivedKey, ULONG cbDerivedKey, ULONG dwFlags); 550 NTSTATUS WINAPI BCryptDeriveKeyPBKDF2(BCRYPT_ALG_HANDLE hPrf, PUCHAR pbPassword, ULONG cbPassword, PUCHAR pbSalt, ULONG cbSalt, ULONGLONG cIterations, PUCHAR pbDerivedKey, ULONG cbDerivedKey, ULONG dwFlags); 551 NTSTATUS WINAPI BCryptResolveProviders(LPCWSTR pszContext, ULONG dwInterface, LPCWSTR pszFunction, LPCWSTR pszProvider, ULONG dwMode, ULONG dwFlags, ULONG* pcbBuffer, PCRYPT_PROVIDER_REFS *ppBuffer); 552 NTSTATUS WINAPI BCryptGetFipsAlgorithmMode(BOOLEAN *pfEnabled); 553 554 #ifndef KERNEL_MODE_CNG 555 NTSTATUS WINAPI BCryptQueryProviderRegistration(LPCWSTR pszProvider, ULONG dwMode, ULONG dwInterface, ULONG *pcbBuffer, PCRYPT_PROVIDER_REG *ppBuffer); 556 NTSTATUS WINAPI BCryptEnumRegisteredProviders(ULONG *pcbBuffer, PCRYPT_PROVIDERS *ppBuffer); 557 NTSTATUS WINAPI BCryptCreateContext(ULONG dwTable, LPCWSTR pszContext, PCRYPT_CONTEXT_CONFIG pConfig); 558 NTSTATUS WINAPI BCryptDeleteContext(ULONG dwTable, LPCWSTR pszContext); 559 NTSTATUS WINAPI BCryptEnumContexts(ULONG dwTable, ULONG *pcbBuffer, PCRYPT_CONTEXTS *ppBuffer); 560 NTSTATUS WINAPI BCryptConfigureContext(ULONG dwTable, LPCWSTR pszContext, PCRYPT_CONTEXT_CONFIG pConfig); 561 NTSTATUS WINAPI BCryptQueryContextConfiguration(ULONG dwTable, LPCWSTR pszContext, ULONG *pcbBuffer, PCRYPT_CONTEXT_CONFIG *ppBuffer); 562 NTSTATUS WINAPI BCryptAddContextFunction(ULONG dwTable, LPCWSTR pszContext, ULONG dwInterface, LPCWSTR pszFunction, ULONG dwPosition); 563 NTSTATUS WINAPI BCryptRemoveContextFunction(ULONG dwTable, LPCWSTR pszContext, ULONG dwInterface, LPCWSTR pszFunction); 564 NTSTATUS WINAPI BCryptEnumContextFunctions(ULONG dwTable, LPCWSTR pszContext, ULONG dwInterface, ULONG *pcbBuffer, PCRYPT_CONTEXT_FUNCTIONS *ppBuffer); 565 NTSTATUS WINAPI BCryptConfigureContextFunction(ULONG dwTable, LPCWSTR pszContext, ULONG dwInterface, LPCWSTR pszFunction, PCRYPT_CONTEXT_FUNCTION_CONFIG pConfig); 566 NTSTATUS WINAPI BCryptQueryContextFunctionConfiguration(ULONG dwTable, LPCWSTR pszContext, ULONG dwInterface, LPCWSTR pszFunction, ULONG *pcbBuffer, PCRYPT_CONTEXT_FUNCTION_CONFIG *ppBuffer); 567 NTSTATUS WINAPI BCryptEnumContextFunctionProviders(ULONG dwTable, LPCWSTR pszContext, ULONG dwInterface, LPCWSTR pszFunction, ULONG *pcbBuffer, PCRYPT_CONTEXT_FUNCTION_PROVIDERS *ppBuffer); 568 NTSTATUS WINAPI BCryptSetContextFunctionProperty(ULONG dwTable, LPCWSTR pszContext, ULONG dwInterface, LPCWSTR pszFunction, LPCWSTR pszProperty, ULONG cbValue, PUCHAR pbValue); 569 NTSTATUS WINAPI BCryptQueryContextFunctionProperty(ULONG dwTable, LPCWSTR pszContext, ULONG dwInterface, LPCWSTR pszFunction, LPCWSTR pszProperty, ULONG* pcbValue, PUCHAR *ppbValue); 570 NTSTATUS WINAPI BCryptRegisterConfigChangeNotify(HANDLE *phEvent); 571 NTSTATUS WINAPI BCryptUnregisterConfigChangeNotify(HANDLE hEvent); 572 #else 573 NTSTATUS WINAPI BCryptRegisterConfigChangeNotify(PRKEVENT pEvent); 574 NTSTATUS WINAPI BCryptUnregisterConfigChangeNotify(PRKEVENT pEvent); 575 #endif 576 577 #endif /* WINAPI_PARTITION_DESKTOP. */ 578 579 #ifdef __cplusplus 580 } 581 #endif 582 583 #endif /* _INC_BCRYPT */ 584