Project

General

Profile

Statistics
| Revision:

root / lab4 / .minix-src / include / openssl / modes.h @ 14

History | View | Annotate | Download (7.65 KB)

1 13 up20180614
/* ====================================================================
2
 * Copyright (c) 2008 The OpenSSL Project. All rights reserved.
3
 *
4
 * Rights for redistribution and usage in source and binary
5
 * forms are granted according to the OpenSSL license.
6
 */
7
8
#include <stddef.h>
9
10
#ifdef  __cplusplus
11
extern "C" {
12
#endif
13
typedef void (*block128_f) (const unsigned char in[16],
14
                            unsigned char out[16], const void *key);
15
16
typedef void (*cbc128_f) (const unsigned char *in, unsigned char *out,
17
                          size_t len, const void *key,
18
                          unsigned char ivec[16], int enc);
19
20
typedef void (*ctr128_f) (const unsigned char *in, unsigned char *out,
21
                          size_t blocks, const void *key,
22
                          const unsigned char ivec[16]);
23
24
typedef void (*ccm128_f) (const unsigned char *in, unsigned char *out,
25
                          size_t blocks, const void *key,
26
                          const unsigned char ivec[16],
27
                          unsigned char cmac[16]);
28
29
void CRYPTO_cbc128_encrypt(const unsigned char *in, unsigned char *out,
30
                           size_t len, const void *key,
31
                           unsigned char ivec[16], block128_f block);
32
void CRYPTO_cbc128_decrypt(const unsigned char *in, unsigned char *out,
33
                           size_t len, const void *key,
34
                           unsigned char ivec[16], block128_f block);
35
36
void CRYPTO_ctr128_encrypt(const unsigned char *in, unsigned char *out,
37
                           size_t len, const void *key,
38
                           unsigned char ivec[16],
39
                           unsigned char ecount_buf[16], unsigned int *num,
40
                           block128_f block);
41
42
void CRYPTO_ctr128_encrypt_ctr32(const unsigned char *in, unsigned char *out,
43
                                 size_t len, const void *key,
44
                                 unsigned char ivec[16],
45
                                 unsigned char ecount_buf[16],
46
                                 unsigned int *num, ctr128_f ctr);
47
48
void CRYPTO_ofb128_encrypt(const unsigned char *in, unsigned char *out,
49
                           size_t len, const void *key,
50
                           unsigned char ivec[16], int *num,
51
                           block128_f block);
52
53
void CRYPTO_cfb128_encrypt(const unsigned char *in, unsigned char *out,
54
                           size_t len, const void *key,
55
                           unsigned char ivec[16], int *num,
56
                           int enc, block128_f block);
57
void CRYPTO_cfb128_8_encrypt(const unsigned char *in, unsigned char *out,
58
                             size_t length, const void *key,
59
                             unsigned char ivec[16], int *num,
60
                             int enc, block128_f block);
61
void CRYPTO_cfb128_1_encrypt(const unsigned char *in, unsigned char *out,
62
                             size_t bits, const void *key,
63
                             unsigned char ivec[16], int *num,
64
                             int enc, block128_f block);
65
66
size_t CRYPTO_cts128_encrypt_block(const unsigned char *in,
67
                                   unsigned char *out, size_t len,
68
                                   const void *key, unsigned char ivec[16],
69
                                   block128_f block);
70
size_t CRYPTO_cts128_encrypt(const unsigned char *in, unsigned char *out,
71
                             size_t len, const void *key,
72
                             unsigned char ivec[16], cbc128_f cbc);
73
size_t CRYPTO_cts128_decrypt_block(const unsigned char *in,
74
                                   unsigned char *out, size_t len,
75
                                   const void *key, unsigned char ivec[16],
76
                                   block128_f block);
77
size_t CRYPTO_cts128_decrypt(const unsigned char *in, unsigned char *out,
78
                             size_t len, const void *key,
79
                             unsigned char ivec[16], cbc128_f cbc);
80
81
size_t CRYPTO_nistcts128_encrypt_block(const unsigned char *in,
82
                                       unsigned char *out, size_t len,
83
                                       const void *key,
84
                                       unsigned char ivec[16],
85
                                       block128_f block);
86
size_t CRYPTO_nistcts128_encrypt(const unsigned char *in, unsigned char *out,
87
                                 size_t len, const void *key,
88
                                 unsigned char ivec[16], cbc128_f cbc);
89
size_t CRYPTO_nistcts128_decrypt_block(const unsigned char *in,
90
                                       unsigned char *out, size_t len,
91
                                       const void *key,
92
                                       unsigned char ivec[16],
93
                                       block128_f block);
94
size_t CRYPTO_nistcts128_decrypt(const unsigned char *in, unsigned char *out,
95
                                 size_t len, const void *key,
96
                                 unsigned char ivec[16], cbc128_f cbc);
97
98
typedef struct gcm128_context GCM128_CONTEXT;
99
100
GCM128_CONTEXT *CRYPTO_gcm128_new(void *key, block128_f block);
101
void CRYPTO_gcm128_init(GCM128_CONTEXT *ctx, void *key, block128_f block);
102
void CRYPTO_gcm128_setiv(GCM128_CONTEXT *ctx, const unsigned char *iv,
103
                         size_t len);
104
int CRYPTO_gcm128_aad(GCM128_CONTEXT *ctx, const unsigned char *aad,
105
                      size_t len);
106
int CRYPTO_gcm128_encrypt(GCM128_CONTEXT *ctx,
107
                          const unsigned char *in, unsigned char *out,
108
                          size_t len);
109
int CRYPTO_gcm128_decrypt(GCM128_CONTEXT *ctx,
110
                          const unsigned char *in, unsigned char *out,
111
                          size_t len);
112
int CRYPTO_gcm128_encrypt_ctr32(GCM128_CONTEXT *ctx,
113
                                const unsigned char *in, unsigned char *out,
114
                                size_t len, ctr128_f stream);
115
int CRYPTO_gcm128_decrypt_ctr32(GCM128_CONTEXT *ctx,
116
                                const unsigned char *in, unsigned char *out,
117
                                size_t len, ctr128_f stream);
118
int CRYPTO_gcm128_finish(GCM128_CONTEXT *ctx, const unsigned char *tag,
119
                         size_t len);
120
void CRYPTO_gcm128_tag(GCM128_CONTEXT *ctx, unsigned char *tag, size_t len);
121
void CRYPTO_gcm128_release(GCM128_CONTEXT *ctx);
122
123
typedef struct ccm128_context CCM128_CONTEXT;
124
125
void CRYPTO_ccm128_init(CCM128_CONTEXT *ctx,
126
                        unsigned int M, unsigned int L, void *key,
127
                        block128_f block);
128
int CRYPTO_ccm128_setiv(CCM128_CONTEXT *ctx, const unsigned char *nonce,
129
                        size_t nlen, size_t mlen);
130
void CRYPTO_ccm128_aad(CCM128_CONTEXT *ctx, const unsigned char *aad,
131
                       size_t alen);
132
int CRYPTO_ccm128_encrypt(CCM128_CONTEXT *ctx, const unsigned char *inp,
133
                          unsigned char *out, size_t len);
134
int CRYPTO_ccm128_decrypt(CCM128_CONTEXT *ctx, const unsigned char *inp,
135
                          unsigned char *out, size_t len);
136
int CRYPTO_ccm128_encrypt_ccm64(CCM128_CONTEXT *ctx, const unsigned char *inp,
137
                                unsigned char *out, size_t len,
138
                                ccm128_f stream);
139
int CRYPTO_ccm128_decrypt_ccm64(CCM128_CONTEXT *ctx, const unsigned char *inp,
140
                                unsigned char *out, size_t len,
141
                                ccm128_f stream);
142
size_t CRYPTO_ccm128_tag(CCM128_CONTEXT *ctx, unsigned char *tag, size_t len);
143
144
typedef struct xts128_context XTS128_CONTEXT;
145
146
int CRYPTO_xts128_encrypt(const XTS128_CONTEXT *ctx,
147
                          const unsigned char iv[16],
148
                          const unsigned char *inp, unsigned char *out,
149
                          size_t len, int enc);
150
151
#ifdef  __cplusplus
152
}
153
#endif