Sync with TP.
[gnutls.git] / lib / gnutls_cipher_int.h
blob55abc09590af45f3f771e4d671f3c2bfd7c3e480
1 /*
2 * Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2010 Free
3 * Software Foundation, Inc.
5 * Author: Nikos Mavrogiannopoulos
7 * This file is part of GNUTLS.
9 * The GNUTLS library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public License
11 * as published by the Free Software Foundation; either version 2.1 of
12 * the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
22 * USA
26 #ifndef GNUTLS_CIPHER_INT
27 # define GNUTLS_CIPHER_INT
29 #include <gnutls/crypto.h>
31 extern int crypto_cipher_prio;
32 extern gnutls_crypto_cipher_st _gnutls_cipher_ops;
34 typedef struct {
35 const gnutls_crypto_single_cipher_st* cc;
36 void* ctx;
37 } reg_hd;
39 typedef struct {
40 int registered; /* true or false(0) */
41 union {
42 void* gc; /* when not registered */
43 reg_hd rh; /* when registered */
44 } hd;
45 } cipher_hd_st;
47 int _gnutls_cipher_init (cipher_hd_st*, gnutls_cipher_algorithm_t cipher,
48 const gnutls_datum_t * key,
49 const gnutls_datum_t * iv);
50 int _gnutls_cipher_encrypt (const cipher_hd_st *handle, void *text, int textlen);
51 int _gnutls_cipher_decrypt (const cipher_hd_st *handle, void *ciphertext,
52 int ciphertextlen);
53 void _gnutls_cipher_deinit (cipher_hd_st* handle);
55 #endif /* GNUTLS_CIPHER_INT */