ReactOS  0.4.13-dev-66-gc714b7f
crypt.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  tagPROVFUNCS
 
struct  tagCRYPTPROV
 
struct  tagCRYPTKEY
 
struct  tagCRYPTHASH
 
struct  ustring
 

Macros

#define MAGIC_CRYPTPROV   0xA39E741F
 
#define MAGIC_CRYPTKEY   0xA39E741E
 
#define MAGIC_CRYPTHASH   0xA39E741D
 
#define MAXPROVTYPES   999
 

Typedefs

typedef struct tagPROVFUNCS PROVFUNCS
 
typedef struct tagPROVFUNCSPPROVFUNCS
 
typedef struct tagCRYPTPROV CRYPTPROV
 
typedef struct tagCRYPTPROVPCRYPTPROV
 
typedef struct tagCRYPTKEY CRYPTKEY
 
typedef struct tagCRYPTKEYPCRYPTKEY
 
typedef struct tagCRYPTHASH CRYPTHASH
 
typedef struct tagCRYPTHASHPCRYPTHASH
 

Functions

unsigned charCRYPT_DEShash (unsigned char *dst, const unsigned char *key, const unsigned char *src) DECLSPEC_HIDDEN
 
unsigned charCRYPT_DESunhash (unsigned char *dst, const unsigned char *key, const unsigned char *src) DECLSPEC_HIDDEN
 
NTSTATUS WINAPI SystemFunction032 (struct ustring *data, const struct ustring *key)
 

Macro Definition Documentation

◆ MAGIC_CRYPTHASH

#define MAGIC_CRYPTHASH   0xA39E741D

Definition at line 61 of file crypt.h.

◆ MAGIC_CRYPTKEY

#define MAGIC_CRYPTKEY   0xA39E741E

Definition at line 60 of file crypt.h.

◆ MAGIC_CRYPTPROV

#define MAGIC_CRYPTPROV   0xA39E741F

Definition at line 59 of file crypt.h.

◆ MAXPROVTYPES

#define MAXPROVTYPES   999

Definition at line 87 of file crypt.h.

Typedef Documentation

◆ CRYPTHASH

◆ CRYPTKEY

◆ CRYPTPROV

◆ PCRYPTHASH

◆ PCRYPTKEY

◆ PCRYPTPROV

◆ PPROVFUNCS

◆ PROVFUNCS

Function Documentation

◆ CRYPT_DEShash()

unsigned char* CRYPT_DEShash ( unsigned char dst,
const unsigned char key,
const unsigned char src 
)

Definition at line 259 of file crypt_des.c.

260 {
261  int i;
262  unsigned char K[7];
263  unsigned char D[8];
264 
265  Permute( K, key, KeyPermuteMap, 7 );
266  Permute( D, src, InitialPermuteMap, 8 );
267 
268  for (i = 0; i < 16; i++)
269  {
270  int j;
271  unsigned char *L = D;
272  unsigned char *R = &(D[4]);
273  unsigned char Rexp[6];
274  unsigned char Rn[4];
275  unsigned char SubK[6];
276 
277  KeyShiftLeft( K, KeyRotation[i] );
278  Permute( SubK, K, KeyCompression, 6 );
279 
280  Permute( Rexp, R, DataExpansion, 6 );
281  xor( Rexp, Rexp, SubK, 6 );
282 
283  sbox( Rn, Rexp );
284  Permute( Rexp, Rn, PBox, 4 );
285  xor( Rn, L, Rexp, 4 );
286 
287  for (j = 0; j < 4; j++)
288  {
289  L[j] = R[j];
290  R[j] = Rn[j];
291  }
292  }
293 
294  Permute( dst, D, FinalPermuteMap, 8 );
295 
296  return dst;
297 }
#define R(b, x)
Definition: sha2.c:134
static void xor(unsigned char *dst, const unsigned char *a, const unsigned char *b, const int count)
Definition: crypt_des.c:251
static const unsigned char DataExpansion[48]
Definition: crypt_des.c:67
static const unsigned char PBox[32]
Definition: crypt_des.c:129
static const unsigned char FinalPermuteMap[64]
Definition: crypt_des.c:137
static void KeyShiftLeft(unsigned char *key, const int numbits)
Definition: crypt_des.c:169
static const unsigned char KeyRotation[16]
Definition: crypt_des.c:54
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static const unsigned char KeyCompression[48]
Definition: crypt_des.c:57
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
static void Permute(unsigned char *dst, const unsigned char *src, const unsigned char *map, const int mapsize)
Definition: crypt_des.c:153
static const WCHAR L[]
Definition: oid.c:1250
GLenum src
Definition: glext.h:6340
static void sbox(unsigned char *dst, const unsigned char *src)
Definition: crypt_des.c:227
#define D(name, bit)
static const unsigned char InitialPermuteMap[64]
Definition: crypt_des.c:31
GLenum GLenum dst
Definition: glext.h:6340
static const unsigned char KeyPermuteMap[56]
Definition: crypt_des.c:43
Definition: path.c:42

