~ubuntu-branches/ubuntu/natty/libgcrypt11/natty-proposed

« back to all changes in this revision

Viewing changes to src/cipher-proto.h

  • Committer: Bazaar Package Importer
  • Author(s): Bhavani Shankar
  • Date: 2009-05-16 20:13:32 UTC
  • mfrom: (1.1.6 upstream) (2.1.3 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090516201332-czkobpu32w318i16
Tags: 1.4.4-2ubuntu1
* Merge from Debian unstable (LP: #364535), remaining changes:
  - Add libgcrypt11-udeb for use by cryptsetup-udeb.
  - Add clean-la.mk, and add a symlink for the .la
  - Install to /lib.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* cipher-proto.h - Internal declarations
 
2
 *      Copyright (C) 2008 Free Software Foundation, Inc.
 
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
/* This file has been factored out from cipher.h so that it can be
 
21
   used standalone in visibility.c . */
 
22
 
 
23
#ifndef G10_CIPHER_PROTO_H
 
24
#define G10_CIPHER_PROTO_H
 
25
 
 
26
/* Definition of a function used to report selftest failures. 
 
27
   DOMAIN is a string describing the function block:
 
28
          "cipher", "digest", "pubkey or "random",
 
29
   ALGO   is the algorithm under test,
 
30
   WHAT   is a string describing what has been tested,
 
31
   DESC   is a string describing the error. */
 
32
typedef void (*selftest_report_func_t)(const char *domain,
 
33
                                       int algo, 
 
34
                                       const char *what,
 
35
                                       const char *errdesc);
 
36
 
 
37
/* Definition of the selftest functions.  */
 
38
typedef gpg_err_code_t (*selftest_func_t)
 
39
     (int algo, int extended, selftest_report_func_t report);
 
40
 
 
41
 
 
42
/* An extended type of the generate function.  */
 
43
typedef gcry_err_code_t (*pk_ext_generate_t)
 
44
     (int algo,
 
45
      unsigned int nbits,
 
46
      unsigned long evalue,
 
47
      gcry_sexp_t genparms,
 
48
      gcry_mpi_t *skey,
 
49
      gcry_mpi_t **retfactors,
 
50
      gcry_sexp_t *extrainfo);
 
51
 
 
52
/* The type used to compute the keygrip.  */
 
53
typedef gpg_err_code_t (*pk_comp_keygrip_t)
 
54
     (gcry_md_hd_t md, gcry_sexp_t keyparm);
 
55
 
 
56
/* The type used to quert ECC curve parameters.  */
 
57
typedef gcry_err_code_t (*pk_get_param_t)
 
58
     (const char *name, gcry_mpi_t *pkey);
 
59
 
 
60
/* The type used to convey additional information to a cipher.  */
 
61
typedef gpg_err_code_t (*cipher_set_extra_info_t)
 
62
     (void *c, int what, const void *buffer, size_t buflen);
 
63
 
 
64
 
 
65
/* Extra module specification structures.  These are used for internal
 
66
   modules which provide more functions than available through the
 
67
   public algorithm register APIs.  */
 
68
typedef struct cipher_extra_spec
 
69
{
 
70
  selftest_func_t selftest;
 
71
  cipher_set_extra_info_t set_extra_info;
 
72
} cipher_extra_spec_t;
 
73
 
 
74
typedef struct md_extra_spec
 
75
{
 
76
  selftest_func_t selftest;
 
77
} md_extra_spec_t;
 
78
 
 
79
typedef struct pk_extra_spec
 
80
{
 
81
  selftest_func_t selftest;
 
82
  pk_ext_generate_t ext_generate;
 
83
  pk_comp_keygrip_t comp_keygrip;
 
84
  pk_get_param_t get_param;
 
85
} pk_extra_spec_t;
 
86
 
 
87
 
 
88
 
 
89
/* The private register functions. */
 
90
gcry_error_t _gcry_cipher_register (gcry_cipher_spec_t *cipher,
 
91
                                    cipher_extra_spec_t *extraspec,
 
92
                                    int *algorithm_id,
 
93
                                    gcry_module_t *module);
 
94
gcry_error_t _gcry_md_register (gcry_md_spec_t *cipher,
 
95
                                md_extra_spec_t *extraspec,
 
96
                                unsigned int *algorithm_id,
 
97
                                gcry_module_t *module);
 
98
gcry_error_t _gcry_pk_register (gcry_pk_spec_t *cipher,
 
99
                                pk_extra_spec_t *extraspec,
 
100
                                unsigned int *algorithm_id,
 
101
                                gcry_module_t *module);
 
102
 
 
103
/* The selftest functions.  */
 
104
gcry_error_t _gcry_cipher_selftest (int algo, int extended, 
 
105
                                    selftest_report_func_t report);
 
106
gcry_error_t _gcry_md_selftest (int algo, int extended,
 
107
                                selftest_report_func_t report);
 
108
gcry_error_t _gcry_pk_selftest (int algo, int extended,
 
109
                                selftest_report_func_t report);
 
110
gcry_error_t _gcry_hmac_selftest (int algo, int extended,
 
111
                                  selftest_report_func_t report);
 
112
 
 
113
gcry_error_t _gcry_random_selftest (selftest_report_func_t report);
 
114
 
 
115
#endif /*G10_CIPHER_PROTO_H*/