ReactOS 0.4.15-dev-8428-g6910fa6
bcrypt.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _BCRYPT_ALGORITHM_IDENTIFIER
 
struct  __BCRYPT_KEY_LENGTHS_STRUCT
 
struct  _BCRYPT_KEY_DATA_BLOB_HEADER
 
struct  _BCRYPT_AUTHENTICATED_CIPHER_MODE_INFO
 
struct  _BCRYPT_ECCKEY_BLOB
 
struct  _BCRYPT_RSAKEY_BLOB
 
struct  _BCRYPT_PKCS1_PADDING_INFO
 

Macros

#define WINAPI   __stdcall
 
#define IN
 
#define OUT
 
#define OPTIONAL
 
#define BCRYPT_ALGORITHM_NAME   L"AlgorithmName"
 
#define BCRYPT_AUTH_TAG_LENGTH   L"AuthTagLength"
 
#define BCRYPT_BLOCK_LENGTH   L"BlockLength"
 
#define BCRYPT_BLOCK_SIZE_LIST   L"BlockSizeList"
 
#define BCRYPT_CHAINING_MODE   L"ChainingMode"
 
#define BCRYPT_EFFECTIVE_KEY_LENGTH   L"EffectiveKeyLength"
 
#define BCRYPT_HASH_BLOCK_LENGTH   L"HashBlockLength"
 
#define BCRYPT_HASH_LENGTH   L"HashDigestLength"
 
#define BCRYPT_HASH_OID_LIST   L"HashOIDList"
 
#define BCRYPT_KEY_LENGTH   L"KeyLength"
 
#define BCRYPT_KEY_LENGTHS   L"KeyLengths"
 
#define BCRYPT_KEY_OBJECT_LENGTH   L"KeyObjectLength"
 
#define BCRYPT_KEY_STRENGTH   L"KeyStrength"
 
#define BCRYPT_OBJECT_LENGTH   L"ObjectLength"
 
#define BCRYPT_PADDING_SCHEMES   L"PaddingSchemes"
 
#define BCRYPT_PROVIDER_HANDLE   L"ProviderHandle"
 
#define BCRYPT_SIGNATURE_LENGTH   L"SignatureLength"
 
#define BCRYPT_OPAQUE_KEY_BLOB   L"OpaqueKeyBlob"
 
#define BCRYPT_KEY_DATA_BLOB   L"KeyDataBlob"
 
#define BCRYPT_AES_WRAP_KEY_BLOB   L"Rfc3565KeyWrapBlob"
 
#define BCRYPT_ECCPUBLIC_BLOB   L"ECCPUBLICBLOB"
 
#define BCRYPT_ECCPRIVATE_BLOB   L"ECCPRIVATEBLOB"
 
#define BCRYPT_RSAPUBLIC_BLOB   L"RSAPUBLICBLOB"
 
#define BCRYPT_RSAPRIVATE_BLOB   L"RSAPRIVATEBLOB"
 
#define MS_PRIMITIVE_PROVIDER   L"Microsoft Primitive Provider"
 
#define MS_PLATFORM_CRYPTO_PROVIDER   L"Microsoft Platform Crypto Provider"
 
#define BCRYPT_MD5_ALGORITHM   L"MD5"
 
#define BCRYPT_RNG_ALGORITHM   L"RNG"
 
#define BCRYPT_SHA1_ALGORITHM   L"SHA1"
 
#define BCRYPT_SHA256_ALGORITHM   L"SHA256"
 
#define BCRYPT_SHA384_ALGORITHM   L"SHA384"
 
#define BCRYPT_SHA512_ALGORITHM   L"SHA512"
 
#define BCRYPT_ECDSA_P256_ALGORITHM   L"ECDSA_P256"
 
#define BCRYPT_ECDSA_P384_ALGORITHM   L"ECDSA_P384"
 
#define BCRYPT_ECDSA_P521_ALGORITHM   L"ECDSA_P521"
 
#define BCRYPT_ECDSA_PUBLIC_P256_MAGIC   0x31534345
 
#define BCRYPT_ECDSA_PRIVATE_P256_MAGIC   0x32534345
 
#define BCRYPT_ECDSA_PUBLIC_P384_MAGIC   0x33534345
 
#define BCRYPT_ECDSA_PRIVATE_P384_MAGIC   0x34534345
 
#define BCRYPT_ECDSA_PUBLIC_P521_MAGIC   0x35534345
 
#define BCRYPT_ECDSA_PRIVATE_P521_MAGIC   0x36534345
 
#define BCRYPT_RSAPUBLIC_MAGIC   0x31415352
 
#define BCRYPT_RSAPRIVATE_MAGIC   0x32415352
 
#define BCRYPT_RSAFULLPRIVATE_MAGIC   0x33415352
 
#define BCRYPT_PAD_NONE   0x00000001
 
#define BCRYPT_PAD_PKCS1   0x00000002
 