Referenced by CRYPT_LMhash(), SystemFunction001(), SystemFunction003(), SystemFunction004(), SystemFunction008(), SystemFunction012(), and SystemFunction024().

◆ CRYPT_DESunhash()

unsigned char* CRYPT_DESunhash ( unsigned char dst,
const unsigned char key,
const unsigned char src 
)

Definition at line 299 of file crypt_des.c.

300 {
301  int i;
302  unsigned char K[7];
303  unsigned char D[8];
304 
305  Permute( K, key, KeyPermuteMap, 7 );
306  Permute( D, src, InitialPermuteMap, 8 );
307 
308  for (i = 0; i < 16; i++)
309  {
310  int j;
311  unsigned char *L = D;
312  unsigned char *R = &(D[4]);
313  unsigned char Rexp[6];
314  unsigned char Rn[4];
315  unsigned char SubK[6];
316 
317  Permute( SubK, K, KeyCompression, 6 );
318 
319  Permute( Rexp, R, DataExpansion, 6 );
320  xor( Rexp, Rexp, SubK, 6 );
321 
322  sbox( Rn, Rexp );
323  Permute( Rexp, Rn, PBox, 4 );
324  xor( Rn, L, Rexp, 4 );
325 
326  for (j = 0; j < 4; j++)
327  {
328  L[j] = R[j];
329  R[j] = Rn[j];
330  }
331 
332  KeyShiftRight( K, KeyRotation[15 - i] );
333  }
334 
335  Permute( dst, D, FinalPermuteMap, 8 );
336 
337  return dst;
338 }
#define R(b, x)
Definition: sha2.c:134
static void xor(unsigned char *dst, const unsigned char *a, const unsigned char *b, const int count)
Definition: crypt_des.c:251
static const unsigned char DataExpansion[48]
Definition: crypt_des.c:67
static const unsigned char PBox[32]
Definition: crypt_des.c:129
static const unsigned char FinalPermuteMap[64]
Definition: crypt_des.c:137
static void KeyShiftRight(unsigned char *key, const int numbits)
Definition: crypt_des.c:198
static const unsigned char KeyRotation[16]
Definition: crypt_des.c:54
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static const unsigned char KeyCompression[48]
Definition: crypt_des.c:57
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
static void Permute(unsigned char *dst, const unsigned char *src, const unsigned char *map, const int mapsize)
Definition: crypt_des.c:153
static const WCHAR L[]
Definition: oid.c:1250
GLenum src
Definition: glext.h:6340
static void sbox(unsigned char *dst, const unsigned char *src)
Definition: crypt_des.c:227
#define D(name, bit)
static const unsigned char InitialPermuteMap[64]
Definition: crypt_des.c:31
GLenum GLenum dst
Definition: glext.h:6340
static const unsigned char KeyPermuteMap[56]
Definition: crypt_des.c:43
Definition: path.c:42

Referenced by SystemFunction002(), SystemFunction005(), SystemFunction013(), and SystemFunction025().

◆ SystemFunction032()

NTSTATUS WINAPI SystemFunction032 ( struct ustring data,
const struct ustring key 
)

Definition at line 533 of file sysfunc.c.

534 {
535  RC4_CONTEXT a4i;
536 
537  rc4_init(&a4i, key->Buffer, key->Length);
538  rc4_crypt(&a4i, data->Buffer, data->Length);
539 
540  return STATUS_SUCCESS;
541 }
void rc4_crypt(RC4_CONTEXT *a4i, unsigned char *inoutString, unsigned int length)
Definition: rc4.c:47
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
void rc4_init(RC4_CONTEXT *a4i, const unsigned char *key, unsigned int keyLen)
Definition: rc4.c:25
return STATUS_SUCCESS
Definition: btrfs.c:2725
Definition: path.c:42

Referenced by read_credential_blob(), and write_credential_blob().