ReactOS 0.4.17-dev-736-g75e91de
bcrypt_internal.h
Go to the documentation of this file.
1#ifndef __BCRYPT_INTERNAL_H
2#define __BCRYPT_INTERNAL_H
3
4#include "precomp.h"
5#ifdef SONAME_LIBMBEDTLS
6#include <mbedtls/md.h>
7#endif
8
9#define MAGIC_DSS1 ('D' | ('S' << 8) | ('S' << 16) | ('1' << 24))
10#define MAGIC_DSS2 ('D' | ('S' << 8) | ('S' << 16) | ('2' << 24))
11
12#define MAGIC_ALG (('A' << 24) | ('L' << 16) | ('G' << 8) | '0')
13#define MAGIC_HASH (('H' << 24) | ('A' << 16) | ('S' << 8) | 'H')
14#define MAGIC_KEY (('K' << 24) | ('E' << 16) | ('Y' << 8) | '0')
15#define MAGIC_SECRET (('S' << 24) | ('C' << 16) | ('R' << 8) | 'T')
16struct object
17{
19};
20
22{
23 /* cipher */
27
28 /* hash */
36
37 /* asymmetric encryption */
39
40 /* secret agreement */
44
45 /* signature */
50
51 /* rng */
53
54 /* key derivation */
56};
57
59{
65};
66
68{
69 struct object hdr;
70 enum alg_id id;
73};
74
75#define BLOCK_LENGTH_RC4 1
76#define BLOCK_LENGTH_3DES 8
77#define BLOCK_LENGTH_AES 16
78
80{
88};
89
90#define KEY_FLAG_LEGACY_DSA_V2 0x00000001
91#define KEY_FLAG_FINALIZED 0x00000002
92
94{
95 ULONG bitlen; /* ignored for ECC keys */
98};
99
100#define PRIVATE_DATA_SIZE 64
101
102struct key
103{
104 struct object hdr;
106 UINT64 private[PRIVATE_DATA_SIZE]; /* private data for backend */
107 union
108 {
111 } u;
112};
113
114struct secret
115{
116 struct object hdr;
117 struct key *privkey;
118 struct key *pubkey;
119};
120
122{
123 struct key *key;
126#ifdef SONAME_LIBMBEDTLS
127 BOOL encrypt;
128#endif
129};
130
132{
133 struct key *key;
134 const UCHAR *input;
135 unsigned input_len;
138};
139
141{
142 struct key *key;
143 const UCHAR *input;
144 unsigned input_len;
147};
148
150{
151 struct key *key;
154};
155
157{
158 struct key *key;
161 void *padding;
166};
167
169{
170 struct key *key;
173 void *padding;
178};
179
181{
182 struct key *key_orig;
183 struct key *key_copy;
184};
185
187{
188 struct key *key;
189 void *padding;
196};
197
199{
200 struct key *key;
201 void *padding;
207};
208
209#define KEY_EXPORT_FLAG_PUBLIC 0x00000001
210#define KEY_EXPORT_FLAG_RSA_FULL 0x00000002
211#define KEY_EXPORT_FLAG_DH_PARAMETERS 0x00000004
212
214{
215 struct key *key;
220};
221
222#define KEY_IMPORT_FLAG_PUBLIC 0x00000001
223#define KEY_IMPORT_FLAG_DH_PARAMETERS 0x00000002
224
226{
227 struct key *key;
231};
232
234{
235 struct key *privkey;
236 struct key *pubkey;
240};
241
242
243#define HASH_FLAG_HMAC 0x01
244#define HASH_FLAG_REUSABLE 0x02
245
246#if defined(HAVE_GNUTLS_HASH)
247struct hash
248{
249 struct object hdr;
250 enum alg_id alg_id;
251 ULONG flags;
252 UCHAR *secret;
254 union
255 {
256 gnutls_hash_hd_t hash_handle;
257 gnutls_hmac_hd_t hmac_handle;
258 } u;
259};
260#elif defined(SONAME_LIBMBEDTLS)
261struct hash
262{
263 struct object hdr;
264 enum alg_id alg_id;
265 ULONG flags;
266 UCHAR *secret;
268 mbedtls_md_context_t hash_ctx;
269};
270#else
271struct hash
272{
273 struct object hdr;
278};
279#endif
280
281extern NTSTATUS hash_init( struct hash *hash );
282extern NTSTATUS hmac_init( struct hash *hash, UCHAR *key, ULONG key_size );
285extern NTSTATUS hash_finish( struct hash *hash, UCHAR *output );
286extern NTSTATUS hmac_finish( struct hash *hash, UCHAR *output );
287extern NTSTATUS hash_get_size( struct hash *hash, ULONG *output );
288
307
308#ifndef ARRAY_SIZE
309#define ARRAY_SIZE ARRAYSIZE
310#endif
311
312#endif /* __BCRYPT_INTERNAL_H */
COMPILER_DEPENDENT_UINT64 UINT64
Definition: actypes.h:131
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS hmac_init(struct hash *hash, UCHAR *key, ULONG key_size)
NTSTATUS key_symmetric_vector_reset(void *args)
NTSTATUS key_symmetric_encrypt_internal(void *args)
NTSTATUS key_asymmetric_export(void *args)
NTSTATUS key_symmetric_set_auth_data(void *args)
#define PRIVATE_DATA_SIZE
NTSTATUS key_symmetric_get_tag(void *args)
NTSTATUS hash_update(struct hash *hash, UCHAR *input, ULONG size)
NTSTATUS key_asymmetric_encrypt(void *args)
NTSTATUS key_symmetric_destroy(void *args)
chain_mode
@ CHAIN_MODE_ECB
@ CHAIN_MODE_CCM
@ CHAIN_MODE_CBC
@ CHAIN_MODE_GCM
@ CHAIN_MODE_CFB
NTSTATUS key_symmetric_decrypt_internal(void *args)
NTSTATUS hmac_update(struct hash *hash, UCHAR *input, ULONG size)
NTSTATUS hash_get_size(struct hash *hash, ULONG *output)
NTSTATUS hash_finish(struct hash *hash, UCHAR *output)
NTSTATUS key_asymmetric_generate(void *args)
NTSTATUS key_asymmetric_destroy(void *args)
NTSTATUS process_attach(void *args)
NTSTATUS key_asymmetric_verify(void *args)
NTSTATUS key_asymmetric_derive_key(void *args)
NTSTATUS key_asymmetric_import(void *args)
NTSTATUS hash_init(struct hash *hash)
NTSTATUS key_asymmetric_sign(void *args)
NTSTATUS key_asymmetric_decrypt(void *args)
NTSTATUS key_asymmetric_duplicate(void *args)
NTSTATUS hmac_finish(struct hash *hash, UCHAR *output)
alg_id
@ ALG_ID_RSA
@ ALG_ID_DSA
@ ALG_ID_RSA_SIGN
@ ALG_ID_3DES
@ ALG_ID_ECDSA_P256
@ ALG_ID_SHA512
@ ALG_ID_PBKDF2
@ ALG_ID_ECDH_P256
@ ALG_ID_SHA384
@ ALG_ID_SHA1
@ ALG_ID_DH
@ ALG_ID_RC4
@ ALG_ID_MD2
@ ALG_ID_ECDSA_P384
@ ALG_ID_SHA256
@ ALG_ID_MD4
@ ALG_ID_ECDH_P384
@ ALG_ID_AES
@ ALG_ID_MD5
@ ALG_ID_RNG
static void process_detach(void)
Definition: main.c:94
unsigned int BOOL
Definition: ntddk_ex.h:94
GLdouble s
Definition: gl.h:2039
GLsizeiptr size
Definition: glext.h:5919
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
GLenum GLenum GLenum input
Definition: glext.h:9031
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 * u
Definition: glfuncs.h:240
This file contains the generic message-digest wrapper.
enum chain_mode mode
struct object hdr
enum alg_id id
Definition: match.c:390
struct object hdr
ULONG secret_len
enum alg_id alg_id
ULONG flags
UCHAR * secret
CRITICAL_SECTION cs
enum chain_mode mode
Definition: copy.c:22
struct object hdr
enum alg_id alg_id
union key::@316 u
ULONG magic
struct object hdr
struct key * privkey
struct key * pubkey
unsigned char UCHAR
Definition: typedefs.h:53
uint32_t ULONG
Definition: typedefs.h:59