Fix.
[gnutls.git] / lib / gnutls_pk.h
blobbee5fae0e32e937c04d2ad56d6f52072c2d8d283
1 /*
2 * Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2008 Free Software Foundation
4 * Author: Nikos Mavrogiannopoulos
6 * This file is part of GNUTLS.
8 * The GNUTLS library 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 2.1 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
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
21 * USA
25 #ifndef GNUTLS_PK_H
26 # define GNUTLS_PK_H
28 extern int crypto_pk_prio;
29 extern gnutls_crypto_pk_st _gnutls_pk_ops;
31 #define _gnutls_pk_encrypt( algo, ciphertext, plaintext, params) _gnutls_pk_ops.encrypt( algo, ciphertext, plaintext, params)
32 #define _gnutls_pk_decrypt( algo, ciphertext, plaintext, params) _gnutls_pk_ops.decrypt( algo, ciphertext, plaintext, params)
33 #define _gnutls_pk_sign( algo, sig, data, params) _gnutls_pk_ops.sign( algo, sig, data, params)
34 #define _gnutls_pk_verify( algo, data, sig, params) _gnutls_pk_ops.verify( algo, data, sig, params)
36 inline static int
37 _gnutls_pk_fixup( gnutls_pk_algorithm_t algo, gnutls_direction_t direction, gnutls_pk_params_st* params)
39 if (_gnutls_pk_ops.pk_fixup_private_params) return _gnutls_pk_ops.pk_fixup_private_params(algo, direction, params);
40 return 0;
43 int _gnutls_pk_params_copy( gnutls_pk_params_st* dst, bigint_t* params, int params_len);
45 int _gnutls_rsa_generate_params (bigint_t * resarr, unsigned int *resarr_len, int bits);
46 int _gnutls_dsa_generate_params (bigint_t * resarr, unsigned int *resarr_len, int bits);
48 /* The internal PK interface */
49 int _gnutls_pkcs1_rsa_encrypt (gnutls_datum_t * ciphertext,
50 const gnutls_datum_t * plaintext,
51 bigint_t * params, unsigned params_len,
52 unsigned btype);
53 int _gnutls_dsa_sign (gnutls_datum_t * signature,
54 const gnutls_datum_t * plaintext, bigint_t * params,
55 unsigned params_len);
56 int _gnutls_pkcs1_rsa_decrypt (gnutls_datum_t * plaintext,
57 const gnutls_datum_t * ciphertext,
58 bigint_t * params, unsigned params_len,
59 unsigned btype);
60 int _gnutls_rsa_verify (const gnutls_datum_t * vdata,
61 const gnutls_datum_t * ciphertext, bigint_t * params,
62 int params_len, int btype);
63 int _gnutls_dsa_verify (const gnutls_datum_t * vdata,
64 const gnutls_datum_t * sig_value, bigint_t * params,
65 int params_len);
67 int
68 _gnutls_encode_ber_rs (gnutls_datum_t * sig_value, bigint_t r, bigint_t s);
70 int
71 _gnutls_decode_ber_rs (const gnutls_datum_t * sig_value, bigint_t * r, bigint_t * s);
73 #endif /* GNUTLS_PK_H */