#define BCRYPT_PAD_OAEP   0x00000004
 
#define BCRYPT_PAD_PSS   0x00000008
 
#define BCRYPT_AUTHENTICATED_CIPHER_MODE_INFO_VERSION   1
 
#define BCRYPT_AUTH_MODE_CHAIN_CALLS_FLAG   0x00000001
 
#define BCRYPT_AUTH_MODE_IN_PROGRESS_FLAG   0x00000002
 
#define BCRYPT_KEY_DATA_BLOB_MAGIC   0x4d42444b
 
#define BCRYPT_KEY_DATA_BLOB_VERSION1   1
 
#define BCRYPT_RNG_USE_ENTROPY_IN_BUFFER   0x00000001
 
#define BCRYPT_USE_SYSTEM_PREFERRED_RNG   0x00000002
 
#define BCRYPT_ALG_HANDLE_HMAC_FLAG   0x00000008
 

Typedefs

typedef NTSTATUSPNTSTATUS
 
typedef struct _BCRYPT_ALGORITHM_IDENTIFIER BCRYPT_ALGORITHM_IDENTIFIER
 
typedef struct __BCRYPT_KEY_LENGTHS_STRUCT BCRYPT_KEY_LENGTHS_STRUCT
 
typedef struct __BCRYPT_KEY_LENGTHS_STRUCT BCRYPT_AUTH_TAG_LENGTHS_STRUCT
 
typedef struct _BCRYPT_KEY_DATA_BLOB_HEADER BCRYPT_KEY_DATA_BLOB_HEADER
 
typedef struct _BCRYPT_KEY_DATA_BLOB_HEADERPBCRYPT_KEY_DATA_BLOB_HEADER
 
typedef struct _BCRYPT_AUTHENTICATED_CIPHER_MODE_INFO BCRYPT_AUTHENTICATED_CIPHER_MODE_INFO
 
typedef struct _BCRYPT_AUTHENTICATED_CIPHER_MODE_INFOPBCRYPT_AUTHENTICATED_CIPHER_MODE_INFO
 
typedef struct _BCRYPT_ECCKEY_BLOB BCRYPT_ECCKEY_BLOB
 
typedef struct _BCRYPT_ECCKEY_BLOBPBCRYPT_ECCKEY_BLOB
 
typedef struct _BCRYPT_RSAKEY_BLOB BCRYPT_RSAKEY_BLOB
 
typedef struct _BCRYPT_PKCS1_PADDING_INFO BCRYPT_PKCS1_PADDING_INFO
 
typedef PVOID BCRYPT_ALG_HANDLE
 
typedef PVOID BCRYPT_KEY_HANDLE
 
typedef PVOID BCRYPT_HANDLE
 
typedef PVOID BCRYPT_HASH_HANDLE
 

Functions

typedef _Return_type_success_ (return >=0) LONG NTSTATUS
 
NTSTATUS WINAPI BCryptCloseAlgorithmProvider (BCRYPT_ALG_HANDLE, ULONG)
 
NTSTATUS WINAPI BCryptCreateHash (BCRYPT_ALG_HANDLE, BCRYPT_HASH_HANDLE *, PUCHAR, ULONG, PUCHAR, ULONG, ULONG)
 
NTSTATUS WINAPI BCryptDecrypt (BCRYPT_KEY_HANDLE, PUCHAR, ULONG, VOID *, PUCHAR, ULONG, PUCHAR, ULONG, ULONG *, ULONG)
 
NTSTATUS WINAPI BCryptDestroyHash (BCRYPT_HASH_HANDLE)
 
NTSTATUS WINAPI BCryptDestroyKey (BCRYPT_KEY_HANDLE)
 
NTSTATUS WINAPI BCryptEncrypt (BCRYPT_KEY_HANDLE, PUCHAR, ULONG, VOID *, PUCHAR, ULONG, PUCHAR, ULONG, ULONG *, ULONG)
 
NTSTATUS WINAPI BCryptEnumAlgorithms (ULONG, ULONG *, BCRYPT_ALGORITHM_IDENTIFIER **, ULONG)
 
NTSTATUS WINAPI BCryptFinishHash (BCRYPT_HASH_HANDLE, PUCHAR, ULONG, ULONG)
 
NTSTATUS WINAPI BCryptGenerateSymmetricKey (BCRYPT_ALG_HANDLE, BCRYPT_KEY_HANDLE *, PUCHAR, ULONG, PUCHAR, ULONG, ULONG)
 
NTSTATUS WINAPI BCryptGenRandom (BCRYPT_ALG_HANDLE, PUCHAR, ULONG, ULONG)
 
NTSTATUS WINAPI BCryptGetFipsAlgorithmMode (BOOLEAN *)
 
NTSTATUS WINAPI BCryptGetProperty (BCRYPT_HANDLE, LPCWSTR, PUCHAR, ULONG, ULONG *, ULONG)
 
