Index: gnupg-2.1.0/g10/encrypt.c =================================================================== --- gnupg-2.1.0.orig/g10/encrypt.c 2014-11-06 18:27:35.176659675 +0100 +++ gnupg-2.1.0/g10/encrypt.c 2014-11-06 18:29:10.987883901 +0100 @@ -783,7 +783,10 @@ encrypt_filter (void *opaque, int contro /* Because 3DES is implicitly in the prefs, this can only happen if we do not have any public keys in the list. */ - efx->cfx.dek->algo = DEFAULT_CIPHER_ALGO; + /* Libgcrypt manual says that gcry_version_check must be called + before calling gcry_fips_mode_active. */ + gcry_check_version (NULL); + efx->cfx.dek->algo = gcry_fips_mode_active() ? CIPHER_ALGO_AES : DEFAULT_CIPHER_ALGO; } /* In case 3DES has been selected, print a warning if Index: gnupg-2.1.0/g10/mainproc.c =================================================================== --- gnupg-2.1.0.orig/g10/mainproc.c 2014-11-06 18:27:33.243634973 +0100 +++ gnupg-2.1.0/g10/mainproc.c 2014-11-06 18:27:35.178659700 +0100 @@ -690,9 +690,15 @@ proc_plaintext( CTX c, PACKET *pkt ) often. There is no good way to specify what algorithms to use in that case, so these three are the historical answer. */ - gcry_md_enable( c->mfx.md, DIGEST_ALGO_RMD160 ); + + /* Libgcrypt manual says that gcry_version_check must be called + before calling gcry_fips_mode_active. */ + gcry_check_version (NULL); + if( !gcry_fips_mode_active() ) + gcry_md_enable( c->mfx.md, DIGEST_ALGO_RMD160 ); gcry_md_enable( c->mfx.md, DIGEST_ALGO_SHA1 ); - gcry_md_enable( c->mfx.md, DIGEST_ALGO_MD5 ); + if( !gcry_fips_mode_active() ) + gcry_md_enable( c->mfx.md, DIGEST_ALGO_MD5 ); } if (opt.pgp2_workarounds && only_md5 && !opt.skip_verify && opt.flags.allow_weak_digest_algos) {