$OpenBSD: patch-g10_getkey_c,v 1.1 2003/12/13 03:22:16 margarida Exp $
--- g10/getkey.c.orig	2003-12-13 01:55:47.000000000 +0000
+++ g10/getkey.c	2003-12-13 02:00:35.000000000 +0000
@@ -1636,6 +1636,12 @@ merge_selfsigs_main( KBNODE keyblock, in
         if ( x ) /* mask it down to the actual allowed usage */
             key_usage &= x; 
     }
+
+    /* Type 20 Elgamal keys are not usable. */
+    if(pk->pubkey_algo==PUBKEY_ALGO_ELGAMAL)
+      key_usage=0;
+
+
     pk->pubkey_usage = key_usage;
 
     if ( !key_expire_seen ) {
@@ -1806,6 +1812,13 @@ merge_selfsigs_subkey( KBNODE keyblock, 
         if ( x ) /* mask it down to the actual allowed usage */
             key_usage &= x; 
     }
+    
+    /* Type 20 Elgamal subkeys or any subkey on a type 20 primary are
+       not usable. */
+    if(mainpk->pubkey_algo==PUBKEY_ALGO_ELGAMAL
+       || subpk->pubkey_algo==PUBKEY_ALGO_ELGAMAL)
+      key_usage=0;
+
     subpk->pubkey_usage = key_usage;
     
     p = parse_sig_subpkt (sig->hashed, SIGSUBPKT_KEY_EXPIRE, NULL);