NTSTATUS WINAPI BCryptHash (BCRYPT_ALG_HANDLE, PUCHAR, ULONG, PUCHAR, ULONG, PUCHAR, ULONG)
 
NTSTATUS WINAPI BCryptHashData (BCRYPT_HASH_HANDLE, PUCHAR, ULONG, ULONG)
 
NTSTATUS WINAPI BCryptImportKeyPair (BCRYPT_ALG_HANDLE, BCRYPT_KEY_HANDLE, LPCWSTR, BCRYPT_KEY_HANDLE *, UCHAR *, ULONG, ULONG)
 
NTSTATUS WINAPI BCryptOpenAlgorithmProvider (BCRYPT_ALG_HANDLE *, LPCWSTR, LPCWSTR, ULONG)
 
NTSTATUS WINAPI BCryptSetProperty (BCRYPT_HANDLE, LPCWSTR, PUCHAR, ULONG, ULONG)
 
NTSTATUS WINAPI BCryptDuplicateHash (BCRYPT_HASH_HANDLE, BCRYPT_HASH_HANDLE *, UCHAR *, ULONG, ULONG)
 
NTSTATUS WINAPI BCryptVerifySignature (BCRYPT_KEY_HANDLE, void *, UCHAR *, ULONG, UCHAR *, ULONG, ULONG)
 

Macro Definition Documentation

◆ BCRYPT_AES_WRAP_KEY_BLOB

#define BCRYPT_AES_WRAP_KEY_BLOB   L"Rfc3565KeyWrapBlob"

Definition at line 63 of file bcrypt.h.

◆ BCRYPT_ALG_HANDLE_HMAC_FLAG

#define BCRYPT_ALG_HANDLE_HMAC_FLAG   0x00000008

Definition at line 172 of file bcrypt.h.

◆ BCRYPT_ALGORITHM_NAME

#define BCRYPT_ALGORITHM_NAME   L"AlgorithmName"

Definition at line 43 of file bcrypt.h.

◆ BCRYPT_AUTH_MODE_CHAIN_CALLS_FLAG

#define BCRYPT_AUTH_MODE_CHAIN_CALLS_FLAG   0x00000001

Definition at line 159 of file bcrypt.h.

◆ BCRYPT_AUTH_MODE_IN_PROGRESS_FLAG

#define BCRYPT_AUTH_MODE_IN_PROGRESS_FLAG   0x00000002

Definition at line 160 of file bcrypt.h.

◆ BCRYPT_AUTH_TAG_LENGTH

#define BCRYPT_AUTH_TAG_LENGTH   L"AuthTagLength"

Definition at line 44 of file bcrypt.h.

◆ BCRYPT_AUTHENTICATED_CIPHER_MODE_INFO_VERSION

#define BCRYPT_AUTHENTICATED_CIPHER_MODE_INFO_VERSION   1

Definition at line 157 of file bcrypt.h.

◆ BCRYPT_BLOCK_LENGTH

#define BCRYPT_BLOCK_LENGTH   L"BlockLength"

Definition at line 45 of file bcrypt.h.

◆ BCRYPT_BLOCK_SIZE_LIST

#define BCRYPT_BLOCK_SIZE_LIST   L"BlockSizeList"

Definition at line 46 of file bcrypt.h.

◆ BCRYPT_CHAINING_MODE

#define BCRYPT_CHAINING_MODE   L"ChainingMode"

Definition at line 47 of file bcrypt.h.

◆ BCRYPT_ECCPRIVATE_BLOB

#define BCRYPT_ECCPRIVATE_BLOB   L"ECCPRIVATEBLOB"

Definition at line 65 of file bcrypt.h.

◆ BCRYPT_ECCPUBLIC_BLOB

#define BCRYPT_ECCPUBLIC_BLOB   L"ECCPUBLICBLOB"

Definition at line 64 of file bcrypt.h.

◆ BCRYPT_ECDSA_P256_ALGORITHM

#define BCRYPT_ECDSA_P256_ALGORITHM   L"ECDSA_P256"

Definition at line 78 of file bcrypt.h.

◆ BCRYPT_ECDSA_P384_ALGORITHM

#define BCRYPT_ECDSA_P384_ALGORITHM   L"ECDSA_P384"

Definition at line 79 of file bcrypt.h.

◆ BCRYPT_ECDSA_P521_ALGORITHM

#define BCRYPT_ECDSA_P521_ALGORITHM   L"ECDSA_P521"

Definition at line 80 of file bcrypt.h.

◆ BCRYPT_ECDSA_PRIVATE_P256_MAGIC

#define BCRYPT_ECDSA_PRIVATE_P256_MAGIC   0x32534345

Definition at line 83 of file bcrypt.h.

◆ BCRYPT_ECDSA_PRIVATE_P384_MAGIC

#define BCRYPT_ECDSA_PRIVATE_P384_MAGIC   0x34534345

