xref: /xnu-11215.41.3/EXTERNAL_HEADERS/corecrypto/ccmode_factory.h (revision 33de042d024d46de5ff4e89f2471de6608e37fa4)
1 /* Copyright (c) (2011,2012,2013,2014,2015,2016,2017,2018,2019) Apple Inc. All rights reserved.
2  *
3  * corecrypto is licensed under Apple Inc.’s Internal Use License Agreement (which
4  * is contained in the License.txt file distributed with corecrypto) and only to
5  * people who accept that license. IMPORTANT:  Any license rights granted to you by
6  * Apple Inc. (if any) are limited to internal use within your organization only on
7  * devices and computers you own or control, for the sole purpose of verifying the
8  * security characteristics and correct functioning of the Apple Software.  You may
9  * not, directly or indirectly, redistribute the Apple Software or any portions thereof.
10  */
11 
12 #ifndef _CORECRYPTO_CCMODE_FACTORY_H_
13 #define _CORECRYPTO_CCMODE_FACTORY_H_
14 
15 #include <corecrypto/ccn.h>
16 #include <corecrypto/ccmode_impl.h>
17 
18 /* Functions defined in this file are only to be used
19  within corecrypto files.
20  */
21 
22 /* Use these function to runtime initialize a ccmode_cbc decrypt object (for
23  example if it's part of a larger structure). Normally you would pass a
24  ecb decrypt mode implementation of some underlying algorithm as the ecb
25  parameter. */
26 void ccmode_factory_cbc_decrypt(struct ccmode_cbc *cbc,
27                                 const struct ccmode_ecb *ecb);
28 
29 /* Use these function to runtime initialize a ccmode_cbc encrypt object (for
30  example if it's part of a larger structure). Normally you would pass a
31  ecb encrypt mode implementation of some underlying algorithm as the ecb
32  parameter. */
33 void ccmode_factory_cbc_encrypt(struct ccmode_cbc *cbc,
34                                 const struct ccmode_ecb *ecb);
35 
36 
37 /* Use these function to runtime initialize a ccmode_cfb decrypt object (for
38  example if it's part of a larger structure). Normally you would pass a
39  ecb encrypt mode implementation of some underlying algorithm as the ecb
40  parameter. */
41 void ccmode_factory_cfb_decrypt(struct ccmode_cfb *cfb,
42                                 const struct ccmode_ecb *ecb);
43 
44 /* Use these function to runtime initialize a ccmode_cfb encrypt object (for
45  example if it's part of a larger structure). Normally you would pass a
46  ecb encrypt mode implementation of some underlying algorithm as the ecb
47  parameter. */
48 void ccmode_factory_cfb_encrypt(struct ccmode_cfb *cfb,
49                                 const struct ccmode_ecb *ecb);
50 
51 /* Use these function to runtime initialize a ccmode_cfb8 decrypt object (for
52  example if it's part of a larger structure). Normally you would pass a
53  ecb decrypt mode implementation of some underlying algorithm as the ecb
54  parameter. */
55 void ccmode_factory_cfb8_decrypt(struct ccmode_cfb8 *cfb8,
56                                  const struct ccmode_ecb *ecb);
57 
58 /* Use these function to runtime initialize a ccmode_cfb8 encrypt object (for
59  example if it's part of a larger structure). Normally you would pass a
60  ecb encrypt mode implementation of some underlying algorithm as the ecb
61  parameter. */
62 void ccmode_factory_cfb8_encrypt(struct ccmode_cfb8 *cfb8,
63                                  const struct ccmode_ecb *ecb);
64 
65 /* Use these function to runtime initialize a ccmode_ctr decrypt object (for
66  example if it's part of a larger structure). Normally you would pass a
67  ecb encrypt mode implementation of some underlying algorithm as the ecb
68  parameter. */
69 void ccmode_factory_ctr_crypt(struct ccmode_ctr *ctr,
70                               const struct ccmode_ecb *ecb);
71 
72 /* Use these function to runtime initialize a ccmode_gcm decrypt object (for
73  example if it's part of a larger structure). For GCM you always pass a
74  ecb encrypt mode implementation of some underlying algorithm as the ecb
75  parameter. */
76 void ccmode_factory_gcm_decrypt(struct ccmode_gcm *gcm,
77                                 const struct ccmode_ecb *ecb_encrypt);
78 
79 /* Use these function to runtime initialize a ccmode_gcm encrypt object (for
80  example if it's part of a larger structure). For GCM you always pass a
81  ecb encrypt mode implementation of some underlying algorithm as the ecb
82  parameter. */
83 void ccmode_factory_gcm_encrypt(struct ccmode_gcm *gcm,
84                                 const struct ccmode_ecb *ecb_encrypt);
85 
86 /* Use these function to runtime initialize a ccmode_ccm decrypt object (for
87  example if it's part of a larger structure). For CCM you always pass a
88  ecb encrypt mode implementation of some underlying algorithm as the ecb
89  parameter. */
90 
91 void ccmode_factory_ccm_decrypt(struct ccmode_ccm *ccm,
92                                 const struct ccmode_ecb *ecb_encrypt);
93 
94 /* Use these function to runtime initialize a ccmode_ccm encrypt object (for
95  example if it's part of a larger structure). For CCM you always pass a
96  ecb encrypt mode implementation of some underlying algorithm as the ecb
97  parameter. */
98 void ccmode_factory_ccm_encrypt(struct ccmode_ccm *ccm,
99                                 const struct ccmode_ecb *ecb_encrypt);
100 
101 /* Use these function to runtime initialize a ccmode_ofb encrypt object (for
102  example if it's part of a larger structure). Normally you would pass a
103  ecb encrypt mode implementation of some underlying algorithm as the ecb
104  parameter. */
105 void ccmode_factory_ofb_crypt(struct ccmode_ofb *ofb,
106                               const struct ccmode_ecb *ecb);
107 
108 /* Use these function to runtime initialize a ccmode_omac decrypt object (for
109  example if it's part of a larger structure). Normally you would pass a
110  ecb decrypt mode implementation of some underlying algorithm as the ecb
111  parameter. */
112 void ccmode_factory_omac_decrypt(struct ccmode_omac *omac,
113                                  const struct ccmode_ecb *ecb);
114 
115 /* Use these function to runtime initialize a ccmode_omac encrypt object (for
116  example if it's part of a larger structure). Normally you would pass a
117  ecb encrypt mode implementation of some underlying algorithm as the ecb
118  parameter. */
119 void ccmode_factory_omac_encrypt(struct ccmode_omac *omac,
120                                  const struct ccmode_ecb *ecb);
121 
122 /* Use these function to runtime initialize a ccmode_xts decrypt object (for
123  example if it's part of a larger structure). Normally you would pass a
124  ecb decrypt mode implementation of some underlying algorithm as the ecb
125  parameter. */
126 void ccmode_factory_xts_decrypt(struct ccmode_xts *xts,
127                                 const struct ccmode_ecb *ecb,
128                                 const struct ccmode_ecb *ecb_encrypt);
129 
130 /* Use these function to runtime initialize a ccmode_xts encrypt object (for
131  example if it's part of a larger structure). Normally you would pass a
132  ecb encrypt mode implementation of some underlying algorithm as the ecb
133  parameter. */
134 void ccmode_factory_xts_encrypt(struct ccmode_xts *xts,
135                                 const struct ccmode_ecb *ecb,
136                                 const struct ccmode_ecb *ecb_encrypt);
137 
138 #endif /* _CORECRYPTO_CCMODE_FACTORY_H_ */
139