ReactOS 0.4.15-dev-7705-g2320c37
bcrypt_main.c File Reference
#include <wine/config.h>
#include <wine/port.h>
#include <ntstatus.h>
#include <windef.h>
#include <winbase.h>
#include <ntsecapi.h>
#include <bcrypt.h>
#include <wine/debug.h>
#include <wine/unicode.h>
#include <wine/library.h>
Include dependency graph for bcrypt_main.c:

Go to the source code of this file.

Classes

struct  object
 
struct  algorithm
 

Macros

#define WIN32_NO_STATUS
 
#define MAGIC_ALG   (('A' << 24) | ('L' << 16) | ('G' << 8) | '0')
 
#define MAGIC_HASH   (('H' << 24) | ('A' << 16) | ('S' << 8) | 'H')
 
#define OBJECT_LENGTH_MD5   274
 
#define OBJECT_LENGTH_SHA1   278
 
#define OBJECT_LENGTH_SHA256   286
 
#define OBJECT_LENGTH_SHA384   382
 
#define OBJECT_LENGTH_SHA512   382
 

Enumerations

enum  alg_id {
  ALG_ID_MD5 , ALG_ID_RNG , ALG_ID_SHA1 , ALG_ID_SHA256 ,
  ALG_ID_SHA384 , ALG_ID_SHA512 , ALG_ID_ECDSA_P256 , ALG_ID_ECDSA_P384
}
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (bcrypt)
 
NTSTATUS WINAPI BCryptEnumAlgorithms (ULONG dwAlgOperations, ULONG *pAlgCount, BCRYPT_ALGORITHM_IDENTIFIER **ppAlgList, ULONG dwFlags)
 
NTSTATUS WINAPI BCryptGenRandom (BCRYPT_ALG_HANDLE handle, UCHAR *buffer, ULONG count, ULONG flags)
 
NTSTATUS WINAPI BCryptOpenAlgorithmProvider (BCRYPT_ALG_HANDLE *handle, LPCWSTR id, LPCWSTR implementation, DWORD flags)
 
NTSTATUS WINAPI BCryptCloseAlgorithmProvider (BCRYPT_ALG_HANDLE handle, DWORD flags)
 
NTSTATUS WINAPI BCryptGetFipsAlgorithmMode (BOOLEAN *enabled)
 
static NTSTATUS generic_alg_property (enum alg_id id, const WCHAR *prop, UCHAR *buf, ULONG size, ULONG *ret_size)
 
static NTSTATUS get_alg_property (enum alg_id id, const WCHAR *prop, UCHAR *buf, ULONG size, ULONG *ret_size)
 
static NTSTATUS get_hash_property (enum alg_id id, const WCHAR *prop, UCHAR *buf, ULONG size, ULONG *ret_size)
 
NTSTATUS WINAPI BCryptGetProperty (BCRYPT_HANDLE handle, LPCWSTR prop, UCHAR *buffer, ULONG count, ULONG *res, ULONG flags)
 
NTSTATUS WINAPI BCryptCreateHash (BCRYPT_ALG_HANDLE algorithm, BCRYPT_HASH_HANDLE *handle, UCHAR *object, ULONG objectlen, UCHAR *secret, ULONG secretlen, ULONG flags)
 
NTSTATUS WINAPI BCryptDestroyHash (BCRYPT_HASH_HANDLE handle)
 
NTSTATUS WINAPI BCryptHashData (BCRYPT_HASH_HANDLE handle, UCHAR *input, ULONG size, ULONG flags)
 
NTSTATUS WINAPI BCryptFinishHash (BCRYPT_HASH_HANDLE handle, UCHAR *output, ULONG size, ULONG flags)
 
NTSTATUS WINAPI BCryptHash (BCRYPT_ALG_HANDLE algorithm, UCHAR *secret, ULONG secretlen, UCHAR *input, ULONG inputlen, UCHAR *output, ULONG outputlen)
 
