Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(31)

Delta Between Two Patch Sets: src/pkg/crypto/openpgp/packet/packet.go

Issue 4280041: crypto/openpgp: add DSA signature support. (Closed)
Left Patch Set: Created 14 years ago
Right Patch Set: diff -r 87209dfd5825 https://go.googlecode.com/hg/ Created 14 years ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | src/pkg/crypto/openpgp/packet/private_key.go » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
1 // Copyright 2011 The Go Authors. All rights reserved. 1 // Copyright 2011 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 // This package implements parsing and serialisation of OpenPGP packets, as 5 // This package implements parsing and serialisation of OpenPGP packets, as
6 // specified in RFC 4880. 6 // specified in RFC 4880.
7 package packet 7 package packet
8 8
9 import ( 9 import (
10 "big"
10 "crypto/aes" 11 "crypto/aes"
11 "crypto/cast5" 12 "crypto/cast5"
12 "crypto/cipher" 13 "crypto/cipher"
13 "crypto/openpgp/error" 14 "crypto/openpgp/error"
14 "io" 15 "io"
15 "os" 16 "os"
16 ) 17 )
17 18
18 // readFull is the same as io.ReadFull except that reading zero bytes returns 19 // readFull is the same as io.ReadFull except that reading zero bytes returns
19 // ErrUnexpectedEOF rather than EOF. 20 // ErrUnexpectedEOF rather than EOF.
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 if err != nil { 379 if err != nil {
379 return 380 return
380 } 381 }
381 bitLength = uint16(buf[0])<<8 | uint16(buf[1]) 382 bitLength = uint16(buf[0])<<8 | uint16(buf[1])
382 numBytes := (int(bitLength) + 7) / 8 383 numBytes := (int(bitLength) + 7) / 8
383 mpi = make([]byte, numBytes) 384 mpi = make([]byte, numBytes)
384 _, err = readFull(r, mpi) 385 _, err = readFull(r, mpi)
385 return 386 return
386 } 387 }
387 388
388 // writeMPI serializes a big integer to r. 389 // writeMPI serializes a big integer to w.
389 func writeMPI(w io.Writer, bitLength uint16, mpiBytes []byte) (err os.Error) { 390 func writeMPI(w io.Writer, bitLength uint16, mpiBytes []byte) (err os.Error) {
390 _, err = w.Write([]byte{byte(bitLength >> 8), byte(bitLength)}) 391 _, err = w.Write([]byte{byte(bitLength >> 8), byte(bitLength)})
391 if err == nil { 392 if err == nil {
392 _, err = w.Write(mpiBytes) 393 _, err = w.Write(mpiBytes)
393 } 394 }
394 return 395 return
395 } 396 }
397
398 // writeBig serializes a *big.Int to w.
399 func writeBig(w io.Writer, i *big.Int) os.Error {
400 return writeMPI(w, uint16(i.BitLen()), i.Bytes())
401 }
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b