aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--g10/ChangeLog3
-rw-r--r--g10/keygen.c23
2 files changed, 22 insertions, 4 deletions
diff --git a/g10/ChangeLog b/g10/ChangeLog
index dad0af9e5..74aec4ac9 100644
--- a/g10/ChangeLog
+++ b/g10/ChangeLog
@@ -1,5 +1,8 @@
2003-02-21 David Shaw <[email protected]>
+ * keygen.c (keygen_set_std_prefs): Don't put AES or CAST5 in
+ default prefs if they are disabled.
+
* g10.c (main): Use 3DES instead of CAST5 if we don't have CAST5
support. Use 3DES for the s2k cipher in --openpgp mode.
(print_mds): #ifdef all of the optional digest algorithms.
diff --git a/g10/keygen.c b/g10/keygen.c
index ccaa4adce..508241743 100644
--- a/g10/keygen.c
+++ b/g10/keygen.c
@@ -1,5 +1,6 @@
/* keygen.c - generate a key pair
- * Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+ * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003
+ * Free Software Foundation, Inc.
*
* This file is part of GnuPG.
*
@@ -38,7 +39,6 @@
#define MAX_PREFS 30
-
enum para_name {
pKEYTYPE,
pKEYLENGTH,
@@ -212,6 +212,18 @@ set_one_pref (int val, int type, const char *item, byte *buf, int *nbuf)
return 0;
}
+#ifdef USE_AES
+#define AES "S7 "
+#else
+#define AES ""
+#endif
+
+#ifdef USE_CAST5
+#define CAST5 "S3 "
+#else
+#define CAST5 ""
+#endif
+
/*
* Parse the supplied string and use it to set the standard
* preferences. The string may be in a form like the one printed by
@@ -230,9 +242,9 @@ keygen_set_std_prefs (const char *string,int personal)
if (opt.def_preference_list)
string=opt.def_preference_list;
else if ( !check_cipher_algo(CIPHER_ALGO_IDEA) )
- string = "S7 S3 S2 S1 H2 H3 Z2 Z1";
+ string = AES CAST5 "S2 S1 H2 H3 Z2 Z1";
else
- string = "S7 S3 S2 H2 H3 Z2 Z1";
+ string = AES CAST5 "S2 H2 H3 Z2 Z1";
/* If we have it, IDEA goes *after* 3DES so it won't be used
unless we're encrypting along with a V3 key. Ideally, we
@@ -375,6 +387,9 @@ keygen_set_std_prefs (const char *string,int personal)
return rc;
}
+#undef CAST5
+#undef AES
+
/* Return a fake user ID containing the preferences. Caller must
free. */
PKT_user_id *keygen_get_std_prefs(void)