]> git.saurik.com Git - apple/security.git/blob - libsecurity_apple_csp/lib/ascContext.h
Security-55179.13.tar.gz
[apple/security.git] / libsecurity_apple_csp / lib / ascContext.h
1 /*
2 * ascContext.h - glue between BlockCrytpor and ComCryption (a.k.a. Apple
3 * Secure Compression).
4 * Written by Doug Mitchell 4/4/2001
5 */
6
7 #ifdef ASC_CSP_ENABLE
8
9 #ifndef _ASC_CONTEXT_H_
10 #define _ASC_CONTEXT_H_
11
12 #include "AppleCSPContext.h"
13 #include <CoreServices/../Frameworks/CarbonCore.framework/Headers/MacTypes.h>
14 #include <security_comcryption/comcryption.h>
15
16 /* symmetric encrypt/decrypt context */
17 class ASCContext : public AppleCSPContext {
18 public:
19 ASCContext(AppleCSPSession &session) :
20 AppleCSPContext(session),
21 mCcObj(NULL) { }
22 ~ASCContext();
23
24 // called by CSPFullPluginSession
25 void init(
26 const Context &context,
27 bool encoding = true);
28 void update(
29 void *inp,
30 size_t &inSize, // in/out
31 void *outp,
32 size_t &outSize); // in/out
33 void final(
34 CssmData &out);
35
36 size_t inputSize(
37 size_t outSize); // input for given output size
38 size_t outputSize(
39 bool final = false,
40 size_t inSize = 0); // output for given input size
41 void minimumProgress(
42 size_t &in,
43 size_t &out); // minimum progress chunks
44
45 private:
46 comcryptObj mCcObj;
47
48 /*
49 * For first implementation, we have to cope with the fact that the final
50 * decrypt call down to the comcryption engine requires *some* ciphertext.
51 * On decrypt, we'll just save one byte on each update in preparation for
52 * the final call. Hopefull we'll have time to fix deComcryptData() so this
53 * is unneccesary.
54 */
55 unsigned char mDecryptBuf;
56 bool mDecryptBufValid;
57
58 }; /* RC4Context */
59
60 #endif /*_ASC_CONTEXT_H_ */
61 #endif /* ASC_CSP_ENABLE */