updated makefiles
[gnutls.git] / lib / gnutls_pk.h
blob189c61c33382cc86fe549898bf13a8c75b567c4b
1 /*
2 * Copyright (C) 2000-2012 Free Software Foundation, Inc.
4 * Author: Nikos Mavrogiannopoulos
6 * This file is part of GnuTLS.
8 * The GnuTLS is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public License
10 * as published by the Free Software Foundation; either version 3 of
11 * the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>
23 #ifndef GNUTLS_PK_H
24 #define GNUTLS_PK_H
26 extern int crypto_pk_prio;
27 extern gnutls_crypto_pk_st _gnutls_pk_ops;
29 #define _gnutls_pk_encrypt( algo, ciphertext, plaintext, params) _gnutls_pk_ops.encrypt( algo, ciphertext, plaintext, params)
30 #define _gnutls_pk_decrypt( algo, ciphertext, plaintext, params) _gnutls_pk_ops.decrypt( algo, ciphertext, plaintext, params)
31 #define _gnutls_pk_sign( algo, sig, data, params) _gnutls_pk_ops.sign( algo, sig, data, params)
32 #define _gnutls_pk_verify( algo, data, sig, params) _gnutls_pk_ops.verify( algo, data, sig, params)
33 #define _gnutls_pk_verify_params( algo, params) _gnutls_pk_ops.verify_params( algo, params)
34 #define _gnutls_pk_derive( algo, out, pub, priv) _gnutls_pk_ops.derive( algo, out, pub, priv)
35 #define _gnutls_pk_generate( algo, bits, priv) _gnutls_pk_ops.generate( algo, bits, priv)
37 inline static int
38 _gnutls_pk_fixup (gnutls_pk_algorithm_t algo, gnutls_direction_t direction,
39 gnutls_pk_params_st * params)
41 if (_gnutls_pk_ops.pk_fixup_private_params)
42 return _gnutls_pk_ops.pk_fixup_private_params (algo, direction, params);
43 return 0;
46 int _gnutls_pk_params_copy (gnutls_pk_params_st * dst, const gnutls_pk_params_st * src);
48 /* The internal PK interface */
49 int _gnutls_pkcs1_rsa_encrypt (gnutls_datum_t * ciphertext,
50 const gnutls_datum_t * plaintext,
51 gnutls_pk_params_st * params,
52 unsigned btype);
53 int _gnutls_pkcs1_rsa_decrypt (gnutls_datum_t * plaintext,
54 const gnutls_datum_t * ciphertext,
55 gnutls_pk_params_st* params,
56 unsigned btype);
57 int _gnutls_rsa_verify (const gnutls_datum_t * vdata,
58 const gnutls_datum_t * ciphertext,
59 gnutls_pk_params_st*,
60 int btype);
62 int
63 _gnutls_encode_ber_rs (gnutls_datum_t * sig_value, bigint_t r, bigint_t s);
65 int
66 _gnutls_decode_ber_rs (const gnutls_datum_t * sig_value, bigint_t * r,
67 bigint_t * s);
69 int _gnutls_pk_get_hash_algorithm (gnutls_pk_algorithm_t pk,
70 gnutls_pk_params_st*,
71 gnutls_digest_algorithm_t * dig,
72 unsigned int *mand);
74 #endif /* GNUTLS_PK_H */