LCOV - code coverage report
Current view: top level - src - gcrypt-int.h (source / functions) Hit Total Coverage
Test: coverage.info Lines: 0 12 0.0 %
Date: 2017-03-02 16:44:37 Functions: 0 6 0.0 %

          Line data    Source code
       1             : /* gcrypt-int.h - Internal version of gcrypt.h
       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_GCRYPT_INT_H
      21             : #define GCRY_GCRYPT_INT_H
      22             : 
      23             : #ifdef _GCRYPT_H
      24             : #error  gcrypt.h already included
      25             : #endif
      26             : 
      27             : #include "gcrypt.h"
      28             : #include "types.h"
      29             : 
      30             : /* These error codes are used but not defined in the required
      31             :  * libgpg-error N.MM.  Define them here.  [None right now.] */
      32             : 
      33             : 
      34             : 
      35             : /* Context used with elliptic curve functions.  */
      36             : struct mpi_ec_ctx_s;
      37             : typedef struct mpi_ec_ctx_s *mpi_ec_t;
      38             : 
      39             : 
      40             : 
      41             : /* Underscore prefixed internal versions of the public functions.
      42             :    They return gpg_err_code and not gpg_error_t.  Some macros also
      43             :    need an underscore prefixed internal version.
      44             : 
      45             :    Note that the memory allocation functions and macros (xmalloc etc.)
      46             :    are not defined here but in g10lib.h because this file here is
      47             :    included by some test programs which define theie own xmalloc
      48             :    macros.  */
      49             : 
      50             : gpg_err_code_t _gcry_cipher_open (gcry_cipher_hd_t *handle,
      51             :                                   int algo, int mode, unsigned int flags);
      52             : void _gcry_cipher_close (gcry_cipher_hd_t h);
      53             : gpg_err_code_t _gcry_cipher_ctl (gcry_cipher_hd_t h, int cmd, void *buffer,
      54             :                              size_t buflen);
      55             : gpg_err_code_t _gcry_cipher_info (gcry_cipher_hd_t h, int what, void *buffer,
      56             :                                   size_t *nbytes);
      57             : gpg_err_code_t _gcry_cipher_algo_info (int algo, int what, void *buffer,
      58             :                                        size_t *nbytes);
      59             : const char *_gcry_cipher_algo_name (int algorithm) _GCRY_GCC_ATTR_PURE;
      60             : int _gcry_cipher_map_name (const char *name) _GCRY_GCC_ATTR_PURE;
      61             : int _gcry_cipher_mode_from_oid (const char *string) _GCRY_GCC_ATTR_PURE;
      62             : gpg_err_code_t _gcry_cipher_encrypt (gcry_cipher_hd_t h,
      63             :                                      void *out, size_t outsize,
      64             :                                      const void *in, size_t inlen);
      65             : gpg_err_code_t _gcry_cipher_decrypt (gcry_cipher_hd_t h,
      66             :                                      void *out, size_t outsize,
      67             :                                      const void *in, size_t inlen);
      68             : gcry_err_code_t _gcry_cipher_setkey (gcry_cipher_hd_t hd,
      69             :                                      const void *key, size_t keylen);
      70             : gcry_err_code_t _gcry_cipher_setiv (gcry_cipher_hd_t hd,
      71             :                                     const void *iv, size_t ivlen);
      72             : gpg_err_code_t _gcry_cipher_authenticate (gcry_cipher_hd_t hd, const void *abuf,
      73             :                                           size_t abuflen);
      74             : gpg_err_code_t _gcry_cipher_gettag (gcry_cipher_hd_t hd, void *outtag,
      75             :                                     size_t taglen);
      76             : gpg_err_code_t _gcry_cipher_checktag (gcry_cipher_hd_t hd, const void *intag,
      77             :                                       size_t taglen);
      78             : gpg_err_code_t _gcry_cipher_setctr (gcry_cipher_hd_t hd,
      79             :                                     const void *ctr, size_t ctrlen);
      80             : gpg_err_code_t _gcry_cipher_getctr (gcry_cipher_hd_t hd,
      81             :                                     void *ctr, size_t ctrlen);
      82             : size_t _gcry_cipher_get_algo_keylen (int algo);
      83             : size_t _gcry_cipher_get_algo_blklen (int algo);
      84             : 
      85             : #define _gcry_cipher_reset(h)  _gcry_cipher_ctl ((h), GCRYCTL_RESET, NULL, 0)
      86             : 
      87             : 
      88             : 
      89             : 
      90             : gpg_err_code_t _gcry_pk_encrypt (gcry_sexp_t *result,
      91             :                                  gcry_sexp_t data, gcry_sexp_t pkey);
      92             : gpg_err_code_t _gcry_pk_decrypt (gcry_sexp_t *result,
      93             :                                  gcry_sexp_t data, gcry_sexp_t skey);
      94             : gpg_err_code_t _gcry_pk_sign (gcry_sexp_t *result,
      95             :                               gcry_sexp_t data, gcry_sexp_t skey);
      96             : gpg_err_code_t _gcry_pk_verify (gcry_sexp_t sigval,
      97             :                                 gcry_sexp_t data, gcry_sexp_t pkey);
      98             : gpg_err_code_t _gcry_pk_testkey (gcry_sexp_t key);
      99             : gpg_err_code_t _gcry_pk_genkey (gcry_sexp_t *r_key, gcry_sexp_t s_parms);
     100             : gpg_err_code_t _gcry_pk_ctl (int cmd, void *buffer, size_t buflen);
     101             : gpg_err_code_t _gcry_pk_algo_info (int algo, int what,
     102             :                                    void *buffer, size_t *nbytes);
     103             : const char *_gcry_pk_algo_name (int algorithm) _GCRY_GCC_ATTR_PURE;
     104             : int _gcry_pk_map_name (const char* name) _GCRY_GCC_ATTR_PURE;
     105             : unsigned int _gcry_pk_get_nbits (gcry_sexp_t key) _GCRY_GCC_ATTR_PURE;
     106             : unsigned char *_gcry_pk_get_keygrip (gcry_sexp_t key, unsigned char *array);
     107             : const char *_gcry_pk_get_curve (gcry_sexp_t key, int iterator,
     108             :                                 unsigned int *r_nbits);
     109             : gcry_sexp_t _gcry_pk_get_param (int algo, const char *name);
     110             : gpg_err_code_t _gcry_pubkey_get_sexp (gcry_sexp_t *r_sexp,
     111             :                                       int mode, gcry_ctx_t ctx);
     112             : 
     113             : 
     114             : gpg_err_code_t _gcry_md_open (gcry_md_hd_t *h, int algo, unsigned int flags);
     115             : void _gcry_md_close (gcry_md_hd_t hd);
     116             : gpg_err_code_t _gcry_md_enable (gcry_md_hd_t hd, int algo);
     117             : gpg_err_code_t _gcry_md_copy (gcry_md_hd_t *bhd, gcry_md_hd_t ahd);
     118             : void _gcry_md_reset (gcry_md_hd_t hd);
     119             : gpg_err_code_t _gcry_md_ctl (gcry_md_hd_t hd, int cmd,
     120             :                           void *buffer, size_t buflen);
     121             : void _gcry_md_write (gcry_md_hd_t hd, const void *buffer, size_t length);
     122             : unsigned char *_gcry_md_read (gcry_md_hd_t hd, int algo);
     123             : gpg_error_t _gcry_md_extract (gcry_md_hd_t hd, int algo, void *buffer,
     124             :                               size_t length);
     125             : void _gcry_md_hash_buffer (int algo, void *digest,
     126             :                            const void *buffer, size_t length);
     127             : gpg_err_code_t _gcry_md_hash_buffers (int algo, unsigned int flags,
     128             :                                       void *digest,
     129             :                                       const gcry_buffer_t *iov, int iovcnt);
     130             : int _gcry_md_get_algo (gcry_md_hd_t hd);
     131             : unsigned int _gcry_md_get_algo_dlen (int algo);
     132             : int _gcry_md_is_enabled (gcry_md_hd_t a, int algo);
     133             : int _gcry_md_is_secure (gcry_md_hd_t a);
     134             : gpg_err_code_t _gcry_md_info (gcry_md_hd_t h, int what, void *buffer,
     135             :                           size_t *nbytes);
     136             : gpg_err_code_t _gcry_md_algo_info (int algo, int what, void *buffer,
     137             :                                 size_t *nbytes);
     138             : const char *_gcry_md_algo_name (int algo) _GCRY_GCC_ATTR_PURE;
     139             : int _gcry_md_map_name (const char* name) _GCRY_GCC_ATTR_PURE;
     140             : gpg_err_code_t _gcry_md_setkey (gcry_md_hd_t hd,
     141             :                                 const void *key, size_t keylen);
     142             : void _gcry_md_debug (gcry_md_hd_t hd, const char *suffix);
     143             : 
     144             : #define _gcry_md_test_algo(a) \
     145             :             _gcry_md_algo_info ((a), GCRYCTL_TEST_ALGO, NULL, NULL)
     146             : 
     147             : #define _gcry_md_final(a) \
     148             :             _gcry_md_ctl ((a), GCRYCTL_FINALIZE, NULL, 0)
     149             : 
     150             : #define _gcry_md_putc(h,c)  \
     151             :             do {                                          \
     152             :                 gcry_md_hd_t h__ = (h);                   \
     153             :                 if( (h__)->bufpos == (h__)->bufsize )     \
     154             :                     _gcry_md_write( (h__), NULL, 0 );     \
     155             :                 (h__)->buf[(h__)->bufpos++] = (c) & 0xff; \
     156             :             } while(0)
     157             : 
     158             : 
     159             : 
     160             : gpg_err_code_t _gcry_mac_open (gcry_mac_hd_t *handle, int algo,
     161             :                             unsigned int flags, gcry_ctx_t ctx);
     162             : void _gcry_mac_close (gcry_mac_hd_t h);
     163             : gpg_err_code_t _gcry_mac_ctl (gcry_mac_hd_t h, int cmd, void *buffer,
     164             :                            size_t buflen);
     165             : gpg_err_code_t _gcry_mac_algo_info (int algo, int what, void *buffer,
     166             :                                  size_t *nbytes);
     167             : gpg_err_code_t _gcry_mac_setkey (gcry_mac_hd_t hd, const void *key,
     168             :                               size_t keylen);
     169             : gpg_err_code_t _gcry_mac_setiv (gcry_mac_hd_t hd, const void *iv,
     170             :                              size_t ivlen);
     171             : gpg_err_code_t _gcry_mac_write (gcry_mac_hd_t hd, const void *buffer,
     172             :                              size_t length);
     173             : gpg_err_code_t _gcry_mac_read (gcry_mac_hd_t hd, void *buffer, size_t *buflen);
     174             : gpg_err_code_t _gcry_mac_verify (gcry_mac_hd_t hd, const void *buffer,
     175             :                                  size_t buflen);
     176             : int _gcry_mac_get_algo (gcry_mac_hd_t hd);
     177             : unsigned int _gcry_mac_get_algo_maclen (int algo);
     178             : unsigned int _gcry_mac_get_algo_keylen (int algo);
     179             : const char *_gcry_mac_algo_name (int algorithm) _GCRY_GCC_ATTR_PURE;
     180             : int _gcry_mac_map_name (const char *name) _GCRY_GCC_ATTR_PURE;
     181             : 
     182             : #define _gcry_mac_reset(h)  _gcry_mac_ctl ((h), GCRYCTL_RESET, NULL, 0)
     183             : 
     184             : 
     185             : gpg_err_code_t _gcry_kdf_derive (const void *passphrase, size_t passphraselen,
     186             :                                  int algo, int subalgo,
     187             :                                  const void *salt, size_t saltlen,
     188             :                                  unsigned long iterations,
     189             :                                  size_t keysize, void *keybuffer);
     190             : 
     191             : 
     192             : gpg_err_code_t _gcry_prime_generate (gcry_mpi_t *prime,
     193             :                                      unsigned int prime_bits,
     194             :                                      unsigned int factor_bits,
     195             :                                      gcry_mpi_t **factors,
     196             :                                      gcry_prime_check_func_t cb_func,
     197             :                                      void *cb_arg,
     198             :                                      gcry_random_level_t random_level,
     199             :                                      unsigned int flags);
     200             : gpg_err_code_t _gcry_prime_group_generator (gcry_mpi_t *r_g,
     201             :                                             gcry_mpi_t prime,
     202             :                                             gcry_mpi_t *factors,
     203             :                                             gcry_mpi_t start_g);
     204             : void _gcry_prime_release_factors (gcry_mpi_t *factors);
     205             : gpg_err_code_t _gcry_prime_check (gcry_mpi_t x, unsigned int flags);
     206             : 
     207             : 
     208             : void _gcry_randomize (void *buffer, size_t length,
     209             :                       enum gcry_random_level level);
     210             : gpg_err_code_t _gcry_random_add_bytes (const void *buffer, size_t length,
     211             :                                     int quality);
     212             : void *_gcry_random_bytes (size_t nbytes, enum gcry_random_level level)
     213             :                          _GCRY_GCC_ATTR_MALLOC;
     214             : void *_gcry_random_bytes_secure (size_t nbytes, enum gcry_random_level level)
     215             :                                 _GCRY_GCC_ATTR_MALLOC;
     216             : void _gcry_mpi_randomize (gcry_mpi_t w,
     217             :                          unsigned int nbits, enum gcry_random_level level);
     218             : void _gcry_create_nonce (void *buffer, size_t length);
     219             : 
     220             : 
     221             : void _gcry_ctx_release (gcry_ctx_t ctx);
     222             : 
     223             : 
     224             : const char *_gcry_check_version (const char *req_version);
     225             : 
     226             : void _gcry_set_allocation_handler (gcry_handler_alloc_t func_alloc,
     227             :                                   gcry_handler_alloc_t func_alloc_secure,
     228             :                                   gcry_handler_secure_check_t func_secure_check,
     229             :                                   gcry_handler_realloc_t func_realloc,
     230             :                                   gcry_handler_free_t func_free);
     231             : void _gcry_set_outofcore_handler (gcry_handler_no_mem_t h, void *opaque);
     232             : void _gcry_set_fatalerror_handler (gcry_handler_error_t fnc, void *opaque);
     233             : void _gcry_set_log_handler (gcry_handler_log_t f, void *opaque);
     234             : void _gcry_set_gettext_handler (const char *(*f)(const char*));
     235             : void _gcry_set_progress_handler (gcry_handler_progress_t cb, void *cb_data);
     236             : 
     237             : 
     238             : /* Return a pointer to a string containing a description of the error
     239             :    code in the error value ERR.  */
     240             : static inline const char *
     241           0 : _gcry_strerror (gcry_error_t err)
     242             : {
     243           0 :   return gpg_strerror (err);
     244             : }
     245             : 
     246             : /* Return a pointer to a string containing a description of the error
     247             :    source in the error value ERR.  */
     248             : static inline const char *
     249           0 : _gcry_strsource (gcry_error_t err)
     250             : {
     251           0 :   return gpg_strsource (err);
     252             : }
     253             : 
     254             : /* Retrieve the error code for the system error ERR.  This returns
     255             :    GPG_ERR_UNKNOWN_ERRNO if the system error is not mapped (report
     256             :    this).  */
     257             : static inline gcry_err_code_t
     258           0 : _gcry_err_code_from_errno (int err)
     259             : {
     260           0 :   return gpg_err_code_from_errno (err);
     261             : }
     262             : 
     263             : /* Retrieve the system error for the error code CODE.  This returns 0
     264             :    if CODE is not a system error code.  */
     265             : static inline int
     266           0 : _gcry_err_code_to_errno (gcry_err_code_t code)
     267             : {
     268           0 :   return gpg_err_code_from_errno (code);
     269             : }
     270             : 
     271             : /* Return an error value with the error source SOURCE and the system
     272             :    error ERR.  */
     273             : static inline gcry_error_t
     274           0 : _gcry_err_make_from_errno (gpg_err_source_t source, int err)
     275             : {
     276           0 :   return gpg_err_make_from_errno (source, err);
     277             : }
     278             : 
     279             : 
     280             : /* Return an error value with the system error ERR.  */
     281             : static inline gcry_error_t
     282           0 : _gcry_error_from_errno (int err)
     283             : {
     284           0 :   return gpg_error (gpg_err_code_from_errno (err));
     285             : }
     286             : 
     287             : 
     288             : 
     289             : gpg_err_code_t _gcry_sexp_new (gcry_sexp_t *retsexp,
     290             :                                const void *buffer, size_t length,
     291             :                                int autodetect);
     292             : gpg_err_code_t _gcry_sexp_create (gcry_sexp_t *retsexp,
     293             :                                   void *buffer, size_t length,
     294             :                                   int autodetect, void (*freefnc) (void *));
     295             : gpg_err_code_t _gcry_sexp_sscan (gcry_sexp_t *retsexp, size_t *erroff,
     296             :                               const char *buffer, size_t length);
     297             : gpg_err_code_t _gcry_sexp_build (gcry_sexp_t *retsexp, size_t *erroff,
     298             :                                  const char *format, ...);
     299             : gpg_err_code_t _gcry_sexp_build_array (gcry_sexp_t *retsexp, size_t *erroff,
     300             :                                        const char *format, void **arg_list);
     301             : void _gcry_sexp_release (gcry_sexp_t sexp);
     302             : size_t _gcry_sexp_canon_len (const unsigned char *buffer, size_t length,
     303             :                             size_t *erroff, gcry_err_code_t *errcode);
     304             : size_t _gcry_sexp_sprint (gcry_sexp_t sexp, int mode, void *buffer,
     305             :                           size_t maxlength);
     306             : void _gcry_sexp_dump (const gcry_sexp_t a);
     307             : gcry_sexp_t _gcry_sexp_cons (const gcry_sexp_t a, const gcry_sexp_t b);
     308             : gcry_sexp_t _gcry_sexp_alist (const gcry_sexp_t *array);
     309             : gcry_sexp_t _gcry_sexp_vlist (const gcry_sexp_t a, ...);
     310             : gcry_sexp_t _gcry_sexp_append (const gcry_sexp_t a, const gcry_sexp_t n);
     311             : gcry_sexp_t _gcry_sexp_prepend (const gcry_sexp_t a, const gcry_sexp_t n);
     312             : gcry_sexp_t _gcry_sexp_find_token (gcry_sexp_t list,
     313             :                                    const char *tok, size_t toklen);
     314             : int _gcry_sexp_length (const gcry_sexp_t list);
     315             : gcry_sexp_t _gcry_sexp_nth (const gcry_sexp_t list, int number);
     316             : gcry_sexp_t _gcry_sexp_car (const gcry_sexp_t list);
     317             : gcry_sexp_t _gcry_sexp_cdr (const gcry_sexp_t list);
     318             : gcry_sexp_t _gcry_sexp_cadr (const gcry_sexp_t list);
     319             : const char *_gcry_sexp_nth_data (const gcry_sexp_t list, int number,
     320             :                                  size_t *datalen);
     321             : void *_gcry_sexp_nth_buffer (const gcry_sexp_t list, int number,
     322             :                              size_t *rlength);
     323             : char *_gcry_sexp_nth_string (gcry_sexp_t list, int number);
     324             : gcry_mpi_t _gcry_sexp_nth_mpi (gcry_sexp_t list, int number, int mpifmt);
     325             : gpg_err_code_t _gcry_sexp_extract_param (gcry_sexp_t sexp,
     326             :                                          const char *path,
     327             :                                          const char *list,
     328             :                                          ...) _GCRY_GCC_ATTR_SENTINEL(0);
     329             : 
     330             : #define sexp_new(a, b, c, d)         _gcry_sexp_new ((a), (b), (c), (d))
     331             : #define sexp_create(a, b, c, d, e)   _gcry_sexp_create ((a), (b), (c), (d), (e))
     332             : #define sexp_sscan(a, b, c, d)       _gcry_sexp_sscan ((a), (b), (c), (d))
     333             : #define sexp_build                   _gcry_sexp_build
     334             : #define sexp_build_array(a, b, c, d) _gcry_sexp_build_array ((a), (b), (c), (d))
     335             : #define sexp_release(a)              _gcry_sexp_release ((a))
     336             : #define sexp_canon_len(a, b, c, d)   _gcry_sexp_canon_len ((a), (b), (c), (d))
     337             : #define sexp_sprint(a, b, c, d)      _gcry_sexp_sprint ((a), (b), (c), (d))
     338             : #define sexp_dump(a)                 _gcry_sexp_dump ((a))
     339             : #define sexp_cons(a, b)              _gcry_sexp_cons ((a), (b))
     340             : #define sexp_alist(a)                _gcry_sexp_alist ((a))
     341             : #define sexp_vlist                   _gcry_sexp_vlist
     342             : #define sexp_append(a, b)            _gcry_sexp_append ((a), (b))
     343             : #define sexp_prepend(a, b)           _gcry_sexp_prepend ((a), (b))
     344             : #define sexp_find_token(a, b, c)     _gcry_sexp_find_token ((a), (b), (c))
     345             : #define sexp_length(a)               _gcry_sexp_length ((a))
     346             : #define sexp_nth(a, b)               _gcry_sexp_nth ((a), (b))
     347             : #define sexp_car(a)                  _gcry_sexp_car ((a))
     348             : #define sexp_cdr(a)                  _gcry_sexp_cdr ((a))
     349             : #define sexp_cadr(a)                 _gcry_sexp_cadr ((a))
     350             : #define sexp_nth_data(a, b, c)       _gcry_sexp_nth_data ((a), (b), (c))
     351             : #define sexp_nth_buffer(a, b, c)     _gcry_sexp_nth_buffer ((a), (b), (c))
     352             : #define sexp_nth_string(a, b)        _gcry_sexp_nth_string ((a), (b))
     353             : #define sexp_nth_mpi(a, b, c)        _gcry_sexp_nth_mpi ((a), (b), (c))
     354             : #define sexp_extract_param           _gcry_sexp_extract_param
     355             : 
     356             : 
     357             : 
     358             : gcry_mpi_t _gcry_mpi_new (unsigned int nbits);
     359             : gcry_mpi_t _gcry_mpi_snew (unsigned int nbits);
     360             : void _gcry_mpi_release (gcry_mpi_t a);
     361             : gcry_mpi_t _gcry_mpi_copy (const gcry_mpi_t a);
     362             : void _gcry_mpi_snatch (gcry_mpi_t w, gcry_mpi_t u);
     363             : gcry_mpi_t _gcry_mpi_set (gcry_mpi_t w, const gcry_mpi_t u);
     364             : gcry_mpi_t _gcry_mpi_set_ui (gcry_mpi_t w, unsigned long u);
     365             : gcry_err_code_t _gcry_mpi_get_ui (gcry_mpi_t w, ulong *u);
     366             : void _gcry_mpi_swap (gcry_mpi_t a, gcry_mpi_t b);
     367             : int _gcry_mpi_is_neg (gcry_mpi_t a);
     368             : void _gcry_mpi_neg (gcry_mpi_t w, gcry_mpi_t u);
     369             : void _gcry_mpi_abs (gcry_mpi_t w);
     370             : int _gcry_mpi_cmp (const gcry_mpi_t u, const gcry_mpi_t v);
     371             : int _gcry_mpi_cmp_ui (const gcry_mpi_t u, unsigned long v);
     372             : gpg_err_code_t _gcry_mpi_scan (gcry_mpi_t *ret_mpi, enum gcry_mpi_format format,
     373             :                               const void *buffer, size_t buflen,
     374             :                               size_t *nscanned);
     375             : gpg_err_code_t _gcry_mpi_print (enum gcry_mpi_format format,
     376             :                                unsigned char *buffer, size_t buflen,
     377             :                                size_t *nwritten,
     378             :                                const gcry_mpi_t a);
     379             : gpg_err_code_t _gcry_mpi_aprint (enum gcry_mpi_format format,
     380             :                                 unsigned char **buffer, size_t *nwritten,
     381             :                                 const gcry_mpi_t a);
     382             : void _gcry_mpi_dump (const gcry_mpi_t a);
     383             : void _gcry_mpi_add (gcry_mpi_t w, gcry_mpi_t u, gcry_mpi_t v);
     384             : void _gcry_mpi_add_ui (gcry_mpi_t w, gcry_mpi_t u, unsigned long v);
     385             : void _gcry_mpi_addm (gcry_mpi_t w, gcry_mpi_t u, gcry_mpi_t v, gcry_mpi_t m);
     386             : void _gcry_mpi_sub (gcry_mpi_t w, gcry_mpi_t u, gcry_mpi_t v);
     387             : void _gcry_mpi_sub_ui (gcry_mpi_t w, gcry_mpi_t u, unsigned long v );
     388             : void _gcry_mpi_subm (gcry_mpi_t w, gcry_mpi_t u, gcry_mpi_t v, gcry_mpi_t m);
     389             : void _gcry_mpi_mul (gcry_mpi_t w, gcry_mpi_t u, gcry_mpi_t v);
     390             : void _gcry_mpi_mul_ui (gcry_mpi_t w, gcry_mpi_t u, unsigned long v );
     391             : void _gcry_mpi_mulm (gcry_mpi_t w, gcry_mpi_t u, gcry_mpi_t v, gcry_mpi_t m);
     392             : void _gcry_mpi_mul_2exp (gcry_mpi_t w, gcry_mpi_t u, unsigned long cnt);
     393             : void _gcry_mpi_div (gcry_mpi_t q, gcry_mpi_t r,
     394             :                    gcry_mpi_t dividend, gcry_mpi_t divisor, int round);
     395             : void _gcry_mpi_mod (gcry_mpi_t r, gcry_mpi_t dividend, gcry_mpi_t divisor);
     396             : void _gcry_mpi_powm (gcry_mpi_t w,
     397             :                     const gcry_mpi_t b, const gcry_mpi_t e,
     398             :                     const gcry_mpi_t m);
     399             : int _gcry_mpi_gcd (gcry_mpi_t g, gcry_mpi_t a, gcry_mpi_t b);
     400             : int _gcry_mpi_invm (gcry_mpi_t x, gcry_mpi_t a, gcry_mpi_t m);
     401             : gcry_mpi_point_t _gcry_mpi_point_new (unsigned int nbits);
     402             : void _gcry_mpi_point_release (gcry_mpi_point_t point);
     403             : void _gcry_mpi_point_get (gcry_mpi_t x, gcry_mpi_t y, gcry_mpi_t z,
     404             :                          gcry_mpi_point_t point);
     405             : void _gcry_mpi_point_snatch_get (gcry_mpi_t x, gcry_mpi_t y, gcry_mpi_t z,
     406             :                                 gcry_mpi_point_t point);
     407             : gcry_mpi_point_t _gcry_mpi_point_set (gcry_mpi_point_t point,
     408             :                                      gcry_mpi_t x, gcry_mpi_t y, gcry_mpi_t z);
     409             : gcry_mpi_point_t _gcry_mpi_point_snatch_set (gcry_mpi_point_t point,
     410             :                                             gcry_mpi_t x, gcry_mpi_t y,
     411             :                                             gcry_mpi_t z);
     412             : 
     413             : gcry_mpi_t _gcry_mpi_ec_get_mpi (const char *name, gcry_ctx_t ctx, int copy);
     414             : gcry_mpi_point_t _gcry_mpi_ec_get_point (const char *name,
     415             :                                         gcry_ctx_t ctx, int copy);
     416             : int _gcry_mpi_ec_get_affine (gcry_mpi_t x, gcry_mpi_t y, gcry_mpi_point_t point,
     417             :                              mpi_ec_t ctx);
     418             : void _gcry_mpi_ec_dup (gcry_mpi_point_t w, gcry_mpi_point_t u, gcry_ctx_t ctx);
     419             : void _gcry_mpi_ec_add (gcry_mpi_point_t w,
     420             :                        gcry_mpi_point_t u, gcry_mpi_point_t v, mpi_ec_t ctx);
     421             : void _gcry_mpi_ec_sub (gcry_mpi_point_t w,
     422             :                        gcry_mpi_point_t u, gcry_mpi_point_t v, mpi_ec_t ctx);
     423             : void _gcry_mpi_ec_mul (gcry_mpi_point_t w, gcry_mpi_t n, gcry_mpi_point_t u,
     424             :                        mpi_ec_t ctx);
     425             : int _gcry_mpi_ec_curve_point (gcry_mpi_point_t w, mpi_ec_t ctx);
     426             : unsigned int _gcry_mpi_get_nbits (gcry_mpi_t a);
     427             : int _gcry_mpi_test_bit (gcry_mpi_t a, unsigned int n);
     428             : void _gcry_mpi_set_bit (gcry_mpi_t a, unsigned int n);
     429             : void _gcry_mpi_clear_bit (gcry_mpi_t a, unsigned int n);
     430             : void _gcry_mpi_set_highbit (gcry_mpi_t a, unsigned int n);
     431             : void _gcry_mpi_clear_highbit (gcry_mpi_t a, unsigned int n);
     432             : void _gcry_mpi_rshift (gcry_mpi_t x, gcry_mpi_t a, unsigned int n);
     433             : void _gcry_mpi_lshift (gcry_mpi_t x, gcry_mpi_t a, unsigned int n);
     434             : gcry_mpi_t _gcry_mpi_set_opaque (gcry_mpi_t a, void *p, unsigned int nbits);
     435             : gcry_mpi_t _gcry_mpi_set_opaque_copy (gcry_mpi_t a,
     436             :                                      const void *p, unsigned int nbits);
     437             : void *_gcry_mpi_get_opaque (gcry_mpi_t a, unsigned int *nbits);
     438             : void _gcry_mpi_set_flag (gcry_mpi_t a, enum gcry_mpi_flag flag);
     439             : void _gcry_mpi_clear_flag (gcry_mpi_t a, enum gcry_mpi_flag flag);
     440             : int _gcry_mpi_get_flag (gcry_mpi_t a, enum gcry_mpi_flag flag);
     441             : 
     442             : 
     443             : /* Private function - do not use.  */
     444             : /* gcry_mpi_t _gcry_mpi_get_const (int no); */
     445             : 
     446             : /* We need our internal versions of the macros.  */
     447             : #ifndef GCRYPT_NO_MPI_MACROS
     448             : # error GCRYPT_NO_MPI_MACROS is not defined
     449             : #endif
     450             : 
     451             : #define mpi_new(n)             _gcry_mpi_new ((n))
     452             : #define mpi_secure_new( n )    _gcry_mpi_snew ((n))
     453             : #define mpi_snew(n)            _gcry_mpi_snew ((n))
     454             : 
     455             : #define mpi_release(a)        \
     456             :   do                          \
     457             :     {                         \
     458             :       _gcry_mpi_release ((a));\
     459             :       (a) = NULL;             \
     460             :     }                         \
     461             :   while (0)
     462             : 
     463             : #define mpi_snatch( w, u)      _gcry_mpi_snatch( (w), (u) )
     464             : #define mpi_set( w, u)         _gcry_mpi_set( (w), (u) )
     465             : #define mpi_set_ui( w, u)      _gcry_mpi_set_ui( (w), (u) )
     466             : #define mpi_get_ui(a,b)        _gcry_mpi_get_ui( (a), (b) )
     467             : #define mpi_swap(a,b)          _gcry_mpi_swap ((a),(b))
     468             : #define mpi_abs( w )           _gcry_mpi_abs( (w) )
     469             : #define mpi_neg( w, u)         _gcry_mpi_neg( (w), (u) )
     470             : #define mpi_cmp( u, v )        _gcry_mpi_cmp( (u), (v) )
     471             : #define mpi_cmp_ui( u, v )     _gcry_mpi_cmp_ui( (u), (v) )
     472             : #define mpi_is_neg( a )        _gcry_mpi_is_neg ((a))
     473             : 
     474             : #define mpi_add_ui(w,u,v)      _gcry_mpi_add_ui((w),(u),(v))
     475             : #define mpi_add(w,u,v)         _gcry_mpi_add ((w),(u),(v))
     476             : #define mpi_addm(w,u,v,m)      _gcry_mpi_addm ((w),(u),(v),(m))
     477             : #define mpi_sub_ui(w,u,v)      _gcry_mpi_sub_ui ((w),(u),(v))
     478             : #define mpi_sub(w,u,v)         _gcry_mpi_sub ((w),(u),(v))
     479             : #define mpi_subm(w,u,v,m)      _gcry_mpi_subm ((w),(u),(v),(m))
     480             : #define mpi_mul_ui(w,u,v)      _gcry_mpi_mul_ui ((w),(u),(v))
     481             : #define mpi_mul_2exp(w,u,v)    _gcry_mpi_mul_2exp ((w),(u),(v))
     482             : #define mpi_mul(w,u,v)         _gcry_mpi_mul ((w),(u),(v))
     483             : #define mpi_mulm(w,u,v,m)      _gcry_mpi_mulm ((w),(u),(v),(m))
     484             : #define mpi_powm(w,b,e,m)      _gcry_mpi_powm ( (w), (b), (e), (m) )
     485             : #define mpi_tdiv(q,r,a,m)      _gcry_mpi_div ( (q), (r), (a), (m), 0)
     486             : #define mpi_fdiv(q,r,a,m)      _gcry_mpi_div ( (q), (r), (a), (m), -1)
     487             : #define mpi_mod(r,a,m)         _gcry_mpi_mod ((r), (a), (m))
     488             : #define mpi_gcd(g,a,b)         _gcry_mpi_gcd ( (g), (a), (b) )
     489             : #define mpi_invm(g,a,b)        _gcry_mpi_invm ( (g), (a), (b) )
     490             : 
     491             : #define mpi_point_new(n)       _gcry_mpi_point_new((n))
     492             : 
     493             : #define mpi_point_release(p)                     \
     494             :   do                                             \
     495             :     {                                            \
     496             :       _gcry_mpi_point_release ((p));             \
     497             :       (p) = NULL;                                \
     498             :     }                                            \
     499             :   while (0)
     500             : 
     501             : #define mpi_point_get(x,y,z,p)        _gcry_mpi_point_get((x),(y),(z),(p))
     502             : #define mpi_point_snatch_get(x,y,z,p) _gcry_mpi_point_snatch_get((x),(y), \
     503             :                                                                  (z),(p))
     504             : #define mpi_point_set(p,x,y,z)        _gcry_mpi_point_set((p),(x),(y),(z))
     505             : #define mpi_point_snatch_set(p,x,y,z) _gcry_mpi_point_snatch_set((p),(x), \
     506             :                                                                  (y),(z))
     507             : 
     508             : #define mpi_get_nbits(a)       _gcry_mpi_get_nbits ((a))
     509             : #define mpi_test_bit(a,b)      _gcry_mpi_test_bit ((a),(b))
     510             : #define mpi_set_bit(a,b)       _gcry_mpi_set_bit ((a),(b))
     511             : #define mpi_set_highbit(a,b)   _gcry_mpi_set_highbit ((a),(b))
     512             : #define mpi_clear_bit(a,b)     _gcry_mpi_clear_bit ((a),(b))
     513             : #define mpi_clear_highbit(a,b) _gcry_mpi_clear_highbit ((a),(b))
     514             : #define mpi_rshift(a,b,c)      _gcry_mpi_rshift ((a),(b),(c))
     515             : #define mpi_lshift(a,b,c)      _gcry_mpi_lshift ((a),(b),(c))
     516             : 
     517             : #define mpi_set_opaque(a,b,c)  _gcry_mpi_set_opaque ((a), (b), (c))
     518             : #define mpi_get_opaque(a,b)    _gcry_mpi_get_opaque ((a), (b))
     519             : #define mpi_set_flag(a,f)      _gcry_mpi_set_flag ((a), (f))
     520             : #define mpi_set_flag(a,f)      _gcry_mpi_set_flag ((a), (f))
     521             : #define mpi_clear_flag(a,f)    _gcry_mpi_clear_flag ((a), (f))
     522             : #define mpi_get_flag(a,f)      _gcry_mpi_get_flag ((a), (f))
     523             : 
     524             : 
     525             : #endif /*GCRY_GCRYPT_INT_H*/

Generated by: LCOV version 1.13