Definition at line 85 of file bcrypt.h.

◆ BCRYPT_ECDSA_PRIVATE_P521_MAGIC

#define BCRYPT_ECDSA_PRIVATE_P521_MAGIC   0x36534345

Definition at line 87 of file bcrypt.h.

◆ BCRYPT_ECDSA_PUBLIC_P256_MAGIC

#define BCRYPT_ECDSA_PUBLIC_P256_MAGIC   0x31534345

Definition at line 82 of file bcrypt.h.

◆ BCRYPT_ECDSA_PUBLIC_P384_MAGIC

#define BCRYPT_ECDSA_PUBLIC_P384_MAGIC   0x33534345

Definition at line 84 of file bcrypt.h.

◆ BCRYPT_ECDSA_PUBLIC_P521_MAGIC

#define BCRYPT_ECDSA_PUBLIC_P521_MAGIC   0x35534345

Definition at line 86 of file bcrypt.h.

◆ BCRYPT_EFFECTIVE_KEY_LENGTH

#define BCRYPT_EFFECTIVE_KEY_LENGTH   L"EffectiveKeyLength"

Definition at line 48 of file bcrypt.h.

◆ BCRYPT_HASH_BLOCK_LENGTH

#define BCRYPT_HASH_BLOCK_LENGTH   L"HashBlockLength"

Definition at line 49 of file bcrypt.h.

◆ BCRYPT_HASH_LENGTH

#define BCRYPT_HASH_LENGTH   L"HashDigestLength"

Definition at line 50 of file bcrypt.h.

◆ BCRYPT_HASH_OID_LIST

#define BCRYPT_HASH_OID_LIST   L"HashOIDList"

Definition at line 51 of file bcrypt.h.

◆ BCRYPT_KEY_DATA_BLOB

#define BCRYPT_KEY_DATA_BLOB   L"KeyDataBlob"

Definition at line 62 of file bcrypt.h.

◆ BCRYPT_KEY_DATA_BLOB_MAGIC

#define BCRYPT_KEY_DATA_BLOB_MAGIC   0x4d42444b

Definition at line 162 of file bcrypt.h.

◆ BCRYPT_KEY_DATA_BLOB_VERSION1

#define BCRYPT_KEY_DATA_BLOB_VERSION1   1

Definition at line 163 of file bcrypt.h.

◆ BCRYPT_KEY_LENGTH

#define BCRYPT_KEY_LENGTH   L"KeyLength"

Definition at line 52 of file bcrypt.h.

◆ BCRYPT_KEY_LENGTHS

#define BCRYPT_KEY_LENGTHS   L"KeyLengths"

Definition at line 53 of file bcrypt.h.

◆ BCRYPT_KEY_OBJECT_LENGTH

#define BCRYPT_KEY_OBJECT_LENGTH   L"KeyObjectLength"

Definition at line 54 of file bcrypt.h.

◆ BCRYPT_KEY_STRENGTH

#define BCRYPT_KEY_STRENGTH   L"KeyStrength"

Definition at line 55 of file bcrypt.h.

◆ BCRYPT_MD5_ALGORITHM

#define BCRYPT_MD5_ALGORITHM   L"MD5"

Definition at line 72 of file bcrypt.h.

◆ BCRYPT_OBJECT_LENGTH

#define BCRYPT_OBJECT_LENGTH   L"ObjectLength"

Definition at line 56 of file bcrypt.h.

◆ BCRYPT_OPAQUE_KEY_BLOB

#define BCRYPT_OPAQUE_KEY_BLOB   L"OpaqueKeyBlob"

Definition at line 61 of file bcrypt.h.

◆ BCRYPT_PAD_NONE

#define BCRYPT_PAD_NONE   0x00000001

Definition at line 152 of file bcrypt.h.

◆ BCRYPT_PAD_OAEP

#define BCRYPT_PAD_OAEP   0x00000004

Definition at line 154 of file bcrypt.h.

◆ BCRYPT_PAD_PKCS1

#define BCRYPT_PAD_PKCS1   0x00000002

Definition at line 153 of file bcrypt.h.

◆ BCRYPT_PAD_PSS

#define BCRYPT_PAD_PSS   0x00000008

Definition at line 155 of file bcrypt.h.

◆ BCRYPT_PADDING_SCHEMES

#define BCRYPT_PADDING_SCHEMES   L"PaddingSchemes"

Definition at line 57 of file bcrypt.h.

◆ BCRYPT_PROVIDER_HANDLE

#define BCRYPT_PROVIDER_HANDLE   L"ProviderHandle"

Definition at line 58 of file bcrypt.h.

◆ BCRYPT_RNG_ALGORITHM

#define BCRYPT_RNG_ALGORITHM   L"RNG"

Definition at line 73 of file bcrypt.h.

◆ BCRYPT_RNG_USE_ENTROPY_IN_BUFFER

