OpenSSL  1.0.1c
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros
modes.h
Go to the documentation of this file.
1 /* ====================================================================
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 typedef void (*block128_f)(const unsigned char in[16],
11  unsigned char out[16],
12  const void *key);
13 
14 typedef void (*cbc128_f)(const unsigned char *in, unsigned char *out,
15  size_t len, const void *key,
16  unsigned char ivec[16], int enc);
17 
18 typedef void (*ctr128_f)(const unsigned char *in, unsigned char *out,
19  size_t blocks, const void *key,
20  const unsigned char ivec[16]);
21 
22 typedef void (*ccm128_f)(const unsigned char *in, unsigned char *out,
23  size_t blocks, const void *key,
24  const unsigned char ivec[16],unsigned char cmac[16]);
25 
26 void CRYPTO_cbc128_encrypt(const unsigned char *in, unsigned char *out,
27  size_t len, const void *key,
28  unsigned char ivec[16], block128_f block);
29 void CRYPTO_cbc128_decrypt(const unsigned char *in, unsigned char *out,
30  size_t len, const void *key,
31  unsigned char ivec[16], block128_f block);
32 
33 void CRYPTO_ctr128_encrypt(const unsigned char *in, unsigned char *out,
34  size_t len, const void *key,
35  unsigned char ivec[16], unsigned char ecount_buf[16],
36  unsigned int *num, block128_f block);
37 
38 void CRYPTO_ctr128_encrypt_ctr32(const unsigned char *in, unsigned char *out,
39  size_t len, const void *key,
40  unsigned char ivec[16], unsigned char ecount_buf[16],
41  unsigned int *num, ctr128_f ctr);
42 
43 void CRYPTO_ofb128_encrypt(const unsigned char *in, unsigned char *out,
44  size_t len, const void *key,
45  unsigned char ivec[16], int *num,
46  block128_f block);
47 
48 void CRYPTO_cfb128_encrypt(const unsigned char *in, unsigned char *out,
49  size_t len, const void *key,
50  unsigned char ivec[16], int *num,
51  int enc, block128_f block);
52 void CRYPTO_cfb128_8_encrypt(const unsigned char *in, unsigned char *out,
53  size_t length, const void *key,
54  unsigned char ivec[16], int *num,
55  int enc, block128_f block);
56 void CRYPTO_cfb128_1_encrypt(const unsigned char *in, unsigned char *out,
57  size_t bits, const void *key,
58  unsigned char ivec[16], int *num,
59  int enc, block128_f block);
60 
61 size_t CRYPTO_cts128_encrypt_block(const unsigned char *in, unsigned char *out,
62  size_t len, const void *key,
63  unsigned char ivec[16], block128_f block);
64 size_t CRYPTO_cts128_encrypt(const unsigned char *in, unsigned char *out,
65  size_t len, const void *key,
66  unsigned char ivec[16], cbc128_f cbc);
67 size_t CRYPTO_cts128_decrypt_block(const unsigned char *in, unsigned char *out,
68  size_t len, const void *key,
69  unsigned char ivec[16], block128_f block);
70 size_t CRYPTO_cts128_decrypt(const unsigned char *in, unsigned char *out,
71  size_t len, const void *key,
72  unsigned char ivec[16], cbc128_f cbc);
73 
74 size_t CRYPTO_nistcts128_encrypt_block(const unsigned char *in, unsigned char *out,
75  size_t len, const void *key,
76  unsigned char ivec[16], block128_f block);
77 size_t CRYPTO_nistcts128_encrypt(const unsigned char *in, unsigned char *out,
78  size_t len, const void *key,
79  unsigned char ivec[16], cbc128_f cbc);
80 size_t CRYPTO_nistcts128_decrypt_block(const unsigned char *in, unsigned char *out,
81  size_t len, const void *key,
82  unsigned char ivec[16], block128_f block);
83 size_t CRYPTO_nistcts128_decrypt(const unsigned char *in, unsigned char *out,
84  size_t len, const void *key,
85  unsigned char ivec[16], cbc128_f cbc);
86 
88 
91 void CRYPTO_gcm128_setiv(GCM128_CONTEXT *ctx, const unsigned char *iv,
92  size_t len);
93 int CRYPTO_gcm128_aad(GCM128_CONTEXT *ctx, const unsigned char *aad,
94  size_t len);
96  const unsigned char *in, unsigned char *out,
97  size_t len);
99  const unsigned char *in, unsigned char *out,
100  size_t len);
102  const unsigned char *in, unsigned char *out,
103  size_t len, ctr128_f stream);
105  const unsigned char *in, unsigned char *out,
106  size_t len, ctr128_f stream);
107 int CRYPTO_gcm128_finish(GCM128_CONTEXT *ctx,const unsigned char *tag,
108  size_t len);
109 void CRYPTO_gcm128_tag(GCM128_CONTEXT *ctx, unsigned char *tag, size_t len);
111 
113 
115  unsigned int M, unsigned int L, void *key,block128_f block);
117  const unsigned char *nonce, size_t nlen, size_t mlen);
119  const unsigned char *aad, size_t alen);
121  const unsigned char *inp, unsigned char *out, size_t len);
123  const unsigned char *inp, unsigned char *out, size_t len);
125  const unsigned char *inp, unsigned char *out, size_t len,
126  ccm128_f stream);
128  const unsigned char *inp, unsigned char *out, size_t len,
129  ccm128_f stream);
130 size_t CRYPTO_ccm128_tag(CCM128_CONTEXT *ctx, unsigned char *tag, size_t len);
131 
133 
134 int CRYPTO_xts128_encrypt(const XTS128_CONTEXT *ctx, const unsigned char iv[16],
135  const unsigned char *inp, unsigned char *out, size_t len, int enc);