aboutsummaryrefslogtreecommitdiffstats
path: root/g10/keygen.c
diff options
context:
space:
mode:
Diffstat (limited to 'g10/keygen.c')
-rw-r--r--g10/keygen.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/g10/keygen.c b/g10/keygen.c
index ce9169be6..37d4a0740 100644
--- a/g10/keygen.c
+++ b/g10/keygen.c
@@ -280,6 +280,30 @@ keygen_get_std_prefs ()
}
+static void
+add_feature_mdc (PKT_signature *sig)
+{
+ const byte *s;
+ size_t i, n;
+ char *buf;
+
+ s = parse_sig_subpkt (sig->hashed, SIGSUBPKT_FEATURES, &n );
+ if (!s)
+ n = 0;
+
+ for (i=0; i < n; i++ ) {
+ if (s[i] == 1)
+ return; /* already set */
+ }
+
+ buf = m_alloc (n+1);
+ buf[0] = 1; /* MDC feature */
+ memcpy (buf+1, s, n);
+ build_sig_subpkt (sig, SIGSUBPKT_FEATURES, buf, n+1);
+ m_free (buf);
+}
+
+
int
keygen_upd_std_prefs( PKT_signature *sig, void *opaque )
{
@@ -298,6 +322,10 @@ keygen_upd_std_prefs( PKT_signature *sig, void *opaque )
build_sig_subpkt (sig, SIGSUBPKT_PREF_COMPR, zip_prefs, nzip_prefs);
else
delete_sig_subpkt (sig->hashed, SIGSUBPKT_PREF_COMPR);
+
+ /* Make sure that the MDC feature flag is set */
+ add_feature_mdc (sig);
+
return 0;
}