Use hash-pjw-bare instead of asn1_bhash().
[gnutls.git] / lib / abstract_int.h
blob9b1de33fe6c202acda8224be6baba19b03b9529b
1 /*
2 * Copyright (C) 2010-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 _ABSTRACT_INT_H
24 # define _ABSTRACT_INT_H
26 #include <gnutls/abstract.h>
28 struct gnutls_privkey_st
30 gnutls_privkey_type_t type;
31 gnutls_pk_algorithm_t pk_algorithm;
33 union
35 gnutls_x509_privkey_t x509;
36 #ifdef ENABLE_PKCS11
37 gnutls_pkcs11_privkey_t pkcs11;
38 #endif
39 #ifdef ENABLE_OPENPGP
40 gnutls_openpgp_privkey_t openpgp;
41 #endif
42 struct {
43 gnutls_privkey_sign_func sign_func;
44 gnutls_privkey_decrypt_func decrypt_func;
45 gnutls_privkey_deinit_func deinit_func;
46 void* userdata;
47 } ext;
48 } key;
50 unsigned int flags;
51 struct pin_info_st pin;
54 struct gnutls_pubkey_st
56 gnutls_pk_algorithm_t pk_algorithm;
57 unsigned int bits; /* an indication of the security parameter */
59 /* the size of params depends on the public
60 * key algorithm
61 * RSA: [0] is modulus
62 * [1] is public exponent
63 * DSA: [0] is p
64 * [1] is q
65 * [2] is g
66 * [3] is public key
68 gnutls_pk_params_st params;
70 uint8_t openpgp_key_id[GNUTLS_OPENPGP_KEYID_SIZE];
71 int openpgp_key_id_set;
73 unsigned int key_usage; /* bits from GNUTLS_KEY_* */
75 struct pin_info_st pin;
78 int _gnutls_privkey_get_public_mpis (gnutls_privkey_t key,
79 gnutls_pk_params_st*);
81 int pubkey_to_bits(gnutls_pk_algorithm_t pk, gnutls_pk_params_st* params);
82 int _gnutls_pubkey_compatible_with_sig(gnutls_session_t, gnutls_pubkey_t pubkey,
83 gnutls_protocol_t ver, gnutls_sign_algorithm_t sign);
84 int _gnutls_pubkey_is_over_rsa_512(gnutls_pubkey_t pubkey);
85 int
86 _gnutls_pubkey_get_mpis (gnutls_pubkey_t key,
87 gnutls_pk_params_st * params);
89 int
90 pubkey_verify_hashed_data (gnutls_pk_algorithm_t pk,
91 gnutls_digest_algorithm_t algo,
92 const gnutls_datum_t * hash,
93 const gnutls_datum_t * signature,
94 gnutls_pk_params_st * issuer_params);
96 int pubkey_verify_data (gnutls_pk_algorithm_t pk,
97 gnutls_digest_algorithm_t algo,
98 const gnutls_datum_t * data,
99 const gnutls_datum_t * signature,
100 gnutls_pk_params_st * issuer_params);
104 gnutls_digest_algorithm_t _gnutls_dsa_q_to_hash (gnutls_pk_algorithm_t algo,
105 const gnutls_pk_params_st* params, unsigned int* hash_len);
107 #endif