corosync  2.3.6
totemcrypto.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2006-2012 Red Hat, Inc.
3  *
4  * All rights reserved.
5  *
6  * Author: Steven Dake (sdake@redhat.com)
7  * Christine Caulfield (ccaulfie@redhat.com)
8  * Jan Friesse (jfriesse@redhat.com)
9  *
10  * This software licensed under BSD license, the text of which follows:
11  *
12  * Redistribution and use in source and binary forms, with or without
13  * modification, are permitted provided that the following conditions are met:
14  *
15  * - Redistributions of source code must retain the above copyright notice,
16  * this list of conditions and the following disclaimer.
17  * - Redistributions in binary form must reproduce the above copyright notice,
18  * this list of conditions and the following disclaimer in the documentation
19  * and/or other materials provided with the distribution.
20  * - Neither the name of the MontaVista Software, Inc. nor the names of its
21  * contributors may be used to endorse or promote products derived from this
22  * software without specific prior written permission.
23  *
24  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
28  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
34  * THE POSSIBILITY OF SUCH DAMAGE.
35  */
36 #ifndef TOTEMCRYPTO_H_DEFINED
37 #define TOTEMCRYPTO_H_DEFINED
38 
39 #include <sys/types.h>
40 
41 struct crypto_instance;
42 
43 extern size_t crypto_sec_header_size(
44  const char *crypto_cipher_type,
45  const char *crypto_hash_type);
46 
48  struct crypto_instance *instance,
49  unsigned char *buf,
50  int *buf_len);
51 
52 extern int crypto_encrypt_and_sign (
53  struct crypto_instance *instance,
54  const unsigned char *buf_in,
55  const size_t buf_in_len,
56  unsigned char *buf_out,
57  size_t *buf_out_len);
58 
59 extern struct crypto_instance *crypto_init(
60  const unsigned char *private_key,
61  unsigned int private_key_len,
62  const char *crypto_cipher_type,
63  const char *crypto_hash_type,
64  void (*log_printf_func) (
65  int level,
66  int subsys,
67  const char *function,
68  const char *file,
69  int line,
70  const char *format,
71  ...)__attribute__((format(printf, 6, 7))),
73  int log_level_notice,
74  int log_level_error,
75  int log_subsys_id);
76 
77 #endif /* TOTEMCRYPTO_H_DEFINED */
unsigned char private_key[1024]
Definition: totemcrypto.c:176
int crypto_encrypt_and_sign(struct crypto_instance *instance, const unsigned char *buf_in, const size_t buf_in_len, unsigned char *buf_out, size_t *buf_out_len)
Definition: totemcrypto.c:711
void(*) in log_level_security)
Definition: totemcrypto.c:193
struct crypto_instance * crypto_init(const unsigned char *private_key, unsigned int private_key_len, const char *crypto_cipher_type, const char *crypto_hash_type, void(*log_printf_func)(int level, int subsys, const char *function, const char *file, int line, const char *format,...) __attribute__((format(printf, 6, 7))), int log_level_security, int log_level_notice, int log_level_error, int log_subsys_id)
Definition: totemcrypto.c:786
uint8_t crypto_cipher_type
Definition: totemcrypto.c:64
typedef __attribute__
uint8_t crypto_hash_type
Definition: totemcrypto.c:65
unsigned int private_key_len
Definition: totemcrypto.c:178
void(* log_printf_func)(int level, int subsys, const char *function, const char *file, int line, const char *format,...) __attribute__((format(printf
Definition: totemcrypto.c:186
size_t crypto_sec_header_size(const char *crypto_cipher_type, const char *crypto_hash_type)
Definition: totemcrypto.c:662
int crypto_authenticate_and_decrypt(struct crypto_instance *instance, unsigned char *buf, int *buf_len)
Definition: totemcrypto.c:733