ReactOS  0.4.13-dev-242-g611e6d7
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  ,
BCRYPT_HASH_HANDLE ,
PUCHAR  ,
ULONG  ,
PUCHAR  ,
ULONG  ,
ULONG   
)

Definition at line 999 of file bcrypt_main.c.

1001 {
1002  struct algorithm *alg = algorithm;
1003  struct hash *hash;
1004  NTSTATUS status;
1005 
1006  TRACE( "%p, %p, %p, %u, %p, %u, %08x - stub\n", algorithm, handle, object, objectlen,
1007  secret, secretlen, flags );
1008  if (flags)
1009  {
1010  FIXME( "unimplemented flags %08x\n", flags );
1011  return STATUS_NOT_IMPLEMENTED;
1012  }
1013 
1014  if (!alg || alg->hdr.magic != MAGIC_ALG) return STATUS_INVALID_HANDLE;
1015  if (object) FIXME( "ignoring object buffer\n" );
1016 
1017  if (!(hash = HeapAlloc( GetProcessHeap(), 0, sizeof(*hash) ))) return STATUS_NO_MEMORY;
1018  hash->hdr.magic = MAGIC_HASH;
1019  hash->alg_id = alg->id;
1020  hash->hmac = alg->hmac;
1021 
1022  if (hash->hmac)
1023  {
1024  status = hmac_init( hash, secret, secretlen );
1025  }
1026  else
1027  {
1028  status = hash_init( hash );
1029  }
1030 
1031  if (status != STATUS_SUCCESS)
1032  {
1033  HeapFree( GetProcessHeap(), 0, hash );
1034  return status;
1035  }
1036 
1037  *handle = hash;
1038  return STATUS_SUCCESS;
1039 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
LONG NTSTATUS
Definition: precomp.h:26
#define STATUS_INVALID_HANDLE
Definition: ntstatus.h:231
static UCHAR ULONG secretlen
Definition: bcrypt.c:29
enum alg_id id
Definition: bcrypt_main.c:287
int hash
Definition: main.c:58
#define FIXME(fmt,...)
Definition: debug.h:110
#define MAGIC_ALG
Definition: bcrypt_main.c:255
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
GLbitfield flags
Definition: glext.h:7161
static UCHAR * secret
Definition: bcrypt.c:29
struct object hdr
Definition: bcrypt_main.c:286
#define STATUS_NO_MEMORY
Definition: ntstatus.h:246
return STATUS_SUCCESS
Definition: btrfs.c:2745
Definition: _hash_fun.h:40
static SERVICE_STATUS status
Definition: service.c:31
#define MAGIC_HASH
Definition: bcrypt_main.c:256
#define HeapFree(x, y, z)
Definition: compat.h:394
static FT_Error hash_init(FT_Hash hash, FT_Bool is_num, FT_Memory memory)
Definition: fthash.c:166
Definition: ps.c:97

Referenced by BCryptHash(), CNG_CalcHash(), test_md5(), test_sha1(), test_sha256(), test_sha384(), and test_sha512().

◆ BCryptDecrypt()

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

◆ BCryptDestroyHash()

NTSTATUS WINAPI BCryptDestroyHash ( BCRYPT_HASH_HANDLE  )

Definition at line 1041 of file bcrypt_main.c.

1042 {
1043  struct hash *hash = handle;
1044 
1045  TRACE( "%p\n", handle );
1046 
1047  if (!hash || hash->hdr.magic != MAGIC_HASH) return STATUS_INVALID_HANDLE;
1048  HeapFree( GetProcessHeap(), 0, hash );
1049  return STATUS_SUCCESS;
1050 }
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:82
#define STATUS_INVALID_HANDLE
Definition: ntstatus.h:231
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
return STATUS_SUCCESS
Definition: btrfs.c:2745
Definition: _hash_fun.h:40
#define MAGIC_HASH
Definition: bcrypt_main.c:256
#define HeapFree(x, y, z)
Definition: compat.h:394

Referenced by BCryptHash(), CNG_CalcHash(), test_md5(), test_sha1(), test_sha256(), test_sha384(), and test_sha512().

◆ 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  ,
ULONG ,
BCRYPT_ALGORITHM_IDENTIFIER **  ,
ULONG   
)

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 
252  return STATUS_NOT_IMPLEMENTED;
253 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175

◆ BCryptFinishHash()

NTSTATUS WINAPI BCryptFinishHash ( BCRYPT_HASH_HANDLE  ,
PUCHAR  ,
ULONG  ,
ULONG   
)

Definition at line 1071 of file bcrypt_main.c.

