cipher: Fix possible NULL dereference.

* cipher/md.c (_gcry_md_selftest): Check for spec being NULL.
--

Also removed left-over code in unused file cipher/test-getrusage.c.

Found by Hans-Christoph Steiner with cppcheck.
pubkey: Re-map all deprecated RSA algo numbers.

* cipher/pubkey.c (map_algo): Mape RSA_E and RSA_S.
random: Small patch for consistency and really burn the stack.

* random/rndlinux.c (_gcry_rndlinux_gather_random): s/int/size_t/.
(_gcry_rndlinux_gather_random): Replace memset by wipememory.
--

size_t was suggested by Marcus Meissner <meissner@suse.de>.  While
looking at the code I identified the useless (i.e. likely optimized
away) memset.
Use internal malloc function in fips.c

* src/fips.c (check_binary_integrity): s/gcry_malloc/xtrymalloc/.
--

This fixes a build problem with ENABLE_HMAC_BINARY_CHECK.

Reported-by: Michal Vyskocil.
Support building using the latest mingw-w64 toolchain.

* acinclude.m4 (GNUPG_SYS_SYMBOL_UNDERSCORE): Change mingw detection.
--

This patch is related to Debian-bug-id 730271 for GnuPG 1.4:

   From: Stephen Kitt <skitt@debian.org>

      All MinGW targets require underscores when linking. This patch fixes
      acinclude.m4 and the resulting configure so they don't limit the use
      of underscores to the old mingw32msvc targets.

Signed-off-by: Werner Koch <wk@gnupg.org>
Comment typo fix

--
mpi: Fix a subtle bug setting spurious bits with in mpi_set_bit.

* mpi/mpi-bit.c (_gcry_mpi_set_bit, _gcry_mpi_set_highbit): Clear
allocated but not used bits before resizing.
* tests/t-mpi-bits.c (set_bit_with_resize): New.
--

Reported-by: Martin Sewelies.

This bug is probably with us for many years.  Probably due to
different memory allocation patterns, it did first revealed itself
with 1.6.  It could be the reason for other heisenbugs.

Signed-off-by: Werner Koch <wk@gnupg.org>
Fix ARM assembly when building __PIC__

* cipher/camellia-arm.S (GET_DATA_POINTER): New.
(_gcry_camellia_arm_encrypt_block): Use GET_DATA_POINTER.
(_gcry_camellia_arm_decrypt_block): Ditto.
* cipher/cast5-arm.S (GET_DATA_POINTER): New.
(_gcry_cast5_arm_encrypt_block, _gcry_cast5_arm_decrypt_block)
(_gcry_cast5_arm_enc_blk2, _gcry_cast5_arm_dec_blk2): Use
GET_DATA_POINTER.
* cipher/rijndael-arm.S (GET_DATA_POINTER): New.
(_gcry_aes_arm_encrypt_block, _gcry_aes_arm_decrypt_block): Use
GET_DATA_POINTER.
--

Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>
(cherry picked from commit 994c758d8f5471c7e9c38c2834742cca2502d35f)
Fix building for the x32 target without asm modules.

* mpi/generic/mpi-asm-defs.h: Use a fixed value for the x32 ABI.
--

See commit fd6721c235a5bdcb332c8eb708fbd4f96e52e824 for details.
mpi: Use BSD syntax for x86_64-apple-darwin

* mpi/config.links: Add case for x86_64-apple-darwin.
--

Suggested by gniibe on 2014-04-24.
Fix bug inhibiting the use of the sentinel attribute.

* src/gcrypt.h.in: Fix typo in macro.
--

Reported-by: Rafaël Carré <funman@videolan.org>
mpi: Fix regression for powerpc-apple-darwin detection.

* mpi/config.links: Add separate entry for powerpc-apple-darwin.
--

GnuPG-bug-id: 1616
mpi: Extend the internal mpi_get_buffer.

* mpi/mpicoder.c (do_get_buffer): Add arg EXTRAALLOC.
(_gcry_mpi_get_buffer_extra): New.
--
(cherry picked from commit 0e10902ad7584277ac966367efc712b183784532)
ecc: Support the non-standard 0x40 compression flag for EdDSA.

* cipher/ecc.c (ecc_generate): Check the "comp" flag for EdDSA.
* cipher/ecc-eddsa.c (eddsa_encode_x_y): Add arg WITH_PREFIX.
(_gcry_ecc_eddsa_encodepoint): Ditto.
(_gcry_ecc_eddsa_ensure_compact): Handle the 0x40 compression prefix.
(_gcry_ecc_eddsa_decodepoint): Ditto.
* tests/keygrip.c: Check an compresssed with prefix Ed25519 key.
* tests/t-ed25519.inp: Ditto.
--
(cherry picked from commit 4556f9b19c024f16bdf542da7173395c0741b91d)
cipher: Fix possible NULL deref in call to prime generator.

* cipher/primegen.c (_gcry_generate_elg_prime): Change to return an
error code.
* cipher/dsa.c (generate): Take care of new return code.
* cipher/elgamal.c (generate): Change to return an error code.  Take
care of _gcry_generate_elg_prime return code.
(generate_using_x): Take care of _gcry_generate_elg_prime return code.
(elg_generate): Propagate return code from generate.
--

GnuPG-bug-id: 1699, 1700
Reported-by: S.K. Gupta

Note that the NULL deref may have only happened on malloc failure.
cipher: Fix a segv in case of calling with wrong parameters.

* cipher/md.c (_gcry_md_info): Fix arg testing.
--

GnuPG-bug-id: 1697
sexp: Check args of gcry_sexp_build.

* src/sexp.c (do_vsexp_sscan): Return error for invalid args.
--

This helps to avoid usage errors by passing NULL for the return
variable and the format string.
build: Fix typo in help string

* configure.ac: Fix.
--
GnuPG-bug-id: 1631
Release 1.6.2

* configure.ac: Set LT version to C20/A0/R2.
Post release updates.

--