BOOL WINAPI DllMain (HINSTANCE hinst, DWORD reason, LPVOID reserved)
 

Variables

static HINSTANCE instance
 
struct {
   ULONG   hash_length
 
   const WCHAR *   alg_name
 
alg_props []
 

Macro Definition Documentation

◆ MAGIC_ALG

#define MAGIC_ALG   (('A' << 24) | ('L' << 16) | ('G' << 8) | '0')

Definition at line 255 of file bcrypt_main.c.

◆ MAGIC_HASH

#define MAGIC_HASH   (('H' << 24) | ('A' << 16) | ('S' << 8) | 'H')

Definition at line 256 of file bcrypt_main.c.

◆ OBJECT_LENGTH_MD5

#define OBJECT_LENGTH_MD5   274

Definition at line 860 of file bcrypt_main.c.

◆ OBJECT_LENGTH_SHA1

#define OBJECT_LENGTH_SHA1   278

Definition at line 861 of file bcrypt_main.c.

◆ OBJECT_LENGTH_SHA256

#define OBJECT_LENGTH_SHA256   286

Definition at line 862 of file bcrypt_main.c.

◆ OBJECT_LENGTH_SHA384

#define OBJECT_LENGTH_SHA384   382

Definition at line 863 of file bcrypt_main.c.

◆ OBJECT_LENGTH_SHA512

#define OBJECT_LENGTH_SHA512   382

Definition at line 864 of file bcrypt_main.c.

◆ WIN32_NO_STATUS

#define WIN32_NO_STATUS

Definition at line 24 of file bcrypt_main.c.

Enumeration Type Documentation

◆ alg_id

Enumerator
ALG_ID_MD5 
ALG_ID_RNG 
ALG_ID_SHA1 
ALG_ID_SHA256 
ALG_ID_SHA384 
ALG_ID_SHA512 
ALG_ID_ECDSA_P256 
ALG_ID_ECDSA_P384 

Definition at line 262 of file bcrypt_main.c.

263{
272};
@ ALG_ID_ECDSA_P256
Definition: bcrypt_main.c:270
@ ALG_ID_SHA512
Definition: bcrypt_main.c:269
@ ALG_ID_SHA384
Definition: bcrypt_main.c:268
@ ALG_ID_SHA1
Definition: bcrypt_main.c:266
@ ALG_ID_ECDSA_P384
Definition: bcrypt_main.c:271
@ ALG_ID_SHA256
Definition: bcrypt_main.c:267
@ ALG_ID_MD5
Definition: bcrypt_main.c:264
@ ALG_ID_RNG
Definition: bcrypt_main.c:265

Function Documentation

◆ BCryptCloseAlgorithmProvider()

NTSTATUS WINAPI BCryptCloseAlgorithmProvider ( BCRYPT_ALG_HANDLE  handle,
DWORD  flags 
)

Definition at line 380 of file bcrypt_main.c.

381{
382 struct algorithm *alg = handle;
383
384 TRACE( "%p, %08x\n", handle, flags );
385
386 if (!alg || alg->hdr.magic != MAGIC_ALG) return STATUS_INVALID_HANDLE;
387 HeapFree( GetProcessHeap(), 0, alg );
388 return STATUS_SUCCESS;
389}
#define MAGIC_ALG
Definition: bcrypt_main.c:255
#define GetProcessHeap()
Definition: compat.h:736
#define HeapFree(x, y, z)
Definition: compat.h:735
GLbitfield flags
Definition: glext.h:7161
#define STATUS_INVALID_HANDLE
Definition: ntstatus.h:245
#define STATUS_SUCCESS
Definition: shellext.h:65
#define TRACE(s)
Definition: solgame.cpp:4
struct object hdr
Definition: bcrypt_main.c:290

Referenced by assembly_get_pubkey_token(), CNG_CalcHash(), and CNG_ImportECCPubKey().

◆ BCryptCreateHash()

NTSTATUS WINAPI BCryptCreateHash ( BCRYPT_ALG_HANDLE  algorithm,
BCRYPT_HASH_HANDLE handle,
UCHAR object,
ULONG  objectlen,
UCHAR 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 MAGIC_HASH
Definition: bcrypt_main.c:256
#define FIXME(fmt,...)
Definition: debug.h:111
#define HeapAlloc
Definition: compat.h:733
static FT_Error hash_init(FT_Hash hash, FT_Bool is_num, FT_Memory memory)
Definition: fthash.c:166
static DATA_BLOB CRYPTPROTECT_PROMPTSTRUCT DATA_BLOB *static LPWSTR DATA_BLOB CRYPTPROTECT_PROMPTSTRUCT DATA_BLOB *static char secret[]
Definition: protectdata.c:33
#define STATUS_NO_MEMORY
Definition: ntstatus.h:260
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:239
enum alg_id id
Definition: bcrypt_main.c:291
Definition: _hash_fun.h:40
Definition: ps.c:97

Referenced by BCryptHash(), and CNG_CalcHash().

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

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

◆ BCryptGenRandom()

NTSTATUS WINAPI BCryptGenRandom ( BCRYPT_ALG_HANDLE  handle,
UCHAR 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
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,
UCHAR 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}
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
#define WARN(fmt,...)
Definition: debug.h:112
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,
UCHAR secret,
ULONG  secretlen,
UCHAR input,
ULONG  inputlen,
UCHAR 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,
UCHAR 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().

◆ BCryptOpenAlgorithmProvider()

NTSTATUS WINAPI BCryptOpenAlgorithmProvider ( BCRYPT_ALG_HANDLE handle,
LPCWSTR  id,
LPCWSTR  implementation,
DWORD  flags 
)

Definition at line 336 of file bcrypt_main.c.

337{
338 struct algorithm *alg;
339 enum alg_id alg_id;
340
341 const DWORD supported_flags = BCRYPT_ALG_HANDLE_HMAC_FLAG;
342
343 TRACE( "%p, %s, %s, %08x\n", handle, wine_dbgstr_w(id), wine_dbgstr_w(implementation), flags );
344
345 if (!handle || !id) return STATUS_INVALID_PARAMETER;
346 if (flags & ~supported_flags)
347 {
348 FIXME( "unsupported flags %08x\n", flags & ~supported_flags);
350 }
351
353 else if (!strcmpW( id, BCRYPT_MD5_ALGORITHM )) alg_id = ALG_ID_MD5;
354 else if (!strcmpW( id, BCRYPT_RNG_ALGORITHM )) alg_id = ALG_ID_RNG;
360 else
361 {
362 FIXME( "algorithm %s not supported\n", debugstr_w(id) );
364 }
365 if (implementation && strcmpW( implementation, MS_PRIMITIVE_PROVIDER ))
366 {
367 FIXME( "implementation %s not supported\n", debugstr_w(implementation) );
369 }
370
371 if (!(alg = HeapAlloc( GetProcessHeap(), 0, sizeof(*alg) ))) return STATUS_NO_MEMORY;
372 alg->hdr.magic = MAGIC_ALG;
373 alg->id = alg_id;
375
376 *handle = alg;
377 return STATUS_SUCCESS;
378}
#define BCRYPT_ECDSA_P384_ALGORITHM
Definition: bcrypt.h:79
#define BCRYPT_SHA512_ALGORITHM
Definition: bcrypt.h:77
#define BCRYPT_SHA256_ALGORITHM
Definition: bcrypt.h:75
#define BCRYPT_ALG_HANDLE_HMAC_FLAG
Definition: bcrypt.h:172
#define BCRYPT_ECDSA_P256_ALGORITHM
Definition: bcrypt.h:78
#define BCRYPT_RNG_ALGORITHM
Definition: bcrypt.h:73
#define MS_PRIMITIVE_PROVIDER
Definition: bcrypt.h:69
#define BCRYPT_SHA384_ALGORITHM
Definition: bcrypt.h:76
#define BCRYPT_SHA1_ALGORITHM
Definition: bcrypt.h:74
#define BCRYPT_MD5_ALGORITHM
Definition: bcrypt.h:72
alg_id
Definition: bcrypt_main.c:263
#define debugstr_w
Definition: kernel32.h:32
#define strcmpW(s1, s2)
Definition: unicode.h:38

Referenced by assembly_get_pubkey_token(), CNG_CalcHash(), and CNG_ImportECCPubKey().

◆ DllMain()

BOOL WINAPI DllMain ( HINSTANCE  hinst,
DWORD  reason,
LPVOID  reserved 
)

Definition at line 1128 of file bcrypt_main.c.

1129{
1130 switch (reason)
1131 {
1132 case DLL_PROCESS_ATTACH:
1133 instance = hinst;
1135#if defined(HAVE_GNUTLS_HASH) && !defined(HAVE_COMMONCRYPTO_COMMONDIGEST_H)
1136 gnutls_initialize();
1137#elif defined(SONAME_LIBMBEDTLS) && !defined(HAVE_COMMONCRYPTO_COMMONDIGEST_H) && !defined(__REACTOS__)
1138 mbedtls_initialize();
1139#endif
1140 break;
1141
1142 case DLL_PROCESS_DETACH:
1143 if (reserved) break;
1144#if defined(HAVE_GNUTLS_HASH) && !defined(HAVE_COMMONCRYPTO_COMMONDIGEST_H)
1145 gnutls_uninitialize();
1146#elif defined(SONAME_LIBMBEDTLS) && !defined(HAVE_COMMONCRYPTO_COMMONDIGEST_H) && !defined(__REACTOS__)
1147 mbedtls_uninitialize();
1148#endif
1149 break;
1150 }
1151 return TRUE;
1152}
static HINSTANCE instance
Definition: bcrypt_main.c:44
#define TRUE
Definition: types.h:120
static WCHAR reason[MAX_STRING_RESOURCE_LEN]
Definition: object.c:1904
#define DLL_PROCESS_ATTACH
Definition: compat.h:131
#define DLL_PROCESS_DETACH
Definition: compat.h:130
BOOL WINAPI DisableThreadLibraryCalls(IN HMODULE hLibModule)
Definition: loader.c:85
r reserved
Definition: btrfs.c:3006
static HINSTANCE hinst
Definition: edit.c:551

◆ generic_alg_property()

static NTSTATUS generic_alg_property ( enum alg_id  id,
const WCHAR prop,
UCHAR buf,
ULONG  size,
ULONG ret_size 
)
static

Definition at line 866 of file bcrypt_main.c.

867{
868 if (!strcmpW( prop, BCRYPT_HASH_LENGTH ))
869 {
870 *ret_size = sizeof(ULONG);
871 if (size < sizeof(ULONG))
873 if(buf)
875 return STATUS_SUCCESS;
876 }
877
878 if (!strcmpW( prop, BCRYPT_ALGORITHM_NAME ))
879 {
880 *ret_size = (strlenW(alg_props[id].alg_name)+1)*sizeof(WCHAR);
881 if (size < *ret_size)
883 if(buf)
884 memcpy(buf, alg_props[id].alg_name, *ret_size);
885 return STATUS_SUCCESS;
886 }
887
889}
#define BCRYPT_ALGORITHM_NAME
Definition: bcrypt.h:43
#define BCRYPT_HASH_LENGTH
Definition: bcrypt.h:50
const WCHAR * alg_name
Definition: bcrypt_main.c:276
static const struct @331 alg_props[]
ULONG hash_length
Definition: bcrypt_main.c:275
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define strlenW(s)
Definition: unicode.h:28
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:69
uint32_t ULONG
Definition: typedefs.h:59
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by get_alg_property(), and get_hash_property().

◆ get_alg_property()

static NTSTATUS get_alg_property ( enum alg_id  id,
const WCHAR prop,
UCHAR buf,
ULONG  size,
ULONG ret_size 
)
static

Definition at line 891 of file bcrypt_main.c.

892{
894 ULONG value;
895
896 status = generic_alg_property( id, prop, buf, size, ret_size );
898 return status;
899
900 switch (id)
901 {
902 case ALG_ID_MD5:
903 if (!strcmpW( prop, BCRYPT_OBJECT_LENGTH ))
904 {
906 break;
907 }
908 FIXME( "unsupported md5 algorithm property %s\n", debugstr_w(prop) );
910
911 case ALG_ID_RNG:
913 FIXME( "unsupported rng algorithm property %s\n", debugstr_w(prop) );
915
916 case ALG_ID_SHA1:
917 if (!strcmpW( prop, BCRYPT_OBJECT_LENGTH ))
918 {
920 break;
921 }
922 FIXME( "unsupported sha1 algorithm property %s\n", debugstr_w(prop) );
924
925 case ALG_ID_SHA256:
926 if (!strcmpW( prop, BCRYPT_OBJECT_LENGTH ))
927 {
929 break;
930 }
931 FIXME( "unsupported sha256 algorithm property %s\n", debugstr_w(prop) );
933
934 case ALG_ID_SHA384:
935 if (!strcmpW( prop, BCRYPT_OBJECT_LENGTH ))
936 {
938 break;
939 }
940 FIXME( "unsupported sha384 algorithm property %s\n", debugstr_w(prop) );
942
943 case ALG_ID_SHA512:
944 if (!strcmpW( prop, BCRYPT_OBJECT_LENGTH ))
945 {
947 break;
948 }
949 FIXME( "unsupported sha512 algorithm property %s\n", debugstr_w(prop) );
951
952 default:
953 FIXME( "unsupported algorithm %u\n", id );
955 }
956
957 if (size < sizeof(ULONG))
958 {
959 *ret_size = sizeof(ULONG);
961 }
962 if (buf) *(ULONG *)buf = value;
963 *ret_size = sizeof(ULONG);
964
965 return STATUS_SUCCESS;
966}
#define BCRYPT_OBJECT_LENGTH
Definition: bcrypt.h:56
static NTSTATUS generic_alg_property(enum alg_id id, const WCHAR *prop, UCHAR *buf, ULONG size, ULONG *ret_size)
Definition: bcrypt_main.c:866
#define OBJECT_LENGTH_SHA384
Definition: bcrypt_main.c:863
#define OBJECT_LENGTH_SHA256
Definition: bcrypt_main.c:862
#define OBJECT_LENGTH_SHA512
Definition: bcrypt_main.c:864
#define OBJECT_LENGTH_SHA1
Definition: bcrypt_main.c:861
#define OBJECT_LENGTH_MD5
Definition: bcrypt_main.c:860
#define STATUS_NOT_SUPPORTED
Definition: ntstatus.h:423
Definition: pdh_main.c:94

Referenced by BCryptGetProperty().

◆ get_hash_property()

static NTSTATUS get_hash_property ( enum alg_id  id,
const WCHAR prop,
UCHAR buf,
ULONG  size,
ULONG ret_size 
)
static

Definition at line 968 of file bcrypt_main.c.

969{
971
972 status = generic_alg_property( id, prop, buf, size, ret_size );
974 FIXME( "unsupported property %s\n", debugstr_w(prop) );
975 return status;
976}

Referenced by BCryptGetProperty().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( bcrypt  )

Variable Documentation

◆ alg_name

const WCHAR* alg_name

Definition at line 276 of file bcrypt_main.c.

Referenced by generic_alg_property().

◆ 

const struct { ... } alg_props[]

◆ hash_length

ULONG hash_length

Definition at line 275 of file bcrypt_main.c.

Referenced by generic_alg_property().

◆ instance

HINSTANCE instance
static

Definition at line 44 of file bcrypt_main.c.

Referenced by DllMain().