guile: Fix `priorities' test to use `run-test'.
[gnutls.git] / lib / gnutls_pk.h
blob6c192da471aeda26343c7a2f551bafbd7ca6fc27
1 /*
2 * Copyright (C) 2000-2011 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_derive( algo, out, pub, priv) _gnutls_pk_ops.derive( algo, out, pub, priv)
34 #define _gnutls_pk_generate( algo, bits, priv) _gnutls_pk_ops.generate( algo, bits, priv)
36 inline static int
37 _gnutls_pk_fixup (gnutls_pk_algorithm_t algo, gnutls_direction_t direction,
38 gnutls_pk_params_st * params)
40 if (_gnutls_pk_ops.pk_fixup_private_params)
41 return _gnutls_pk_ops.pk_fixup_private_params (algo, direction, params);
42 return 0;
45 int _gnutls_pk_params_copy (gnutls_pk_params_st * dst, const gnutls_pk_params_st * src);
47 /* The internal PK interface */
48 int _gnutls_pkcs1_rsa_encrypt (gnutls_datum_t * ciphertext,
49 const gnutls_datum_t * plaintext,
50 gnutls_pk_params_st * params,
51 unsigned btype);
52 int _gnutls_pkcs1_rsa_decrypt (gnutls_datum_t * plaintext,
53 const gnutls_datum_t * ciphertext,
54 gnutls_pk_params_st* params,
55 unsigned btype);
56 int _gnutls_rsa_verify (const gnutls_datum_t * vdata,
57 const gnutls_datum_t * ciphertext,
58 gnutls_pk_params_st*,
59 int btype);
61 int
62 _gnutls_encode_ber_rs (gnutls_datum_t * sig_value, bigint_t r, bigint_t s);
64 int
65 _gnutls_decode_ber_rs (const gnutls_datum_t * sig_value, bigint_t * r,
66 bigint_t * s);
68 int _gnutls_calc_rsa_exp (gnutls_pk_params_st*);
70 int _gnutls_pk_get_hash_algorithm (gnutls_pk_algorithm_t pk,
71 gnutls_pk_params_st*,
72 gnutls_digest_algorithm_t * dig,
73 unsigned int *mand);
75 #endif /* GNUTLS_PK_H */