1072 {
1073  struct hash *hash = handle;
1074 
1075  TRACE( "%p, %p, %u, %08x\n", handle, output, size, flags );
1076 
1077  if (!hash || hash->hdr.magic != MAGIC_HASH) return STATUS_INVALID_HANDLE;
1078  if (!output) return STATUS_INVALID_PARAMETER;
1079 
1080  if (hash->hmac)
1081  {
1082  return hmac_finish( hash, output, size );
1083  }
1084  else
1085  {
1086  return hash_finish( hash, output, size );
1087  }
1088 }
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:82
static UCHAR ULONG UCHAR ULONG UCHAR * output
Definition: bcrypt.c:29
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define STATUS_INVALID_HANDLE
Definition: ntstatus.h:231
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
GLbitfield flags
Definition: glext.h:7161
Definition: _hash_fun.h:40
#define MAGIC_HASH
Definition: bcrypt_main.c:256

Referenced by BCryptHash(), CNG_CalcHash(), test_md5(), test_sha1(), test_sha256(), test_sha384(), and test_sha512().

◆ BCryptGenerateSymmetricKey()

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

◆ BCryptGenRandom()

NTSTATUS WINAPI BCryptGenRandom ( BCRYPT_ALG_HANDLE  ,
PUCHAR  ,
ULONG  ,
ULONG   
)

Definition at line 291 of file bcrypt_main.c.

292 {
293  const DWORD supported_flags = BCRYPT_USE_SYSTEM_PREFERRED_RNG;
294  struct algorithm *algorithm = handle;
295 
296  TRACE("%p, %p, %u, %08x - semi-stub\n", handle, buffer, count, flags);
297 
298  if (!algorithm)
299  {
300  /* It's valid to call without an algorithm if BCRYPT_USE_SYSTEM_PREFERRED_RNG
301  * is set. In this case the preferred system RNG is used.
302  */
304  return STATUS_INVALID_HANDLE;
305  }
306  else if (algorithm->hdr.magic != MAGIC_ALG || algorithm->id != ALG_ID_RNG)
307  return STATUS_INVALID_HANDLE;
308 
309  if (!buffer)
311 
312  if (flags & ~supported_flags)
313  FIXME("unsupported flags %08x\n", flags & ~supported_flags);
314 
315  if (algorithm)
316  FIXME("ignoring selected algorithm\n");
317 
318  /* When zero bytes are requested the function returns success too. */
319  if (!count)
320  return STATUS_SUCCESS;
321 
323  {
324  if (RtlGenRandom(buffer, count))
325  return STATUS_SUCCESS;
326  }
327 
328  FIXME("called with unsupported parameters, returning error\n");
329  return STATUS_NOT_IMPLEMENTED;
330 }
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:82
#define BCRYPT_USE_SYSTEM_PREFERRED_RNG
Definition: bcrypt.h:171
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLuint buffer
Definition: glext.h:5915
#define STATUS_INVALID_HANDLE
Definition: ntstatus.h:231
enum alg_id id
Definition: bcrypt_main.c:287
#define FIXME(fmt,...)
Definition: debug.h:110
#define MAGIC_ALG
Definition: bcrypt_main.c:255
#define TRACE(s)
Definition: solgame.cpp:4
BOOLEAN WINAPI RtlGenRandom(PVOID, ULONG)
unsigned long DWORD
Definition: ntddk_ex.h:95
GLbitfield flags
Definition: glext.h:7161
struct object hdr
Definition: bcrypt_main.c:286
return STATUS_SUCCESS
Definition: btrfs.c:2745

Referenced by test_BCryptGenRandom(), and test_rng().

◆ BCryptGetFipsAlgorithmMode()

NTSTATUS WINAPI BCryptGetFipsAlgorithmMode ( BOOLEAN )

Definition at line 385 of file bcrypt_main.c.

