ReactOS 0.4.15-dev-7934-g1dc8d80
crypt_sha.c File Reference
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "winerror.h"
#include "wine/test.h"
Include dependency graph for crypt_sha.c:

Go to the source code of this file.

Classes

struct  SHA_CTX
 

Typedefs

typedef struct SHA_CTXPSHA_CTX
 

Functions

static void test_sha_ctx (void)
 
 START_TEST (crypt_sha)
 

Typedef Documentation

◆ PSHA_CTX

typedef struct SHA_CTX * PSHA_CTX

Function Documentation

◆ START_TEST()

START_TEST ( crypt_sha  )

Definition at line 69 of file crypt_sha.c.

70{
72}
static void test_sha_ctx(void)
Definition: crypt_sha.c:36

◆ test_sha_ctx()

static void test_sha_ctx ( void  )
static

Definition at line 36 of file crypt_sha.c.

37{
38 void (WINAPI *pA_SHAInit)(PSHA_CTX);
39 void (WINAPI *pA_SHAUpdate)(PSHA_CTX, const unsigned char *, UINT);
40 void (WINAPI *pA_SHAFinal)(PSHA_CTX, PULONG);
41 static const unsigned char test_buffer[] = "In our Life there's If"
42 "In our beliefs there's Lie"
43 "In our business there is Sin"
44 "In our bodies, there is Die";
47 ULONG result[5];
48 ULONG result_correct[5] = {0xe014f93, 0xe09791ec, 0x6dcf96c8, 0x8e9385fc, 0x1611c1bb};
49
50 hmod = GetModuleHandleA("advapi32.dll");
51 pA_SHAInit = (void *)GetProcAddress(hmod, "A_SHAInit");
52 pA_SHAUpdate = (void *)GetProcAddress(hmod, "A_SHAUpdate");
53 pA_SHAFinal = (void *)GetProcAddress(hmod, "A_SHAFinal");
54
55 if (!pA_SHAInit || !pA_SHAUpdate || !pA_SHAFinal)
56 {
57 win_skip("A_SHAInit and/or A_SHAUpdate and/or A_SHAFinal are not available\n");
58 return;
59 }
60
61 RtlZeroMemory(&ctx, sizeof(ctx));
62 pA_SHAInit(&ctx);
63 pA_SHAUpdate(&ctx, test_buffer, sizeof(test_buffer)-1);
64 pA_SHAUpdate(&ctx, test_buffer, sizeof(test_buffer)-1);
65 pA_SHAFinal(&ctx, result);
66 ok(!memcmp(result, result_correct, sizeof(result)), "incorrect result\n");
67}
static TCHAR test_buffer[TEST_BUFFER_SIZE]
Definition: _tfileio.c:53
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
#define ok(value,...)
Definition: atltest.h:57
struct SHA_CTX * PSHA_CTX
#define GetProcAddress(x, y)
Definition: compat.h:753
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
GLuint64EXT * result
Definition: glext.h:11304
static PEXPLICIT_ACCESSW *static HMODULE hmod
Definition: security.c:143
unsigned int UINT
Definition: ndis.h:50
#define win_skip
Definition: test.h:160
Definition: addons.c:69
uint32_t * PULONG
Definition: typedefs.h:59
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
uint32_t ULONG
Definition: typedefs.h:59
#define WINAPI
Definition: msvc.h:6

Referenced by START_TEST().