ia64/xen-unstable

view tools/vtpm_manager/crypto/sym_crypto.h @ 8977:f84d5cdd9895

Clean up segment selector fixup and validation.

Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Thu Feb 23 14:43:45 2006 +0100 (2006-02-23)
parents 06d84bf87159
children
line source
1 // ===================================================================
2 //
3 // Copyright (c) 2005, Intel Corp.
4 // All rights reserved.
5 //
6 // Redistribution and use in source and binary forms, with or without
7 // modification, are permitted provided that the following conditions
8 // are met:
9 //
10 // * Redistributions of source code must retain the above copyright
11 // notice, this list of conditions and the following disclaimer.
12 // * Redistributions in binary form must reproduce the above
13 // copyright notice, this list of conditions and the following
14 // disclaimer in the documentation and/or other materials provided
15 // with the distribution.
16 // * Neither the name of Intel Corporation nor the names of its
17 // contributors may be used to endorse or promote products derived
18 // from this software without specific prior written permission.
19 //
20 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23 // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24 // COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25 // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26 // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27 // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
29 // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
31 // OF THE POSSIBILITY OF SUCH DAMAGE.
32 // ===================================================================
33 //
34 // sym_crypto.h
35 //
36 // Symmetric Crypto
37 //
38 // ==================================================================
40 #ifndef _SYM_CRYPTO_H
41 #define _SYM_CRYPTO_H
43 #include <openssl/evp.h>
44 #include "buffer.h"
46 typedef struct symkey_t {
47 buffer_t key;
49 EVP_CIPHER_CTX context;
50 const EVP_CIPHER * cipher;
51 } symkey_t;
53 extern const EVP_CIPHER * SYM_CIPHER;
55 TPM_RESULT Crypto_symcrypto_genkey (symkey_t * key);
57 TPM_RESULT Crypto_symcrypto_initkey (symkey_t * key, const buffer_t* keybits);
60 // these functions will allocate their output buffers
61 TPM_RESULT Crypto_symcrypto_encrypt (symkey_t* key,
62 const buffer_t* clear,
63 buffer_t* o_cipher);
65 TPM_RESULT Crypto_symcrypto_decrypt (symkey_t* key,
66 const buffer_t* cipher,
67 buffer_t* o_clear);
69 // only free the internal parts, not the 'key' ptr
70 TPM_RESULT Crypto_symcrypto_freekey (symkey_t * key);
72 #endif /* _SYM_CRYPTO_H */