* g10.c (main): Use 3DES instead of CAST5 if we don't have CAST5 support.
[gnupg.git] / g10 / build-packet.c
index d0122b1..269cca3 100644 (file)
@@ -763,6 +763,15 @@ build_sig_subpkt (PKT_signature *sig, sigsubpkttype_t type,
        sig->trust_regexp=buffer;
        break;
 
+       /* This should never happen since we don't currently allow
+          creating such a subpacket, but just in case... */
+      case SIGSUBPKT_SIG_EXPIRE:
+       if(buffer_to_u32(buffer)+sig->timestamp<=make_timestamp())
+         sig->flags.expired=1;
+       else
+         sig->flags.expired=0;
+       break;
+
       default:
        break;
       }
@@ -869,7 +878,11 @@ build_sig_subpkt_from_sig( PKT_signature *sig )
 
     if(sig->expiredate)
       {
-       u = sig->expiredate-sig->timestamp;
+       if(sig->expiredate>sig->timestamp)
+         u=sig->expiredate-sig->timestamp;
+       else
+         u=0;
+
        buf[0] = (u >> 24) & 0xff;
        buf[1] = (u >> 16) & 0xff;
        buf[2] = (u >>  8) & 0xff;