#define BCRYPT_RNG_USE_ENTROPY_IN_BUFFER   0x00000001

Definition at line 170 of file bcrypt.h.

◆ BCRYPT_RSAFULLPRIVATE_MAGIC

#define BCRYPT_RSAFULLPRIVATE_MAGIC   0x33415352

Definition at line 135 of file bcrypt.h.

◆ BCRYPT_RSAPRIVATE_BLOB

#define BCRYPT_RSAPRIVATE_BLOB   L"RSAPRIVATEBLOB"

Definition at line 67 of file bcrypt.h.

◆ BCRYPT_RSAPRIVATE_MAGIC

#define BCRYPT_RSAPRIVATE_MAGIC   0x32415352

Definition at line 134 of file bcrypt.h.

◆ BCRYPT_RSAPUBLIC_BLOB

#define BCRYPT_RSAPUBLIC_BLOB   L"RSAPUBLICBLOB"

Definition at line 66 of file bcrypt.h.

◆ BCRYPT_RSAPUBLIC_MAGIC

#define BCRYPT_RSAPUBLIC_MAGIC   0x31415352

Definition at line 133 of file bcrypt.h.

◆ BCRYPT_SHA1_ALGORITHM

#define BCRYPT_SHA1_ALGORITHM   L"SHA1"

Definition at line 74 of file bcrypt.h.

◆ BCRYPT_SHA256_ALGORITHM

#define BCRYPT_SHA256_ALGORITHM   L"SHA256"

Definition at line 75 of file bcrypt.h.

◆ BCRYPT_SHA384_ALGORITHM

#define BCRYPT_SHA384_ALGORITHM   L"SHA384"

Definition at line 76 of file bcrypt.h.

◆ BCRYPT_SHA512_ALGORITHM

#define BCRYPT_SHA512_ALGORITHM   L"SHA512"

Definition at line 77 of file bcrypt.h.

◆ BCRYPT_SIGNATURE_LENGTH

#define BCRYPT_SIGNATURE_LENGTH   L"SignatureLength"

Definition at line 59 of file bcrypt.h.

◆ BCRYPT_USE_SYSTEM_PREFERRED_RNG

#define BCRYPT_USE_SYSTEM_PREFERRED_RNG   0x00000002

Definition at line 171 of file bcrypt.h.

◆ IN

#define IN

Definition at line 27 of file bcrypt.h.

◆ MS_PLATFORM_CRYPTO_PROVIDER

#define MS_PLATFORM_CRYPTO_PROVIDER   L"Microsoft Platform Crypto Provider"

Definition at line 70 of file bcrypt.h.

◆ MS_PRIMITIVE_PROVIDER

#define MS_PRIMITIVE_PROVIDER   L"Microsoft Primitive Provider"

Definition at line 69 of file bcrypt.h.

◆ OPTIONAL

Definition at line 35 of file bcrypt.h.

◆ OUT

#define OUT

Definition at line 31 of file bcrypt.h.

◆ WINAPI

#define WINAPI   __stdcall

Definition at line 23 of file bcrypt.h.

Typedef Documentation

◆ BCRYPT_ALG_HANDLE

Definition at line 165 of file bcrypt.h.

◆ BCRYPT_ALGORITHM_IDENTIFIER

◆ BCRYPT_AUTH_TAG_LENGTHS_STRUCT

◆ BCRYPT_AUTHENTICATED_CIPHER_MODE_INFO

◆ BCRYPT_ECCKEY_BLOB

◆ BCRYPT_HANDLE

Definition at line 167 of file bcrypt.h.

◆ BCRYPT_HASH_HANDLE

Definition at line 168 of file bcrypt.h.

◆ BCRYPT_KEY_DATA_BLOB_HEADER

◆ BCRYPT_KEY_HANDLE

Definition at line 166 of file bcrypt.h.

◆ BCRYPT_KEY_LENGTHS_STRUCT

◆ BCRYPT_PKCS1_PADDING_INFO

◆ BCRYPT_RSAKEY_BLOB

◆ PBCRYPT_AUTHENTICATED_CIPHER_MODE_INFO

◆ PBCRYPT_ECCKEY_BLOB

◆ PBCRYPT_KEY_DATA_BLOB_HEADER

◆ PNTSTATUS

typedef NTSTATUS* PNTSTATUS

Definition at line 40 of file bcrypt.h.

Function Documentation

◆ _Return_type_success_()

typedef _Return_type_success_ ( return >=  0)

◆ BCryptCloseAlgorithmProvider()

NTSTATUS WINAPI BCryptCloseAlgorithmProvider ( BCRYPT_ALG_HANDLE  ,
ULONG   
)

◆ BCryptCreateHash()

NTSTATUS WINAPI BCryptCreateHash ( BCRYPT_ALG_HANDLE  algorithm,
BCRYPT_HASH_HANDLE handle,
PUCHAR  object,
ULONG  objectlen,
PUCHAR  secret,
ULONG  secretlen,
ULONG  flags 
)

