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

Generated by: LCOV version 1.11