epoint-client += query documents by id
[epoint] / patches / creationtime.diff
1 diff -r 221f3eb76b52 src/pkg/crypto/openpgp/packet/signature.go
2 --- a/src/pkg/crypto/openpgp/packet/signature.go        Thu Nov 24 08:51:47 2011 -0800
3 +++ b/src/pkg/crypto/openpgp/packet/signature.go        Fri Dec 02 01:56:00 2011 +0100
4 @@ -144,14 +144,21 @@
5  // parseSignatureSubpackets parses subpackets of the main signature packet. See
6  // RFC 4880, section 5.2.3.1.
7  func parseSignatureSubpackets(sig *Signature, subpackets []byte, isHashed bool) (err error) {
8 +       hasCreationTime := false
9 +
10         for len(subpackets) > 0 {
11 -               subpackets, err = parseSignatureSubpacket(sig, subpackets, isHashed)
12 +               var packetType signatureSubpacketType
13 +
14 +               packetType, subpackets, err = parseSignatureSubpacket(sig, subpackets, isHashed)
15                 if err != nil {
16                         return
17                 }
18 +               if packetType == creationTimeSubpacket {
19 +                       hasCreationTime = true
20 +               }
21         }
22  
23 -       if sig.CreationTime == 0 {
24 +       if isHashed && !hasCreationTime {
25                 err = error_.StructuralError("no creation time in signature")
26         }
27  
28 @@ -173,11 +180,10 @@
29  )
30  
31  // parseSignatureSubpacket parses a single subpacket. len(subpacket) is >= 1.
32 -func parseSignatureSubpacket(sig *Signature, subpacket []byte, isHashed bool) (rest []byte, err error) {
33 +func parseSignatureSubpacket(sig *Signature, subpacket []byte, isHashed bool) (packetType signatureSubpacketType, rest []byte, err error) {
34         // RFC 4880, section 5.2.3.1
35         var (
36                 length     uint32
37 -               packetType signatureSubpacketType
38                 isCritical bool
39         )
40         switch {