Definition at line 1005 of file bcrypt_main.c.

1007{
1008 struct algorithm *alg = algorithm;
1009 struct hash *hash;
1011
1012 TRACE( "%p, %p, %p, %u, %p, %u, %08x - stub\n", algorithm, handle, object, objectlen,
1013 secret, secretlen, flags );
1014 if (flags)
1015 {
1016 FIXME( "unimplemented flags %08x\n", flags );
1018 }
1019
1020 if (!alg || alg->hdr.magic != MAGIC_ALG) return STATUS_INVALID_HANDLE;
1021 if (object) FIXME( "ignoring object buffer\n" );
1022
1023 if (!(hash = HeapAlloc( GetProcessHeap(), 0, sizeof(*hash) ))) return STATUS_NO_MEMORY;
1024 hash->hdr.magic = MAGIC_HASH;
1025 hash->alg_id = alg->id;
1026 hash->hmac = alg->hmac;
1027
1028 if (hash->hmac)
1029 {
1030 status = hmac_init( hash, secret, secretlen );
1031 }
1032 else
1033 {
1034 status = hash_init( hash );
1035 }
1036
1037 if (status != STATUS_SUCCESS)
1038 {
1039 HeapFree( GetProcessHeap(), 0, hash );
1040 return status;
1041 }
1042
1043 *handle = hash;
1044 return STATUS_SUCCESS;
1045}
LONG NTSTATUS
Definition: precomp.h:26
#define FIXME(fmt,...)
Definition: precomp.h:53
#define MAGIC_ALG
Definition: bcrypt_main.c:255
#define MAGIC_HASH
Definition: bcrypt_main.c:256
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define HeapFree(x, y, z)
Definition: compat.h:735
static FT_Error hash_init(FT_Hash hash, FT_Bool is_num, FT_Memory memory)
Definition: fthash.c:166
GLbitfield flags
Definition: glext.h:7161
static DATA_BLOB CRYPTPROTECT_PROMPTSTRUCT DATA_BLOB *static LPWSTR DATA_BLOB CRYPTPROTECT_PROMPTSTRUCT DATA_BLOB *static char secret[]
Definition: protectdata.c:33
#define STATUS_INVALID_HANDLE
Definition: ntstatus.h:245
#define STATUS_NO_MEMORY
Definition: ntstatus.h:260
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:239
#define STATUS_SUCCESS
Definition: shellext.h:65
#define TRACE(s)
Definition: solgame.cpp:4
struct object hdr
Definition: bcrypt_main.c:290
enum alg_id id
Definition: bcrypt_main.c:291
Definition: _hash_fun.h:40
Definition: ps.c:97

Referenced by BCryptHash(), and CNG_CalcHash().

◆ BCryptDecrypt()

NTSTATUS WINAPI BCryptDecrypt ( BCRYPT_KEY_HANDLE  ,
PUCHAR  ,
ULONG  ,
VOID ,
PUCHAR  ,
ULONG  ,
PUCHAR  ,
ULONG  ,
ULONG ,
ULONG   
)

◆ BCryptDestroyHash()

NTSTATUS WINAPI BCryptDestroyHash ( BCRYPT_HASH_HANDLE  handle)

Definition at line 1047 of file bcrypt_main.c.

1048{
1049 struct hash *hash = handle;
1050
1051 TRACE( "%p\n", handle );
1052
1053 if (!hash || hash->hdr.magic != MAGIC_HASH) return STATUS_INVALID_HANDLE;
1054 HeapFree( GetProcessHeap(), 0, hash );
1055 return STATUS_SUCCESS;
1056}

Referenced by BCryptHash(), and CNG_CalcHash().

◆ BCryptDestroyKey()

NTSTATUS WINAPI BCryptDestroyKey ( BCRYPT_KEY_HANDLE  )

Referenced by CNG_VerifySignature().

◆ BCryptDuplicateHash()

NTSTATUS WINAPI BCryptDuplicateHash ( BCRYPT_HASH_HANDLE  ,
BCRYPT_HASH_HANDLE ,
UCHAR ,
ULONG  ,
ULONG   
)

◆ BCryptEncrypt()

NTSTATUS WINAPI BCryptEncrypt ( BCRYPT_KEY_HANDLE  ,
PUCHAR  ,
ULONG  ,
VOID ,
PUCHAR  ,
ULONG  ,
PUCHAR  ,
ULONG  ,
ULONG ,
ULONG   
)

◆ BCryptEnumAlgorithms()

NTSTATUS WINAPI BCryptEnumAlgorithms ( ULONG  dwAlgOperations,
ULONG pAlgCount,
BCRYPT_ALGORITHM_IDENTIFIER **  ppAlgList,
ULONG  dwFlags 
)

Definition at line 244 of file bcrypt_main.c.

