Speed-up SHA-1 NEON assembly implementation
[libgcrypt.git] / cipher / pubkey-internal.h
1 /* pubkey-internal.h  - Internal defs for pubkey.c
2  * Copyright (C) 2013 g10 code GmbH
3  *
4  * This file is part of Libgcrypt.
5  *
6  * Libgcrypt is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU Lesser general Public License as
8  * published by the Free Software Foundation; either version 2.1 of
9  * the License, or (at your option) any later version.
10  *
11  * Libgcrypt is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this program; if not, see <http://www.gnu.org/licenses/>.
18  */
19
20 #ifndef GCRY_PUBKEY_INTERNAL_H
21 #define GCRY_PUBKEY_INTERNAL_H
22
23 /*-- pubkey-util.c --*/
24 gpg_err_code_t _gcry_pk_util_parse_flaglist (gcry_sexp_t list,
25                                              int *r_flags,
26                                              enum pk_encoding *r_encoding);
27 gpg_err_code_t _gcry_pk_util_get_nbits (gcry_sexp_t list,
28                                         unsigned int *r_nbits);
29 gpg_err_code_t _gcry_pk_util_get_rsa_use_e (gcry_sexp_t list,
30                                             unsigned long *r_e);
31 gpg_err_code_t _gcry_pk_util_preparse_sigval (gcry_sexp_t s_sig,
32                                               const char **algo_names,
33                                               gcry_sexp_t *r_parms,
34                                               int *r_eccflags);
35 gpg_err_code_t _gcry_pk_util_preparse_encval (gcry_sexp_t sexp,
36                                               const char **algo_names,
37                                               gcry_sexp_t *r_parms,
38                                               struct pk_encoding_ctx *ctx);
39 void _gcry_pk_util_init_encoding_ctx (struct pk_encoding_ctx *ctx,
40                                       enum pk_operation op,
41                                       unsigned int nbits);
42 void _gcry_pk_util_free_encoding_ctx (struct pk_encoding_ctx *ctx);
43 gcry_err_code_t _gcry_pk_util_data_to_mpi (gcry_sexp_t input,
44                                            gcry_mpi_t *ret_mpi,
45                                            struct pk_encoding_ctx *ctx);
46
47
48
49 /*-- rsa-common.c --*/
50 gpg_err_code_t
51 _gcry_rsa_pkcs1_encode_for_enc (gcry_mpi_t *r_result, unsigned int nbits,
52                                 const unsigned char *value, size_t valuelen,
53                                 const unsigned char *random_override,
54                                 size_t random_override_len);
55 gpg_err_code_t
56 _gcry_rsa_pkcs1_decode_for_enc (unsigned char **r_result, size_t *r_resultlen,
57                                 unsigned int nbits, gcry_mpi_t value);
58 gpg_err_code_t
59 _gcry_rsa_pkcs1_encode_raw_for_sig (gcry_mpi_t *r_result, unsigned int nbits,
60                                 const unsigned char *value, size_t valuelen);
61
62 gpg_err_code_t
63 _gcry_rsa_pkcs1_encode_for_sig (gcry_mpi_t *r_result, unsigned int nbits,
64                                 const unsigned char *value, size_t valuelen,
65                                 int algo);
66 gpg_err_code_t
67 _gcry_rsa_oaep_encode (gcry_mpi_t *r_result, unsigned int nbits, int algo,
68                        const unsigned char *value, size_t valuelen,
69                        const unsigned char *label, size_t labellen,
70                        const void *random_override, size_t random_override_len);
71 gpg_err_code_t
72 _gcry_rsa_oaep_decode (unsigned char **r_result, size_t *r_resultlen,
73                        unsigned int nbits, int algo,
74                        gcry_mpi_t value,
75                        const unsigned char *label, size_t labellen);
76 gpg_err_code_t
77 _gcry_rsa_pss_encode (gcry_mpi_t *r_result, unsigned int nbits, int algo,
78                       const unsigned char *value, size_t valuelen, int saltlen,
79                       const void *random_override, size_t random_override_len);
80 gpg_err_code_t
81 _gcry_rsa_pss_verify (gcry_mpi_t value, gcry_mpi_t encoded,
82                       unsigned int nbits, int algo, size_t saltlen);
83
84
85
86 /*-- dsa-common.c --*/
87 gcry_mpi_t _gcry_dsa_gen_k (gcry_mpi_t q, int security_level);
88 gpg_err_code_t _gcry_dsa_gen_rfc6979_k (gcry_mpi_t *r_k,
89                                         gcry_mpi_t dsa_q, gcry_mpi_t dsa_x,
90                                         const unsigned char *h1,
91                                         unsigned int h1len,
92                                         int halgo,
93                                         unsigned int extraloops);
94
95 gpg_err_code_t _gcry_dsa_normalize_hash (gcry_mpi_t input,
96                                          gcry_mpi_t *out,
97                                          unsigned int qbits);
98
99 /*-- ecc.c --*/
100 gpg_err_code_t _gcry_pk_ecc_get_sexp (gcry_sexp_t *r_sexp, int mode,
101                                       mpi_ec_t ec);
102
103
104 #endif /*GCRY_PUBKEY_INTERNAL_H*/