Blame SOURCES/gnupg-2.0.19-fips-algo.patch

04fc35
diff -up gnupg-2.0.19/g10/encode.c.fips gnupg-2.0.19/g10/encode.c
04fc35
--- gnupg-2.0.19/g10/encode.c.fips	2012-03-27 10:00:37.000000000 +0200
04fc35
+++ gnupg-2.0.19/g10/encode.c	2012-11-22 15:51:23.314371267 +0100
04fc35
@@ -732,7 +732,7 @@ encrypt_filter( void *opaque, int contro
04fc35
 		if( efx->cfx.dek->algo == -1 ) {
04fc35
                     /* because 3DES is implicitly in the prefs, this can only
04fc35
                      * happen if we do not have any public keys in the list */
04fc35
-		    efx->cfx.dek->algo = DEFAULT_CIPHER_ALGO;
04fc35
+		    efx->cfx.dek->algo = gcry_fips_mode_active() ? CIPHER_ALGO_AES : DEFAULT_CIPHER_ALGO;
04fc35
                 }
04fc35
 
04fc35
                 /* In case 3DES has been selected, print a warning if
04fc35
diff -up gnupg-2.0.19/g10/gpg.c.fips gnupg-2.0.19/g10/gpg.c
04fc35
--- gnupg-2.0.19/g10/gpg.c.fips	2012-11-22 15:51:23.308371138 +0100
04fc35
+++ gnupg-2.0.19/g10/gpg.c	2012-11-22 15:51:23.315371289 +0100
04fc35
@@ -1973,7 +1973,7 @@ main (int argc, char **argv)
04fc35
     opt.compress_algo = -1; /* defaults to DEFAULT_COMPRESS_ALGO */
04fc35
     opt.s2k_mode = 3; /* iterated+salted */
04fc35
     opt.s2k_count = 0; /* Auto-calibrate when needed.  */
04fc35
-    opt.s2k_cipher_algo = CIPHER_ALGO_CAST5;
04fc35
+    opt.s2k_cipher_algo = gcry_fips_mode_active() ? CIPHER_ALGO_AES : CIPHER_ALGO_CAST5;
04fc35
     opt.completes_needed = 1;
04fc35
     opt.marginals_needed = 3;
04fc35
     opt.max_cert_depth = 5;
04fc35
diff -up gnupg-2.0.19/g10/mainproc.c.fips gnupg-2.0.19/g10/mainproc.c
04fc35
--- gnupg-2.0.19/g10/mainproc.c.fips	2012-03-27 10:00:37.000000000 +0200
04fc35
+++ gnupg-2.0.19/g10/mainproc.c	2012-11-22 16:43:51.876084682 +0100
04fc35
@@ -685,9 +685,11 @@ proc_plaintext( CTX c, PACKET *pkt )
04fc35
 	   often.  There is no good way to specify what algorithms to
04fc35
 	   use in that case, so these three are the historical
04fc35
 	   answer. */
04fc35
-	gcry_md_enable( c->mfx.md, DIGEST_ALGO_RMD160 );
04fc35
+	if( !gcry_fips_mode_active() )
04fc35
+	  gcry_md_enable( c->mfx.md, DIGEST_ALGO_RMD160 );
04fc35
 	gcry_md_enable( c->mfx.md, DIGEST_ALGO_SHA1 );
04fc35
-	gcry_md_enable( c->mfx.md, DIGEST_ALGO_MD5 );
04fc35
+	if( !gcry_fips_mode_active() )
04fc35
+	  gcry_md_enable( c->mfx.md, DIGEST_ALGO_MD5 );
04fc35
       }
04fc35
     if( opt.pgp2_workarounds && only_md5 && !opt.skip_verify ) {
04fc35
 	/* This is a kludge to work around a bug in pgp2.  It does only