246{
247 FIXME("%08x, %p, %p, %08x - stub\n", dwAlgOperations, pAlgCount, ppAlgList, dwFlags);
248
249 *ppAlgList=NULL;
250 *pAlgCount=0;
251
253}
#define NULL
Definition: types.h:112
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1176

◆ BCryptFinishHash()

NTSTATUS WINAPI BCryptFinishHash ( BCRYPT_HASH_HANDLE  handle,
PUCHAR  output,
ULONG  size,
ULONG  flags 
)

Definition at line 1077 of file bcrypt_main.c.

1078{
1079 struct hash *hash = handle;
1080
1081 TRACE( "%p, %p, %u, %08x\n", handle, output, size, flags );
1082
1083 if (!hash || hash->hdr.magic != MAGIC_HASH) return STATUS_INVALID_HANDLE;
1084 if (!output) return STATUS_INVALID_PARAMETER;
1085
1086 if (hash->hmac)
1087 {
1088 return hmac_finish( hash, output, size );
1089 }
1090 else
1091 {
1092 return hash_finish( hash, output, size );
1093 }
1094}
GLsizeiptr size
Definition: glext.h:5919
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135

Referenced by BCryptHash(), and CNG_CalcHash().

◆ BCryptGenerateSymmetricKey()

NTSTATUS WINAPI BCryptGenerateSymmetricKey ( BCRYPT_ALG_HANDLE  ,
BCRYPT_KEY_HANDLE ,
PUCHAR  ,
ULONG  ,
PUCHAR  ,
ULONG  ,
ULONG   
)

◆ BCryptGenRandom()

NTSTATUS WINAPI BCryptGenRandom ( BCRYPT_ALG_HANDLE  handle,
PUCHAR  buffer,
ULONG  count,
ULONG  flags 
)

Definition at line 295 of file bcrypt_main.c.

296{
297 const DWORD supported_flags = BCRYPT_USE_SYSTEM_PREFERRED_RNG;
298 struct algorithm *algorithm = handle;
299
300 TRACE("%p, %p, %u, %08x - semi-stub\n", handle, buffer, count, flags);
301
302 if (!algorithm)
303 {
304 /* It's valid to call without an algorithm if BCRYPT_USE_SYSTEM_PREFERRED_RNG
305 * is set. In this case the preferred system RNG is used.
306 */
309 }
310 else if (algorithm->hdr.magic != MAGIC_ALG || algorithm->id != ALG_ID_RNG)
312
313 if (!buffer)
315
316 if (flags & ~supported_flags)
317 FIXME("unsupported flags %08x\n", flags & ~supported_flags);
318
319 if (algorithm)
320 FIXME("ignoring selected algorithm\n");
321
322 /* When zero bytes are requested the function returns success too. */
323 if (!count)
324 return STATUS_SUCCESS;
325
327 {
329 return STATUS_SUCCESS;
330 }
331
332 FIXME("called with unsupported parameters, returning error\n");
334}
#define BCRYPT_USE_SYSTEM_PREFERRED_RNG
Definition: bcrypt.h:171
@ ALG_ID_RNG
Definition: bcrypt_main.c:265
unsigned long DWORD
Definition: ntddk_ex.h:95
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLuint buffer
Definition: glext.h:5915
#define RtlGenRandom
Definition: ntsecapi.h:691

◆ BCryptGetFipsAlgorithmMode()

NTSTATUS WINAPI BCryptGetFipsAlgorithmMode ( BOOLEAN enabled)

Definition at line 391 of file bcrypt_main.c.

392{
393 FIXME("%p - semi-stub\n", enabled);
394
395 if (!enabled)
397
398 *enabled = FALSE;
399 return STATUS_SUCCESS;
400}
#define FALSE
Definition: types.h:117
GLenum GLenum GLsizei const GLuint GLboolean enabled
Definition: glext.h:7750

◆ BCryptGetProperty()

NTSTATUS WINAPI BCryptGetProperty ( BCRYPT_HANDLE  handle,
LPCWSTR  prop,
PUCHAR  buffer,
ULONG  count,
ULONG res,
ULONG  flags 
)

Definition at line 978 of file bcrypt_main.c.

979{
980 struct object *object = handle;
981
982 TRACE( "%p, %s, %p, %u, %p, %08x\n", handle, wine_dbgstr_w(prop), buffer, count, res, flags );
983
984 if (!object) return STATUS_INVALID_HANDLE;
985 if (!prop || !res) return STATUS_INVALID_PARAMETER;
986
987 switch (object->magic)
988 {
989 case MAGIC_ALG:
990 {
991 const struct algorithm *alg = (const struct algorithm *)object;
992 return get_alg_property( alg->id, prop, buffer, count, res );
993 }
994 case MAGIC_HASH:
995 {
996 const struct hash *hash = (const struct hash *)object;
997 return get_hash_property( hash->alg_id, prop, buffer, count, res );
998 }
999 default:
1000 WARN( "unknown magic %08x\n", object->magic );
1001 return STATUS_INVALID_HANDLE;
1002 }
1003}
#define WARN(fmt,...)
Definition: precomp.h:61
static NTSTATUS get_hash_property(enum alg_id id, const WCHAR *prop, UCHAR *buf, ULONG size, ULONG *ret_size)
Definition: bcrypt_main.c:968
static NTSTATUS get_alg_property(enum alg_id id, const WCHAR *prop, UCHAR *buf, ULONG size, ULONG *ret_size)
Definition: bcrypt_main.c:891
GLuint res
Definition: glext.h:9613
#define wine_dbgstr_w
Definition: kernel32.h:34
ULONG magic
Definition: bcrypt_main.c:259

