gnutls-cli: Fix uninitialized variable when PKCS#11 uris in use.
[gnutls.git] / lib / gnutls_pk.h
blobf9b5174d56957528e1af0ff2a3d526d676147e7f
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 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_PK_H
27 #define GNUTLS_PK_H
29 extern int crypto_pk_prio;
30 extern gnutls_crypto_pk_st _gnutls_pk_ops;
32 #define _gnutls_pk_encrypt( algo, ciphertext, plaintext, params) _gnutls_pk_ops.encrypt( algo, ciphertext, plaintext, params)
33 #define _gnutls_pk_decrypt( algo, ciphertext, plaintext, params) _gnutls_pk_ops.decrypt( algo, ciphertext, plaintext, params)
34 #define _gnutls_pk_sign( algo, sig, data, params) _gnutls_pk_ops.sign( algo, sig, data, params)
35 #define _gnutls_pk_verify( algo, data, sig, params) _gnutls_pk_ops.verify( algo, data, sig, params)
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, bigint_t * params,
47 int params_len);
49 int _gnutls_rsa_generate_params (bigint_t * resarr, unsigned int *resarr_len,
50 int bits);
51 int _gnutls_dsa_generate_params (bigint_t * resarr, unsigned int *resarr_len,
52 int bits);
54 /* The internal PK interface */
55 int _gnutls_pkcs1_rsa_encrypt (gnutls_datum_t * ciphertext,
56 const gnutls_datum_t * plaintext,
57 bigint_t * params, unsigned params_len,
58 unsigned btype);
59 int _gnutls_dsa_sign (gnutls_datum_t * signature,
60 const gnutls_datum_t * plaintext, bigint_t * params,
61 unsigned params_len);
62 int _gnutls_pkcs1_rsa_decrypt (gnutls_datum_t * plaintext,
63 const gnutls_datum_t * ciphertext,
64 bigint_t * params, unsigned params_len,
65 unsigned btype);
66 int _gnutls_rsa_verify (const gnutls_datum_t * vdata,
67 const gnutls_datum_t * ciphertext, bigint_t * params,
68 int params_len, int btype);
69 int _gnutls_dsa_verify (const gnutls_datum_t * vdata,
70 const gnutls_datum_t * sig_value, bigint_t * params,
71 int params_len);
73 int
74 _gnutls_encode_ber_rs (gnutls_datum_t * sig_value, bigint_t r, bigint_t s);
76 int
77 _gnutls_decode_ber_rs (const gnutls_datum_t * sig_value, bigint_t * r,
78 bigint_t * s);
80 int _gnutls_calc_rsa_exp (bigint_t * params, unsigned int params_size);
82 int _gnutls_pk_get_hash_algorithm (gnutls_pk_algorithm_t pk,
83 bigint_t * params, int params_size,
84 gnutls_digest_algorithm_t * dig,
85 unsigned int *mand);
87 #endif /* GNUTLS_PK_H */