386 {
387  FIXME("%p - semi-stub\n", enabled);
388 
389  if (!enabled)
391 
392  *enabled = FALSE;
393  return STATUS_SUCCESS;
394 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
GLenum GLenum GLsizei const GLuint GLboolean enabled
Definition: glext.h:7750
#define FIXME(fmt,...)
Definition: debug.h:110
return STATUS_SUCCESS
Definition: btrfs.c:2745

Referenced by test_BCryptGetFipsAlgorithmMode().

◆ BCryptGetProperty()

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

Definition at line 972 of file bcrypt_main.c.

973 {
974  struct object *object = handle;
975 
976  TRACE( "%p, %s, %p, %u, %p, %08x\n", handle, wine_dbgstr_w(prop), buffer, count, res, flags );
977 
978  if (!object) return STATUS_INVALID_HANDLE;
979  if (!prop || !res) return STATUS_INVALID_PARAMETER;
980 
981  switch (object->magic)
982  {
983  case MAGIC_ALG:
984  {
985  const struct algorithm *alg = (const struct algorithm *)object;
986  return get_alg_property( alg->id, prop, buffer, count, res );
987  }
988  case MAGIC_HASH:
989  {
990  const struct hash *hash = (const struct hash *)object;
991  return get_hash_property( hash->alg_id, prop, buffer, count, res );
992  }
993  default:
994  WARN( "unknown magic %08x\n", object->magic );
995  return STATUS_INVALID_HANDLE;
996  }
997 }
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:82
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define WARN(fmt,...)
Definition: debug.h:111
static NTSTATUS get_hash_property(enum alg_id id, const WCHAR *prop, UCHAR *buf, ULONG size, ULONG *ret_size)
Definition: bcrypt_main.c:962
#define wine_dbgstr_w
Definition: kernel32.h:34
static NTSTATUS get_alg_property(enum alg_id id, const WCHAR *prop, UCHAR *buf, ULONG size, ULONG *ret_size)
Definition: bcrypt_main.c:885
GLuint buffer
Definition: glext.h:5915
ULONG magic
Definition: bcrypt_main.c:259
#define STATUS_INVALID_HANDLE
Definition: ntstatus.h:231
enum alg_id id
Definition: bcrypt_main.c:287
#define MAGIC_ALG
Definition: bcrypt_main.c:255
#define TRACE(s)
Definition: solgame.cpp:4
GLbitfield flags
Definition: glext.h:7161
GLuint res
Definition: glext.h:9613
Definition: _hash_fun.h:40
#define MAGIC_HASH
Definition: bcrypt_main.c:256

Referenced by _test_alg_name(), _test_hash_length(), CNG_CalcHash(), test_md5(), test_rng(), test_sha1(), test_sha256(), test_sha384(), and test_sha512().

◆ BCryptHash()

NTSTATUS WINAPI BCryptHash ( BCRYPT_ALG_HANDLE  ,
PUCHAR  ,
ULONG  ,
PUCHAR  ,
ULONG  ,
PUCHAR  ,
ULONG   
)

Definition at line 1090 of file bcrypt_main.c.

1092 {
1093  NTSTATUS status;
1095 
1096  TRACE( "%p, %p, %u, %p, %u, %p, %u\n", algorithm, secret, secretlen,
1098 
1100  if (status != STATUS_SUCCESS)
1101  {
1102  return status;
1103  }
1104 
1106  if (status != STATUS_SUCCESS)
1107  {
1109  return status;
1110  }
1111 
1113  if (status != STATUS_SUCCESS)
1114  {
1116  return status;
1117  }
1118 
1119  return BCryptDestroyHash( handle );
1120 }
static UCHAR ULONG UCHAR ULONG UCHAR ULONG outputlen
Definition: bcrypt.c:29
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:82
static UCHAR ULONG UCHAR ULONG UCHAR * output
Definition: bcrypt.c:29
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS WINAPI BCryptHashData(BCRYPT_HASH_HANDLE handle, UCHAR *input, ULONG size, ULONG flags)
Definition: bcrypt_main.c:1052
NTSTATUS WINAPI BCryptFinishHash(BCRYPT_HASH_HANDLE handle, UCHAR *output, ULONG size, ULONG flags)
Definition: bcrypt_main.c:1071
static UCHAR ULONG secretlen
Definition: bcrypt.c:29
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
static UCHAR * secret
Definition: bcrypt.c:29
GLenum GLenum GLenum input
Definition: glext.h:9031
static UCHAR ULONG UCHAR ULONG inputlen
Definition: bcrypt.c:29
return STATUS_SUCCESS
Definition: btrfs.c:2745
static SERVICE_STATUS status
Definition: service.c:31
NTSTATUS WINAPI BCryptDestroyHash(BCRYPT_HASH_HANDLE handle)
Definition: bcrypt_main.c:1041
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:999
Definition: ps.c:97

◆ BCryptHashData()

NTSTATUS WINAPI BCryptHashData ( BCRYPT_HASH_HANDLE  ,
PUCHAR  ,
ULONG  ,
ULONG   
)

Definition at line 1052 of file bcrypt_main.c.

1053 {
1054  struct hash *hash = handle;
1055 
1056  TRACE( "%p, %p, %u, %08x\n", handle, input, size, flags );
1057 
1058  if (!hash || hash->hdr.magic != MAGIC_HASH) return STATUS_INVALID_HANDLE;
1059  if (!input) return STATUS_SUCCESS;
1060 
1061  if (hash->hmac)
1062  {
1063  return hmac_update( hash, input, size );
1064  }
1065  else
1066  {
1067  return hash_update( hash, input, size );
1068  }
1069 }
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:82
#define STATUS_INVALID_HANDLE
Definition: ntstatus.h:231
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
GLbitfield flags
Definition: glext.h:7161
GLenum GLenum GLenum input
Definition: glext.h:9031
return STATUS_SUCCESS
Definition: btrfs.c:2745
Definition: _hash_fun.h:40
#define MAGIC_HASH
Definition: bcrypt_main.c:256

Referenced by BCryptHash(), CNG_CalcHash(), test_md5(), test_sha1(), test_sha256(), test_sha384(), and test_sha512().

◆ 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().