Referenced by CNG_CalcHash().

◆ BCryptHash()

NTSTATUS WINAPI BCryptHash ( BCRYPT_ALG_HANDLE  algorithm,
PUCHAR  secret,
ULONG  secretlen,
PUCHAR  input,
ULONG  inputlen,
PUCHAR  output,
ULONG  outputlen 
)

Definition at line 1096 of file bcrypt_main.c.

1098{
1101
1102 TRACE( "%p, %p, %u, %p, %u, %p, %u\n", algorithm, secret, secretlen,
1103 input, inputlen, output, outputlen );
1104
1105 status = BCryptCreateHash( algorithm, &handle, NULL, 0, secret, secretlen, 0);
1106 if (status != STATUS_SUCCESS)
1107 {
1108 return status;
1109 }
1110
1111 status = BCryptHashData( handle, input, inputlen, 0 );
1112 if (status != STATUS_SUCCESS)
1113 {
1115 return status;
1116 }
1117
1118 status = BCryptFinishHash( handle, output, outputlen, 0 );
1119 if (status != STATUS_SUCCESS)
1120 {
1122 return status;
1123 }
1124
1125 return BCryptDestroyHash( handle );
1126}
NTSTATUS WINAPI BCryptHashData(BCRYPT_HASH_HANDLE handle, UCHAR *input, ULONG size, ULONG flags)
Definition: bcrypt_main.c:1058
NTSTATUS WINAPI BCryptDestroyHash(BCRYPT_HASH_HANDLE handle)
Definition: bcrypt_main.c:1047
NTSTATUS WINAPI BCryptCreateHash(BCRYPT_ALG_HANDLE algorithm, BCRYPT_HASH_HANDLE *handle, UCHAR *object, ULONG objectlen, UCHAR *secret, ULONG secretlen, ULONG flags)
Definition: bcrypt_main.c:1005
NTSTATUS WINAPI BCryptFinishHash(BCRYPT_HASH_HANDLE handle, UCHAR *output, ULONG size, ULONG flags)
Definition: bcrypt_main.c:1077
GLenum GLenum GLenum input
Definition: glext.h:9031

Referenced by assembly_get_pubkey_token().

◆ BCryptHashData()

NTSTATUS WINAPI BCryptHashData ( BCRYPT_HASH_HANDLE  handle,
PUCHAR  input,
ULONG  size,
ULONG  flags 
)

Definition at line 1058 of file bcrypt_main.c.

1059{
1060 struct hash *hash = handle;
1061
1062 TRACE( "%p, %p, %u, %08x\n", handle, input, size, flags );
1063
1064 if (!hash || hash->hdr.magic != MAGIC_HASH) return STATUS_INVALID_HANDLE;
1065 if (!input) return STATUS_SUCCESS;
1066
1067 if (hash->hmac)
1068 {
1069 return hmac_update( hash, input, size );
1070 }
1071 else
1072 {
1073 return hash_update( hash, input, size );
1074 }
1075}

Referenced by BCryptHash(), and CNG_CalcHash().

◆ BCryptImportKeyPair()

NTSTATUS WINAPI BCryptImportKeyPair ( BCRYPT_ALG_HANDLE  ,
BCRYPT_KEY_HANDLE  ,
LPCWSTR  ,
BCRYPT_KEY_HANDLE ,
UCHAR ,
ULONG  ,
ULONG   
)

Referenced by CNG_ImportECCPubKey().

◆ BCryptOpenAlgorithmProvider()

NTSTATUS WINAPI BCryptOpenAlgorithmProvider ( BCRYPT_ALG_HANDLE ,
LPCWSTR  ,
LPCWSTR  ,
ULONG   
)

◆ BCryptSetProperty()

NTSTATUS WINAPI BCryptSetProperty ( BCRYPT_HANDLE  ,
LPCWSTR  ,
PUCHAR  ,
ULONG  ,
ULONG   
)

◆ BCryptVerifySignature()

NTSTATUS WINAPI BCryptVerifySignature ( BCRYPT_KEY_HANDLE  ,
void ,
UCHAR ,
ULONG  ,
UCHAR ,
ULONG  ,
ULONG   
)

Referenced by CNG_VerifySignature().