1 // Copyright © 2016-2017 winapi-rs developers
2 // Licensed under the Apache License, Version 2.0
3 // <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
4 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option.
5 // All files in the project carrying such notice may not be copied, modified, or distributed
6 // except according to those terms.
7 //! Cryptographic Primitive API Prototypes and Definitions
8 use shared::minwindef::{PUCHAR, UCHAR, ULONG, USHORT};
9 use um::winnt::{BOOLEAN, HANDLE, LONG, LPCWSTR, LPWSTR, PVOID, PWSTR, ULONGLONG, VOID};
10 pub type NTSTATUS = LONG;
11 pub type PNTSTATUS = *mut NTSTATUS;
12 #[inline]
BCRYPT_SUCCESS(Status: NTSTATUS) -> bool13 pub fn BCRYPT_SUCCESS(Status: NTSTATUS) -> bool {
14     Status >= 0
15 }
16 pub const BCRYPT_OBJECT_ALIGNMENT: usize = 16;
17 pub const BCRYPT_KDF_HASH: &'static str = "HASH";
18 pub const BCRYPT_KDF_HMAC: &'static str = "HMAC";
19 pub const BCRYPT_KDF_TLS_PRF: &'static str = "TLS_PRF";
20 pub const BCRYPT_KDF_SP80056A_CONCAT: &'static str = "SP800_56A_CONCAT";
21 pub const BCRYPT_KDF_RAW_SECRET: &'static str = "TRUNCATE";
22 pub const KDF_HASH_ALGORITHM: ULONG = 0x0;
23 pub const KDF_SECRET_PREPEND: ULONG = 0x1;
24 pub const KDF_SECRET_APPEND: ULONG = 0x2;
25 pub const KDF_HMAC_KEY: ULONG = 0x3;
26 pub const KDF_TLS_PRF_LABEL: ULONG = 0x4;
27 pub const KDF_TLS_PRF_SEED: ULONG = 0x5;
28 pub const KDF_SECRET_HANDLE: ULONG = 0x6;
29 pub const KDF_TLS_PRF_PROTOCOL: ULONG = 0x7;
30 pub const KDF_ALGORITHMID: ULONG = 0x8;
31 pub const KDF_PARTYUINFO: ULONG = 0x9;
32 pub const KDF_PARTYVINFO: ULONG = 0xA;
33 pub const KDF_SUPPPUBINFO: ULONG = 0xB;
34 pub const KDF_SUPPPRIVINFO: ULONG = 0xC;
35 pub const KDF_LABEL: ULONG = 0xD;
36 pub const KDF_CONTEXT: ULONG = 0xE;
37 pub const KDF_SALT: ULONG = 0xF;
38 pub const KDF_ITERATION_COUNT: ULONG = 0x10;
39 pub const KDF_GENERIC_PARAMETER: ULONG = 0x11;
40 pub const KDF_KEYBITLENGTH: ULONG = 0x12;
41 pub const KDF_USE_SECRET_AS_HMAC_KEY_FLAG: ULONG = 0x1;
42 STRUCT!{struct BCRYPT_KEY_LENGTHS_STRUCT {
43     dwMinLength: ULONG,
44     dwMaxLength: ULONG,
45     dwIncrement: ULONG,
46 }}
47 pub type BCRYPT_AUTH_TAG_LENGTHS_STRUCT = BCRYPT_KEY_LENGTHS_STRUCT;
48 STRUCT!{struct BCRYPT_OID {
49     cbOID: ULONG,
50     pbOID: PUCHAR,
51 }}
52 STRUCT!{struct BCRYPT_OID_LIST {
53     dwOIDCount: ULONG,
54     pOIDs: *mut BCRYPT_OID,
55 }}
56 STRUCT!{struct BCRYPT_PKCS1_PADDING_INFO {
57     pszAlgId: LPCWSTR,
58 }}
59 STRUCT!{struct BCRYPT_PSS_PADDING_INFO {
60     pszAlgId: LPCWSTR,
61     cbSalt: ULONG,
62 }}
63 STRUCT!{struct BCRYPT_OAEP_PADDING_INFO {
64     pszAlgId: LPCWSTR,
65     pbLabel: PUCHAR,
66     cbLabel: ULONG,
67 }}
68 pub const BCRYPT_AUTHENTICATED_CIPHER_MODE_INFO_VERSION: ULONG = 1;
69 pub const BCRYPT_AUTH_MODE_CHAIN_CALLS_FLAG: ULONG = 0x00000001;
70 pub const BCRYPT_AUTH_MODE_IN_PROGRESS_FLAG: ULONG = 0x00000002;
71 STRUCT!{struct BCRYPT_AUTHENTICATED_CIPHER_MODE_INFO {
72     cbSize: ULONG,
73     dwInfoVersion: ULONG,
74     pbNonce: PUCHAR,
75     cbNonce: ULONG,
76     pbAuthData: PUCHAR,
77     cbAuthData: ULONG,
78     pbTag: PUCHAR,
79     cbTag: ULONG,
80     pbMacContext: PUCHAR,
81     cbMacContext: ULONG,
82     cbAAD: ULONG,
83     cbData: ULONGLONG,
84     dwFlags: ULONG,
85 }}
86 pub type PBCRYPT_AUTHENTICATED_CIPHER_MODE_INFO = *mut BCRYPT_AUTHENTICATED_CIPHER_MODE_INFO;
87 pub const BCRYPT_OPAQUE_KEY_BLOB: &'static str = "OpaqueKeyBlob";
88 pub const BCRYPT_KEY_DATA_BLOB: &'static str = "KeyDataBlob";
89 pub const BCRYPT_AES_WRAP_KEY_BLOB: &'static str = "Rfc3565KeyWrapBlob";
90 pub const BCRYPT_OBJECT_LENGTH: &'static str = "ObjectLength";
91 pub const BCRYPT_ALGORITHM_NAME: &'static str = "AlgorithmName";
92 pub const BCRYPT_PROVIDER_HANDLE: &'static str = "ProviderHandle";
93 pub const BCRYPT_CHAINING_MODE: &'static str = "ChainingMode";
94 pub const BCRYPT_BLOCK_LENGTH: &'static str = "BlockLength";
95 pub const BCRYPT_KEY_LENGTH: &'static str = "KeyLength";
96 pub const BCRYPT_KEY_OBJECT_LENGTH: &'static str = "KeyObjectLength";
97 pub const BCRYPT_KEY_STRENGTH: &'static str = "KeyStrength";
98 pub const BCRYPT_KEY_LENGTHS: &'static str = "KeyLengths";
99 pub const BCRYPT_BLOCK_SIZE_LIST: &'static str = "BlockSizeList";
100 pub const BCRYPT_EFFECTIVE_KEY_LENGTH: &'static str = "EffectiveKeyLength";
101 pub const BCRYPT_HASH_LENGTH: &'static str = "HashDigestLength";
102 pub const BCRYPT_HASH_OID_LIST: &'static str = "HashOIDList";
103 pub const BCRYPT_PADDING_SCHEMES: &'static str = "PaddingSchemes";
104 pub const BCRYPT_SIGNATURE_LENGTH: &'static str = "SignatureLength";
105 pub const BCRYPT_HASH_BLOCK_LENGTH: &'static str = "HashBlockLength";
106 pub const BCRYPT_AUTH_TAG_LENGTH: &'static str = "AuthTagLength";
107 pub const BCRYPT_PRIMITIVE_TYPE: &'static str = "PrimitiveType";
108 pub const BCRYPT_IS_KEYED_HASH: &'static str = "IsKeyedHash";
109 pub const BCRYPT_IS_REUSABLE_HASH: &'static str = "IsReusableHash";
110 pub const BCRYPT_MESSAGE_BLOCK_LENGTH: &'static str = "MessageBlockLength";
111 pub const BCRYPT_PUBLIC_KEY_LENGTH: &'static str = "PublicKeyLength";
112 pub const BCRYPT_PCP_PLATFORM_TYPE_PROPERTY: &'static str = "PCP_PLATFORM_TYPE";
113 pub const BCRYPT_PCP_PROVIDER_VERSION_PROPERTY: &'static str = "PCP_PROVIDER_VERSION";
114 pub const BCRYPT_MULTI_OBJECT_LENGTH: &'static str = "MultiObjectLength";
115 pub const BCRYPT_INITIALIZATION_VECTOR: &'static str = "IV";
116 pub const BCRYPT_CHAIN_MODE_NA: &'static str = "ChainingModeN/A";
117 pub const BCRYPT_CHAIN_MODE_CBC: &'static str = "ChainingModeCBC";
118 pub const BCRYPT_CHAIN_MODE_ECB: &'static str = "ChainingModeECB";
119 pub const BCRYPT_CHAIN_MODE_CFB: &'static str = "ChainingModeCFB";
120 pub const BCRYPT_CHAIN_MODE_CCM: &'static str = "ChainingModeCCM";
121 pub const BCRYPT_CHAIN_MODE_GCM: &'static str = "ChainingModeGCM";
122 pub const BCRYPT_PROV_DISPATCH: ULONG = 0x00000001;
123 pub const BCRYPT_BLOCK_PADDING: ULONG = 0x00000001;
124 pub const BCRYPT_PAD_NONE: ULONG = 0x00000001;
125 pub const BCRYPT_PAD_PKCS1: ULONG = 0x00000002;
126 pub const BCRYPT_PAD_OAEP: ULONG = 0x00000004;
127 pub const BCRYPT_PAD_PSS: ULONG = 0x00000008;
128 pub const BCRYPT_PAD_PKCS1_OPTIONAL_HASH_OID: ULONG = 0x00000010;
129 pub const BCRYPTBUFFER_VERSION: ULONG = 0;
130 STRUCT!{struct BCryptBuffer {
131     cbBuffer: ULONG,
132     BufferType: ULONG,
133     pvBuffer: PVOID,
134 }}
135 pub type PBCryptBuffer = *mut BCryptBuffer;
136 STRUCT!{struct BCryptBufferDesc {
137     ulVersion: ULONG,
138     cBuffers: ULONG,
139     pBuffers: PBCryptBuffer,
140 }}
141 pub type PBCryptBufferDesc = *mut BCryptBufferDesc;
142 pub type BCRYPT_HANDLE = PVOID;
143 pub type BCRYPT_ALG_HANDLE = PVOID;
144 pub type BCRYPT_KEY_HANDLE = PVOID;
145 pub type BCRYPT_HASH_HANDLE = PVOID;
146 pub type BCRYPT_SECRET_HANDLE = PVOID;
147 pub const BCRYPT_PUBLIC_KEY_BLOB: &'static str = "PUBLICBLOB";
148 pub const BCRYPT_PRIVATE_KEY_BLOB: &'static str = "PRIVATEBLOB";
149 STRUCT!{struct BCRYPT_KEY_BLOB {
150     Magic: ULONG,
151 }}
152 pub const BCRYPT_RSAPUBLIC_BLOB: &'static str = "RSAPUBLICBLOB";
153 pub const BCRYPT_RSAPRIVATE_BLOB: &'static str = "RSAPRIVATEBLOB";
154 pub const LEGACY_RSAPUBLIC_BLOB: &'static str = "CAPIPUBLICBLOB";
155 pub const LEGACY_RSAPRIVATE_BLOB: &'static str = "CAPIPRIVATEBLOB";
156 pub const BCRYPT_RSAPUBLIC_MAGIC: ULONG = 0x31415352;
157 pub const BCRYPT_RSAPRIVATE_MAGIC: ULONG = 0x32415352;
158 STRUCT!{struct BCRYPT_RSAKEY_BLOB {
159     Magic: ULONG,
160     BitLength: ULONG,
161     cbPublicExp: ULONG,
162     cbModulus: ULONG,
163     cbPrime1: ULONG,
164     cbPrime2: ULONG,
165 }}
166 pub const BCRYPT_RSAFULLPRIVATE_BLOB: &'static str = "RSAFULLPRIVATEBLOB";
167 pub const BCRYPT_RSAFULLPRIVATE_MAGIC: ULONG = 0x33415352;
168 pub const BCRYPT_GLOBAL_PARAMETERS: &'static str = "SecretAgreementParam";
169 pub const BCRYPT_PRIVATE_KEY: &'static str = "PrivKeyVal";
170 pub const BCRYPT_ECCPUBLIC_BLOB: &'static str = "ECCPUBLICBLOB";
171 pub const BCRYPT_ECCPRIVATE_BLOB: &'static str = "ECCPRIVATEBLOB";
172 pub const BCRYPT_ECCFULLPUBLIC_BLOB: &'static str = "ECCFULLPUBLICBLOB";
173 pub const BCRYPT_ECCFULLPRIVATE_BLOB: &'static str = "ECCFULLPRIVATEBLOB";
174 pub const SSL_ECCPUBLIC_BLOB: &'static str = "SSLECCPUBLICBLOB";
175 pub const BCRYPT_ECDH_PUBLIC_P256_MAGIC: ULONG = 0x314B4345;
176 pub const BCRYPT_ECDH_PRIVATE_P256_MAGIC: ULONG = 0x324B4345;
177 pub const BCRYPT_ECDH_PUBLIC_P384_MAGIC: ULONG = 0x334B4345;
178 pub const BCRYPT_ECDH_PRIVATE_P384_MAGIC: ULONG = 0x344B4345;
179 pub const BCRYPT_ECDH_PUBLIC_P521_MAGIC: ULONG = 0x354B4345;
180 pub const BCRYPT_ECDH_PRIVATE_P521_MAGIC: ULONG = 0x364B4345;
181 pub const BCRYPT_ECDH_PUBLIC_GENERIC_MAGIC: ULONG = 0x504B4345;
182 pub const BCRYPT_ECDH_PRIVATE_GENERIC_MAGIC: ULONG = 0x564B4345;
183 pub const BCRYPT_ECDSA_PUBLIC_P256_MAGIC: ULONG = 0x31534345;
184 pub const BCRYPT_ECDSA_PRIVATE_P256_MAGIC: ULONG = 0x32534345;
185 pub const BCRYPT_ECDSA_PUBLIC_P384_MAGIC: ULONG = 0x33534345;
186 pub const BCRYPT_ECDSA_PRIVATE_P384_MAGIC: ULONG = 0x34534345;
187 pub const BCRYPT_ECDSA_PUBLIC_P521_MAGIC: ULONG = 0x35534345;
188 pub const BCRYPT_ECDSA_PRIVATE_P521_MAGIC: ULONG = 0x36534345;
189 pub const BCRYPT_ECDSA_PUBLIC_GENERIC_MAGIC: ULONG = 0x50444345;
190 pub const BCRYPT_ECDSA_PRIVATE_GENERIC_MAGIC: ULONG = 0x56444345;
191 STRUCT!{struct BCRYPT_ECCKEY_BLOB {
192     dwMagic: ULONG,
193     cbKey: ULONG,
194 }}
195 pub type PBCRYPT_ECCKEY_BLOB = *mut BCRYPT_ECCKEY_BLOB;
196 STRUCT!{struct SSL_ECCKEY_BLOB {
197     dwCurveType: ULONG,
198     cbKey: ULONG,
199 }}
200 pub type PSSL_ECCKEY_BLOB = *mut SSL_ECCKEY_BLOB;
201 pub const BCRYPT_ECC_FULLKEY_BLOB_V1: ULONG = 0x1;
202 ENUM!{enum ECC_CURVE_TYPE_ENUM {
203     BCRYPT_ECC_PRIME_SHORT_WEIERSTRASS_CURVE = 0x1,
204     BCRYPT_ECC_PRIME_TWISTED_EDWARDS_CURVE = 0x2,
205     BCRYPT_ECC_PRIME_MONTGOMERY_CURVE = 0x3,
206 }}
207 ENUM!{enum ECC_CURVE_ALG_ID_ENUM {
208     BCRYPT_NO_CURVE_GENERATION_ALG_ID = 0x0,
209 }}
210 STRUCT!{struct BCRYPT_ECCFULLKEY_BLOB {
211     dwMagic: ULONG,
212     dwVersion: ULONG,
213     dwCurveType: ECC_CURVE_TYPE_ENUM,
214     dwCurveGenerationAlgId: ECC_CURVE_ALG_ID_ENUM,
215     cbFieldLength: ULONG,
216     cbSubgroupOrder: ULONG,
217     cbCofactor: ULONG,
218     cbSeed: ULONG,
219 }}
220 pub type PBCRYPT_ECCFULLKEY_BLOB = *mut BCRYPT_ECCFULLKEY_BLOB;
221 pub const BCRYPT_DH_PUBLIC_BLOB: &'static str = "DHPUBLICBLOB";
222 pub const BCRYPT_DH_PRIVATE_BLOB: &'static str = "DHPRIVATEBLOB";
223 pub const LEGACY_DH_PUBLIC_BLOB: &'static str = "CAPIDHPUBLICBLOB";
224 pub const LEGACY_DH_PRIVATE_BLOB: &'static str = "CAPIDHPRIVATEBLOB";
225 pub const BCRYPT_DH_PUBLIC_MAGIC: ULONG = 0x42504844;
226 pub const BCRYPT_DH_PRIVATE_MAGIC: ULONG = 0x56504844;
227 STRUCT!{struct BCRYPT_DH_KEY_BLOB {
228     dwMagic: ULONG,
229     cbKey: ULONG,
230 }}
231 pub type PBCRYPT_DH_KEY_BLOB = *mut BCRYPT_DH_KEY_BLOB;
232 pub const BCRYPT_DH_PARAMETERS: &'static str = "DHParameters";
233 pub const BCRYPT_DH_PARAMETERS_MAGIC: ULONG = 0x4d504844;
234 STRUCT!{struct BCRYPT_DH_PARAMETER_HEADER {
235     cbLength: ULONG,
236     dwMagic: ULONG,
237     cbKeyLength: ULONG,
238 }}
239 pub const BCRYPT_DSA_PUBLIC_BLOB: &'static str = "DSAPUBLICBLOB";
240 pub const BCRYPT_DSA_PRIVATE_BLOB: &'static str = "DSAPRIVATEBLOB";
241 pub const LEGACY_DSA_PUBLIC_BLOB: &'static str = "CAPIDSAPUBLICBLOB";
242 pub const LEGACY_DSA_PRIVATE_BLOB: &'static str = "CAPIDSAPRIVATEBLOB";
243 pub const LEGACY_DSA_V2_PUBLIC_BLOB: &'static str = "V2CAPIDSAPUBLICBLOB";
244 pub const LEGACY_DSA_V2_PRIVATE_BLOB: &'static str = "V2CAPIDSAPRIVATEBLOB";
245 pub const BCRYPT_DSA_PUBLIC_MAGIC: ULONG = 0x42505344;
246 pub const BCRYPT_DSA_PRIVATE_MAGIC: ULONG = 0x56505344;
247 pub const BCRYPT_DSA_PUBLIC_MAGIC_V2: ULONG = 0x32425044;
248 pub const BCRYPT_DSA_PRIVATE_MAGIC_V2: ULONG = 0x32565044;
249 STRUCT!{struct BCRYPT_DSA_KEY_BLOB {
250     dwMagic: ULONG,
251     cbKey: ULONG,
252     Count: [UCHAR; 4],
253     Seed: [UCHAR; 20],
254     q: [UCHAR; 20],
255 }}
256 pub type PBCRYPT_DSA_KEY_BLOB = *mut BCRYPT_DSA_KEY_BLOB;
257 ENUM!{enum HASHALGORITHM_ENUM {
258     DSA_HASH_ALGORITHM_SHA1,
259     DSA_HASH_ALGORITHM_SHA256,
260     DSA_HASH_ALGORITHM_SHA512,
261 }}
262 ENUM!{enum DSAFIPSVERSION_ENUM {
263     DSA_FIPS186_2,
264     DSA_FIPS186_3,
265 }}
266 STRUCT!{struct BCRYPT_DSA_KEY_BLOB_V2 {
267     dwMagic: ULONG,
268     cbKey: ULONG,
269     hashAlgorithm: HASHALGORITHM_ENUM,
270     standardVersion: DSAFIPSVERSION_ENUM,
271     cbSeedLength: ULONG,
272     cbGroupSize: ULONG,
273     Count: [UCHAR; 4],
274 }}
275 pub type PBCRYPT_DSA_KEY_BLOB_V2 = *mut BCRYPT_DSA_KEY_BLOB_V2;
276 STRUCT!{struct BCRYPT_KEY_DATA_BLOB_HEADER {
277     dwMagic: ULONG,
278     dwVersion: ULONG,
279     cbKeyData: ULONG,
280 }}
281 pub type PBCRYPT_KEY_DATA_BLOB_HEADER = *mut BCRYPT_KEY_DATA_BLOB_HEADER;
282 pub const BCRYPT_KEY_DATA_BLOB_MAGIC: ULONG = 0x4d42444b;
283 pub const BCRYPT_KEY_DATA_BLOB_VERSION1: ULONG = 0x1;
284 pub const BCRYPT_DSA_PARAMETERS: &'static str = "DSAParameters";
285 pub const BCRYPT_DSA_PARAMETERS_MAGIC: ULONG = 0x4d505344;
286 pub const BCRYPT_DSA_PARAMETERS_MAGIC_V2: ULONG = 0x324d5044;
287 STRUCT!{struct BCRYPT_DSA_PARAMETER_HEADER {
288     cbLength: ULONG,
289     dwMagic: ULONG,
290     cbKeyLength: ULONG,
291     Count: [UCHAR; 4],
292     Seed: [UCHAR; 20],
293     q: [UCHAR; 20],
294 }}
295 STRUCT!{struct BCRYPT_DSA_PARAMETER_HEADER_V2 {
296     cbLength: ULONG,
297     dwMagic: ULONG,
298     cbKeyLength: ULONG,
299     hashAlgorithm: HASHALGORITHM_ENUM,
300     standardVersion: DSAFIPSVERSION_ENUM,
301     cbSeedLength: ULONG,
302     cbGroupSize: ULONG,
303     Count: [UCHAR; 4],
304 }}
305 pub const BCRYPT_ECC_PARAMETERS: &'static str = "ECCParameters";
306 pub const BCRYPT_ECC_CURVE_NAME: &'static str = "ECCCurveName";
307 pub const BCRYPT_ECC_CURVE_NAME_LIST: &'static str = "ECCCurveNameList";
308 pub const BCRYPT_ECC_PARAMETERS_MAGIC: ULONG = 0x50434345;
309 STRUCT!{struct BCRYPT_ECC_CURVE_NAMES {
310     dwEccCurveNames: ULONG,
311     pEccCurveNames: LPWSTR,
312 }}
313 pub const BCRYPT_ECC_CURVE_BRAINPOOLP160R1: &'static str = "brainpoolP160r1";
314 pub const BCRYPT_ECC_CURVE_BRAINPOOLP160T1: &'static str = "brainpoolP160t1";
315 pub const BCRYPT_ECC_CURVE_BRAINPOOLP192R1: &'static str = "brainpoolP192r1";
316 pub const BCRYPT_ECC_CURVE_BRAINPOOLP192T1: &'static str = "brainpoolP192t1";
317 pub const BCRYPT_ECC_CURVE_BRAINPOOLP224R1: &'static str = "brainpoolP224r1";
318 pub const BCRYPT_ECC_CURVE_BRAINPOOLP224T1: &'static str = "brainpoolP224t1";
319 pub const BCRYPT_ECC_CURVE_BRAINPOOLP256R1: &'static str = "brainpoolP256r1";
320 pub const BCRYPT_ECC_CURVE_BRAINPOOLP256T1: &'static str = "brainpoolP256t1";
321 pub const BCRYPT_ECC_CURVE_BRAINPOOLP320R1: &'static str = "brainpoolP320r1";
322 pub const BCRYPT_ECC_CURVE_BRAINPOOLP320T1: &'static str = "brainpoolP320t1";
323 pub const BCRYPT_ECC_CURVE_BRAINPOOLP384R1: &'static str = "brainpoolP384r1";
324 pub const BCRYPT_ECC_CURVE_BRAINPOOLP384T1: &'static str = "brainpoolP384t1";
325 pub const BCRYPT_ECC_CURVE_BRAINPOOLP512R1: &'static str = "brainpoolP512r1";
326 pub const BCRYPT_ECC_CURVE_BRAINPOOLP512T1: &'static str = "brainpoolP512t1";
327 pub const BCRYPT_ECC_CURVE_25519: &'static str = "curve25519";
328 pub const BCRYPT_ECC_CURVE_EC192WAPI: &'static str = "ec192wapi";
329 pub const BCRYPT_ECC_CURVE_NISTP192: &'static str = "nistP192";
330 pub const BCRYPT_ECC_CURVE_NISTP224: &'static str = "nistP224";
331 pub const BCRYPT_ECC_CURVE_NISTP256: &'static str = "nistP256";
332 pub const BCRYPT_ECC_CURVE_NISTP384: &'static str = "nistP384";
333 pub const BCRYPT_ECC_CURVE_NISTP521: &'static str = "nistP521";
334 pub const BCRYPT_ECC_CURVE_NUMSP256T1: &'static str = "numsP256t1";
335 pub const BCRYPT_ECC_CURVE_NUMSP384T1: &'static str = "numsP384t1";
336 pub const BCRYPT_ECC_CURVE_NUMSP512T1: &'static str = "numsP512t1";
337 pub const BCRYPT_ECC_CURVE_SECP160K1: &'static str = "secP160k1";
338 pub const BCRYPT_ECC_CURVE_SECP160R1: &'static str = "secP160r1";
339 pub const BCRYPT_ECC_CURVE_SECP160R2: &'static str = "secP160r2";
340 pub const BCRYPT_ECC_CURVE_SECP192K1: &'static str = "secP192k1";
341 pub const BCRYPT_ECC_CURVE_SECP192R1: &'static str = "secP192r1";
342 pub const BCRYPT_ECC_CURVE_SECP224K1: &'static str = "secP224k1";
343 pub const BCRYPT_ECC_CURVE_SECP224R1: &'static str = "secP224r1";
344 pub const BCRYPT_ECC_CURVE_SECP256K1: &'static str = "secP256k1";
345 pub const BCRYPT_ECC_CURVE_SECP256R1: &'static str = "secP256r1";
346 pub const BCRYPT_ECC_CURVE_SECP384R1: &'static str = "secP384r1";
347 pub const BCRYPT_ECC_CURVE_SECP521R1: &'static str = "secP521r1";
348 pub const BCRYPT_ECC_CURVE_WTLS7: &'static str = "wtls7";
349 pub const BCRYPT_ECC_CURVE_WTLS9: &'static str = "wtls9";
350 pub const BCRYPT_ECC_CURVE_WTLS12: &'static str = "wtls12";
351 pub const BCRYPT_ECC_CURVE_X962P192V1: &'static str = "x962P192v1";
352 pub const BCRYPT_ECC_CURVE_X962P192V2: &'static str = "x962P192v2";
353 pub const BCRYPT_ECC_CURVE_X962P192V3: &'static str = "x962P192v3";
354 pub const BCRYPT_ECC_CURVE_X962P239V1: &'static str = "x962P239v1";
355 pub const BCRYPT_ECC_CURVE_X962P239V2: &'static str = "x962P239v2";
356 pub const BCRYPT_ECC_CURVE_X962P239V3: &'static str = "x962P239v3";
357 pub const BCRYPT_ECC_CURVE_X962P256V1: &'static str = "x962P256v1";
358 ENUM!{enum BCRYPT_HASH_OPERATION_TYPE {
359     BCRYPT_HASH_OPERATION_HASH_DATA = 1,
360     BCRYPT_HASH_OPERATION_FINISH_HASH = 2,
361 }}
362 STRUCT!{struct BCRYPT_MULTI_HASH_OPERATION {
363     iHash: ULONG,
364     hashOperation: BCRYPT_HASH_OPERATION_TYPE,
365     pbBuffer: PUCHAR,
366     cbBuffer: ULONG,
367 }}
368 ENUM!{enum BCRYPT_MULTI_OPERATION_TYPE {
369     BCRYPT_OPERATION_TYPE_HASH = 1,
370 }}
371 STRUCT!{struct BCRYPT_MULTI_OBJECT_LENGTH_STRUCT {
372     cbPerObject: ULONG,
373     cbPerElement: ULONG,
374 }}
375 pub const MS_PRIMITIVE_PROVIDER: &'static str = "Microsoft Primitive Provider";
376 pub const MS_PLATFORM_CRYPTO_PROVIDER: &'static str = "Microsoft Platform Crypto Provider";
377 pub const BCRYPT_RSA_ALGORITHM: &'static str = "RSA";
378 pub const BCRYPT_RSA_SIGN_ALGORITHM: &'static str = "RSA_SIGN";
379 pub const BCRYPT_DH_ALGORITHM: &'static str = "DH";
380 pub const BCRYPT_DSA_ALGORITHM: &'static str = "DSA";
381 pub const BCRYPT_RC2_ALGORITHM: &'static str = "RC2";
382 pub const BCRYPT_RC4_ALGORITHM: &'static str = "RC4";
383 pub const BCRYPT_AES_ALGORITHM: &'static str = "AES";
384 pub const BCRYPT_DES_ALGORITHM: &'static str = "DES";
385 pub const BCRYPT_DESX_ALGORITHM: &'static str = "DESX";
386 pub const BCRYPT_3DES_ALGORITHM: &'static str = "3DES";
387 pub const BCRYPT_3DES_112_ALGORITHM: &'static str = "3DES_112";
388 pub const BCRYPT_MD2_ALGORITHM: &'static str = "MD2";
389 pub const BCRYPT_MD4_ALGORITHM: &'static str = "MD4";
390 pub const BCRYPT_MD5_ALGORITHM: &'static str = "MD5";
391 pub const BCRYPT_SHA1_ALGORITHM: &'static str = "SHA1";
392 pub const BCRYPT_SHA256_ALGORITHM: &'static str = "SHA256";
393 pub const BCRYPT_SHA384_ALGORITHM: &'static str = "SHA384";
394 pub const BCRYPT_SHA512_ALGORITHM: &'static str = "SHA512";
395 pub const BCRYPT_AES_GMAC_ALGORITHM: &'static str = "AES-GMAC";
396 pub const BCRYPT_AES_CMAC_ALGORITHM: &'static str = "AES-CMAC";
397 pub const BCRYPT_ECDSA_P256_ALGORITHM: &'static str = "ECDSA_P256";
398 pub const BCRYPT_ECDSA_P384_ALGORITHM: &'static str = "ECDSA_P384";
399 pub const BCRYPT_ECDSA_P521_ALGORITHM: &'static str = "ECDSA_P521";
400 pub const BCRYPT_ECDH_P256_ALGORITHM: &'static str = "ECDH_P256";
401 pub const BCRYPT_ECDH_P384_ALGORITHM: &'static str = "ECDH_P384";
402 pub const BCRYPT_ECDH_P521_ALGORITHM: &'static str = "ECDH_P521";
403 pub const BCRYPT_RNG_ALGORITHM: &'static str = "RNG";
404 pub const BCRYPT_RNG_FIPS186_DSA_ALGORITHM: &'static str = "FIPS186DSARNG";
405 pub const BCRYPT_RNG_DUAL_EC_ALGORITHM: &'static str = "DUALECRNG";
406 pub const BCRYPT_SP800108_CTR_HMAC_ALGORITHM: &'static str = "SP800_108_CTR_HMAC";
407 pub const BCRYPT_SP80056A_CONCAT_ALGORITHM: &'static str = "SP800_56A_CONCAT";
408 pub const BCRYPT_PBKDF2_ALGORITHM: &'static str = "PBKDF2";
409 pub const BCRYPT_CAPI_KDF_ALGORITHM: &'static str = "CAPI_KDF";
410 pub const BCRYPT_TLS1_1_KDF_ALGORITHM: &'static str = "TLS1_1_KDF";
411 pub const BCRYPT_TLS1_2_KDF_ALGORITHM: &'static str = "TLS1_2_KDF";
412 pub const BCRYPT_ECDSA_ALGORITHM: &'static str = "ECDSA";
413 pub const BCRYPT_ECDH_ALGORITHM: &'static str = "ECDH";
414 pub const BCRYPT_XTS_AES_ALGORITHM: &'static str = "XTS-AES";
415 pub const BCRYPT_CIPHER_INTERFACE: ULONG = 0x00000001;
416 pub const BCRYPT_HASH_INTERFACE: ULONG = 0x00000002;
417 pub const BCRYPT_ASYMMETRIC_ENCRYPTION_INTERFACE: ULONG = 0x00000003;
418 pub const BCRYPT_SECRET_AGREEMENT_INTERFACE: ULONG = 0x00000004;
419 pub const BCRYPT_SIGNATURE_INTERFACE: ULONG = 0x00000005;
420 pub const BCRYPT_RNG_INTERFACE: ULONG = 0x00000006;
421 pub const BCRYPT_KEY_DERIVATION_INTERFACE: ULONG = 0x00000007;
422 pub const BCRYPT_MD2_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x00000001 as BCRYPT_ALG_HANDLE;
423 pub const BCRYPT_MD4_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x00000011 as BCRYPT_ALG_HANDLE;
424 pub const BCRYPT_MD5_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x00000021 as BCRYPT_ALG_HANDLE;
425 pub const BCRYPT_SHA1_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x00000031 as BCRYPT_ALG_HANDLE;
426 pub const BCRYPT_SHA256_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x00000041 as BCRYPT_ALG_HANDLE;
427 pub const BCRYPT_SHA384_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x00000051 as BCRYPT_ALG_HANDLE;
428 pub const BCRYPT_SHA512_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x00000061 as BCRYPT_ALG_HANDLE;
429 pub const BCRYPT_RC4_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x00000071 as BCRYPT_ALG_HANDLE;
430 pub const BCRYPT_RNG_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x00000081 as BCRYPT_ALG_HANDLE;
431 pub const BCRYPT_HMAC_MD5_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x00000091 as BCRYPT_ALG_HANDLE;
432 pub const BCRYPT_HMAC_SHA1_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x000000a1 as BCRYPT_ALG_HANDLE;
433 pub const BCRYPT_HMAC_SHA256_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x000000b1 as BCRYPT_ALG_HANDLE;
434 pub const BCRYPT_HMAC_SHA384_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x000000c1 as BCRYPT_ALG_HANDLE;
435 pub const BCRYPT_HMAC_SHA512_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x000000d1 as BCRYPT_ALG_HANDLE;
436 pub const BCRYPT_RSA_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x000000e1 as BCRYPT_ALG_HANDLE;
437 pub const BCRYPT_ECDSA_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x000000f1 as BCRYPT_ALG_HANDLE;
438 pub const BCRYPT_AES_CMAC_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x00000101 as BCRYPT_ALG_HANDLE;
439 pub const BCRYPT_AES_GMAC_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x00000111 as BCRYPT_ALG_HANDLE;
440 pub const BCRYPT_HMAC_MD2_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x00000121 as BCRYPT_ALG_HANDLE;
441 pub const BCRYPT_HMAC_MD4_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x00000131 as BCRYPT_ALG_HANDLE;
442 pub const BCRYPT_3DES_CBC_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x00000141 as BCRYPT_ALG_HANDLE;
443 pub const BCRYPT_3DES_ECB_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x00000151 as BCRYPT_ALG_HANDLE;
444 pub const BCRYPT_3DES_CFB_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x00000161 as BCRYPT_ALG_HANDLE;
445 pub const BCRYPT_3DES_112_CBC_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x00000171 as BCRYPT_ALG_HANDLE;
446 pub const BCRYPT_3DES_112_ECB_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x00000181 as BCRYPT_ALG_HANDLE;
447 pub const BCRYPT_3DES_112_CFB_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x00000191 as BCRYPT_ALG_HANDLE;
448 pub const BCRYPT_AES_CBC_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x000001a1 as BCRYPT_ALG_HANDLE;
449 pub const BCRYPT_AES_ECB_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x000001b1 as BCRYPT_ALG_HANDLE;
450 pub const BCRYPT_AES_CFB_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x000001c1 as BCRYPT_ALG_HANDLE;
451 pub const BCRYPT_AES_CCM_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x000001d1 as BCRYPT_ALG_HANDLE;
452 pub const BCRYPT_AES_GCM_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x000001e1 as BCRYPT_ALG_HANDLE;
453 pub const BCRYPT_DES_CBC_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x000001f1 as BCRYPT_ALG_HANDLE;
454 pub const BCRYPT_DES_ECB_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x00000201 as BCRYPT_ALG_HANDLE;
455 pub const BCRYPT_DES_CFB_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x00000211 as BCRYPT_ALG_HANDLE;
456 pub const BCRYPT_DESX_CBC_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x00000221 as BCRYPT_ALG_HANDLE;
457 pub const BCRYPT_DESX_ECB_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x00000231 as BCRYPT_ALG_HANDLE;
458 pub const BCRYPT_DESX_CFB_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x00000241 as BCRYPT_ALG_HANDLE;
459 pub const BCRYPT_RC2_CBC_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x00000251 as BCRYPT_ALG_HANDLE;
460 pub const BCRYPT_RC2_ECB_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x00000261 as BCRYPT_ALG_HANDLE;
461 pub const BCRYPT_RC2_CFB_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x00000271 as BCRYPT_ALG_HANDLE;
462 pub const BCRYPT_DH_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x00000281 as BCRYPT_ALG_HANDLE;
463 pub const BCRYPT_ECDH_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x00000291 as BCRYPT_ALG_HANDLE;
464 pub const BCRYPT_ECDH_P256_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x000002a1 as BCRYPT_ALG_HANDLE;
465 pub const BCRYPT_ECDH_P384_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x000002b1 as BCRYPT_ALG_HANDLE;
466 pub const BCRYPT_ECDH_P521_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x000002c1 as BCRYPT_ALG_HANDLE;
467 pub const BCRYPT_DSA_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x000002d1 as BCRYPT_ALG_HANDLE;
468 pub const BCRYPT_ECDSA_P256_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x000002e1 as BCRYPT_ALG_HANDLE;
469 pub const BCRYPT_ECDSA_P384_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x000002f1 as BCRYPT_ALG_HANDLE;
470 pub const BCRYPT_ECDSA_P521_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x00000301 as BCRYPT_ALG_HANDLE;
471 pub const BCRYPT_RSA_SIGN_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x00000311 as BCRYPT_ALG_HANDLE;
472 pub const BCRYPT_CAPI_KDF_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x00000321 as BCRYPT_ALG_HANDLE;
473 pub const BCRYPT_PBKDF2_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x00000331 as BCRYPT_ALG_HANDLE;
474 pub const BCRYPT_SP800108_CTR_HMAC_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x00000341 as BCRYPT_ALG_HANDLE;
475 pub const BCRYPT_SP80056A_CONCAT_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x00000351 as BCRYPT_ALG_HANDLE;
476 pub const BCRYPT_TLS1_1_KDF_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x00000361 as BCRYPT_ALG_HANDLE;
477 pub const BCRYPT_TLS1_2_KDF_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x00000371 as BCRYPT_ALG_HANDLE;
478 pub const BCRYPT_XTS_AES_ALG_HANDLE: BCRYPT_ALG_HANDLE = 0x00000381 as BCRYPT_ALG_HANDLE;
479 pub const BCRYPT_ALG_HANDLE_HMAC_FLAG: ULONG = 0x00000008;
480 pub const BCRYPT_CAPI_AES_FLAG: ULONG = 0x00000010;
481 pub const BCRYPT_HASH_REUSABLE_FLAG: ULONG = 0x00000020;
482 pub const BCRYPT_BUFFERS_LOCKED_FLAG: ULONG = 0x00000040;
483 pub const BCRYPT_EXTENDED_KEYSIZE: ULONG = 0x00000080;
484 pub const BCRYPT_ENABLE_INCOMPATIBLE_FIPS_CHECKS: ULONG = 0x00000100;
485 extern "system" {
BCryptOpenAlgorithmProvider( phAlgorithm: *mut BCRYPT_ALG_HANDLE, pszAlgId: LPCWSTR, pszImplementation: LPCWSTR, dwFlags: ULONG, ) -> NTSTATUS486     pub fn BCryptOpenAlgorithmProvider(
487         phAlgorithm: *mut BCRYPT_ALG_HANDLE,
488         pszAlgId: LPCWSTR,
489         pszImplementation: LPCWSTR,
490         dwFlags: ULONG,
491     ) -> NTSTATUS;
492 }
493 pub const BCRYPT_CIPHER_OPERATION: ULONG = 0x00000001;
494 pub const BCRYPT_HASH_OPERATION: ULONG = 0x00000002;
495 pub const BCRYPT_ASYMMETRIC_ENCRYPTION_OPERATION: ULONG = 0x00000004;
496 pub const BCRYPT_SECRET_AGREEMENT_OPERATION: ULONG = 0x00000008;
497 pub const BCRYPT_SIGNATURE_OPERATION: ULONG = 0x00000010;
498 pub const BCRYPT_RNG_OPERATION: ULONG = 0x00000020;
499 pub const BCRYPT_KEY_DERIVATION_OPERATION: ULONG = 0x00000040;
500 STRUCT!{struct BCRYPT_ALGORITHM_IDENTIFIER {
501     pszName: LPWSTR,
502     dwClass: ULONG,
503     dwFlags: ULONG,
504 }}
505 extern "system" {
BCryptEnumAlgorithms( dwAlgOperations: ULONG, pAlgCount: *mut ULONG, ppAlgList: *mut *mut BCRYPT_ALGORITHM_IDENTIFIER, dwFlags: ULONG, ) -> NTSTATUS506     pub fn BCryptEnumAlgorithms(
507         dwAlgOperations: ULONG,
508         pAlgCount: *mut ULONG,
509         ppAlgList: *mut *mut BCRYPT_ALGORITHM_IDENTIFIER,
510         dwFlags: ULONG,
511     ) -> NTSTATUS;
512 }
513 STRUCT!{struct BCRYPT_PROVIDER_NAME {
514     pszProviderName: LPWSTR,
515 }}
516 extern "system" {
BCryptEnumProviders( pszAlgId: LPCWSTR, pImplCount: *mut ULONG, ppImplList: *mut *mut BCRYPT_PROVIDER_NAME, dwFlags: ULONG, ) -> NTSTATUS517     pub fn BCryptEnumProviders(
518         pszAlgId: LPCWSTR,
519         pImplCount: *mut ULONG,
520         ppImplList: *mut *mut BCRYPT_PROVIDER_NAME,
521         dwFlags: ULONG,
522     ) -> NTSTATUS;
523 }
524 pub const BCRYPT_PUBLIC_KEY_FLAG: ULONG = 0x00000001;
525 pub const BCRYPT_PRIVATE_KEY_FLAG: ULONG = 0x00000002;
526 extern "system" {
BCryptGetProperty( hObject: BCRYPT_HANDLE, pszProperty: LPCWSTR, pbOutput: PUCHAR, cbOutput: ULONG, pcbResult: *mut ULONG, dwFlags: ULONG, ) -> NTSTATUS527     pub fn BCryptGetProperty(
528         hObject: BCRYPT_HANDLE,
529         pszProperty: LPCWSTR,
530         pbOutput: PUCHAR,
531         cbOutput: ULONG,
532         pcbResult: *mut ULONG,
533         dwFlags: ULONG,
534     ) -> NTSTATUS;
BCryptSetProperty( hObject: BCRYPT_HANDLE, pszProperty: LPCWSTR, pbInput: PUCHAR, cbInput: ULONG, dwFlags: ULONG, ) -> NTSTATUS535     pub fn BCryptSetProperty(
536         hObject: BCRYPT_HANDLE,
537         pszProperty: LPCWSTR,
538         pbInput: PUCHAR,
539         cbInput: ULONG,
540         dwFlags: ULONG,
541     ) -> NTSTATUS;
BCryptCloseAlgorithmProvider( hAlgorithm: BCRYPT_ALG_HANDLE, dwFlags: ULONG, ) -> NTSTATUS542     pub fn BCryptCloseAlgorithmProvider(
543         hAlgorithm: BCRYPT_ALG_HANDLE,
544         dwFlags: ULONG,
545     ) -> NTSTATUS;
BCryptFreeBuffer( pvBuffer: PVOID, )546     pub fn BCryptFreeBuffer(
547         pvBuffer: PVOID,
548     );
BCryptGenerateSymmetricKey( hAlgorithm: BCRYPT_ALG_HANDLE, phKey: *mut BCRYPT_KEY_HANDLE, pbKeyObject: PUCHAR, cbKeyObject: ULONG, pbSecret: PUCHAR, cbSecret: ULONG, dwFlags: ULONG, ) -> NTSTATUS549     pub fn BCryptGenerateSymmetricKey(
550         hAlgorithm: BCRYPT_ALG_HANDLE,
551         phKey: *mut BCRYPT_KEY_HANDLE,
552         pbKeyObject: PUCHAR,
553         cbKeyObject: ULONG,
554         pbSecret: PUCHAR,
555         cbSecret: ULONG,
556         dwFlags: ULONG,
557     ) -> NTSTATUS;
BCryptGenerateKeyPair( hAlgorithm: BCRYPT_ALG_HANDLE, phKey: *mut BCRYPT_KEY_HANDLE, dwLength: ULONG, dwFlags: ULONG, ) -> NTSTATUS558     pub fn BCryptGenerateKeyPair(
559         hAlgorithm: BCRYPT_ALG_HANDLE,
560         phKey: *mut BCRYPT_KEY_HANDLE,
561         dwLength: ULONG,
562         dwFlags: ULONG,
563     ) -> NTSTATUS;
BCryptEncrypt( hKey: BCRYPT_KEY_HANDLE, pbInput: PUCHAR, cbInput: ULONG, pPaddingInfo: *mut VOID, pbIV: PUCHAR, cbIV: ULONG, pbOutput: PUCHAR, cbOutput: ULONG, pcbResult: *mut ULONG, dwFlags: ULONG, ) -> NTSTATUS564     pub fn BCryptEncrypt(
565         hKey: BCRYPT_KEY_HANDLE,
566         pbInput: PUCHAR,
567         cbInput: ULONG,
568         pPaddingInfo: *mut VOID,
569         pbIV: PUCHAR,
570         cbIV: ULONG,
571         pbOutput: PUCHAR,
572         cbOutput: ULONG,
573         pcbResult: *mut ULONG,
574         dwFlags: ULONG,
575     ) -> NTSTATUS;
BCryptDecrypt( hKey: BCRYPT_KEY_HANDLE, pbInput: PUCHAR, cbInput: ULONG, pPaddingInfo: *mut VOID, pbIV: PUCHAR, cbIV: ULONG, pbOutput: PUCHAR, cbOutput: ULONG, pcbResult: *mut ULONG, dwFlags: ULONG, ) -> NTSTATUS576     pub fn BCryptDecrypt(
577         hKey: BCRYPT_KEY_HANDLE,
578         pbInput: PUCHAR,
579         cbInput: ULONG,
580         pPaddingInfo: *mut VOID,
581         pbIV: PUCHAR,
582         cbIV: ULONG,
583         pbOutput: PUCHAR,
584         cbOutput: ULONG,
585         pcbResult: *mut ULONG,
586         dwFlags: ULONG,
587     ) -> NTSTATUS;
BCryptExportKey( hKey: BCRYPT_KEY_HANDLE, hExportKey: BCRYPT_KEY_HANDLE, pszBlobType: LPCWSTR, pbOutput: PUCHAR, cbOutput: ULONG, pcbResult: *mut ULONG, dwFlags: ULONG, ) -> NTSTATUS588     pub fn BCryptExportKey(
589         hKey: BCRYPT_KEY_HANDLE,
590         hExportKey: BCRYPT_KEY_HANDLE,
591         pszBlobType: LPCWSTR,
592         pbOutput: PUCHAR,
593         cbOutput: ULONG,
594         pcbResult: *mut ULONG,
595         dwFlags: ULONG,
596     ) -> NTSTATUS;
BCryptImportKey( hAlgorithm: BCRYPT_ALG_HANDLE, hImportKey: BCRYPT_KEY_HANDLE, pszBlobType: LPCWSTR, phKey: *mut BCRYPT_KEY_HANDLE, pbKeyObject: PUCHAR, cbKeyObject: ULONG, pbInput: PUCHAR, cbInput: ULONG, dwFlags: ULONG, ) -> NTSTATUS597     pub fn BCryptImportKey(
598         hAlgorithm: BCRYPT_ALG_HANDLE,
599         hImportKey: BCRYPT_KEY_HANDLE,
600         pszBlobType: LPCWSTR,
601         phKey: *mut BCRYPT_KEY_HANDLE,
602         pbKeyObject: PUCHAR,
603         cbKeyObject: ULONG,
604         pbInput: PUCHAR,
605         cbInput: ULONG,
606         dwFlags: ULONG,
607     ) -> NTSTATUS;
608 }
609 pub const BCRYPT_NO_KEY_VALIDATION: ULONG = 0x00000008;
610 extern "system" {
BCryptImportKeyPair( hAlgorithm: BCRYPT_ALG_HANDLE, hImportKey: BCRYPT_KEY_HANDLE, pszBlobType: LPCWSTR, phKey: *mut BCRYPT_KEY_HANDLE, pbInput: PUCHAR, cbInput: ULONG, dwFlags: ULONG, ) -> NTSTATUS611     pub fn BCryptImportKeyPair(
612         hAlgorithm: BCRYPT_ALG_HANDLE,
613         hImportKey: BCRYPT_KEY_HANDLE,
614         pszBlobType: LPCWSTR,
615         phKey: *mut BCRYPT_KEY_HANDLE,
616         pbInput: PUCHAR,
617         cbInput: ULONG,
618         dwFlags: ULONG,
619     ) -> NTSTATUS;
BCryptDuplicateKey( hKey: BCRYPT_KEY_HANDLE, phNewKey: *mut BCRYPT_KEY_HANDLE, pbKeyObject: PUCHAR, cbKeyObject: ULONG, dwFlags: ULONG, ) -> NTSTATUS620     pub fn BCryptDuplicateKey(
621         hKey: BCRYPT_KEY_HANDLE,
622         phNewKey: *mut BCRYPT_KEY_HANDLE,
623         pbKeyObject: PUCHAR,
624         cbKeyObject: ULONG,
625         dwFlags: ULONG,
626     ) -> NTSTATUS;
BCryptFinalizeKeyPair( hKey: BCRYPT_KEY_HANDLE, dwFlags: ULONG, ) -> NTSTATUS627     pub fn BCryptFinalizeKeyPair(
628         hKey: BCRYPT_KEY_HANDLE,
629         dwFlags: ULONG,
630     ) -> NTSTATUS;
BCryptDestroyKey( hKey: BCRYPT_KEY_HANDLE, ) -> NTSTATUS631     pub fn BCryptDestroyKey(
632         hKey: BCRYPT_KEY_HANDLE,
633     ) -> NTSTATUS;
BCryptDestroySecret( hSecret: BCRYPT_SECRET_HANDLE, ) -> NTSTATUS634     pub fn BCryptDestroySecret(
635         hSecret: BCRYPT_SECRET_HANDLE,
636     ) -> NTSTATUS;
BCryptSignHash( hKey: BCRYPT_KEY_HANDLE, pPaddingInfo: *mut VOID, pbInput: PUCHAR, cbInput: ULONG, pbOutput: PUCHAR, cbOutput: ULONG, pcbResult: *mut ULONG, dwFlags: ULONG, ) -> NTSTATUS637     pub fn BCryptSignHash(
638         hKey: BCRYPT_KEY_HANDLE,
639         pPaddingInfo: *mut VOID,
640         pbInput: PUCHAR,
641         cbInput: ULONG,
642         pbOutput: PUCHAR,
643         cbOutput: ULONG,
644         pcbResult: *mut ULONG,
645         dwFlags: ULONG,
646     ) -> NTSTATUS;
BCryptVerifySignature( hKey: BCRYPT_KEY_HANDLE, pPaddingInfo: *mut VOID, pbHash: PUCHAR, cbHash: ULONG, pbSignature: PUCHAR, cbSignature: ULONG, dwFlags: ULONG, ) -> NTSTATUS647     pub fn BCryptVerifySignature(
648         hKey: BCRYPT_KEY_HANDLE,
649         pPaddingInfo: *mut VOID,
650         pbHash: PUCHAR,
651         cbHash: ULONG,
652         pbSignature: PUCHAR,
653         cbSignature: ULONG,
654         dwFlags: ULONG,
655     ) -> NTSTATUS;
BCryptSecretAgreement( hPrivKey: BCRYPT_KEY_HANDLE, hPubKey: BCRYPT_KEY_HANDLE, phAgreedSecret: *mut BCRYPT_SECRET_HANDLE, dwFlags: ULONG, ) -> NTSTATUS656     pub fn BCryptSecretAgreement(
657         hPrivKey: BCRYPT_KEY_HANDLE,
658         hPubKey: BCRYPT_KEY_HANDLE,
659         phAgreedSecret: *mut BCRYPT_SECRET_HANDLE,
660         dwFlags: ULONG,
661     ) -> NTSTATUS;
BCryptDeriveKey( hSharedSecret: BCRYPT_SECRET_HANDLE, pwszKDF: LPCWSTR, pParameterList: *mut BCryptBufferDesc, pbDerivedKey: PUCHAR, cbDerivedKey: ULONG, pcbResult: *mut ULONG, dwFlags: ULONG, ) -> NTSTATUS662     pub fn BCryptDeriveKey(
663         hSharedSecret: BCRYPT_SECRET_HANDLE,
664         pwszKDF: LPCWSTR,
665         pParameterList: *mut BCryptBufferDesc,
666         pbDerivedKey: PUCHAR,
667         cbDerivedKey: ULONG,
668         pcbResult: *mut ULONG,
669         dwFlags: ULONG,
670     ) -> NTSTATUS;
BCryptKeyDerivation( hKey: BCRYPT_KEY_HANDLE, pParameterList: *mut BCryptBufferDesc, pbDerivedKey: PUCHAR, cbDerivedKey: ULONG, pcbResult: *mut ULONG, dwFlags: ULONG, ) -> NTSTATUS671     pub fn BCryptKeyDerivation(
672         hKey: BCRYPT_KEY_HANDLE,
673         pParameterList: *mut BCryptBufferDesc,
674         pbDerivedKey: PUCHAR,
675         cbDerivedKey: ULONG,
676         pcbResult: *mut ULONG,
677         dwFlags: ULONG,
678     ) -> NTSTATUS;
BCryptCreateHash( hAlgorithm: BCRYPT_ALG_HANDLE, phHash: *mut BCRYPT_HASH_HANDLE, pbHashObject: PUCHAR, cbHashObject: ULONG, pbSecret: PUCHAR, cbSecret: ULONG, dwFlags: ULONG, ) -> NTSTATUS679     pub fn BCryptCreateHash(
680         hAlgorithm: BCRYPT_ALG_HANDLE,
681         phHash: *mut BCRYPT_HASH_HANDLE,
682         pbHashObject: PUCHAR,
683         cbHashObject: ULONG,
684         pbSecret: PUCHAR,
685         cbSecret: ULONG,
686         dwFlags: ULONG,
687     ) -> NTSTATUS;
BCryptHashData( hHash: BCRYPT_HASH_HANDLE, pbInput: PUCHAR, cbInput: ULONG, dwFlags: ULONG, ) -> NTSTATUS688     pub fn BCryptHashData(
689         hHash: BCRYPT_HASH_HANDLE,
690         pbInput: PUCHAR,
691         cbInput: ULONG,
692         dwFlags: ULONG,
693     ) -> NTSTATUS;
BCryptFinishHash( hHash: BCRYPT_HASH_HANDLE, pbOutput: PUCHAR, cbOutput: ULONG, dwFlags: ULONG, ) -> NTSTATUS694     pub fn BCryptFinishHash(
695         hHash: BCRYPT_HASH_HANDLE,
696         pbOutput: PUCHAR,
697         cbOutput: ULONG,
698         dwFlags: ULONG,
699     ) -> NTSTATUS;
BCryptCreateMultiHash( hAlgorithm: BCRYPT_ALG_HANDLE, phHash: *mut BCRYPT_HASH_HANDLE, nHashes: ULONG, pbHashObject: PUCHAR, cbHashObject: ULONG, pbSecret: PUCHAR, cbSecret: ULONG, dwFlags: ULONG, ) -> NTSTATUS700     pub fn BCryptCreateMultiHash(
701         hAlgorithm: BCRYPT_ALG_HANDLE,
702         phHash: *mut BCRYPT_HASH_HANDLE,
703         nHashes: ULONG,
704         pbHashObject: PUCHAR,
705         cbHashObject: ULONG,
706         pbSecret: PUCHAR,
707         cbSecret: ULONG,
708         dwFlags: ULONG,
709     ) -> NTSTATUS;
BCryptProcessMultiOperations( hObject: BCRYPT_HANDLE, operationType: BCRYPT_MULTI_OPERATION_TYPE, pOperations: PVOID, cbOperations: ULONG, dwFlags: ULONG, ) -> NTSTATUS710     pub fn BCryptProcessMultiOperations(
711         hObject: BCRYPT_HANDLE,
712         operationType: BCRYPT_MULTI_OPERATION_TYPE,
713         pOperations: PVOID,
714         cbOperations: ULONG,
715         dwFlags: ULONG,
716     ) -> NTSTATUS;
BCryptDuplicateHash( hHash: BCRYPT_HASH_HANDLE, phNewHash: *mut BCRYPT_HASH_HANDLE, pbHashObject: PUCHAR, cbHashObject: ULONG, dwFlags: ULONG, ) -> NTSTATUS717     pub fn BCryptDuplicateHash(
718         hHash: BCRYPT_HASH_HANDLE,
719         phNewHash: *mut BCRYPT_HASH_HANDLE,
720         pbHashObject: PUCHAR,
721         cbHashObject: ULONG,
722         dwFlags: ULONG,
723     ) -> NTSTATUS;
BCryptDestroyHash( hHash: BCRYPT_HASH_HANDLE, ) -> NTSTATUS724     pub fn BCryptDestroyHash(
725         hHash: BCRYPT_HASH_HANDLE,
726     ) -> NTSTATUS;
BCryptHash( hAlgorithm: BCRYPT_ALG_HANDLE, pbSecret: PUCHAR, cbSecret: ULONG, pbInput: PUCHAR, cbInput: ULONG, pbOutput: PUCHAR, cbOutput: ULONG, ) -> NTSTATUS727     pub fn BCryptHash(
728         hAlgorithm: BCRYPT_ALG_HANDLE,
729         pbSecret: PUCHAR,
730         cbSecret: ULONG,
731         pbInput: PUCHAR,
732         cbInput: ULONG,
733         pbOutput: PUCHAR,
734         cbOutput: ULONG,
735     ) -> NTSTATUS;
736 }
737 pub const BCRYPT_RNG_USE_ENTROPY_IN_BUFFER: ULONG = 0x00000001;
738 pub const BCRYPT_USE_SYSTEM_PREFERRED_RNG: ULONG = 0x00000002;
739 extern "system" {
BCryptGenRandom( hAlgorithm: BCRYPT_ALG_HANDLE, pbBuffer: PUCHAR, cbBuffer: ULONG, dwFlags: ULONG, ) -> NTSTATUS740     pub fn BCryptGenRandom(
741         hAlgorithm: BCRYPT_ALG_HANDLE,
742         pbBuffer: PUCHAR,
743         cbBuffer: ULONG,
744         dwFlags: ULONG,
745     ) -> NTSTATUS;
BCryptDeriveKeyCapi( hHash: BCRYPT_HASH_HANDLE, hTargetAlg: BCRYPT_ALG_HANDLE, pbDerivedKey: PUCHAR, cbDerivedKey: ULONG, dwFlags: ULONG, ) -> NTSTATUS746     pub fn BCryptDeriveKeyCapi(
747         hHash: BCRYPT_HASH_HANDLE,
748         hTargetAlg: BCRYPT_ALG_HANDLE,
749         pbDerivedKey: PUCHAR,
750         cbDerivedKey: ULONG,
751         dwFlags: ULONG,
752     ) -> NTSTATUS;
BCryptDeriveKeyPBKDF2( hPrf: BCRYPT_ALG_HANDLE, pbPassword: PUCHAR, cbPassword: ULONG, pbSalt: PUCHAR, cbSalt: ULONG, cIterations: ULONGLONG, pbDerivedKey: PUCHAR, cbDerivedKey: ULONG, dwFlags: ULONG, ) -> NTSTATUS753     pub fn BCryptDeriveKeyPBKDF2(
754         hPrf: BCRYPT_ALG_HANDLE,
755         pbPassword: PUCHAR,
756         cbPassword: ULONG,
757         pbSalt: PUCHAR,
758         cbSalt: ULONG,
759         cIterations: ULONGLONG,
760         pbDerivedKey: PUCHAR,
761         cbDerivedKey: ULONG,
762         dwFlags: ULONG,
763     ) -> NTSTATUS;
764 }
765 STRUCT!{struct BCRYPT_INTERFACE_VERSION {
766     MajorVersion: USHORT,
767     MinorVersion: USHORT,
768 }}
769 pub type PBCRYPT_INTERFACE_VERSION = *mut BCRYPT_INTERFACE_VERSION;
770 #[inline]
BCRYPT_IS_INTERFACE_VERSION_COMPATIBLE( loader: BCRYPT_INTERFACE_VERSION, provider: BCRYPT_INTERFACE_VERSION, ) -> bool771 pub fn BCRYPT_IS_INTERFACE_VERSION_COMPATIBLE(
772     loader: BCRYPT_INTERFACE_VERSION,
773     provider: BCRYPT_INTERFACE_VERSION,
774 ) -> bool {
775     loader.MajorVersion <= provider.MajorVersion
776 }
777 pub const BCRYPT_CIPHER_INTERFACE_VERSION_1: BCRYPT_INTERFACE_VERSION =
778     BCRYPT_MAKE_INTERFACE_VERSION!(1, 0);
779 pub const BCRYPT_HASH_INTERFACE_VERSION_1: BCRYPT_INTERFACE_VERSION =
780     BCRYPT_MAKE_INTERFACE_VERSION!(1, 0);
781 pub const BCRYPT_HASH_INTERFACE_MAJORVERSION_2: USHORT = 2;
782 pub const BCRYPT_HASH_INTERFACE_VERSION_2: BCRYPT_INTERFACE_VERSION =
783     BCRYPT_MAKE_INTERFACE_VERSION!(BCRYPT_HASH_INTERFACE_MAJORVERSION_2, 0);
784 pub const BCRYPT_ASYMMETRIC_ENCRYPTION_INTERFACE_VERSION_1: BCRYPT_INTERFACE_VERSION =
785     BCRYPT_MAKE_INTERFACE_VERSION!(1, 0);
786 pub const BCRYPT_SECRET_AGREEMENT_INTERFACE_VERSION_1: BCRYPT_INTERFACE_VERSION =
787     BCRYPT_MAKE_INTERFACE_VERSION!(1, 0);
788 pub const BCRYPT_SIGNATURE_INTERFACE_VERSION_1: BCRYPT_INTERFACE_VERSION =
789     BCRYPT_MAKE_INTERFACE_VERSION!(1, 0);
790 pub const BCRYPT_RNG_INTERFACE_VERSION_1: BCRYPT_INTERFACE_VERSION =
791     BCRYPT_MAKE_INTERFACE_VERSION!(1, 0);
792 pub const CRYPT_MIN_DEPENDENCIES: ULONG = 0x00000001;
793 pub const CRYPT_PROCESS_ISOLATE: ULONG = 0x00010000;
794 pub const CRYPT_UM: ULONG = 0x00000001;
795 pub const CRYPT_KM: ULONG = 0x00000002;
796 pub const CRYPT_MM: ULONG = 0x00000003;
797 pub const CRYPT_ANY: ULONG = 0x00000004;
798 pub const CRYPT_OVERWRITE: ULONG = 0x00000001;
799 pub const CRYPT_LOCAL: ULONG = 0x00000001;
800 pub const CRYPT_DOMAIN: ULONG = 0x00000002;
801 pub const CRYPT_EXCLUSIVE: ULONG = 0x00000001;
802 pub const CRYPT_OVERRIDE: ULONG = 0x00010000;
803 pub const CRYPT_ALL_FUNCTIONS: ULONG = 0x00000001;
804 pub const CRYPT_ALL_PROVIDERS: ULONG = 0x00000002;
805 pub const CRYPT_PRIORITY_TOP: ULONG = 0x00000000;
806 pub const CRYPT_PRIORITY_BOTTOM: ULONG = 0xFFFFFFFF;
807 pub const CRYPT_DEFAULT_CONTEXT: &'static str = "Default";
808 STRUCT!{struct CRYPT_INTERFACE_REG {
809     dwInterface: ULONG,
810     dwFlags: ULONG,
811     cFunctions: ULONG,
812     rgpszFunctions: *mut PWSTR,
813 }}
814 pub type PCRYPT_INTERFACE_REG = *mut CRYPT_INTERFACE_REG;
815 STRUCT!{struct CRYPT_IMAGE_REG {
816     pszImage: PWSTR,
817     cInterfaces: ULONG,
818     rgpInterfaces: *mut PCRYPT_INTERFACE_REG,
819 }}
820 pub type PCRYPT_IMAGE_REG = *mut CRYPT_IMAGE_REG;
821 STRUCT!{struct CRYPT_PROVIDER_REG {
822     cAliases: ULONG,
823     rgpszAliases: *mut PWSTR,
824     pUM: PCRYPT_IMAGE_REG,
825     pKM: PCRYPT_IMAGE_REG,
826 }}
827 pub type PCRYPT_PROVIDER_REG = *mut CRYPT_PROVIDER_REG;
828 STRUCT!{struct CRYPT_PROVIDERS {
829     cProviders: ULONG,
830     rgpszProviders: *mut PWSTR,
831 }}
832 pub type PCRYPT_PROVIDERS = *mut CRYPT_PROVIDERS;
833 STRUCT!{struct CRYPT_CONTEXT_CONFIG {
834     dwFlags: ULONG,
835     dwReserved: ULONG,
836 }}
837 pub type PCRYPT_CONTEXT_CONFIG = *mut CRYPT_CONTEXT_CONFIG;
838 STRUCT!{struct CRYPT_CONTEXT_FUNCTION_CONFIG {
839     dwFlags: ULONG,
840     dwReserved: ULONG,
841 }}
842 pub type PCRYPT_CONTEXT_FUNCTION_CONFIG = *mut CRYPT_CONTEXT_FUNCTION_CONFIG;
843 STRUCT!{struct CRYPT_CONTEXTS {
844     cContexts: ULONG,
845     rgpszContexts: *mut PWSTR,
846 }}
847 pub type PCRYPT_CONTEXTS = *mut CRYPT_CONTEXTS;
848 STRUCT!{struct CRYPT_CONTEXT_FUNCTIONS {
849     cFunctions: ULONG,
850     rgpszFunctions: *mut PWSTR,
851 }}
852 pub type PCRYPT_CONTEXT_FUNCTIONS = *mut CRYPT_CONTEXT_FUNCTIONS;
853 STRUCT!{struct CRYPT_CONTEXT_FUNCTION_PROVIDERS {
854     cProviders: ULONG,
855     rgpszProviders: *mut PWSTR,
856 }}
857 pub type PCRYPT_CONTEXT_FUNCTION_PROVIDERS = *mut CRYPT_CONTEXT_FUNCTION_PROVIDERS;
858 STRUCT!{struct CRYPT_PROPERTY_REF {
859     pszProperty: PWSTR,
860     cbValue: ULONG,
861     pbValue: PUCHAR,
862 }}
863 pub type PCRYPT_PROPERTY_REF = *mut CRYPT_PROPERTY_REF;
864 STRUCT!{struct CRYPT_IMAGE_REF {
865     pszImage: PWSTR,
866     dwFlags: ULONG,
867 }}
868 pub type PCRYPT_IMAGE_REF = *mut CRYPT_IMAGE_REF;
869 STRUCT!{struct CRYPT_PROVIDER_REF {
870     dwInterface: ULONG,
871     pszFunction: PWSTR,
872     pszProvider: PWSTR,
873     cProperties: ULONG,
874     rgpProperties: *mut PCRYPT_PROPERTY_REF,
875     pUM: PCRYPT_IMAGE_REF,
876     pKM: PCRYPT_IMAGE_REF,
877 }}
878 pub type PCRYPT_PROVIDER_REF = *mut CRYPT_PROVIDER_REF;
879 STRUCT!{struct CRYPT_PROVIDER_REFS {
880     cProviders: ULONG,
881     rgpProviders: *mut PCRYPT_PROVIDER_REF,
882 }}
883 pub type PCRYPT_PROVIDER_REFS = *mut CRYPT_PROVIDER_REFS;
884 extern "system" {
BCryptQueryProviderRegistration( pszProvider: LPCWSTR, dwMode: ULONG, dwInterface: ULONG, pcbBuffer: *mut ULONG, ppBuffer: *mut PCRYPT_PROVIDER_REG, ) -> NTSTATUS885     pub fn BCryptQueryProviderRegistration(
886         pszProvider: LPCWSTR,
887         dwMode: ULONG,
888         dwInterface: ULONG,
889         pcbBuffer: *mut ULONG,
890         ppBuffer: *mut PCRYPT_PROVIDER_REG,
891     ) -> NTSTATUS;
BCryptEnumRegisteredProviders( pcbBuffer: *mut ULONG, ppBuffer: *mut PCRYPT_PROVIDERS, ) -> NTSTATUS892     pub fn BCryptEnumRegisteredProviders(
893         pcbBuffer: *mut ULONG,
894         ppBuffer: *mut PCRYPT_PROVIDERS,
895     ) -> NTSTATUS;
BCryptCreateContext( dwTable: ULONG, pszContext: LPCWSTR, pConfig: PCRYPT_CONTEXT_CONFIG, ) -> NTSTATUS896     pub fn BCryptCreateContext(
897         dwTable: ULONG,
898         pszContext: LPCWSTR,
899         pConfig: PCRYPT_CONTEXT_CONFIG,
900     ) -> NTSTATUS;
BCryptDeleteContext( dwTable: ULONG, pszContext: LPCWSTR, ) -> NTSTATUS901     pub fn BCryptDeleteContext(
902         dwTable: ULONG,
903         pszContext: LPCWSTR,
904     ) -> NTSTATUS;
BCryptEnumContexts( dwTable: ULONG, pcbBuffer: *mut ULONG, ppBuffer: *mut PCRYPT_CONTEXTS, ) -> NTSTATUS905     pub fn BCryptEnumContexts(
906         dwTable: ULONG,
907         pcbBuffer: *mut ULONG,
908         ppBuffer: *mut PCRYPT_CONTEXTS,
909     ) -> NTSTATUS;
BCryptConfigureContext( dwTable: ULONG, pszContext: LPCWSTR, pConfig: PCRYPT_CONTEXT_CONFIG, ) -> NTSTATUS910     pub fn BCryptConfigureContext(
911         dwTable: ULONG,
912         pszContext: LPCWSTR,
913         pConfig: PCRYPT_CONTEXT_CONFIG,
914     ) -> NTSTATUS;
BCryptQueryContextConfiguration( dwTable: ULONG, pszContext: LPCWSTR, pcbBuffer: *mut ULONG, ppBuffer: *mut PCRYPT_CONTEXT_CONFIG, ) -> NTSTATUS915     pub fn BCryptQueryContextConfiguration(
916         dwTable: ULONG,
917         pszContext: LPCWSTR,
918         pcbBuffer: *mut ULONG,
919         ppBuffer: *mut PCRYPT_CONTEXT_CONFIG,
920     ) -> NTSTATUS;
BCryptAddContextFunction( dwTable: ULONG, pszContext: LPCWSTR, dwInterface: ULONG, pszFunction: LPCWSTR, dwPosition: ULONG, ) -> NTSTATUS921     pub fn BCryptAddContextFunction(
922         dwTable: ULONG,
923         pszContext: LPCWSTR,
924         dwInterface: ULONG,
925         pszFunction: LPCWSTR,
926         dwPosition: ULONG,
927     ) -> NTSTATUS;
BCryptRemoveContextFunction( dwTable: ULONG, pszContext: LPCWSTR, dwInterface: ULONG, pszFunction: LPCWSTR, ) -> NTSTATUS928     pub fn BCryptRemoveContextFunction(
929         dwTable: ULONG,
930         pszContext: LPCWSTR,
931         dwInterface: ULONG,
932         pszFunction: LPCWSTR,
933     ) -> NTSTATUS;
BCryptEnumContextFunctions( dwTable: ULONG, pszContext: LPCWSTR, dwInterface: ULONG, pcbBuffer: *mut ULONG, ppBuffer: *mut PCRYPT_CONTEXT_FUNCTIONS, ) -> NTSTATUS934     pub fn BCryptEnumContextFunctions(
935         dwTable: ULONG,
936         pszContext: LPCWSTR,
937         dwInterface: ULONG,
938         pcbBuffer: *mut ULONG,
939         ppBuffer: *mut PCRYPT_CONTEXT_FUNCTIONS,
940     ) -> NTSTATUS;
BCryptConfigureContextFunction( dwTable: ULONG, pszContext: LPCWSTR, dwInterface: ULONG, pszFunction: LPCWSTR, pConfig: PCRYPT_CONTEXT_FUNCTION_CONFIG, ) -> NTSTATUS941     pub fn BCryptConfigureContextFunction(
942         dwTable: ULONG,
943         pszContext: LPCWSTR,
944         dwInterface: ULONG,
945         pszFunction: LPCWSTR,
946         pConfig: PCRYPT_CONTEXT_FUNCTION_CONFIG,
947     ) -> NTSTATUS;
BCryptQueryContextFunctionConfiguration( dwTable: ULONG, pszContext: LPCWSTR, dwInterface: ULONG, pszFunction: LPCWSTR, pcbBuffer: *mut ULONG, ppBuffer: *mut PCRYPT_CONTEXT_FUNCTION_CONFIG, ) -> NTSTATUS948     pub fn BCryptQueryContextFunctionConfiguration(
949         dwTable: ULONG,
950         pszContext: LPCWSTR,
951         dwInterface: ULONG,
952         pszFunction: LPCWSTR,
953         pcbBuffer: *mut ULONG,
954         ppBuffer: *mut PCRYPT_CONTEXT_FUNCTION_CONFIG,
955     ) -> NTSTATUS;
BCryptEnumContextFunctionProviders( dwTable: ULONG, pszContext: LPCWSTR, dwInterface: ULONG, pszFunction: LPCWSTR, pcbBuffer: *mut ULONG, ppBuffer: *mut PCRYPT_CONTEXT_FUNCTION_PROVIDERS, ) -> NTSTATUS956     pub fn BCryptEnumContextFunctionProviders(
957         dwTable: ULONG,
958         pszContext: LPCWSTR,
959         dwInterface: ULONG,
960         pszFunction: LPCWSTR,
961         pcbBuffer: *mut ULONG,
962         ppBuffer: *mut PCRYPT_CONTEXT_FUNCTION_PROVIDERS,
963     ) -> NTSTATUS;
BCryptSetContextFunctionProperty( dwTable: ULONG, pszContext: LPCWSTR, dwInterface: ULONG, pszFunction: LPCWSTR, pszProperty: LPCWSTR, cbValue: ULONG, pbValue: PUCHAR, ) -> NTSTATUS964     pub fn BCryptSetContextFunctionProperty(
965         dwTable: ULONG,
966         pszContext: LPCWSTR,
967         dwInterface: ULONG,
968         pszFunction: LPCWSTR,
969         pszProperty: LPCWSTR,
970         cbValue: ULONG,
971         pbValue: PUCHAR,
972     ) -> NTSTATUS;
BCryptQueryContextFunctionProperty( dwTable: ULONG, pszContext: LPCWSTR, dwInterface: ULONG, pszFunction: LPCWSTR, pszProperty: LPCWSTR, pcbValue: *mut ULONG, ppbValue: *mut PUCHAR, ) -> NTSTATUS973     pub fn BCryptQueryContextFunctionProperty(
974         dwTable: ULONG,
975         pszContext: LPCWSTR,
976         dwInterface: ULONG,
977         pszFunction: LPCWSTR,
978         pszProperty: LPCWSTR,
979         pcbValue: *mut ULONG,
980         ppbValue: *mut PUCHAR,
981     ) -> NTSTATUS;
BCryptRegisterConfigChangeNotify( phEvent: *mut HANDLE, ) -> NTSTATUS982     pub fn BCryptRegisterConfigChangeNotify(
983         phEvent: *mut HANDLE,
984     ) -> NTSTATUS;
BCryptUnregisterConfigChangeNotify( hEvent: HANDLE, ) -> NTSTATUS985     pub fn BCryptUnregisterConfigChangeNotify(
986         hEvent: HANDLE,
987     ) -> NTSTATUS;
BCryptResolveProviders( pszContext: LPCWSTR, dwInterface: ULONG, pszFunction: LPCWSTR, pszProvider: LPCWSTR, dwMode: ULONG, dwFlags: ULONG, pcbBuffer: *mut ULONG, ppBuffer: *mut PCRYPT_PROVIDER_REFS, ) -> NTSTATUS988     pub fn BCryptResolveProviders(
989         pszContext: LPCWSTR,
990         dwInterface: ULONG,
991         pszFunction: LPCWSTR,
992         pszProvider: LPCWSTR,
993         dwMode: ULONG,
994         dwFlags: ULONG,
995         pcbBuffer: *mut ULONG,
996         ppBuffer: *mut PCRYPT_PROVIDER_REFS,
997     ) -> NTSTATUS;
BCryptGetFipsAlgorithmMode( pfEnabled: *mut BOOLEAN, ) -> NTSTATUS998     pub fn BCryptGetFipsAlgorithmMode(
999         pfEnabled: *mut BOOLEAN,
1000     ) -> NTSTATUS;
CngGetFipsAlgorithmMode() -> BOOLEAN1001     pub fn CngGetFipsAlgorithmMode() -> BOOLEAN;
1002 }
1003