diff options
author | Nikos <nmav@crystal.(none)> | 2008-03-16 11:17:55 +0200 |
---|---|---|
committer | Nikos <nmav@crystal.(none)> | 2008-03-16 11:17:55 +0200 |
commit | a1cd6fe1a072717d2c33fd5a20306741c86399ae (patch) | |
tree | cda9b8f8412d1e14c1864c976add689f2d7def93 /includes | |
parent | ac6bc2abdd43c0becc60f89be11adc0bc42dab00 (diff) | |
download | gnutls-a1cd6fe1a072717d2c33fd5a20306741c86399ae.tar.gz |
Added functionality to override (register) a cipher. Initial functionality for MAC and digest algorithms.
Diffstat (limited to 'includes')
-rw-r--r-- | includes/gnutls/crypto.h | 59 | ||||
-rw-r--r-- | includes/gnutls/gnutls.h.in | 1 |
2 files changed, 60 insertions, 0 deletions
diff --git a/includes/gnutls/crypto.h b/includes/gnutls/crypto.h new file mode 100644 index 0000000000..b362b9d3ec --- /dev/null +++ b/includes/gnutls/crypto.h @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2008 Free Software Foundation + * + * Author: Nikos Mavrogiannopoulos + * + * This file is part of GNUTLS. + * + * The GNUTLS library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA + * + */ + +#ifndef GNUTLS_CRYPTO_H +# define GNUTLS_CRYPTO_H + +typedef struct gnutls_crypto_cipher { + int (*init)( void** ctx); + int (*setkey)( void* ctx, const void * key, int keysize); + int (*setiv)(void* ctx, const void* iv, int ivsize); + int (*encrypt)(void* ctx, const void* plain, int plainsize, void* encr, int encrsize); + int (*decrypt)(void* ctx, const void* encr, int encrsize, void* plain, int plainsize); + void (*deinit)( void* ctx); +} gnutls_crypto_cipher_st; + +typedef struct gnutls_crypto_mac { + int (*init)( void** ctx); + int (*mac)( void* ctx, const void * text, int textsize); + int (*copy)( void* src_ctx, void* dst_ctx); + int (*output) ( void* src_ctx, void* digest, int digestsize); + void (*deinit)( void* ctx); +} gnutls_crypto_mac_st; + +typedef struct gnutls_crypto_digest { + int (*init)( void** ctx); + int (*digest)( void* ctx, const void * text, int textsize); + int (*copy)( void* src_ctx, void* dst_ctx); + int (*output) ( void* src_ctx, void* digest, int digestsize); + void (*deinit)( void* ctx); +} gnutls_crypto_digest_st; + +/* priority: infinity for backend algorithms, 90 for kernel algorithms - lowest wins + */ +int gnutls_crypto_cipher_register( gnutls_cipher_algorithm_t algorithm, int priority, gnutls_crypto_cipher_st* s); +int gnutls_crypto_mac_register( gnutls_mac_algorithm_t algorithm, int priority, gnutls_crypto_mac_st* s); +int gnutls_crypto_digest_register( gnutls_digest_algorithm_t algorithm, int priority, gnutls_crypto_digest_st* s); + +#endif diff --git a/includes/gnutls/gnutls.h.in b/includes/gnutls/gnutls.h.in index 5ce8f35f93..0292ab7cc0 100644 --- a/includes/gnutls/gnutls.h.in +++ b/includes/gnutls/gnutls.h.in @@ -1301,6 +1301,7 @@ extern "C" #define GNUTLS_E_OPENPGP_SUBKEY_ERROR -208 +#define GNUTLS_E_CRYPTO_ALREADY_REGISTERED -209 #define GNUTLS_E_UNIMPLEMENTED_FEATURE -1250 |