diff options
author | Werner Koch <wk@gnupg.org> | 2011-02-04 20:21:45 +0100 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2011-02-04 20:21:45 +0100 |
commit | 4f048514ecae879fa4bb7b8522baf801229be522 (patch) | |
tree | d798c8527b68e83e4419c14d7c6dd47f2abdfd9e /src | |
parent | 9d00b28e0d04361fe9ccf02983bea781b5701c1d (diff) | |
download | libgcrypt-4f048514ecae879fa4bb7b8522baf801229be522.tar.gz |
Nuked almost all trailing whitespace.post-nuke-of-trailing-ws
Check and install the standard git pre-commit hook.
Diffstat (limited to 'src')
-rw-r--r-- | src/ChangeLog | 86 | ||||
-rw-r--r-- | src/Makefile.am | 7 | ||||
-rw-r--r-- | src/ath.c | 13 | ||||
-rw-r--r-- | src/ath.h | 10 | ||||
-rw-r--r-- | src/cipher-proto.h | 6 | ||||
-rw-r--r-- | src/cipher.h | 16 | ||||
-rw-r--r-- | src/dumpsexp.c | 59 | ||||
-rw-r--r-- | src/fips.c | 66 | ||||
-rw-r--r-- | src/g10lib.h | 20 | ||||
-rw-r--r-- | src/gcrypt-module.h | 12 | ||||
-rw-r--r-- | src/gcrypt.h.in | 62 | ||||
-rw-r--r-- | src/gcryptrnd.c | 39 | ||||
-rw-r--r-- | src/getrandom.c | 25 | ||||
-rw-r--r-- | src/global.c | 74 | ||||
-rw-r--r-- | src/hmac256.c | 62 | ||||
-rw-r--r-- | src/hwfeatures.c | 24 | ||||
-rw-r--r-- | src/libgcrypt.def | 26 | ||||
-rw-r--r-- | src/libgcrypt.m4 | 4 | ||||
-rw-r--r-- | src/libgcrypt.vers | 23 | ||||
-rw-r--r-- | src/misc.c | 14 | ||||
-rw-r--r-- | src/missing-string.c | 3 | ||||
-rw-r--r-- | src/module.c | 4 | ||||
-rw-r--r-- | src/mpi.h | 18 | ||||
-rw-r--r-- | src/secmem.c | 14 | ||||
-rw-r--r-- | src/sexp.c | 136 | ||||
-rw-r--r-- | src/stdmem.c | 28 | ||||
-rw-r--r-- | src/versioninfo.rc.in | 5 | ||||
-rw-r--r-- | src/visibility.c | 56 | ||||
-rw-r--r-- | src/visibility.h | 392 |
29 files changed, 647 insertions, 657 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 1a0910b5..8c0ef73b 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -149,7 +149,7 @@ * cipher-proto.h (pk_ext_generate_t): Add field EXTRAINFO changed all implementors. - * cipher-proto.h (pk_ext_generate_t): Simplify. + * cipher-proto.h (pk_ext_generate_t): Simplify. (pk_get_param): New. (pk_extra_spec_t): Add field GET_PARAM. * cipher.h (PUBKEY_FLAG_TRANSIENT_KEY): Remove. @@ -169,7 +169,7 @@ 2008-10-24 Werner Koch <wk@g10code.com> - * global.c (inactive_fips_mode): Move to fips.c. + * global.c (inactive_fips_mode): Move to fips.c. (gcry_set_allocation_handler): Factor code out to ... * fips.c (_gcry_inactivate_fips_mode): New. (_gcry_is_fips_mode_inactive): New. @@ -242,7 +242,7 @@ 2008-09-12 Werner Koch <wk@g10code.com> * fips.c (_gcry_fips_run_selftests): Add arg EXTENDED. - (run_cipher_selftests, run_digest_selftests, run_hmac_selftests) + (run_cipher_selftests, run_digest_selftests, run_hmac_selftests) (run_pubkey_selftests): Ditto. * cipher-proto.h (selftest_func_t): Add arg EXTENDED @@ -334,17 +334,17 @@ * gcrypt.h.in (gcry_cipher_setkey): Replace macro by function. (gcry_cipher_setiv): Ditto. (gcry_cipher_setctr): Ditto. - * visibility.c (gcry_cipher_setkey, gcry_cipher_setiv) + * visibility.c (gcry_cipher_setkey, gcry_cipher_setiv) (gcry_cipher_setctr): New. - * visibility.h (gcry_cipher_setkey, gcry_cipher_setiv) + * visibility.h (gcry_cipher_setkey, gcry_cipher_setiv) (gcry_cipher_setctr): New. * libgcrypt.vers (gcry_cipher_setkey, gcry_cipher_setiv) (gcry_cipher_setctr): New. - * libgcrypt.def (gcry_cipher_setkey, gcry_cipher_setiv) + * libgcrypt.def (gcry_cipher_setkey, gcry_cipher_setiv) (gcry_cipher_setctr): New. * hmac256.h, hmac256.c: New. - * Makefile.am (hmac256_SOURCES): New. + * Makefile.am (hmac256_SOURCES): New. * Makefile.am (bin_PROGRAMS): Add hmac256. * gcrypt.h.in (struct gcry_thread_cbs): Change type of OPTION to @@ -352,13 +352,13 @@ difference. * ath.c (ath_install): Take the version of the option field in account. - + * visibility.c (gcry_pk_encrypt, gcry_pk_decrypt, gcry_pk_sign) (gcry_pk_verify, gcry_pk_testkey, gcry_pk_genkey) (gcry_pk_get_nbits, gcry_pk_get_keygrip) - (gcry_md_open, gcry_md_copy, gcry_md_enable) - (gcry_md_write, md_final, gcry_md_ctl, gcry_md_setkey) - (gcry_md_hash_buffer, gcry_md_get_algo, gcry_md_info) + (gcry_md_open, gcry_md_copy, gcry_md_enable) + (gcry_md_write, md_final, gcry_md_ctl, gcry_md_setkey) + (gcry_md_hash_buffer, gcry_md_get_algo, gcry_md_info) (gcry_md_is_enabled) (gcry_cipher_open, gcry_cipher_encrypt) (gcry_cipher_decrypt, gcry_cipher_ctl) @@ -368,7 +368,7 @@ * cipher.h: Include cipher-proto.h. * visibility.h: Remove duplicate macro definitions. Remove gcry_cipher_register, gcry_md_register, gcry_pk_register macros. - * visibility.c: Include cipher-proto.h. + * visibility.c: Include cipher-proto.h. (gcry_cipher_register): Pass dummy extra args to the internal register function. (gcry_md_register, gcry_pk_register): Ditto. @@ -401,7 +401,7 @@ * gcrypt.h.in (gcry_ac_em_t, gcry_ac_scheme_t): Remove trailing comma for full C-89 compatibility. - + 2008-01-21 Marcus Brinkmann <marcus@g10code.de> * hwfeatures.c (detect_ia32_gnuc): Fix inline asm. @@ -517,7 +517,7 @@ * secmem.c (init_pool): Use sysconf() if available to determine page size. - + 2007-03-22 Werner Koch <wk@g10code.com> * mpi.h (mpi_mod): New. @@ -670,7 +670,7 @@ [_WIN32 || __WIN32__]: Do not include <sys/socket.h>, but <winsock2.h> and <ws2tcpip.h>. Suggested by Simon Josefsson <jas@extundo.com>. - + * Makefile.am (install-data-local, uninstall-local, %.lo, (install-def-file, uninstall-def-file): New targets. (LTRCCOMPILE, gcrypt_res, gcrypt_res_ldflag, no_undefined, @@ -690,8 +690,8 @@ (sexp_sscan): Remove all xmalloc style calls and return proper error codes on allocation failures. (gcry_sexp_find_token): Ditto. - (gcry_sexp_nth): - + (gcry_sexp_nth): + * sexp.c (gcry_sexp_find_token): Re-indented and removed a cruft "while(level);" which fortunately had no effect. @@ -704,7 +704,7 @@ 2006-04-22 Moritz Schulte <moritz@g10code.com> * gcrypt.h (gcry_ctl_cmds): New commands: - GCRYCTL_SET_RANDOM_DAEMON_SOCKET, GCRYCTL_USE_RANDOM_DAEMON. + GCRYCTL_SET_RANDOM_DAEMON_SOCKET, GCRYCTL_USE_RANDOM_DAEMON. * global.c (gcry_control): Handle new commands, calling _gcry_set_random_daemon_socket() and _gcry_use_random_daemon(). @@ -754,7 +754,7 @@ GnuPG relict (Libgcrypt does not define this symbol anywhere). (FLAG_MODULE_DISABLED): Don't forget parantheses around shifted value. - + Removed GCC_ATTR_PURE macro definitions, since gcrypt.h does already contain such a macro named _GCRY_GCC_ATTR_PURE, which we can use here as well. @@ -861,7 +861,7 @@ 2004-08-23 Moritz Schulte <moritz@g10code.com> - * global.c: Do not include <assert.h>. + * global.c: Do not include <assert.h>. * sexp.c: Likewise. * module.c: Likewise. * misc.c: Likewise. @@ -945,7 +945,7 @@ (libgcrypt_la_DEPENDENCIES): ... this. (libgcrypt_real_la_LIBADD): Merge with ... (libgcrypt_la_LIBADD): ... this. - * libgcrypt-config.in (libs_pthread, libs_pth, cflags_pth) + * libgcrypt-config.in (libs_pthread, libs_pth, cflags_pth) (cflags_pthread, thread_module, thread_modules): Removed. (Options): Remove --thread option from help output. If the option is specified, output an error and exit. @@ -980,7 +980,7 @@ $(ath_pthread_src). * ath-compat.c, ath-pth-compat.c, ath-pthread-compat.c: Files removed. - + 2004-02-20 Werner Koch <wk@gnupg.org> * gcrypt.h (GCRY_PRIME_CHECK_AT_GOT_PRIME) @@ -1023,7 +1023,7 @@ gcry_ac_key_get_nbits, gcry_ac_key_get_grip. * gcrypt.h (GCRY_AC_FLAG_DATA_NO_BLINDING): Removed symbol. - (GCRY_AC_FLAG_DEALLOC, GCRY_AC_FLAG_COPY) + (GCRY_AC_FLAG_DEALLOC, GCRY_AC_FLAG_COPY) (GCRY_AC_FLAG_NO_BLINDING): New symbols. * global.c (gcry_strdup): Removed function. @@ -1278,7 +1278,7 @@ * gcrypt.h (enum gcry_md_flags): Removed, used define instead, since that is more common than an enumeration list when it comes to flags that can be bitwise ORed. - + 2003-07-08 Moritz Schulte <moritz@g10code.com> * global.c: Use new types for handlers. @@ -1291,7 +1291,7 @@ Thanks to Simon Josefsson <jas@extunde.com>. * gcrypt.h: Declare: gcry_cipher_list, gcry_pk_list, gcry_md_list. - + 2003-07-05 Moritz Schulte <moritz@g10code.com> * gcrypt.h: Declare: gcry_cipher_register, gcry_cipher_unregister, @@ -1423,7 +1423,7 @@ * g10lib.h: Declare: _gcry_cipher_init, _gcry_md_init, _gcry_pk_init. - + * global.c (gcry_strerror): Remove compatibility code. * Makefile.am: Remove support libgpg-error special handling. @@ -1445,7 +1445,7 @@ GPG_ERR_SOURCE_DEFAULT, so that libgpg-error still works despite the use of the old gcrypt error codes. (gcry_md_copy): Swapped arguments. - + 2003-06-09 Moritz Schulte <moritz@g10code.com> * Makefile.am: Support for libgpg-error. @@ -1464,7 +1464,7 @@ before the '#'. This is not required by C89, but there are some compilers out there that don't like it. Replaced any occurence of the now deprecated type names with the new ones. - + * gcrypt.h: Re-organized checking for gcc features; New macro: _GCRY_GCC_ATTR_DEPRECATED. Include copy of libgpg-error's gpg-error.h in order to make it @@ -1509,7 +1509,7 @@ * gcrypt.h: Changed declarations for: gcry_pk_algo_info, gcry_md_open, gcry_md_copy, gcry_md_algo_info, gcry_md_info, gcry_md_get_algo, gcry_random_add_bytes. - + (gcry_md_is_secure): Adjust macro for new API. 2003-05-29 Moritz Schulte <moritz@g10code.com> @@ -1634,10 +1634,10 @@ gcry_digest_register, gcry_digest_unregister, gcry_pubkey_register, gcry_pubkey_unregister): Function declarations removed - for now. - + * gcrypt.h (GcryModule): Declaration removed. * gcrypt.h (GcryPubkeySpec, GcryDigestSpec, GcryCipherSpec): - Types Moved... + Types Moved... * cipher.h: ... here. 2003-04-17 Moritz Schulte <moritz@g10code.com> @@ -1727,7 +1727,7 @@ values. * secmem.c (_gcry_secmem_set_flags): Likewise. * secmem.c (_gcry_secmem_get_flags): Likewise. - + 2003-03-03 Moritz Schulte <moritz@g10code.com> * misc.c: Removed old FIXME, since there is already a function to @@ -1766,7 +1766,7 @@ 2003-01-23 Werner Koch <wk@gnupg.org> - * gcrypt.h (GCRY_ENABLE_QUICK_RANDOM): New. + * gcrypt.h (GCRY_ENABLE_QUICK_RANDOM): New. * global.c (gcry_control): Make use of it. 2003-01-21 Werner Koch <wk@gnupg.org> @@ -1776,7 +1776,7 @@ 2003-01-21 Timo Schulz <twoaday@freakmail.de> * gcrypt.h (gcry_random_add_bytes): New. - + 2003-01-20 Simon Josefsson <jas@extundo.com> * gcrypt.h (gcry_md_algos): Add GCRY_MD_CRC32, @@ -1800,13 +1800,13 @@ 2003-01-02 Werner Koch <wk@gnupg.org> * libgcrypt.vers: Temporary export _gcry_generate_elg_prime for - use by GNUTLS. + use by GNUTLS. 2002-12-21 Werner Koch <wk@gnupg.org> - * gcrypt.h: Make use of gcc's pure and malloc attributes + * gcrypt.h: Make use of gcc's pure and malloc attributes (gcry_md_putc): Use a helper variable to avoid multiple - evaluation of H. + evaluation of H. * g10lib.h, stdmem.h, secmem.h: Use gcc attributes pure and malloc. * stdmem.c (use_m_guard): Don't default to yes. @@ -1815,7 +1815,7 @@ * global.c (global_init): The meat was never run due to a faulty check. Thanks to Nikos for pointing this out. - + * global.c (gcry_control): Return 1 and not -1 for the initialization tests. @@ -1829,7 +1829,7 @@ 2002-12-09 Werner Koch <wk@gnupg.org> * global.c (gcry_calloc,gcry_calloc_secure): Check for overflow. - Noted by Florian Weimer. + Noted by Florian Weimer. 2002-11-10 Simon Josefsson <jas@extundo.com> @@ -1839,7 +1839,7 @@ 2002-11-10 Werner Koch <wk@gnupg.org> - * gcrypt.h (GCRY_MD_MD4): New. We use a non OpenPGP value here. + * gcrypt.h (GCRY_MD_MD4): New. We use a non OpenPGP value here. 2002-09-20 Werner Koch <wk@gnupg.org> @@ -2057,11 +2057,11 @@ * gcrypt.h, mpi.h: Made some mpi functions public. * wrapper.c: Removed. - * global.c: Renamed all g10_ prefixed functions which had wrappers + * global.c: Renamed all g10_ prefixed functions which had wrappers to gcry_xxx. So we now use the exported memory functions inernally. Renamed all g10_ prefixed functions to _gcry_ prefixed ones. - + * g10lib.h (_GCRYPT_IN_LIBGCRYPT): Replace defintion by a test on it. 2001-05-28 Werner Koch <wk@gnupg.org> @@ -2080,7 +2080,7 @@ Major change: Removed all GnuPG stuff and renamed this piece of software - to gcrypt. + to gcrypt. 2000-11-14 Werner Koch <wk@gnupg.org> diff --git a/src/Makefile.am b/src/Makefile.am index 8ceed983..20eb0d62 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -41,14 +41,14 @@ arch_gpg_error_cflags = $(GPG_ERROR_CFLAGS) arch_gpg_error_libs = $(GPG_ERROR_LIBS) else arch_gpg_error_cflags = -arch_gpg_error_libs = +arch_gpg_error_libs = endif if HAVE_LD_VERSION_SCRIPT libgcrypt_version_script_cmd = -Wl,--version-script=$(srcdir)/libgcrypt.vers else - libgcrypt_version_script_cmd = + libgcrypt_version_script_cmd = endif libgcrypt_la_CFLAGS = $(GPG_ERROR_CFLAGS) @@ -105,7 +105,7 @@ libgcrypt_la_DEPENDENCIES = \ ../random/librandom.la \ ../mpi/libmpi.la \ ../compat/libcompat.la \ - $(srcdir)/libgcrypt.vers $(gcrypt_deps) + $(srcdir)/libgcrypt.vers $(gcrypt_deps) libgcrypt_la_LIBADD = $(gcrypt_res) \ ../cipher/libcipher.la \ ../random/librandom.la \ @@ -141,4 +141,3 @@ uninstall-local: uninstall-def-file # ./hmac256 "What am I, a doctor or a moonshuttle conductor?" \ # < $(DESTDIR)$(libdir)/libgcrypt.so.11.5.0 \ # > $(DESTDIR)$(libdir)/.libgcrypt.so.11.5.0.hmac - @@ -2,17 +2,17 @@ Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. This file is part of Libgcrypt. - + Libgcrypt is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - + Libgcrypt is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU Lesser General Public License along with Libgcrypt; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA @@ -88,7 +88,7 @@ ath_install (struct ath_ops *ath_ops, int check_only) if (check_only) { unsigned int option = 0; - + /* Check if the requested thread option is compatible to the thread option we are already committed to. */ if (ath_ops) @@ -105,7 +105,7 @@ ath_install (struct ath_ops *ath_ops, int check_only) return 0; } - + if (ath_ops) { /* It is convenient to not require DESTROY. */ @@ -257,7 +257,7 @@ ath_select (int nfd, fd_set *rset, fd_set *wset, fd_set *eset, #endif } - + ssize_t ath_waitpid (pid_t pid, int *status, int options) { @@ -342,4 +342,3 @@ ath_recvmsg (int s, struct msghdr *msg, int flags) return recvmsg (s, msg, flags); #endif } - @@ -2,17 +2,17 @@ Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. This file is part of Libgcrypt. - + Libgcrypt is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - + Libgcrypt is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU Lesser General Public License along with Libgcrypt; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA @@ -77,7 +77,7 @@ enum ath_thread_option struct ath_ops { /* The OPTION field encodes the thread model and the version number - of this structure. + of this structure. Bits 7 - 0 are used for the thread model Bits 15 - 8 are used for the version number. */ @@ -142,6 +142,6 @@ int ath_accept (int s, struct sockaddr *addr, socklen_t *length_ptr); int ath_connect (int s, struct sockaddr *addr, socklen_t length); int ath_sendmsg (int s, const struct msghdr *msg, int flags); int ath_recvmsg (int s, struct msghdr *msg, int flags); -#endif +#endif #endif /* ATH_H */ diff --git a/src/cipher-proto.h b/src/cipher-proto.h index e936eeae..347681ff 100644 --- a/src/cipher-proto.h +++ b/src/cipher-proto.h @@ -23,14 +23,14 @@ #ifndef G10_CIPHER_PROTO_H #define G10_CIPHER_PROTO_H -/* Definition of a function used to report selftest failures. +/* Definition of a function used to report selftest failures. DOMAIN is a string describing the function block: "cipher", "digest", "pubkey or "random", ALGO is the algorithm under test, WHAT is a string describing what has been tested, DESC is a string describing the error. */ typedef void (*selftest_report_func_t)(const char *domain, - int algo, + int algo, const char *what, const char *errdesc); @@ -110,7 +110,7 @@ gcry_error_t _gcry_pk_register (gcry_pk_spec_t *cipher, gcry_module_t *module); /* The selftest functions. */ -gcry_error_t _gcry_cipher_selftest (int algo, int extended, +gcry_error_t _gcry_cipher_selftest (int algo, int extended, selftest_report_func_t report); gcry_error_t _gcry_md_selftest (int algo, int extended, selftest_report_func_t report); diff --git a/src/cipher.h b/src/cipher.h index 2be8787a..ca2d9564 100644 --- a/src/cipher.h +++ b/src/cipher.h @@ -41,16 +41,16 @@ void _gcry_sha1_hash_buffer (void *outbuf, const void *buffer, size_t length); /*-- rijndael.c --*/ -void _gcry_aes_cfb_enc (void *context, unsigned char *iv, +void _gcry_aes_cfb_enc (void *context, unsigned char *iv, void *outbuf, const void *inbuf, unsigned int nblocks); -void _gcry_aes_cfb_dec (void *context, unsigned char *iv, +void _gcry_aes_cfb_dec (void *context, unsigned char *iv, void *outbuf_arg, const void *inbuf_arg, unsigned int nblocks); -void _gcry_aes_cbc_enc (void *context, unsigned char *iv, +void _gcry_aes_cbc_enc (void *context, unsigned char *iv, void *outbuf_arg, const void *inbuf_arg, unsigned int nblocks, int cbc_mac); -void _gcry_aes_cbc_dec (void *context, unsigned char *iv, +void _gcry_aes_cbc_dec (void *context, unsigned char *iv, void *outbuf_arg, const void *inbuf_arg, unsigned int nblocks); @@ -131,10 +131,10 @@ extern gcry_pk_spec_t _gcry_pubkey_spec_dsa; extern gcry_pk_spec_t _gcry_pubkey_spec_ecdsa; extern gcry_pk_spec_t _gcry_pubkey_spec_ecdh; -extern pk_extra_spec_t _gcry_pubkey_extraspec_rsa; -extern pk_extra_spec_t _gcry_pubkey_extraspec_dsa; -extern pk_extra_spec_t _gcry_pubkey_extraspec_elg; -extern pk_extra_spec_t _gcry_pubkey_extraspec_ecdsa; +extern pk_extra_spec_t _gcry_pubkey_extraspec_rsa; +extern pk_extra_spec_t _gcry_pubkey_extraspec_dsa; +extern pk_extra_spec_t _gcry_pubkey_extraspec_elg; +extern pk_extra_spec_t _gcry_pubkey_extraspec_ecdsa; #endif /*G10_CIPHER_H*/ diff --git a/src/dumpsexp.c b/src/dumpsexp.c index d93cd676..a397b241 100644 --- a/src/dumpsexp.c +++ b/src/dumpsexp.c @@ -48,7 +48,7 @@ print_version (int with_help) "This is free software: you are free to change and redistribute it.\n" "There is NO WARRANTY, to the extent permitted by law.\n", stdout); - + if (with_help) fputs ("\n" "Usage: " PGM " [OPTIONS] [file]\n" @@ -61,7 +61,7 @@ print_version (int with_help) " --version Print version of the program and exit\n" " --help Display this help and exit\n" BUGREPORT_LINE, stdout ); - + exit (0); } @@ -90,7 +90,7 @@ print_usage (void) to the S-expressions definition. */ static inline int whitespace_p (int c) -{ +{ switch (c) { case ' ': case '\t': case '\v': case '\f': case '\r': case '\n': return 1; @@ -220,11 +220,11 @@ addrawdata (int c) } -static void +static void printcursor (int both) { int i; - + flushdatabuffer (); printf ("%8s ", ""); for (i=0; i < sizeof (databuffer); i++) @@ -250,14 +250,14 @@ printcursor (int both) databufferlen = skipdatabufferlen = nbytesprinted; } -static void +static void printerr (const char *text) { printcursor (1); printf ("\n Error: %s\n", text); } -static void +static void printctl (const char *text) { if (verbose && !advanced) @@ -267,7 +267,7 @@ printctl (const char *text) } } -static void +static void printchr (int c) { putchar (c); @@ -297,7 +297,7 @@ gcry_sexp_sprint (const gcry_sexp_t list, DATALEN n; char numbuf[20]; int i, indent = 0; - + s = list? list->d : empty; d = buffer; while ( *s != ST_STOP ) @@ -307,7 +307,7 @@ gcry_sexp_sprint (const gcry_sexp_t list, case ST_OPEN: s++; if (indent) - putchar ('\n'); + putchar ('\n'); for (i=0; i < indent; i++) putchar (' '); putchar ('('); @@ -331,7 +331,7 @@ gcry_sexp_sprint (const gcry_sexp_t list, { int type; size_t nn; - + switch ( (type=suitable_encoding (s, n))) { case 1: nn = convert_to_string (s, n, NULL); break; @@ -361,7 +361,7 @@ gcry_sexp_sprint (const gcry_sexp_t list, BUG (); } } - putchar ('\n'); + putchar ('\n'); return len; } #endif @@ -405,14 +405,14 @@ parse_and_print (FILE *fp) unsigned long datalen = 0; char quote_buf[10]; int quote_idx = 0; - enum + enum { INIT_STATE = 0, IN_NUMBER, PRE_DATA, IN_DATA, IN_STRING, IN_ESCAPE, IN_OCT_ESC, IN_HEX_ESC, CR_ESC, LF_ESC, IN_HEXFMT, IN_BASE64 } state = INIT_STATE; - + while ((c = my_getc (fp)) != EOF ) { @@ -566,7 +566,7 @@ parse_and_print (FILE *fp) printctl ("endstring"); flush_data (); state = INIT_STATE; - } + } else if (c == '\\') state = IN_ESCAPE; else @@ -585,23 +585,23 @@ parse_and_print (FILE *fp) case '"': push_data ('"'); state = IN_STRING; break; case '\'': push_data ('\''); state = IN_STRING; break; case '\\': push_data ('\\'); state = IN_STRING; break; - + case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': state = IN_OCT_ESC; quote_idx = 0; - quote_buf[quote_idx++] = c; + quote_buf[quote_idx++] = c; break; - + case 'x': state = IN_HEX_ESC; quote_idx = 0; break; - + case '\r': state = CR_ESC; break; - + case '\n': state = LF_ESC; break; @@ -612,11 +612,11 @@ parse_and_print (FILE *fp) break; } break; - - case IN_OCT_ESC: + + case IN_OCT_ESC: if (quote_idx < 3 && strchr ("01234567", c)) { - quote_buf[quote_idx++] = c; + quote_buf[quote_idx++] = c; if (quote_idx == 3) { push_data ((unsigned int)quote_buf[0] * 8 * 8 @@ -628,10 +628,10 @@ parse_and_print (FILE *fp) else state = IN_STRING; break; - case IN_HEX_ESC: + case IN_HEX_ESC: if (quote_idx < 2 && strchr ("0123456789abcdefABCDEF", c)) { - quote_buf[quote_idx++] = c; + quote_buf[quote_idx++] = c; if (quote_idx == 2) { push_data (xtoi_1 (quote_buf[0]) * 16 @@ -694,7 +694,7 @@ parse_and_print (FILE *fp) -int +int main (int argc, char **argv) { int rc; @@ -736,7 +736,7 @@ main (int argc, char **argv) } else print_usage (); - } + } if (!argc) { @@ -753,7 +753,7 @@ main (int argc, char **argv) logit ("can't open `%s': %s\n", *argv, strerror (errno)); rc = 1; } - else + else { if (parse_and_print (fp)) rc = 1; @@ -761,7 +761,6 @@ main (int argc, char **argv) } } } - + return !!rc; } - @@ -24,7 +24,7 @@ #include <unistd.h> #include <string.h> #ifdef ENABLE_HMAC_BINARY_CHECK -# include <dlfcn.h> +# include <dlfcn.h> #endif #ifdef HAVE_SYSLOG # include <syslog.h> @@ -41,7 +41,7 @@ /* The states of the finite state machine used in fips mode. */ -enum module_states +enum module_states { /* POWEROFF cannot be represented. */ STATE_POWERON = 0, @@ -102,7 +102,7 @@ _gcry_initialize_fips_mode (int force) { static int done; gpg_error_t err; - + /* Make sure we are not accidently called twice. */ if (done) { @@ -144,7 +144,7 @@ _gcry_initialize_fips_mode (int force) if (fp) { char line[256]; - + if (fgets (line, sizeof line, fp) && atoi (line)) { /* System is in fips mode. */ @@ -170,7 +170,7 @@ _gcry_initialize_fips_mode (int force) abort (); } } - + /* Fips not not requested, set flag. */ no_fips_mode_required = 1; @@ -197,14 +197,14 @@ _gcry_initialize_fips_mode (int force) abort (); } - + /* If the FIPS force files exists, is readable and has a number != 0 on its first line, we enable the enforced fips mode. */ fp = fopen (FIPS_FORCE_FILE, "r"); if (fp) { char line[256]; - + if (fgets (line, sizeof line, fp) && atoi (line)) enforced_fips_mode = 1; fclose (fp); @@ -212,7 +212,7 @@ _gcry_initialize_fips_mode (int force) /* Now get us into the INIT state. */ fips_new_state (STATE_INIT); - + } return; } @@ -225,7 +225,7 @@ lock_fsm (void) err = ath_mutex_lock (&fsm_lock); if (err) { - log_info ("FATAL: failed to acquire the FSM lock in libgrypt: %s\n", + log_info ("FATAL: failed to acquire the FSM lock in libgrypt: %s\n", strerror (err)); #ifdef HAVE_SYSLOG syslog (LOG_USER|LOG_ERR, "Libgcrypt error: " @@ -271,7 +271,7 @@ _gcry_fips_mode (void) /* Return a flag telling whether we are in the enforced fips mode. */ -int +int _gcry_enforced_fips_mode (void) { return enforced_fips_mode; @@ -347,7 +347,7 @@ state2str (enum module_states state) /* Return true if the library is in the operational state. */ -int +int _gcry_fips_is_operational (void) { int result; @@ -437,8 +437,8 @@ reporter (const char *domain, int algo, const char *what, const char *errtxt) !strcmp (domain, "digest")? _gcry_md_algo_name (algo) : !strcmp (domain, "hmac")? _gcry_md_algo_name (algo) : !strcmp (domain, "pubkey")? _gcry_pk_algo_name (algo) : "", - algo, errtxt? errtxt:"Okay", - what?" (":"", what? what:"", what?")":""); + algo, errtxt? errtxt:"Okay", + what?" (":"", what? what:"", what?")":""); } /* Run self-tests for all required cipher algorithms. Return 0 on @@ -446,7 +446,7 @@ reporter (const char *domain, int algo, const char *what, const char *errtxt) static int run_cipher_selftests (int extended) { - static int algos[] = + static int algos[] = { GCRY_CIPHER_3DES, GCRY_CIPHER_AES128, @@ -475,7 +475,7 @@ run_cipher_selftests (int extended) static int run_digest_selftests (int extended) { - static int algos[] = + static int algos[] = { GCRY_MD_SHA1, GCRY_MD_SHA224, @@ -504,7 +504,7 @@ run_digest_selftests (int extended) static int run_hmac_selftests (int extended) { - static int algos[] = + static int algos[] = { GCRY_MD_SHA1, GCRY_MD_SHA224, @@ -534,7 +534,7 @@ run_hmac_selftests (int extended) static int run_pubkey_selftests (int extended) { - static int algos[] = + static int algos[] = { GCRY_PK_RSA, GCRY_PK_DSA, @@ -566,7 +566,7 @@ run_random_selftests (void) err = _gcry_random_selftest (reporter); reporter ("random", 0, NULL, err? gpg_strerror (err):NULL); - + return !!err; } @@ -581,7 +581,7 @@ check_binary_integrity (void) int dlen; char *fname = NULL; const char key[] = "What am I, a doctor or a moonshuttle conductor?"; - + if (!dladdr ("gcry_check_version", &info)) err = gpg_error_from_syserror (); else @@ -621,7 +621,7 @@ check_binary_integrity (void) { /* A buffer of 64 bytes plus one for a LF and one to detect garbage. */ - unsigned char buffer[64+1+1]; + unsigned char buffer[64+1+1]; const unsigned char *s; int n; @@ -667,7 +667,7 @@ _gcry_fips_run_selftests (int extended) { enum module_states result = STATE_ERROR; gcry_err_code_t ec = GPG_ERR_SELFTEST_FAILED; - + if (fips_mode ()) fips_new_state (STATE_SELFTEST); @@ -726,14 +726,14 @@ _gcry_fips_signal_error (const char *srcfile, int srcline, const char *srcfunc, /* Print error. */ log_info ("%serror in libgcrypt, file %s, line %d%s%s: %s\n", is_fatal? "fatal ":"", - srcfile, srcline, + srcfile, srcline, srcfunc? ", function ":"", srcfunc? srcfunc:"", description? description : "no description available"); #ifdef HAVE_SYSLOG syslog (LOG_USER|LOG_ERR, "Libgcrypt error: " "%serror in file %s, line %d%s%s: %s", is_fatal? "fatal ":"", - srcfile, srcline, + srcfile, srcline, srcfunc? ", function ":"", srcfunc? srcfunc:"", description? description : "no description available"); #endif /*HAVE_SYSLOG*/ @@ -766,22 +766,22 @@ fips_new_state (enum module_states new_state) || new_state == STATE_FATALERROR) ok = 1; break; - + case STATE_SELFTEST: if (new_state == STATE_OPERATIONAL || new_state == STATE_ERROR || new_state == STATE_FATALERROR) ok = 1; break; - + case STATE_OPERATIONAL: - if (new_state == STATE_SHUTDOWN + if (new_state == STATE_SHUTDOWN || new_state == STATE_SELFTEST || new_state == STATE_ERROR || new_state == STATE_FATALERROR) ok = 1; break; - + case STATE_ERROR: if (new_state == STATE_SHUTDOWN || new_state == STATE_ERROR @@ -789,18 +789,18 @@ fips_new_state (enum module_states new_state) || new_state == STATE_SELFTEST) ok = 1; break; - + case STATE_FATALERROR: if (new_state == STATE_SHUTDOWN ) ok = 1; break; - + case STATE_SHUTDOWN: /* We won't see any transition *from* Shutdown because the only allowed new state is Power-Off and that one can't be represented. */ break; - + } if (ok) @@ -814,12 +814,12 @@ fips_new_state (enum module_states new_state) log_info ("libgcrypt state transition %s => %s %s\n", state2str (last_state), state2str (new_state), ok? "granted":"denied"); - + if (!ok) { /* Invalid state transition. Halting library. */ #ifdef HAVE_SYSLOG - syslog (LOG_USER|LOG_ERR, + syslog (LOG_USER|LOG_ERR, "Libgcrypt error: invalid state transition %s => %s", state2str (last_state), state2str (new_state)); #endif /*HAVE_SYSLOG*/ @@ -828,7 +828,7 @@ fips_new_state (enum module_states new_state) else if (new_state == STATE_ERROR || new_state == STATE_FATALERROR) { #ifdef HAVE_SYSLOG - syslog (LOG_USER|LOG_WARNING, + syslog (LOG_USER|LOG_WARNING, "Libgcrypt notice: state transition %s => %s", state2str (last_state), state2str (new_state)); #endif /*HAVE_SYSLOG*/ diff --git a/src/g10lib.h b/src/g10lib.h index d8e967a6..60773fd8 100644 --- a/src/g10lib.h +++ b/src/g10lib.h @@ -29,7 +29,7 @@ #error gcrypt.h already included #endif -#ifndef _GCRYPT_IN_LIBGCRYPT +#ifndef _GCRYPT_IN_LIBGCRYPT #error something is wrong with config.h #endif @@ -55,15 +55,15 @@ #define JNLIB_GCC_A_NR #define JNLIB_GCC_A_PRINTF( f, a ) #define JNLIB_GCC_A_NR_PRINTF( f, a ) -#define GCC_ATTR_NORETURN +#define GCC_ATTR_NORETURN #endif -#if __GNUC__ >= 3 +#if __GNUC__ >= 3 /* According to glibc this attribute is available since 2.8 however we better play safe and use it only with gcc 3 or newer. */ #define GCC_ATTR_FORMAT_ARG(a) __attribute__ ((format_arg (a))) #else -#define GCC_ATTR_FORMAT_ARG(a) +#define GCC_ATTR_FORMAT_ARG(a) #endif @@ -175,10 +175,10 @@ gcry_mpi_t _gcry_generate_public_prime (unsigned int nbits, gcry_random_level_t random_level, int (*extra_check)(void*, gcry_mpi_t), void *extra_check_arg); -gcry_mpi_t _gcry_generate_elg_prime (int mode, +gcry_mpi_t _gcry_generate_elg_prime (int mode, unsigned int pbits, unsigned int qbits, gcry_mpi_t g, gcry_mpi_t **factors); -gcry_mpi_t _gcry_derive_x931_prime (const gcry_mpi_t xp, +gcry_mpi_t _gcry_derive_x931_prime (const gcry_mpi_t xp, const gcry_mpi_t xp1, const gcry_mpi_t xp2, const gcry_mpi_t e, gcry_mpi_t *r_p1, gcry_mpi_t *r_p2); @@ -188,7 +188,7 @@ gpg_err_code_t _gcry_generate_fips186_2_prime gcry_mpi_t *r_q, gcry_mpi_t *r_p, int *r_counter, void **r_seed, size_t *r_seedlen); -gpg_err_code_t _gcry_generate_fips186_3_prime +gpg_err_code_t _gcry_generate_fips186_3_prime (unsigned int pbits, unsigned int qbits, const void *seed, size_t seedlen, gcry_mpi_t *r_q, gcry_mpi_t *r_p, @@ -312,7 +312,7 @@ gcry_err_code_t _gcry_pk_get_elements (int algo, char **enc, char **sig); /*-- sexp.c --*/ -gcry_error_t _gcry_sexp_vbuild (gcry_sexp_t *retsexp, size_t *erroff, +gcry_error_t _gcry_sexp_vbuild (gcry_sexp_t *retsexp, size_t *erroff, const char *format, va_list arg_ptr); char *_gcry_sexp_nth_string (const gcry_sexp_t list, int number); @@ -330,8 +330,8 @@ void _gcry_inactivate_fips_mode (const char *text); int _gcry_is_fips_mode_inactive (void); -void _gcry_fips_signal_error (const char *srcfile, - int srcline, +void _gcry_fips_signal_error (const char *srcfile, + int srcline, const char *srcfunc, int is_fatal, const char *description); diff --git a/src/gcrypt-module.h b/src/gcrypt-module.h index e717b70c..d8a8cefc 100644 --- a/src/gcrypt-module.h +++ b/src/gcrypt-module.h @@ -1,25 +1,25 @@ /* gcrypt-module.h - GNU Cryptographic Library Interface Copyright (C) 2003, 2007 Free Software Foundation, Inc. - + This file is part of Libgcrypt. - + Libgcrypt is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - + Libgcrypt is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - + You should have received a copy of the GNU Lesser General Public License along with this program; if not, see <http://www.gnu.org/licenses/>. */ /* This file contains the necessary declarations/definitions for - working with Libgcrypt modules. + working with Libgcrypt modules. */ #ifndef _GCRYPT_MODULE_H @@ -35,7 +35,7 @@ extern "C" { /* The interfaces using the module system reserve a certain range of IDs for application use. These IDs are not valid within Libgcrypt but Libgcrypt makes sure never to allocate such a module ID. */ -#define GCRY_MODULE_ID_USER 1024 +#define GCRY_MODULE_ID_USER 1024 #define GCRY_MODULE_ID_USER_LAST 4095 diff --git a/src/gcrypt.h.in b/src/gcrypt.h.in index 1b32de05..f8daeb35 100644 --- a/src/gcrypt.h.in +++ b/src/gcrypt.h.in @@ -1,19 +1,19 @@ /* gcrypt.h - GNU Cryptographic Library Interface -*- c -*- Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2006 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. - + This file is part of Libgcrypt. - + Libgcrypt is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - + Libgcrypt is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - + You should have received a copy of the GNU Lesser General Public License along with this program; if not, see <http://www.gnu.org/licenses/>. @@ -198,7 +198,7 @@ enum gcry_thread_option struct gcry_thread_cbs { /* The OPTION field encodes the thread model and the version number - of this structure. + of this structure. Bits 7 - 0 are used for the thread model Bits 15 - 8 are used for the version number. */ @@ -357,7 +357,7 @@ const char *gcry_check_version (const char *req_version); /* Codes for function dispatchers. */ /* Codes used with the gcry_control function. */ -enum gcry_ctl_cmds +enum gcry_ctl_cmds { GCRYCTL_SET_KEY = 1, GCRYCTL_SET_IV = 2, @@ -422,7 +422,7 @@ enum gcry_ctl_cmds gcry_error_t gcry_control (enum gcry_ctl_cmds CMD, ...); -/* S-expression management. */ +/* S-expression management. */ /* The object to represent an S-expression as used with the public key functions. */ @@ -476,7 +476,7 @@ void gcry_sexp_release (gcry_sexp_t sexp); /* Calculate the length of an canonized S-expresion in BUFFER and check for a valid encoding. */ -size_t gcry_sexp_canon_len (const unsigned char *buffer, size_t length, +size_t gcry_sexp_canon_len (const unsigned char *buffer, size_t length, size_t *erroff, gcry_error_t *errcode); /* Copies the S-expression object SEXP into BUFFER using the format @@ -558,7 +558,7 @@ gcry_mpi_t gcry_sexp_nth_mpi (gcry_sexp_t list, int number, int mpifmt); *******************************************/ /* Different formats of external big integer representation. */ -enum gcry_mpi_format +enum gcry_mpi_format { GCRYMPI_FMT_NONE= 0, GCRYMPI_FMT_STD = 1, /* Twos complement stored without length. */ @@ -569,7 +569,7 @@ enum gcry_mpi_format }; /* Flags used for creating big integers. */ -enum gcry_mpi_flag +enum gcry_mpi_flag { GCRYMPI_FLAG_SECURE = 1, /* Allocate the number in "secure" memory. */ GCRYMPI_FLAG_OPAQUE = 2 /* The number is not a real one but just @@ -614,7 +614,7 @@ int gcry_mpi_cmp_ui (const gcry_mpi_t u, unsigned long v); RET_MPI. If NSCANNED is not NULL, it will receive the number of bytes actually scanned after a successful operation. */ gcry_error_t gcry_mpi_scan (gcry_mpi_t *ret_mpi, enum gcry_mpi_format format, - const void *buffer, size_t buflen, + const void *buffer, size_t buflen, size_t *nscanned); /* Convert the big integer A into the external representation @@ -685,7 +685,7 @@ void gcry_mpi_powm (gcry_mpi_t w, const gcry_mpi_t b, const gcry_mpi_t e, const gcry_mpi_t m); -/* Set G to the greatest common divisor of A and B. +/* Set G to the greatest common divisor of A and B. Return true if the G is 1. */ int gcry_mpi_gcd (gcry_mpi_t g, gcry_mpi_t a, gcry_mpi_t b); @@ -719,7 +719,7 @@ void gcry_mpi_rshift (gcry_mpi_t x, gcry_mpi_t a, unsigned int n); void gcry_mpi_lshift (gcry_mpi_t x, gcry_mpi_t a, unsigned int n); /* Store NBITS of the value P points to in A and mark A as an opaque - value. WARNING: Never use an opaque MPI for anything thing else then + value. WARNING: Never use an opaque MPI for anything thing else then gcry_mpi_release, gcry_mpi_get_opaque. */ gcry_mpi_t gcry_mpi_set_opaque (gcry_mpi_t a, void *p, unsigned int nbits); @@ -758,7 +758,7 @@ int gcry_mpi_get_flag (gcry_mpi_t a, enum gcry_mpi_flag flag); #define mpi_set_ui( w, u) gcry_mpi_set_ui( (w), (u) ) #define mpi_cmp( u, v ) gcry_mpi_cmp( (u), (v) ) #define mpi_cmp_ui( u, v ) gcry_mpi_cmp_ui( (u), (v) ) - + #define mpi_add_ui(w,u,v) gcry_mpi_add_ui((w),(u),(v)) #define mpi_add(w,u,v) gcry_mpi_add ((w),(u),(v)) #define mpi_addm(w,u,v,m) gcry_mpi_addm ((w),(u),(v),(m)) @@ -838,15 +838,15 @@ enum gcry_cipher_algos }; /* The Rijndael algorithm is basically AES, so provide some macros. */ -#define GCRY_CIPHER_AES128 GCRY_CIPHER_AES -#define GCRY_CIPHER_RIJNDAEL GCRY_CIPHER_AES -#define GCRY_CIPHER_RIJNDAEL128 GCRY_CIPHER_AES128 -#define GCRY_CIPHER_RIJNDAEL192 GCRY_CIPHER_AES192 -#define GCRY_CIPHER_RIJNDAEL256 GCRY_CIPHER_AES256 +#define GCRY_CIPHER_AES128 GCRY_CIPHER_AES +#define GCRY_CIPHER_RIJNDAEL GCRY_CIPHER_AES +#define GCRY_CIPHER_RIJNDAEL128 GCRY_CIPHER_AES128 +#define GCRY_CIPHER_RIJNDAEL192 GCRY_CIPHER_AES192 +#define GCRY_CIPHER_RIJNDAEL256 GCRY_CIPHER_AES256 /* The supported encryption modes. Note that not all of them are supported for each algorithm. */ -enum gcry_cipher_modes +enum gcry_cipher_modes { GCRY_CIPHER_MODE_NONE = 0, /* Not yet specified. */ GCRY_CIPHER_MODE_ECB = 1, /* Electronic codebook. */ @@ -858,7 +858,7 @@ enum gcry_cipher_modes GCRY_CIPHER_MODE_AESWRAP= 7 /* AES-WRAP algorithm. */ }; -/* Flags used with the open function. */ +/* Flags used with the open function. */ enum gcry_cipher_flags { GCRY_CIPHER_SECURE = 1, /* Allocate in secure memory. */ @@ -967,7 +967,7 @@ gcry_error_t gcry_cipher_list (int *list, int *list_length); ************************************/ /* The algorithms and their IDs we support. */ -enum gcry_pk_algos +enum gcry_pk_algos { GCRY_PK_RSA = 1, GCRY_PK_RSA_E = 2, /* (deprecated) */ @@ -980,11 +980,11 @@ enum gcry_pk_algos }; /* Flags describing usage capabilities of a PK algorithm. */ -#define GCRY_PK_USAGE_SIGN 1 /* Good for signatures. */ -#define GCRY_PK_USAGE_ENCR 2 /* Good for encryption. */ +#define GCRY_PK_USAGE_SIGN 1 /* Good for signatures. */ +#define GCRY_PK_USAGE_ENCR 2 /* Good for encryption. */ #define GCRY_PK_USAGE_CERT 4 /* Good to certify other keys. */ -#define GCRY_PK_USAGE_AUTH 8 /* Good for authentication. */ -#define GCRY_PK_USAGE_UNKN 128 /* Unknown usage flag. */ +#define GCRY_PK_USAGE_AUTH 8 /* Good for authentication. */ +#define GCRY_PK_USAGE_UNKN 128 /* Unknown usage flag. */ /* Encrypt the DATA using the public key PKEY and store the result as a newly created S-expression at RESULT. */ @@ -1069,7 +1069,7 @@ gcry_error_t gcry_pk_list (int *list, int *list_length); are implemnted. */ enum gcry_md_algos { - GCRY_MD_NONE = 0, + GCRY_MD_NONE = 0, GCRY_MD_MD5 = 1, GCRY_MD_SHA1 = 2, GCRY_MD_RMD160 = 3, @@ -1102,11 +1102,11 @@ struct gcry_md_context; /* This object is used to hold a handle to a message digest object. This structure is private - only to be used by the public gcry_md_* macros. */ -typedef struct gcry_md_handle +typedef struct gcry_md_handle { /* Actual context. */ struct gcry_md_context *ctx; - + /* Buffer management. */ int bufpos; int bufsize; @@ -1612,7 +1612,7 @@ gcry_error_t gcry_ac_data_verify_scheme (gcry_ac_handle_t handle, gcry_pk_algo_name. */ #ifndef GCRYPT_NO_DEPRECATED gcry_error_t gcry_ac_id_to_name (gcry_ac_id_t algorithm, - const char **name) + const char **name) /* */ _GCRY_GCC_ATTR_DEPRECATED; /* Store the numeric ID of the algorithm whose textual representation is contained in NAME in ALGORITHM. This function is deprecated; @@ -1750,7 +1750,7 @@ gcry_error_t gcry_prime_check (gcry_mpi_t x, unsigned int flags); ************************************/ /* Log levels used by the internal logging facility. */ -enum gcry_log_levels +enum gcry_log_levels { GCRY_LOG_CONT = 0, /* (Continue the last log line.) */ GCRY_LOG_INFO = 10, diff --git a/src/gcryptrnd.c b/src/gcryptrnd.c index 34c24733..b13931b6 100644 --- a/src/gcryptrnd.c +++ b/src/gcryptrnd.c @@ -118,7 +118,7 @@ my_gcry_logger (void *dummy, int level, const char *format, va_list arg_ptr) case GCRY_LOG_FATAL:level = LOG_CRIT; break; case GCRY_LOG_BUG: level = LOG_CRIT; break; case GCRY_LOG_DEBUG:level = LOG_DEBUG; break; - default: level = LOG_ERR; break; + default: level = LOG_ERR; break; } if (running_detached) { @@ -152,24 +152,24 @@ daemonize (void) fflush (NULL); pid = fork (); - if (pid == (pid_t)-1) + if (pid == (pid_t)-1) { logit (LOG_CRIT, "fork failed: %s", strerror (errno)); exit (1); } if (pid) - exit (0); + exit (0); if (setsid() == -1) { logit (LOG_CRIT, "setsid() failed: %s", strerror(errno)); exit (1); } - + signal (SIGHUP, SIG_IGN); pid = fork (); - if (pid == (pid_t)-1) + if (pid == (pid_t)-1) { logit (LOG_CRIT, PGM ": second fork failed: %s", strerror (errno)); exit (1); @@ -221,7 +221,7 @@ print_version (int with_help) "This is free software: you are free to change and redistribute it.\n" "There is NO WARRANTY, to the extent permitted by law.\n", stdout); - + if (with_help) fputs ("\n" "Usage: " PGM " [OPTIONS] [SOCKETNAME]\n" @@ -229,11 +229,11 @@ print_version (int with_help) " on socket SOCKETNAME\n" "SOCKETNAME defaults to XXX\n" "\n" - " --no-detach do not deatach from the console\n" + " --no-detach do not deatach from the console\n" " --version print version of the program and exit\n" " --help display this help and exit\n" BUGREPORT_LINE, stdout ); - + exit (0); } @@ -246,7 +246,7 @@ print_usage (void) } -int +int main (int argc, char **argv) { int no_detach = 0; @@ -257,7 +257,7 @@ main (int argc, char **argv) int rc; const char *socketname = "/var/run/libgcrypt/S.gcryptrnd"; - + if (argc) { argc--; argv++; @@ -280,8 +280,8 @@ main (int argc, char **argv) } else print_usage (); - } - + } + if (argc == 1) socketname = argv[0]; else if (argc > 1) @@ -336,7 +336,7 @@ main (int argc, char **argv) logit (LOG_CRIT, "can't create socket: %s", strerror (errno)); exit (1); } - srvr_addr = gcry_xmalloc (sizeof *srvr_addr); + srvr_addr = gcry_xmalloc (sizeof *srvr_addr); memset (srvr_addr, 0, sizeof *srvr_addr); srvr_addr->sun_family = AF_UNIX; if (strlen (socketname) + 1 >= sizeof (srvr_addr->sun_path)) @@ -367,7 +367,7 @@ main (int argc, char **argv) close (fd); exit (1); } - + logit (LOG_INFO, "listening on socket `%s', fd=%d", srvr_addr->sun_path, fd); @@ -556,7 +556,7 @@ connection_thread (void *arg) close (fd); logit (LOG_INFO, "connection handler for fd %d terminated", fd); active_connections--; - + return NULL; } @@ -573,11 +573,11 @@ handle_signal (int signo) case SIGHUP: logit (LOG_NOTICE, "SIGHUP received - re-reading configuration"); break; - + case SIGUSR1: logit (LOG_NOTICE, "SIGUSR1 received - no action defined"); break; - + case SIGUSR2: logit (LOG_NOTICE, "SIGUSR2 received - no action defined"); break; @@ -595,7 +595,7 @@ handle_signal (int signo) return 1; } break; - + case SIGINT: logit (LOG_NOTICE, "SIGINT received - immediate shutdown"); return 1; @@ -675,7 +675,6 @@ serve (int listen_fd) close (fd); } } - + pth_event_free (ev, PTH_FREE_ALL); } - diff --git a/src/getrandom.c b/src/getrandom.c index f4c9b4b2..f9bb5c0c 100644 --- a/src/getrandom.c +++ b/src/getrandom.c @@ -56,7 +56,7 @@ writen (int fd, const void *buffer, size_t length) while (length) { ssize_t n; - + do n = write (fd, buffer, length); while (n < 0 && errno == EINTR); @@ -84,7 +84,7 @@ print_version (int with_help) "This is free software: you are free to change and redistribute it.\n" "There is NO WARRANTY, to the extent permitted by law.\n", stdout); - + if (with_help) fputs ("\n" "Usage: " PGM " [OPTIONS] NBYTES\n" @@ -94,13 +94,13 @@ print_version (int with_help) " --nonce Return weak random suitable for a nonce\n" " --very-strong Return very strong random\n" " --ping Send a ping\n" - " --socket NAME Name of sockket to connect to\n" + " --socket NAME Name of sockket to connect to\n" " --hex Return result as a hex dump\n" " --verbose Show what we are doing\n" " --version Print version of the program and exit\n" " --help Display this help and exit\n" BUGREPORT_LINE, stdout ); - + exit (0); } @@ -113,7 +113,7 @@ print_usage (void) } -int +int main (int argc, char **argv) { struct sockaddr_un *srvr_addr; @@ -130,7 +130,7 @@ main (int argc, char **argv) int verbose = 0; int fail = 0; int do_hex = 0; - + if (argc) { argc--; argv++; @@ -179,15 +179,15 @@ main (int argc, char **argv) } else print_usage (); - } + } + - if (!argc && do_ping) ; /* This is allowed. */ else if (argc != 1) print_usage (); req_nbytes = argc? atoi (*argv) : 0; - + if (req_nbytes < 0) print_usage (); @@ -198,7 +198,7 @@ main (int argc, char **argv) logit ("can't create socket: %s", strerror (errno)); exit (1); } - srvr_addr = malloc (sizeof *srvr_addr); + srvr_addr = malloc (sizeof *srvr_addr); if (!srvr_addr) { logit ("malloc failed: %s", strerror (errno)); @@ -244,7 +244,7 @@ main (int argc, char **argv) { for (nleft=2, nread=0; nleft > 0; ) { - do + do n = read (fd, buffer+nread, nleft); while (n < 0 && errno == EINTR); if (n < 0) @@ -281,7 +281,7 @@ main (int argc, char **argv) for (nleft=nbytes, nread=0; nleft > 0; ) { - do + do n = read (fd, buffer+nread, nleft); while (n < 0 && errno == EINTR); if (n < 0) @@ -324,4 +324,3 @@ main (int argc, char **argv) free (srvr_addr); return fail? 1 : 0; } - diff --git a/src/global.c b/src/global.c index 2944b2c5..096ac98c 100644 --- a/src/global.c +++ b/src/global.c @@ -87,7 +87,7 @@ global_init (void) err = ath_init (); if (err) goto fail; - + /* See whether the system is in FIPS mode. This needs to come as early as possible put after the ATH has been initialized. */ _gcry_initialize_fips_mode (force_fips_mode); @@ -126,7 +126,7 @@ global_init (void) sure that the minimal initialization has been done. This is far from a perfect solution and hides problems with an improper initialization but at least in single-threaded mode it should work - reliable. + reliable. The reason we need this is that a lot of applications don't use Libgcrypt properly by not running any initialization code at all. @@ -266,7 +266,7 @@ print_config ( int (*fnc)(FILE *fp, const char *format, ...), FILE *fp) { HWF_PADLOCK_AES, "padlock-aes" }, { HWF_PADLOCK_SHA, "padlock-sha" }, { HWF_INTEL_AES, "intel-aes" }, - { 0, NULL} + { 0, NULL} }; int i; @@ -298,7 +298,7 @@ print_config ( int (*fnc)(FILE *fp, const char *format, ...), FILE *fp) /* We use y/n instead of 1/0 for the simple reason that Emacsen's compile error parser would accidently flag that line when printed during "make check" as an error. */ - fnc (fp, "fips-mode:%c:%c:\n", + fnc (fp, "fips-mode:%c:%c:\n", fips_mode ()? 'y':'n', _gcry_enforced_fips_mode ()? 'y':'n' ); } @@ -313,7 +313,7 @@ _gcry_vcontrol (enum gcry_ctl_cmds cmd, va_list arg_ptr) { static int init_finished = 0; gcry_err_code_t err = 0; - + switch (cmd) { case GCRYCTL_ENABLE_M_GUARD: @@ -351,7 +351,7 @@ _gcry_vcontrol (enum gcry_ctl_cmds cmd, va_list arg_ptr) case GCRYCTL_DISABLE_SECMEM: global_init (); no_secure_memory = 1; - break; + break; case GCRYCTL_INIT_SECMEM: global_init (); @@ -451,7 +451,7 @@ _gcry_vcontrol (enum gcry_ctl_cmds cmd, va_list arg_ptr) _gcry_random_initialize (1); if ( fips_is_operational () ) - _gcry_fast_random_poll (); + _gcry_fast_random_poll (); break; case GCRYCTL_SET_RNDEGD_SOCKET: @@ -472,7 +472,7 @@ _gcry_vcontrol (enum gcry_ctl_cmds cmd, va_list arg_ptr) _gcry_random_initialize (1); _gcry_use_random_daemon (!! va_arg (arg_ptr, int)); break; - + /* This command dumps information pertaining to the configuration of libgcrypt to the given stream. It may be used before the initialization has been finished but not @@ -492,8 +492,8 @@ _gcry_vcontrol (enum gcry_ctl_cmds cmd, va_list arg_ptr) break; case GCRYCTL_FIPS_MODE_P: - if (fips_mode () - && !_gcry_is_fips_mode_inactive () + if (fips_mode () + && !_gcry_is_fips_mode_inactive () && !no_secure_memory) err = GPG_ERR_GENERAL; /* Used as TRUE value */ break; @@ -509,7 +509,7 @@ _gcry_vcontrol (enum gcry_ctl_cmds cmd, va_list arg_ptr) into fips mode during initialization. */ force_fips_mode = 1; } - else + else { /* Already initialized. If we are already operational we run a selftest. If not we use the is_operational call to @@ -583,7 +583,7 @@ gcry_control (enum gcry_ctl_cmds cmd, ...) { gcry_error_t err; va_list arg_ptr; - + va_start (arg_ptr, cmd); err = _gcry_vcontrol (cmd, arg_ptr); va_end(arg_ptr); @@ -626,7 +626,7 @@ gcry_err_code_to_errno (gcry_err_code_t code) return gpg_err_code_from_errno (code); } - + /* Return an error value with the error source SOURCE and the system error ERR. */ gcry_error_t @@ -699,7 +699,7 @@ gcry_set_outofcore_handler( int (*f)( void*, size_t, unsigned int ), log_info ("out of core handler ignored in FIPS mode\n"); return; } - + outofcore_handler = f; outofcore_handler_value = value; } @@ -753,7 +753,7 @@ do_malloc (size_t n, unsigned int flags, void **mem) return err; } - + void * gcry_malloc (size_t n) { @@ -788,7 +788,7 @@ void _gcry_check_heap( const void *a ) { (void)a; - + /* FIXME: implement this*/ #if 0 if( some_handler ) @@ -841,7 +841,7 @@ gcry_calloc (size_t n, size_t m) bytes = n * m; /* size_t is unsigned so the behavior on overflow is defined. */ - if (m && bytes / m != n) + if (m && bytes / m != n) { gpg_err_set_errno (ENOMEM); return NULL; @@ -861,12 +861,12 @@ gcry_calloc_secure (size_t n, size_t m) bytes = n * m; /* size_t is unsigned so the behavior on overflow is defined. */ - if (m && bytes / m != n) + if (m && bytes / m != n) { gpg_err_set_errno (ENOMEM); return NULL; } - + p = gcry_malloc_secure (bytes); if (p) memset (p, 0, bytes); @@ -890,7 +890,7 @@ gcry_strdup (const char *string) string_cp = gcry_malloc_secure (string_n + 1); else string_cp = gcry_malloc (string_n + 1); - + if (string_cp) strcpy (string_cp, string); @@ -902,10 +902,10 @@ void * gcry_xmalloc( size_t n ) { void *p; - - while ( !(p = gcry_malloc( n )) ) + + while ( !(p = gcry_malloc( n )) ) { - if ( fips_mode () + if ( fips_mode () || !outofcore_handler || !outofcore_handler (outofcore_handler_value, n, 0) ) { @@ -919,7 +919,7 @@ void * gcry_xrealloc( void *a, size_t n ) { void *p; - + while ( !(p = gcry_realloc( a, n )) ) { if ( fips_mode () @@ -937,8 +937,8 @@ void * gcry_xmalloc_secure( size_t n ) { void *p; - - while ( !(p = gcry_malloc_secure( n )) ) + + while ( !(p = gcry_malloc_secure( n )) ) { if ( fips_mode () || !outofcore_handler @@ -958,8 +958,8 @@ gcry_xcalloc( size_t n, size_t m ) size_t nbytes; void *p; - nbytes = n * m; - if (m && nbytes / m != n) + nbytes = n * m; + if (m && nbytes / m != n) { gpg_err_set_errno (ENOMEM); _gcry_fatal_error(gpg_err_code_from_errno (errno), NULL ); @@ -976,8 +976,8 @@ gcry_xcalloc_secure( size_t n, size_t m ) size_t nbytes; void *p; - nbytes = n * m; - if (m && nbytes / m != n) + nbytes = n * m; + if (m && nbytes / m != n) { gpg_err_set_errno (ENOMEM); _gcry_fatal_error(gpg_err_code_from_errno (errno), NULL ); @@ -992,15 +992,15 @@ char * gcry_xstrdup (const char *string) { char *p; - - while ( !(p = gcry_strdup (string)) ) + + while ( !(p = gcry_strdup (string)) ) { size_t n = strlen (string); int is_sec = !!gcry_is_secure (string); - + if (fips_mode () || !outofcore_handler - || !outofcore_handler (outofcore_handler_value, n, is_sec) ) + || !outofcore_handler (outofcore_handler_value, n, is_sec) ) { _gcry_fatal_error (gpg_err_code_from_errno (errno), is_sec? _("out of core in secure memory"):NULL); @@ -1022,7 +1022,7 @@ _gcry_get_debug_flag (unsigned int mask) /* It is often useful to get some feedback of long running operations. - This function may be used to register a handler for this. + This function may be used to register a handler for this. The callback function CB is used as: void cb (void *opaque, const char *what, int printchar, @@ -1051,10 +1051,10 @@ _gcry_get_debug_flag (unsigned int mask) ':' Restart with a new random value '+' - Rabin Miller test passed + Rabin Miller test passed "pk_elg" '+','-','.','\n' 0 0 Only used in debugging mode. - "pk_dsa" + "pk_dsa" Only used in debugging mode. */ void diff --git a/src/hmac256.c b/src/hmac256.c index 6e31d200..f3bc0924 100644 --- a/src/hmac256.c +++ b/src/hmac256.c @@ -17,7 +17,7 @@ * License along with this program; if not, see <http://www.gnu.org/licenses/>. */ -/* +/* This is a standalone HMAC-SHA-256 implementation based on the code from ../cipher/sha256.c. It is a second implementation to allow comparing against the standard implementations and to be used for @@ -33,7 +33,7 @@ Constants: - WORDS_BIGENDIAN Defined to 1 on big endian systems. + WORDS_BIGENDIAN Defined to 1 on big endian systems. inline If defined, it should yield the keyword used to inline a function. HAVE_U32_TYPEDEF Defined if the u32 type is available. @@ -91,7 +91,7 @@ struct hmac256_context u32 nblocks; int count; int finalized:1; - int use_hmac:1; + int use_hmac:1; unsigned char buf[64]; unsigned char opad[64]; }; @@ -121,7 +121,7 @@ ror(u32 x, int n) -/* +/* The SHA-256 core: Transform the message X which consists of 16 32-bit-words. See FIPS 180-2 for details. */ @@ -149,13 +149,13 @@ transform (hmac256_context_t hd, const void *data_arg) b = a; \ a = t1 + t2; \ } while (0) - - static const u32 K[64] = + + static const u32 K[64] = { 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, - 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, + 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, @@ -174,7 +174,7 @@ transform (hmac256_context_t hd, const void *data_arg) u32 x[16]; u32 w[64]; int i; - + a = hd->h0; b = hd->h1; c = hd->h2; @@ -183,14 +183,14 @@ transform (hmac256_context_t hd, const void *data_arg) f = hd->h5; g = hd->h6; h = hd->h7; - + #ifdef WORDS_BIGENDIAN memcpy (x, data, 64); #else /*!WORDS_BIGENDIAN*/ - { + { unsigned char *p2; - - for (i=0, p2=(unsigned char*)x; i < 16; i++, p2 += 4 ) + + for (i=0, p2=(unsigned char*)x; i < 16; i++, p2 += 4 ) { p2[3] = *data++; p2[2] = *data++; @@ -232,7 +232,7 @@ finalize (hmac256_context_t hd) { u32 t, msb, lsb; unsigned char *p; - + if (hd->finalized) return; /* Silently ignore a finalized context. */ @@ -336,7 +336,7 @@ _gcry_hmac256_new (const void *key, size_t keylen) else { hmac256_context_t tmphd; - + tmphd = _gcry_hmac256_new (NULL, 0); if (!tmphd) { @@ -349,7 +349,7 @@ _gcry_hmac256_new (const void *key, size_t keylen) memcpy (hd->opad, tmphd->buf, 32); _gcry_hmac256_release (tmphd); } - for (i=0; i < 64; i++) + for (i=0; i < 64; i++) { ipad[i] ^= 0x36; hd->opad[i] ^= 0x5c; @@ -358,7 +358,7 @@ _gcry_hmac256_new (const void *key, size_t keylen) _gcry_hmac256_update (hd, ipad, 64); my_wipememory (ipad, 64); } - + return hd; } @@ -389,7 +389,7 @@ _gcry_hmac256_update (hmac256_context_t hd, return; /* Silently ignore a finalized context. */ if (hd->count == 64) - { + { /* Flush the buffer. */ transform (hd, hd->buf); hd->count = 0; @@ -431,7 +431,7 @@ _gcry_hmac256_finalize (hmac256_context_t hd, size_t *r_dlen) if (hd->use_hmac) { hmac256_context_t tmphd; - + tmphd = _gcry_hmac256_new (NULL, 0); if (!tmphd) { @@ -456,7 +456,7 @@ _gcry_hmac256_finalize (hmac256_context_t hd, size_t *r_dlen) FILENAME. KEY and KEYLEN are as described for _gcry_hmac256_new. On success the function returns the valid length of the result buffer (which will be 32) or -1 on error. On error ERRNO is set - appropriate. */ + appropriate. */ int _gcry_hmac256_file (void *result, size_t resultsize, const char *filename, const void *key, size_t keylen) @@ -466,7 +466,7 @@ _gcry_hmac256_file (void *result, size_t resultsize, const char *filename, size_t buffer_size, nread, digestlen; char *buffer; const unsigned char *digest; - + fp = fopen (filename, "rb"); if (!fp) return -1; @@ -507,7 +507,7 @@ _gcry_hmac256_file (void *result, size_t resultsize, const char *filename, _gcry_hmac256_release (hd); return -1; } - + if (digestlen > resultsize) { _gcry_hmac256_release (hd); @@ -526,7 +526,7 @@ _gcry_hmac256_file (void *result, size_t resultsize, const char *filename, static int selftest (void) { - static struct + static struct { const char * const desc; const char * const data; @@ -535,7 +535,7 @@ selftest (void) } tv[] = { { "data-28 key-4", - "what do ya want for nothing?", + "what do ya want for nothing?", "Jefe", { 0x5b, 0xdc, 0xc1, 0x46, 0xbf, 0x60, 0x75, 0x4e, 0x6a, 0x04, 0x24, 0x26, 0x08, 0x95, 0x75, 0xc7, @@ -612,7 +612,7 @@ selftest (void) { NULL } }; int tvidx; - + for (tvidx=0; tv[tvidx].desc; tvidx++) { hmac256_context_t hmachd; @@ -637,12 +637,12 @@ selftest (void) } _gcry_hmac256_release (hmachd); } - + return 0; /* Succeeded. */ } -int +int main (int argc, char **argv) { const char *pgm; @@ -699,7 +699,7 @@ main (int argc, char **argv) argc--; argv++; use_binary = 1; } - } + } if (argc < 1) { @@ -729,14 +729,14 @@ main (int argc, char **argv) fp = use_stdin? stdin : fopen (fname, "rb"); if (!fp) { - fprintf (stderr, "%s: can't open `%s': %s\n", + fprintf (stderr, "%s: can't open `%s': %s\n", pgm, fname, strerror (errno)); exit (1); } hd = _gcry_hmac256_new (key, keylen); if (!hd) { - fprintf (stderr, "%s: can't allocate context: %s\n", + fprintf (stderr, "%s: can't allocate context: %s\n", pgm, strerror (errno)); exit (1); } @@ -744,7 +744,7 @@ main (int argc, char **argv) _gcry_hmac256_update (hd, buffer, n); if (ferror (fp)) { - fprintf (stderr, "%s: error reading `%s': %s\n", + fprintf (stderr, "%s: error reading `%s': %s\n", pgm, fname, strerror (errno)); exit (1); } @@ -762,7 +762,7 @@ main (int argc, char **argv) { if (fwrite (digest, dlen, 1, stdout) != 1) { - fprintf (stderr, "%s: error writing output: %s\n", + fprintf (stderr, "%s: error writing output: %s\n", pgm, strerror (errno)); exit (1); } diff --git a/src/hwfeatures.c b/src/hwfeatures.c index da5d303a..99c9347e 100644 --- a/src/hwfeatures.c +++ b/src/hwfeatures.c @@ -48,7 +48,7 @@ detect_ia32_gnuc (void) build it if that support has been disabled. */ int has_cpuid = 0; char vendor_id[12+1]; - + /* Detect the CPUID feature by testing some undefined behaviour (16 vs 32 bit pushf/popf). */ asm volatile @@ -56,9 +56,9 @@ detect_ia32_gnuc (void) "popl %%eax\n\t" "movl %%eax, %%ecx\n\t" /* Save flags into ECX. */ "xorl $0x200000, %%eax\n\t" /* Toggle ID bit and copy it to the flags. */ - "pushl %%eax\n\t" - "popf\n\t" - "pushf\n\t" /* Copy changed flags again to EAX. */ + "pushl %%eax\n\t" + "popf\n\t" + "pushf\n\t" /* Copy changed flags again to EAX. */ "popl %%eax\n\t" "pushl %%ecx\n\t" /* Restore flags from ECX. */ "popf\n\t" @@ -70,10 +70,10 @@ detect_ia32_gnuc (void) : : "%eax", "%ecx", "cc" ); - + if (!has_cpuid) return; /* No way. */ - + asm volatile ("pushl %%ebx\n\t" /* Save GOT register. */ "xorl %%eax, %%eax\n\t" /* 0 -> EAX. */ @@ -90,11 +90,11 @@ detect_ia32_gnuc (void) if (0) ; /* Just to make "else if" and ifdef macros look pretty. */ -#ifdef ENABLE_PADLOCK_SUPPORT +#ifdef ENABLE_PADLOCK_SUPPORT else if (!strcmp (vendor_id, "CentaurHauls")) { /* This is a VIA CPU. Check what PadLock features we have. */ - asm volatile + asm volatile ("pushl %%ebx\n\t" /* Save GOT register. */ "movl $0xC0000000, %%eax\n\t" /* Check for extended centaur */ "cpuid\n\t" /* feature flags. */ @@ -144,7 +144,7 @@ detect_ia32_gnuc (void) else if (!strcmp (vendor_id, "GenuineIntel")) { /* This is an Intel CPU. */ - asm volatile + asm volatile ("pushl %%ebx\n\t" /* Save GOT register. */ "movl $1, %%eax\n\t" /* Get CPU info and feature flags. */ "cpuid\n" @@ -177,14 +177,14 @@ _gcry_detect_hw_features (void) hw_features = 0; if (fips_mode ()) - return; /* Hardware support is not to be evaluated. */ + return; /* Hardware support is not to be evaluated. */ #if defined (__i386__) && SIZEOF_UNSIGNED_LONG == 4 -#ifdef __GNUC__ +#ifdef __GNUC__ detect_ia32_gnuc (); #endif #elif defined (__i386__) && SIZEOF_UNSIGNED_LONG == 8 -#ifdef __GNUC__ +#ifdef __GNUC__ #endif #endif } diff --git a/src/libgcrypt.def b/src/libgcrypt.def index 3db4cb5a..ac3d575e 100644 --- a/src/libgcrypt.def +++ b/src/libgcrypt.def @@ -1,6 +1,6 @@ ;; libgcrypt.defs - Exported symbols for W32 ;; Copyright (C) 2003, 2007 Free Software Foundation, Inc. -;; +;; ;; This file is part of Libgcrypt. ;; ;; Libgcrypt is free software; you can redistribute it and/or modify @@ -25,7 +25,7 @@ EXPORTS gcry_check_version @1 gcry_control @2 - + gcry_malloc @3 gcry_calloc @4 gcry_malloc_secure @5 @@ -40,21 +40,21 @@ EXPORTS gcry_xstrdup @14 gcry_is_secure @15 gcry_free @16 - + gcry_set_progress_handler @17 gcry_set_allocation_handler @18 gcry_set_outofcore_handler @19 gcry_set_fatalerror_handler @20 gcry_set_log_handler @21 gcry_set_gettext_handler @22 - + gcry_strerror @23 gcry_strsource @24 gcry_err_code_from_errno @25 gcry_err_code_to_errno @26 gcry_err_make_from_errno @27 gcry_error_from_errno @28 - + gcry_sexp_new @29 gcry_sexp_create @30 gcry_sexp_sscan @31 @@ -77,7 +77,7 @@ EXPORTS gcry_sexp_cadr @48 gcry_sexp_nth_data @49 gcry_sexp_nth_mpi @50 - + gcry_mpi_new @51 gcry_mpi_snew @52 gcry_mpi_release @53 @@ -119,7 +119,7 @@ EXPORTS gcry_mpi_clear_flag @89 gcry_mpi_get_flag @90 - + gcry_cipher_open @92 gcry_cipher_close @93 gcry_cipher_ctl @94 @@ -133,7 +133,7 @@ EXPORTS gcry_cipher_get_algo_keylen @102 gcry_cipher_get_algo_blklen @103 gcry_cipher_list @104 - + gcry_pk_encrypt @105 gcry_pk_decrypt @106 gcry_pk_sign @107 @@ -147,7 +147,7 @@ EXPORTS gcry_pk_get_nbits @115 gcry_pk_get_keygrip @116 gcry_pk_list @117 - + gcry_ac_data_new @118 gcry_ac_data_destroy @119 gcry_ac_data_set @120 @@ -173,7 +173,7 @@ EXPORTS gcry_ac_data_verify @140 gcry_ac_id_to_name @141 gcry_ac_name_to_id @142 - + gcry_md_open @143 gcry_md_close @144 gcry_md_enable @145 @@ -193,13 +193,13 @@ EXPORTS gcry_md_map_name @159 gcry_md_setkey @160 gcry_md_list @161 - + gcry_randomize @162 gcry_random_add_bytes @163 gcry_random_bytes @164 gcry_random_bytes_secure @165 gcry_mpi_randomize @166 - + gcry_prime_generate @167 gcry_prime_group_generator @168 gcry_prime_release_factors @169 @@ -215,7 +215,7 @@ EXPORTS gcry_md_unregister @176 gcry_pk_register @177 gcry_pk_unregister @178 - + gcry_ac_data_from_sexp @179 gcry_ac_data_to_sexp @180 gcry_ac_io_init @181 diff --git a/src/libgcrypt.m4 b/src/libgcrypt.m4 index 854eaaa8..0f60165a 100644 --- a/src/libgcrypt.m4 +++ b/src/libgcrypt.m4 @@ -15,7 +15,7 @@ dnl [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]]) dnl Test for libgcrypt and define LIBGCRYPT_CFLAGS and LIBGCRYPT_LIBS. dnl MINIMUN-VERSION is a string with the version number optionalliy prefixed dnl with the API version to also check the API compatibility. Example: -dnl a MINIMUN-VERSION of 1:1.2.5 won't pass the test unless the installed +dnl a MINIMUN-VERSION of 1:1.2.5 won't pass the test unless the installed dnl version of libgcrypt is at least 1.2.5 *and* the API number is 1. Using dnl this features allows to prevent build against newer versions of libgcrypt dnl with a changed API. @@ -59,7 +59,7 @@ AC_DEFUN([AM_PATH_LIBGCRYPT], sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'` if test "$major" -gt "$req_major"; then ok=yes - else + else if test "$major" -eq "$req_major"; then if test "$minor" -gt "$req_minor"; then ok=yes diff --git a/src/libgcrypt.vers b/src/libgcrypt.vers index f2a3513d..fbeb47bd 100644 --- a/src/libgcrypt.vers +++ b/src/libgcrypt.vers @@ -26,24 +26,24 @@ GCRYPT_1.2 { gcry_set_allocation_handler; gcry_set_fatalerror_handler; gcry_set_gettext_handler; gcry_set_log_handler; gcry_set_outofcore_handler; gcry_set_progress_handler; - + gcry_err_code_from_errno; gcry_err_code_to_errno; gcry_err_make_from_errno; gcry_error_from_errno; gcry_strerror; gcry_strsource; - + gcry_free; gcry_malloc; gcry_malloc_secure; gcry_calloc; gcry_calloc_secure; gcry_realloc; gcry_strdup; gcry_is_secure; gcry_xcalloc; gcry_xcalloc_secure; gcry_xmalloc; gcry_xmalloc_secure; gcry_xrealloc; gcry_xstrdup; - + gcry_md_algo_info; gcry_md_algo_name; gcry_md_close; gcry_md_copy; gcry_md_ctl; gcry_md_enable; gcry_md_get; gcry_md_get_algo; gcry_md_get_algo_dlen; gcry_md_hash_buffer; gcry_md_info; gcry_md_is_enabled; gcry_md_is_secure; gcry_md_list; gcry_md_map_name; gcry_md_open; gcry_md_read; - gcry_md_register; gcry_md_reset; gcry_md_setkey; + gcry_md_register; gcry_md_reset; gcry_md_setkey; gcry_md_unregister; gcry_md_write; gcry_md_debug; - + gcry_cipher_algo_info; gcry_cipher_algo_name; gcry_cipher_close; gcry_cipher_ctl; gcry_cipher_decrypt; gcry_cipher_encrypt; gcry_cipher_get_algo_blklen; gcry_cipher_get_algo_keylen; @@ -51,7 +51,7 @@ GCRYPT_1.2 { gcry_cipher_mode_from_oid; gcry_cipher_open; gcry_cipher_register; gcry_cipher_unregister; gcry_cipher_setkey; gcry_cipher_setiv; gcry_cipher_setctr; - + gcry_pk_algo_info; gcry_pk_algo_name; gcry_pk_ctl; gcry_pk_decrypt; gcry_pk_encrypt; gcry_pk_genkey; gcry_pk_get_keygrip; gcry_pk_get_nbits; gcry_pk_list; @@ -69,18 +69,18 @@ GCRYPT_1.2 { gcry_ac_data_sign; gcry_ac_data_verify; gcry_ac_id_to_name; gcry_ac_name_to_id; gcry_ac_list; gcry_ac_data_encode; gcry_ac_data_decode; gcry_ac_mpi_to_os; gcry_ac_mpi_to_os_alloc; - gcry_ac_os_to_mpi; gcry_ac_data_encrypt_scheme; + gcry_ac_os_to_mpi; gcry_ac_data_encrypt_scheme; gcry_ac_data_decrypt_scheme; gcry_ac_data_sign_scheme; gcry_ac_data_verify_scheme; gcry_ac_data_to_sexp; gcry_ac_data_from_sexp; gcry_ac_io_init; gcry_ac_io_init_va; - gcry_prime_check; gcry_prime_generate; + gcry_prime_check; gcry_prime_generate; gcry_prime_group_generator; gcry_prime_release_factors; - + gcry_random_add_bytes; gcry_random_bytes; gcry_random_bytes_secure; gcry_randomize; gcry_create_nonce; - + gcry_sexp_alist; gcry_sexp_append; gcry_sexp_build; gcry_sexp_build_array; gcry_sexp_cadr; gcry_sexp_canon_len; gcry_sexp_car; gcry_sexp_cdr; gcry_sexp_cons; gcry_sexp_create; @@ -89,7 +89,7 @@ GCRYPT_1.2 { gcry_sexp_nth_mpi; gcry_sexp_prepend; gcry_sexp_release; gcry_sexp_sprint; gcry_sexp_sscan; gcry_sexp_vlist; gcry_sexp_nth_string; - + gcry_mpi_add; gcry_mpi_add_ui; gcry_mpi_addm; gcry_mpi_aprint; gcry_mpi_clear_bit; gcry_mpi_clear_flag; gcry_mpi_clear_highbit; gcry_mpi_cmp; gcry_mpi_cmp_ui; gcry_mpi_copy; gcry_mpi_div; @@ -107,4 +107,3 @@ GCRYPT_1.2 { *; }; - @@ -1,5 +1,5 @@ /* misc.c - * Copyright (C) 1999, 2001, 2002, 2003, 2007, + * Copyright (C) 1999, 2001, 2002, 2003, 2007, * 2008 Free Software Foundation, Inc. * * This file is part of Libgcrypt. @@ -118,9 +118,9 @@ _gcry_logv( int level, const char *fmt, va_list arg_ptr ) { if (log_handler) log_handler (log_handler_value, level, fmt, arg_ptr); - else + else { - switch (level) + switch (level) { case GCRY_LOG_CONT: break; case GCRY_LOG_INFO: break; @@ -133,7 +133,7 @@ _gcry_logv( int level, const char *fmt, va_list arg_ptr ) } vfprintf(stderr,fmt,arg_ptr) ; } - + if ( level == GCRY_LOG_FATAL || level == GCRY_LOG_BUG ) { fips_signal_fatal_error ("internal error (fatal or bug)"); @@ -257,8 +257,8 @@ void _gcry_log_printf (const char *fmt, ...) { va_list arg_ptr; - - if (fmt) + + if (fmt) { va_start( arg_ptr, fmt ) ; _gcry_logv (GCRY_LOG_CONT, fmt, arg_ptr); @@ -290,7 +290,7 @@ void _gcry_burn_stack (int bytes) { char buf[64]; - + wipememory (buf, sizeof buf); bytes -= sizeof buf; if (bytes > 0) diff --git a/src/missing-string.c b/src/missing-string.c index a5e56c3f..4756c00e 100644 --- a/src/missing-string.c +++ b/src/missing-string.c @@ -1,5 +1,5 @@ /* missing-string.c - missing string utilities - * Copyright (C) 1994, 1998, 1999, 2000, 2001, + * Copyright (C) 1994, 1998, 1999, 2000, 2001, * 2003 Free Software Foundation, Inc. * * This file is part of Libgcrypt. @@ -52,4 +52,3 @@ strcasecmp( const char *a, const char *b ) return *(const byte*)a - *(const byte*)b; } #endif - diff --git a/src/module.c b/src/module.c index 4f282af2..32f668de 100644 --- a/src/module.c +++ b/src/module.c @@ -127,7 +127,7 @@ _gcry_module_drop (gcry_module_t entry) /* Lookup a module specification by it's ID. After a successful lookup, the module has it's resource counter incremented. */ -gcry_module_t +gcry_module_t _gcry_module_lookup_id (gcry_module_t entries, unsigned int mod_id) { gcry_module_t entry; @@ -146,7 +146,7 @@ _gcry_module_lookup_id (gcry_module_t entries, unsigned int mod_id) module has it's resource counter incremented. FUNC is a function provided by the caller, which is responsible for identifying the wanted module. */ -gcry_module_t +gcry_module_t _gcry_module_lookup (gcry_module_t entries, void *data, gcry_module_lookup_t func) { @@ -62,7 +62,7 @@ #define DBG_MPI _gcry_get_debug_flag( 2 ); -struct gcry_mpi +struct gcry_mpi { int alloced; /* Array size (# of allocated limbs). */ int nlimbs; /* Number of valid limbs. */ @@ -107,13 +107,13 @@ struct gcry_mpi #define mpi_is_opaque(a) ((a) && ((a)->flags&4)) #define mpi_is_secure(a) ((a) && ((a)->flags&1)) #define mpi_clear(a) _gcry_mpi_clear ((a)) -#define mpi_alloc_like(a) _gcry_mpi_alloc_like((a)) -#define mpi_set(a,b) _gcry_mpi_set ((a),(b)) -#define mpi_set_ui(a,b) _gcry_mpi_set_ui ((a),(b)) +#define mpi_alloc_like(a) _gcry_mpi_alloc_like((a)) +#define mpi_set(a,b) _gcry_mpi_set ((a),(b)) +#define mpi_set_ui(a,b) _gcry_mpi_set_ui ((a),(b)) #define mpi_get_ui(a,b) _gcry_mpi_get_ui ((a),(b)) #define mpi_alloc_set_ui(a) _gcry_mpi_alloc_set_ui ((a)) -#define mpi_m_check(a) _gcry_mpi_m_check ((a)) -#define mpi_swap(a,b) _gcry_mpi_swap ((a),(b)) +#define mpi_m_check(a) _gcry_mpi_m_check ((a)) +#define mpi_swap(a,b) _gcry_mpi_swap ((a),(b)) #define mpi_new(n) _gcry_mpi_new ((n)) #define mpi_snew(n) _gcry_mpi_snew ((n)) @@ -131,7 +131,7 @@ void _gcry_log_mpidump( const char *text, gcry_mpi_t a ); u32 _gcry_mpi_get_keyid( gcry_mpi_t a, u32 *keyid ); byte *_gcry_mpi_get_buffer( gcry_mpi_t a, unsigned *nbytes, int *sign ); byte *_gcry_mpi_get_secure_buffer( gcry_mpi_t a, unsigned *nbytes, int *sign ); -void _gcry_mpi_set_buffer ( gcry_mpi_t a, const void *buffer, +void _gcry_mpi_set_buffer ( gcry_mpi_t a, const void *buffer, unsigned int nbytes, int sign ); #define log_mpidump _gcry_log_mpidump @@ -249,10 +249,10 @@ mpi_ec_t _gcry_mpi_ec_init (gcry_mpi_t p, gcry_mpi_t a); void _gcry_mpi_ec_free (mpi_ec_t ctx); int _gcry_mpi_ec_get_affine (gcry_mpi_t x, gcry_mpi_t y, mpi_point_t *point, mpi_ec_t ctx); -void _gcry_mpi_ec_dup_point (mpi_point_t *result, +void _gcry_mpi_ec_dup_point (mpi_point_t *result, mpi_point_t *point, mpi_ec_t ctx); void _gcry_mpi_ec_add_points (mpi_point_t *result, - mpi_point_t *p1, mpi_point_t *p2, + mpi_point_t *p1, mpi_point_t *p2, mpi_ec_t ctx); void _gcry_mpi_ec_mul_point (mpi_point_t *result, gcry_mpi_t scalar, mpi_point_t *point, diff --git a/src/secmem.c b/src/secmem.c index 1e375bfd..30c27774 100644 --- a/src/secmem.c +++ b/src/secmem.c @@ -136,7 +136,7 @@ mb_get_next (memblock_t *mb) memblock_t *mb_next; mb_next = (memblock_t *) ((char *) mb + BLOCK_HEAD_SIZE + mb->size); - + if (! ptr_into_pool_p (mb_next)) mb_next = NULL; @@ -192,7 +192,7 @@ static memblock_t * mb_get_new (memblock_t *block, size_t size) { memblock_t *mb, *mb_split; - + for (mb = block; ptr_into_pool_p (mb); mb = mb_get_next (mb)) if (! (mb->flags & MB_FLAG_ACTIVE) && mb->size >= size) { @@ -202,7 +202,7 @@ mb_get_new (memblock_t *block, size_t size) if (mb->size - size > BLOCK_HEAD_SIZE) { /* Split block. */ - + mb_split = (memblock_t *) (((char *) mb) + BLOCK_HEAD_SIZE + size); mb_split->size = mb->size - size - BLOCK_HEAD_SIZE; mb_split->flags = 0; @@ -271,7 +271,7 @@ lock_pool (void *p, size_t n) /* Under HP/UX mlock segfaults if called by non-root. Note, we have noch checked whether mlock does really work under AIX where we also detected a broken nlock. Note further, that using plock () - is not a good idea under AIX. */ + is not a good idea under AIX. */ if (uid) { errno = EPERM; @@ -323,7 +323,7 @@ lock_pool (void *p, size_t n) (void)p; (void)n; #elif defined (HAVE_DOSISH_SYSTEM) || defined (__CYGWIN__) - /* It does not make sense to print such a warning, given the fact that + /* It does not make sense to print such a warning, given the fact that * this whole Windows !@#$% and their user base are inherently insecure. */ (void)p; (void)n; @@ -548,7 +548,7 @@ _gcry_secmem_malloc (size_t size) SECMEM_LOCK; p = _gcry_secmem_malloc_internal (size); SECMEM_UNLOCK; - + return p; } @@ -666,7 +666,7 @@ _gcry_secmem_term () void _gcry_secmem_dump_stats () { -#if 1 +#if 1 SECMEM_LOCK; if (pool_okay) @@ -68,7 +68,7 @@ sexp_sscan (gcry_sexp_t *retsexp, size_t *erroff, #undef whitespacep static GPG_ERR_INLINE int whitespacep (const char *p) -{ +{ switch (*p) { case ' ': case '\t': case '\v': case '\f': case '\r': case '\n': return 1; @@ -98,7 +98,7 @@ dump_string (const byte *p, size_t n, int delim ) { for (; n; n--, p++ ) { - if ((*p & 0x80) || iscntrl( *p ) || *p == delim ) + if ((*p & 0x80) || iscntrl( *p ) || *p == delim ) { if( *p == '\n' ) log_printf ("\\n"); @@ -110,7 +110,7 @@ dump_string (const byte *p, size_t n, int delim ) log_printf ("\\v"); else if( *p == '\b' ) log_printf ("\\b"); - else if( !*p ) + else if( !*p ) log_printf ("\\0"); else log_printf ("\\x%02x", *p ); @@ -178,7 +178,7 @@ normalize ( gcry_sexp_t list ) if ( !list ) return NULL; p = list->d; - if ( *p == ST_STOP ) + if ( *p == ST_STOP ) { /* this is "" */ gcry_sexp_release ( list ); @@ -190,7 +190,7 @@ normalize ( gcry_sexp_t list ) gcry_sexp_release ( list ); return NULL; } - + return list; } @@ -200,13 +200,13 @@ normalize ( gcry_sexp_t list ) the buffer is transferred to the newly created object. FREEFNC should be the freefnc used to release BUFFER; there is no guarantee at which point this function is called; most likey you want to use - free() or gcry_free(). - + free() or gcry_free(). + Passing LENGTH and AUTODETECT as 0 is allowed to indicate that BUFFER points to a valid canonical encoded S-expression. A LENGTH of 0 and AUTODETECT 1 indicates that buffer points to a null-terminated string. - + This function returns 0 and and the pointer to the new object in RETSEXP or an error code in which case RETSEXP is set to NULL. */ gcry_error_t @@ -283,7 +283,7 @@ gcry_sexp_release( gcry_sexp_t sexp ) break; case ST_CLOSE: break; - case ST_DATA: + case ST_DATA: { DATALEN n; memcpy ( &n, p, sizeof n ); @@ -386,7 +386,7 @@ gcry_sexp_find_token( const gcry_sexp_t list, const char *tok, size_t toklen ) { const byte *p; DATALEN n; - + if ( !list ) return NULL; @@ -396,7 +396,7 @@ gcry_sexp_find_token( const gcry_sexp_t list, const char *tok, size_t toklen ) p = list->d; while ( *p != ST_STOP ) { - if ( *p == ST_OPEN && p[1] == ST_DATA ) + if ( *p == ST_OPEN && p[1] == ST_DATA ) { const byte *head = p; @@ -410,7 +410,7 @@ gcry_sexp_find_token( const gcry_sexp_t list, const char *tok, size_t toklen ) int level = 1; /* Look for the end of the list. */ - for ( p += n; level; p++ ) + for ( p += n; level; p++ ) { if ( *p == ST_DATA ) { @@ -418,15 +418,15 @@ gcry_sexp_find_token( const gcry_sexp_t list, const char *tok, size_t toklen ) p += sizeof n + n; p--; /* Compensate for later increment. */ } - else if ( *p == ST_OPEN ) + else if ( *p == ST_OPEN ) { level++; } - else if ( *p == ST_CLOSE ) + else if ( *p == ST_CLOSE ) { level--; } - else if ( *p == ST_STOP ) + else if ( *p == ST_STOP ) { BUG (); } @@ -505,15 +505,15 @@ get_internal_buffer (const gcry_sexp_t list, size_t *r_off) DATALEN n; int type; int level = 0; - + *r_off = 0; if (list) { p = list->d; - while ( (type=*p) != ST_STOP ) + while ( (type=*p) != ST_STOP ) { p++; - if (type == ST_DATA) + if (type == ST_DATA) { memcpy (&n, p, sizeof n); p += sizeof n + n; @@ -635,9 +635,9 @@ sexp_nth_data (const gcry_sexp_t list, int number, size_t *datalen) const byte *p; DATALEN n; int level = 0; - + *datalen = 0; - if ( !list ) + if ( !list ) return NULL; p = list->d; @@ -647,9 +647,9 @@ sexp_nth_data (const gcry_sexp_t list, int number, size_t *datalen) return NULL; /* Not a list but N > 0 requested. */ /* Skip over N elements. */ - while ( number > 0 ) + while ( number > 0 ) { - if ( *p == ST_DATA ) + if ( *p == ST_DATA ) { memcpy ( &n, ++p, sizeof n ); p += sizeof n + n; @@ -657,17 +657,17 @@ sexp_nth_data (const gcry_sexp_t list, int number, size_t *datalen) if ( !level ) number--; } - else if ( *p == ST_OPEN ) + else if ( *p == ST_OPEN ) { level++; } - else if ( *p == ST_CLOSE ) + else if ( *p == ST_CLOSE ) { level--; if ( !level ) number--; } - else if ( *p == ST_STOP ) + else if ( *p == ST_STOP ) { return NULL; } @@ -681,7 +681,7 @@ sexp_nth_data (const gcry_sexp_t list, int number, size_t *datalen) *datalen = n; return (const char*)p + sizeof n; } - + return NULL; } @@ -859,13 +859,13 @@ static gpg_err_code_t make_space ( struct make_space_ctx *c, size_t n ) { size_t used = c->pos - c->sexp->d; - + if ( used + n + sizeof(DATALEN) + 1 >= c->allocated ) { gcry_sexp_t newsexp; byte *newhead; size_t newsize; - + newsize = c->allocated + 2*(n+sizeof(DATALEN)+1); if (newsize <= c->allocated) return GPG_ERR_TOO_LARGE; @@ -914,7 +914,7 @@ unquote_string (const char *string, size_t length, unsigned char *buf) s++; n--; } break; - + case '\n': /* ignore LF[,CR] */ if (n>1 && s[1] == '\r') { @@ -946,7 +946,7 @@ unquote_string (const char *string, size_t length, unsigned char *buf) esc = 1; else *d++ = *s; - } + } return d - buf; } @@ -961,10 +961,10 @@ unquote_string (const char *string, size_t length, unsigned char *buf) * %m - MPI * %s - string (no autoswitch to secure allocation) * %d - integer stored as string (no autoswitch to secure allocation) - * %b - memory buffer; this takes _two_ arguments: an integer with the + * %b - memory buffer; this takes _two_ arguments: an integer with the * length of the buffer and a pointer to the buffer. * %S - Copy an gcry_sexp_t here. The S-expression needs to be a - * regular one, starting with a parenthesis. + * regular one, starting with a parenthesis. * (no autoswitch to secure allocation) * all other format elements are currently not defined and return an error. * this includes the "%%" sequence becauce the percent sign is not an @@ -1100,7 +1100,7 @@ vsexp_sscan (gcry_sexp_t *retsexp, size_t *erroff, n -= 2; quoted_esc = 0; break; - + case 'x': if (!((n > 2) && hexdigitp (p+1) && hexdigitp (p+2))) { @@ -1149,7 +1149,7 @@ vsexp_sscan (gcry_sexp_t *retsexp, size_t *erroff, never be larger. */ unsigned char *save; size_t len; - + quoted++; /* Skip leading quote. */ MAKE_SPACE (p - quoted); *c.pos++ = ST_DATA; @@ -1256,7 +1256,7 @@ vsexp_sscan (gcry_sexp_t *retsexp, size_t *erroff, size_t nm = 0; ARG_NEXT (m, gcry_mpi_t); - + if (gcry_mpi_get_flag (m, GCRYMPI_FLAG_OPAQUE)) { void *mp; @@ -1336,7 +1336,7 @@ vsexp_sscan (gcry_sexp_t *retsexp, size_t *erroff, ARG_NEXT (astr, const char *); alen = strlen (astr); - + MAKE_SPACE (alen); *c.pos++ = ST_DATA; STORE_LEN (c.pos, alen); @@ -1351,7 +1351,7 @@ vsexp_sscan (gcry_sexp_t *retsexp, size_t *erroff, ARG_NEXT (alen, int); ARG_NEXT (astr, const char *); - + MAKE_SPACE (alen); if (alen && !gcry_is_secure (c.sexp->d) @@ -1386,7 +1386,7 @@ vsexp_sscan (gcry_sexp_t *retsexp, size_t *erroff, int aint; size_t alen; char buf[20]; - + ARG_NEXT (aint, int); sprintf (buf, "%d", aint); alen = strlen (buf); @@ -1559,12 +1559,12 @@ sexp_sscan (gcry_sexp_t *retsexp, size_t *erroff, { gcry_error_t rc; va_list arg_ptr; - + va_start (arg_ptr, arg_list); rc = vsexp_sscan (retsexp, erroff, buffer, length, argflag, arg_list, arg_ptr); va_end (arg_ptr); - + return rc; } @@ -1574,18 +1574,18 @@ gcry_sexp_build (gcry_sexp_t *retsexp, size_t *erroff, const char *format, ...) { gcry_error_t rc; va_list arg_ptr; - + va_start (arg_ptr, format); rc = vsexp_sscan (retsexp, erroff, format, strlen(format), 1, NULL, arg_ptr); va_end (arg_ptr); - + return rc; } gcry_error_t -_gcry_sexp_vbuild (gcry_sexp_t *retsexp, size_t *erroff, +_gcry_sexp_vbuild (gcry_sexp_t *retsexp, size_t *erroff, const char *format, va_list arg_ptr) { return vsexp_sscan (retsexp, erroff, format, strlen(format), 1, @@ -1624,7 +1624,7 @@ suitable_encoding (const unsigned char *buffer, size_t length) if (!length) return 1; - + for (s=buffer; length; s++, length--) { if ( (*s < 0x20 || (*s >= 0x7f && *s <= 0xa0)) @@ -1676,10 +1676,10 @@ convert_to_string (const unsigned char *s, size_t len, char *dest) case '\"': *p++ = '\\'; *p++ = '\"'; break; case '\'': *p++ = '\\'; *p++ = '\''; break; case '\\': *p++ = '\\'; *p++ = '\\'; break; - default: + default: if ( (*s < 0x20 || (*s >= 0x7f && *s <= 0xa0))) { - sprintf (p, "\\x%02x", *s); + sprintf (p, "\\x%02x", *s); p += 4; } else @@ -1696,16 +1696,16 @@ convert_to_string (const unsigned char *s, size_t len, char *dest) { switch (*s) { - case '\b': - case '\t': - case '\v': - case '\n': - case '\f': - case '\r': + case '\b': + case '\t': + case '\v': + case '\n': + case '\f': + case '\r': case '\"': case '\'': case '\\': count += 2; break; - default: + default: if ( (*s < 0x20 || (*s >= 0x7f && *s <= 0xa0))) count += 4; else @@ -1744,7 +1744,7 @@ gcry_sexp_sprint (const gcry_sexp_t list, int mode, char numbuf[20]; size_t len = 0; int i, indent = 0; - + s = list? list->d : empty; d = buffer; while ( *s != ST_STOP ) @@ -1756,18 +1756,18 @@ gcry_sexp_sprint (const gcry_sexp_t list, int mode, if ( mode != GCRYSEXP_FMT_CANON ) { if (indent) - len++; + len++; len += indent; } len++; - if ( buffer ) + if ( buffer ) { if ( len >= maxlength ) return 0; if ( mode != GCRYSEXP_FMT_CANON ) { if (indent) - *d++ = '\n'; + *d++ = '\n'; for (i=0; i < indent; i++) *d++ = ' '; } @@ -1778,7 +1778,7 @@ gcry_sexp_sprint (const gcry_sexp_t list, int mode, case ST_CLOSE: s++; len++; - if ( buffer ) + if ( buffer ) { if ( len >= maxlength ) return 0; @@ -1841,7 +1841,7 @@ gcry_sexp_sprint (const gcry_sexp_t list, int mode, { sprintf (numbuf, "%u:", (unsigned int)n ); len += strlen (numbuf) + n; - if ( buffer ) + if ( buffer ) { if ( len >= maxlength ) return 0; @@ -1862,10 +1862,10 @@ gcry_sexp_sprint (const gcry_sexp_t list, int mode, { if ( len >= maxlength ) return 0; - *d++ = '\n'; + *d++ = '\n'; } } - if (buffer) + if (buffer) { if ( len >= maxlength ) return 0; @@ -1885,7 +1885,7 @@ gcry_sexp_sprint (const gcry_sexp_t list, int mode, data passed from outside. errorcode and erroff may both be passed as NULL. */ size_t -gcry_sexp_canon_len (const unsigned char *buffer, size_t length, +gcry_sexp_canon_len (const unsigned char *buffer, size_t length, size_t *erroff, gcry_error_t *errcode) { const unsigned char *p; @@ -1919,7 +1919,7 @@ gcry_sexp_canon_len (const unsigned char *buffer, size_t length, *errcode = gcry_error (GPG_ERR_SEXP_STRING_TOO_LONG); return 0; } - + if (datalen) { if (*p == ':') @@ -1936,7 +1936,7 @@ gcry_sexp_canon_len (const unsigned char *buffer, size_t length, } else if (digitp(p)) datalen = datalen*10 + atoi_1(p); - else + else { *erroff = count; *errcode = gcry_error (GPG_ERR_SEXP_INV_LEN_SPEC); @@ -1972,7 +1972,7 @@ gcry_sexp_canon_len (const unsigned char *buffer, size_t length, } else if (*p == '[') { - if (disphint) + if (disphint) { *erroff = count; *errcode = gcry_error (GPG_ERR_SEXP_NESTED_DH); @@ -1982,7 +1982,7 @@ gcry_sexp_canon_len (const unsigned char *buffer, size_t length, } else if (*p == ']') { - if ( !disphint ) + if ( !disphint ) { *erroff = count; *errcode = gcry_error (GPG_ERR_SEXP_UNMATCHED_DH); @@ -1993,7 +1993,7 @@ gcry_sexp_canon_len (const unsigned char *buffer, size_t length, else if (digitp (p) ) { if (*p == '0') - { + { *erroff = count; *errcode = gcry_error (GPG_ERR_SEXP_ZERO_PREFIX); return 0; @@ -2007,7 +2007,7 @@ gcry_sexp_canon_len (const unsigned char *buffer, size_t length, return 0; } else - { + { *erroff = count; *errcode = gcry_error (GPG_ERR_SEXP_BAD_CHARACTER); return 0; diff --git a/src/stdmem.c b/src/stdmem.c index bb8adeab..c20c4b4f 100644 --- a/src/stdmem.c +++ b/src/stdmem.c @@ -25,8 +25,8 @@ * | * \ / * global.c: [MM entrance points] -----> [user callbacks] - * | | - * | | + * | | + * | | * \ / \ / * * stdmem.c: [non-secure handlers] [secure handlers] @@ -87,13 +87,13 @@ _gcry_private_enable_m_guard (void) void * _gcry_private_malloc (size_t n) { - if (!n) + if (!n) return NULL; /* Allocating 0 bytes is undefined - we better return an error to detect such coding errors. */ - if (use_m_guard) + if (use_m_guard) { char *p; - + if ( !(p = malloc (n + EXTRA_ALIGN+5)) ) return NULL; ((byte*)p)[EXTRA_ALIGN+0] = n; @@ -103,7 +103,7 @@ _gcry_private_malloc (size_t n) p[4+EXTRA_ALIGN+n] = MAGIC_END_BYTE; return p+EXTRA_ALIGN+4; } - else + else { return malloc( n ); } @@ -117,13 +117,13 @@ _gcry_private_malloc (size_t n) void * _gcry_private_malloc_secure (size_t n) { - if (!n) + if (!n) return NULL; /* Allocating 0 bytes is undefined - better return an error to detect such coding errors. */ - if (use_m_guard) + if (use_m_guard) { char *p; - + if ( !(p = _gcry_secmem_malloc (n +EXTRA_ALIGN+ 5)) ) return NULL; ((byte*)p)[EXTRA_ALIGN+0] = n; @@ -152,10 +152,10 @@ _gcry_private_realloc ( void *a, size_t n ) unsigned char *p = a; char *b; size_t len; - + if (!a) return _gcry_private_malloc(n); - + _gcry_private_check_heap(p); len = p[-4]; len |= p[-3] << 8; @@ -191,10 +191,10 @@ _gcry_private_check_heap (const void *a) { const byte *p = a; size_t len; - + if (!p) return; - + if ( !(p[-1] == MAGIC_NOR_BYTE || p[-1] == MAGIC_SEC_BYTE) ) _gcry_log_fatal ("memory at %p corrupted (underflow=%02x)\n", p, p[-1]); len = p[-4]; @@ -231,5 +231,3 @@ _gcry_private_free (void *a) else free(p); } - - diff --git a/src/versioninfo.rc.in b/src/versioninfo.rc.in index e5e87e0b..2e9402d1 100644 --- a/src/versioninfo.rc.in +++ b/src/versioninfo.rc.in @@ -1,6 +1,6 @@ /* versioninfo.rc.in - for libgcrypt * Copyright (C) 2005, 2006 g10 Code GmbH - * + * * This file is free software; as a special exception the author gives * unlimited permission to copy and/or distribute it, with or without * modifications, as long as this notice is preserved. @@ -9,7 +9,7 @@ * WITHOUT ANY WARRANTY, to the extent permitted by law; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ - + /* This file is processed by configure to create versioninfo.rc */ #line __LINE__ "versioninfo.rc.in" @@ -49,4 +49,3 @@ BEGIN END END END - diff --git a/src/visibility.c b/src/visibility.c index c4fd09da..2d203f9a 100644 --- a/src/visibility.c +++ b/src/visibility.c @@ -20,7 +20,7 @@ #include <config.h> #include <stdarg.h> -#define _GCRY_INCLUDED_BY_VISIBILITY_C +#define _GCRY_INCLUDED_BY_VISIBILITY_C #include "g10lib.h" #include "cipher-proto.h" @@ -38,7 +38,7 @@ gcry_strsource (gcry_error_t err) return _gcry_strsource (err); } -gcry_err_code_t +gcry_err_code_t gcry_err_code_from_errno (int err) { return _gcry_err_code_from_errno (err); @@ -50,13 +50,13 @@ gcry_err_code_to_errno (gcry_err_code_t code) return _gcry_err_code_to_errno (code); } -gcry_error_t +gcry_error_t gcry_err_make_from_errno (gcry_err_source_t source, int err) { return _gcry_err_make_from_errno (source, err); } -gcry_err_code_t +gcry_err_code_t gcry_error_from_errno (int err) { return _gcry_error_from_errno (err); @@ -68,19 +68,19 @@ gcry_check_version (const char *req_version) return _gcry_check_version (req_version); } -gcry_error_t +gcry_error_t gcry_control (enum gcry_ctl_cmds cmd, ...) { gcry_error_t err; va_list arg_ptr; - + va_start (arg_ptr, cmd); err = _gcry_vcontrol (cmd, arg_ptr); va_end(arg_ptr); return err; } -gcry_error_t +gcry_error_t gcry_sexp_new (gcry_sexp_t *retsexp, const void *buffer, size_t length, int autodetect) @@ -88,7 +88,7 @@ gcry_sexp_new (gcry_sexp_t *retsexp, return _gcry_sexp_new (retsexp, buffer, length, autodetect); } -gcry_error_t +gcry_error_t gcry_sexp_create (gcry_sexp_t *retsexp, void *buffer, size_t length, int autodetect, void (*freefnc) (void *)) @@ -97,53 +97,53 @@ gcry_sexp_create (gcry_sexp_t *retsexp, autodetect, freefnc); } -gcry_error_t +gcry_error_t gcry_sexp_sscan (gcry_sexp_t *retsexp, size_t *erroff, const char *buffer, size_t length) { return _gcry_sexp_sscan (retsexp, erroff, buffer, length); } -gcry_error_t +gcry_error_t gcry_sexp_build (gcry_sexp_t *retsexp, size_t *erroff, const char *format, ...) { gcry_error_t err; va_list arg_ptr; - + va_start (arg_ptr, format); err = _gcry_sexp_vbuild (retsexp, erroff, format, arg_ptr); va_end (arg_ptr); return err; } -gcry_error_t +gcry_error_t gcry_sexp_build_array (gcry_sexp_t *retsexp, size_t *erroff, const char *format, void **arg_list) { return _gcry_sexp_build_array (retsexp, erroff, format, arg_list); } -void +void gcry_sexp_release (gcry_sexp_t sexp) { _gcry_sexp_release (sexp); } -size_t -gcry_sexp_canon_len (const unsigned char *buffer, size_t length, +size_t +gcry_sexp_canon_len (const unsigned char *buffer, size_t length, size_t *erroff, gcry_error_t *errcode) { return _gcry_sexp_canon_len (buffer, length, erroff, errcode); } -size_t +size_t gcry_sexp_sprint (gcry_sexp_t sexp, int mode, void *buffer, size_t maxlength) { return _gcry_sexp_sprint (sexp, mode, buffer, maxlength); } -void +void gcry_sexp_dump (const gcry_sexp_t a) { _gcry_sexp_dump (a); @@ -249,7 +249,7 @@ gcry_mpi_snew (unsigned int nbits) return _gcry_mpi_snew (nbits); } -void +void gcry_mpi_release (gcry_mpi_t a) { _gcry_mpi_release (a); @@ -293,7 +293,7 @@ gcry_mpi_cmp_ui (const gcry_mpi_t u, unsigned long v) gcry_error_t gcry_mpi_scan (gcry_mpi_t *ret_mpi, enum gcry_mpi_format format, - const void *buffer, size_t buflen, + const void *buffer, size_t buflen, size_t *nscanned) { return _gcry_mpi_scan (ret_mpi, format, buffer, buflen, nscanned); @@ -591,7 +591,7 @@ gcry_cipher_encrypt (gcry_cipher_hd_t h, { /* Make sure that the plaintext will never make it to OUT. */ if (out) - memset (out, 0x42, outsize); + memset (out, 0x42, outsize); return gpg_error (fips_not_operational ()); } @@ -777,7 +777,7 @@ gcry_md_open (gcry_md_hd_t *h, int algo, unsigned int flags) return _gcry_md_open (h, algo, flags); } -void +void gcry_md_close (gcry_md_hd_t hd) { _gcry_md_close (hd); @@ -833,7 +833,7 @@ gcry_md_read (gcry_md_hd_t hd, int algo) return _gcry_md_read (hd, algo); } -void +void gcry_md_hash_buffer (int algo, void *digest, const void *buffer, size_t length) { @@ -1105,7 +1105,7 @@ gcry_ac_data_encrypt (gcry_ac_handle_t handle, gcry_mpi_t data_plain, gcry_ac_data_t *data_encrypted) { - return _gcry_ac_data_encrypt (handle, flags, key, + return _gcry_ac_data_encrypt (handle, flags, key, data_plain, data_encrypted); } @@ -1187,7 +1187,7 @@ gcry_ac_data_verify_scheme (gcry_ac_handle_t handle, } gcry_error_t -gcry_ac_id_to_name (gcry_ac_id_t algorithm, const char **name) +gcry_ac_id_to_name (gcry_ac_id_t algorithm, const char **name) { /* This function is deprecated. We implement it in terms of the suggested replacement. */ @@ -1217,7 +1217,7 @@ gcry_randomize (void *buffer, size_t length, enum gcry_random_level level) { (void)fips_not_operational (); fips_signal_fatal_error ("called in non-operational state"); - fips_noreturn (); + fips_noreturn (); } _gcry_randomize (buffer, length, level); } @@ -1237,7 +1237,7 @@ gcry_random_bytes (size_t nbytes, enum gcry_random_level level) { (void)fips_not_operational (); fips_signal_fatal_error ("called in non-operational state"); - fips_noreturn (); + fips_noreturn (); } return _gcry_random_bytes (nbytes,level); @@ -1250,7 +1250,7 @@ gcry_random_bytes_secure (size_t nbytes, enum gcry_random_level level) { (void)fips_not_operational (); fips_signal_fatal_error ("called in non-operational state"); - fips_noreturn (); + fips_noreturn (); } return _gcry_random_bytes_secure (nbytes, level); @@ -1270,7 +1270,7 @@ gcry_create_nonce (void *buffer, size_t length) { (void)fips_not_operational (); fips_signal_fatal_error ("called in non-operational state"); - fips_noreturn (); + fips_noreturn (); } _gcry_create_nonce (buffer, length); } diff --git a/src/visibility.h b/src/visibility.h index cf5a3ff3..6a054c5c 100644 --- a/src/visibility.h +++ b/src/visibility.h @@ -52,7 +52,7 @@ #define gcry_xmalloc_secure _gcry_xmalloc_secure #define gcry_xrealloc _gcry_xrealloc #define gcry_xstrdup _gcry_xstrdup - + #define gcry_md_algo_info _gcry_md_algo_info #define gcry_md_algo_name _gcry_md_algo_name #define gcry_md_close _gcry_md_close @@ -246,7 +246,7 @@ #endif /* Prototypes of functions exported but not ready for use. */ -gcry_err_code_t gcry_md_get (gcry_md_hd_t hd, int algo, +gcry_err_code_t gcry_md_get (gcry_md_hd_t hd, int algo, unsigned char *buffer, int buflen); void gcry_ac_mpi_to_os (gcry_mpi_t mpi, unsigned char *os, size_t os_n); gcry_error_t gcry_ac_mpi_to_os_alloc (gcry_mpi_t mpi, unsigned char **os, @@ -257,7 +257,7 @@ void gcry_ac_os_to_mpi (gcry_mpi_t mpi, unsigned char *os, size_t os_n); /* Our use of the ELF visibility feature works by passing -fvisibiliy=hidden on the command line and by explicitly marking - all exported functions as visible. + all exported functions as visible. NOTE: When adding new functions, please make sure to add them to libgcrypt.vers and libgcrypt.def as well. */ @@ -279,214 +279,214 @@ void gcry_ac_os_to_mpi (gcry_mpi_t mpi, unsigned char *os, size_t os_n); /* First undef all redefined symbols so that we set the attribute on the correct version name. */ -#undef gcry_check_version -#undef gcry_control +#undef gcry_check_version +#undef gcry_control #undef gcry_set_allocation_handler #undef gcry_set_fatalerror_handler -#undef gcry_set_gettext_handler -#undef gcry_set_log_handler -#undef gcry_set_outofcore_handler -#undef gcry_set_progress_handler -#undef gcry_err_code_from_errno -#undef gcry_err_code_to_errno -#undef gcry_err_make_from_errno -#undef gcry_error_from_errno -#undef gcry_strerror -#undef gcry_strsource - -#undef gcry_free -#undef gcry_malloc -#undef gcry_malloc_secure -#undef gcry_calloc -#undef gcry_calloc_secure -#undef gcry_realloc -#undef gcry_strdup -#undef gcry_is_secure -#undef gcry_xcalloc -#undef gcry_xcalloc_secure -#undef gcry_xmalloc -#undef gcry_xmalloc_secure -#undef gcry_xrealloc -#undef gcry_xstrdup - -#undef gcry_md_algo_info -#undef gcry_md_algo_name -#undef gcry_md_close -#undef gcry_md_copy -#undef gcry_md_ctl -#undef gcry_md_enable -#undef gcry_md_get -#undef gcry_md_get_algo -#undef gcry_md_get_algo_dlen -#undef gcry_md_hash_buffer -#undef gcry_md_info -#undef gcry_md_is_enabled -#undef gcry_md_is_secure -#undef gcry_md_list -#undef gcry_md_map_name -#undef gcry_md_open -#undef gcry_md_read +#undef gcry_set_gettext_handler +#undef gcry_set_log_handler +#undef gcry_set_outofcore_handler +#undef gcry_set_progress_handler +#undef gcry_err_code_from_errno +#undef gcry_err_code_to_errno +#undef gcry_err_make_from_errno +#undef gcry_error_from_errno +#undef gcry_strerror +#undef gcry_strsource + +#undef gcry_free +#undef gcry_malloc +#undef gcry_malloc_secure +#undef gcry_calloc +#undef gcry_calloc_secure +#undef gcry_realloc +#undef gcry_strdup +#undef gcry_is_secure +#undef gcry_xcalloc +#undef gcry_xcalloc_secure +#undef gcry_xmalloc +#undef gcry_xmalloc_secure +#undef gcry_xrealloc +#undef gcry_xstrdup + +#undef gcry_md_algo_info +#undef gcry_md_algo_name +#undef gcry_md_close +#undef gcry_md_copy +#undef gcry_md_ctl +#undef gcry_md_enable +#undef gcry_md_get +#undef gcry_md_get_algo +#undef gcry_md_get_algo_dlen +#undef gcry_md_hash_buffer +#undef gcry_md_info +#undef gcry_md_is_enabled +#undef gcry_md_is_secure +#undef gcry_md_list +#undef gcry_md_map_name +#undef gcry_md_open +#undef gcry_md_read /* gcry_md_register is not anymore a macro. */ -#undef gcry_md_unregister -#undef gcry_md_reset -#undef gcry_md_setkey -#undef gcry_md_write -#undef gcry_md_debug - -#undef gcry_cipher_algo_info -#undef gcry_cipher_algo_name -#undef gcry_cipher_close +#undef gcry_md_unregister +#undef gcry_md_reset +#undef gcry_md_setkey +#undef gcry_md_write +#undef gcry_md_debug + +#undef gcry_cipher_algo_info +#undef gcry_cipher_algo_name +#undef gcry_cipher_close #undef gcry_cipher_setkey #undef gcry_cipher_setiv #undef gcry_cipher_setctr -#undef gcry_cipher_ctl -#undef gcry_cipher_decrypt -#undef gcry_cipher_encrypt +#undef gcry_cipher_ctl +#undef gcry_cipher_decrypt +#undef gcry_cipher_encrypt #undef gcry_cipher_get_algo_blklen #undef gcry_cipher_get_algo_keylen -#undef gcry_cipher_info -#undef gcry_cipher_list -#undef gcry_cipher_map_name -#undef gcry_cipher_mode_from_oid -#undef gcry_cipher_open +#undef gcry_cipher_info +#undef gcry_cipher_list +#undef gcry_cipher_map_name +#undef gcry_cipher_mode_from_oid +#undef gcry_cipher_open /* gcry_cipher_register is not anymore a macro. */ -#undef gcry_cipher_unregister - -#undef gcry_pk_algo_info -#undef gcry_pk_algo_name -#undef gcry_pk_ctl -#undef gcry_pk_decrypt -#undef gcry_pk_encrypt -#undef gcry_pk_genkey -#undef gcry_pk_get_keygrip +#undef gcry_cipher_unregister + +#undef gcry_pk_algo_info +#undef gcry_pk_algo_name +#undef gcry_pk_ctl +#undef gcry_pk_decrypt +#undef gcry_pk_encrypt +#undef gcry_pk_genkey +#undef gcry_pk_get_keygrip #undef gcry_pk_get_curve #undef gcry_pk_get_param -#undef gcry_pk_get_nbits -#undef gcry_pk_list -#undef gcry_pk_map_name +#undef gcry_pk_get_nbits +#undef gcry_pk_list +#undef gcry_pk_map_name /* gcry_pk_register is not anymore a macro. */ -#undef gcry_pk_unregister -#undef gcry_pk_sign -#undef gcry_pk_testkey -#undef gcry_pk_verify - -#undef gcry_ac_data_new -#undef gcry_ac_data_destroy -#undef gcry_ac_data_copy -#undef gcry_ac_data_length -#undef gcry_ac_data_clear -#undef gcry_ac_data_set -#undef gcry_ac_data_get_name -#undef gcry_ac_data_get_index -#undef gcry_ac_open -#undef gcry_ac_close -#undef gcry_ac_key_init -#undef gcry_ac_key_pair_generate -#undef gcry_ac_key_pair_extract -#undef gcry_ac_key_data_get -#undef gcry_ac_key_test -#undef gcry_ac_key_get_nbits -#undef gcry_ac_key_get_grip -#undef gcry_ac_key_destroy -#undef gcry_ac_key_pair_destroy -#undef gcry_ac_data_encrypt -#undef gcry_ac_data_decrypt -#undef gcry_ac_data_sign -#undef gcry_ac_data_verify -#undef gcry_ac_id_to_name -#undef gcry_ac_name_to_id -#undef gcry_ac_data_encode -#undef gcry_ac_data_decode -#undef gcry_ac_mpi_to_os -#undef gcry_ac_mpi_to_os_alloc -#undef gcry_ac_os_to_mpi +#undef gcry_pk_unregister +#undef gcry_pk_sign +#undef gcry_pk_testkey +#undef gcry_pk_verify + +#undef gcry_ac_data_new +#undef gcry_ac_data_destroy +#undef gcry_ac_data_copy +#undef gcry_ac_data_length +#undef gcry_ac_data_clear +#undef gcry_ac_data_set +#undef gcry_ac_data_get_name +#undef gcry_ac_data_get_index +#undef gcry_ac_open +#undef gcry_ac_close +#undef gcry_ac_key_init +#undef gcry_ac_key_pair_generate +#undef gcry_ac_key_pair_extract +#undef gcry_ac_key_data_get +#undef gcry_ac_key_test +#undef gcry_ac_key_get_nbits +#undef gcry_ac_key_get_grip +#undef gcry_ac_key_destroy +#undef gcry_ac_key_pair_destroy +#undef gcry_ac_data_encrypt +#undef gcry_ac_data_decrypt +#undef gcry_ac_data_sign +#undef gcry_ac_data_verify +#undef gcry_ac_id_to_name +#undef gcry_ac_name_to_id +#undef gcry_ac_data_encode +#undef gcry_ac_data_decode +#undef gcry_ac_mpi_to_os +#undef gcry_ac_mpi_to_os_alloc +#undef gcry_ac_os_to_mpi #undef gcry_ac_data_encrypt_scheme #undef gcry_ac_data_decrypt_scheme -#undef gcry_ac_data_sign_scheme -#undef gcry_ac_data_verify_scheme -#undef gcry_ac_data_to_sexp -#undef gcry_ac_data_from_sexp -#undef gcry_ac_io_init -#undef gcry_ac_io_init_va - -#undef gcry_prime_check -#undef gcry_prime_generate -#undef gcry_prime_group_generator -#undef gcry_prime_release_factors - -#undef gcry_random_add_bytes -#undef gcry_random_bytes -#undef gcry_random_bytes_secure -#undef gcry_randomize -#undef gcry_create_nonce - -#undef gcry_sexp_alist -#undef gcry_sexp_append -#undef gcry_sexp_build -#undef gcry_sexp_build_array -#undef gcry_sexp_cadr -#undef gcry_sexp_canon_len -#undef gcry_sexp_car -#undef gcry_sexp_cdr -#undef gcry_sexp_cons -#undef gcry_sexp_create -#undef gcry_sexp_dump -#undef gcry_sexp_find_token -#undef gcry_sexp_length -#undef gcry_sexp_new -#undef gcry_sexp_nth -#undef gcry_sexp_nth_data -#undef gcry_sexp_nth_mpi -#undef gcry_sexp_prepend -#undef gcry_sexp_release -#undef gcry_sexp_sprint -#undef gcry_sexp_sscan -#undef gcry_sexp_vlist -#undef gcry_sexp_nth_string - -#undef gcry_mpi_add -#undef gcry_mpi_add_ui -#undef gcry_mpi_addm -#undef gcry_mpi_aprint -#undef gcry_mpi_clear_bit -#undef gcry_mpi_clear_flag -#undef gcry_mpi_clear_highbit -#undef gcry_mpi_cmp -#undef gcry_mpi_cmp_ui -#undef gcry_mpi_copy -#undef gcry_mpi_div -#undef gcry_mpi_dump -#undef gcry_mpi_gcd -#undef gcry_mpi_get_flag -#undef gcry_mpi_get_nbits -#undef gcry_mpi_get_opaque -#undef gcry_mpi_invm -#undef gcry_mpi_mod -#undef gcry_mpi_mul -#undef gcry_mpi_mul_2exp -#undef gcry_mpi_mul_ui -#undef gcry_mpi_mulm -#undef gcry_mpi_new -#undef gcry_mpi_powm -#undef gcry_mpi_print -#undef gcry_mpi_randomize -#undef gcry_mpi_release -#undef gcry_mpi_rshift -#undef gcry_mpi_lshift -#undef gcry_mpi_scan -#undef gcry_mpi_set -#undef gcry_mpi_set_bit -#undef gcry_mpi_set_flag -#undef gcry_mpi_set_highbit -#undef gcry_mpi_set_opaque -#undef gcry_mpi_set_ui -#undef gcry_mpi_snew -#undef gcry_mpi_sub -#undef gcry_mpi_sub_ui -#undef gcry_mpi_subm -#undef gcry_mpi_swap -#undef gcry_mpi_test_bit +#undef gcry_ac_data_sign_scheme +#undef gcry_ac_data_verify_scheme +#undef gcry_ac_data_to_sexp +#undef gcry_ac_data_from_sexp +#undef gcry_ac_io_init +#undef gcry_ac_io_init_va + +#undef gcry_prime_check +#undef gcry_prime_generate +#undef gcry_prime_group_generator +#undef gcry_prime_release_factors + +#undef gcry_random_add_bytes +#undef gcry_random_bytes +#undef gcry_random_bytes_secure +#undef gcry_randomize +#undef gcry_create_nonce + +#undef gcry_sexp_alist +#undef gcry_sexp_append +#undef gcry_sexp_build +#undef gcry_sexp_build_array +#undef gcry_sexp_cadr +#undef gcry_sexp_canon_len +#undef gcry_sexp_car +#undef gcry_sexp_cdr +#undef gcry_sexp_cons +#undef gcry_sexp_create +#undef gcry_sexp_dump +#undef gcry_sexp_find_token +#undef gcry_sexp_length +#undef gcry_sexp_new +#undef gcry_sexp_nth +#undef gcry_sexp_nth_data +#undef gcry_sexp_nth_mpi +#undef gcry_sexp_prepend +#undef gcry_sexp_release +#undef gcry_sexp_sprint +#undef gcry_sexp_sscan +#undef gcry_sexp_vlist +#undef gcry_sexp_nth_string + +#undef gcry_mpi_add +#undef gcry_mpi_add_ui +#undef gcry_mpi_addm +#undef gcry_mpi_aprint +#undef gcry_mpi_clear_bit +#undef gcry_mpi_clear_flag +#undef gcry_mpi_clear_highbit +#undef gcry_mpi_cmp +#undef gcry_mpi_cmp_ui +#undef gcry_mpi_copy +#undef gcry_mpi_div +#undef gcry_mpi_dump +#undef gcry_mpi_gcd +#undef gcry_mpi_get_flag +#undef gcry_mpi_get_nbits +#undef gcry_mpi_get_opaque +#undef gcry_mpi_invm +#undef gcry_mpi_mod +#undef gcry_mpi_mul +#undef gcry_mpi_mul_2exp +#undef gcry_mpi_mul_ui +#undef gcry_mpi_mulm +#undef gcry_mpi_new +#undef gcry_mpi_powm +#undef gcry_mpi_print +#undef gcry_mpi_randomize +#undef gcry_mpi_release +#undef gcry_mpi_rshift +#undef gcry_mpi_lshift +#undef gcry_mpi_scan +#undef gcry_mpi_set +#undef gcry_mpi_set_bit +#undef gcry_mpi_set_flag +#undef gcry_mpi_set_highbit +#undef gcry_mpi_set_opaque +#undef gcry_mpi_set_ui +#undef gcry_mpi_snew +#undef gcry_mpi_sub +#undef gcry_mpi_sub_ui +#undef gcry_mpi_subm +#undef gcry_mpi_swap +#undef gcry_mpi_test_bit /* Now mark all symbols. */ |