Index: g10/keygen.c =================================================================== --- g10/keygen.c +++ g10/keygen.c @@ -301,7 +301,7 @@ byte sym[MAX_PREFS], hash[MAX_PREFS], zip[MAX_PREFS]; int nsym=0, nhash=0, nzip=0, val, rc=0; int mdc=1, modify=0; /* mdc defaults on, modify defaults off. */ - char dummy_string[45+1]; /* Enough for 15 items. */ + char dummy_string[80+1]; /* Enough for 20 items. */ if (!string || !ascii_strcasecmp (string, "default")) { @@ -323,9 +323,9 @@ possible to prefer AES128. */ - /* Make sure we do not add more than 15 items here, as we + /* Make sure we do not add more than 20 items here, as we could overflow the size of dummy_string. We currently - have at most 12. */ + have at most 15. */ if ( !openpgp_cipher_test_algo (CIPHER_ALGO_AES256) ) strcat(dummy_string,"S9 "); if ( !openpgp_cipher_test_algo (CIPHER_ALGO_AES192) ) @@ -345,16 +345,28 @@ if ( !openpgp_cipher_test_algo (CIPHER_ALGO_IDEA) ) strcat(dummy_string,"S1 "); - /* SHA-1 */ - strcat(dummy_string,"H2 "); + /* default-preference-list: + SHA512 SHA384 SHA256 SHA224 RIPEMD160 SHA1 */ + if (!openpgp_md_test_algo(DIGEST_ALGO_SHA512)) + strcat(dummy_string,"H10 "); + + if (!openpgp_md_test_algo(DIGEST_ALGO_SHA384)) + strcat(dummy_string,"H9 "); + if (!openpgp_md_test_algo(DIGEST_ALGO_SHA256)) strcat(dummy_string,"H8 "); + if (!openpgp_md_test_algo(DIGEST_ALGO_SHA224)) + strcat(dummy_string,"H11 "); + /* RIPEMD160 */ if (!openpgp_md_test_algo(DIGEST_ALGO_RMD160)) strcat(dummy_string,"H3 "); + /* SHA-1 */ + strcat(dummy_string,"H2 "); + /* ZLIB */ strcat(dummy_string,"Z2 ");