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

Side by Side Diff: openpgp/packet/public_key.go

Issue 10113043: code review 10113043: go.crypto: remove unreachable code. (Closed)
Patch Set: diff -r 627fbe8ff755 https://code.google.com/p/go.crypto/ Created 11 years, 9 months 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:
View unified diff | Download patch
« no previous file with comments | « openpgp/packet/packet.go ('k') | ssh/channel.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 package packet 5 package packet
6 6
7 import ( 7 import (
8 "code.google.com/p/go.crypto/openpgp/elgamal" 8 "code.google.com/p/go.crypto/openpgp/elgamal"
9 "code.google.com/p/go.crypto/openpgp/errors" 9 "code.google.com/p/go.crypto/openpgp/errors"
10 "crypto/dsa" 10 "crypto/dsa"
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 if len(hashBytes) > subgroupSize { 311 if len(hashBytes) > subgroupSize {
312 hashBytes = hashBytes[:subgroupSize] 312 hashBytes = hashBytes[:subgroupSize]
313 } 313 }
314 if !dsa.Verify(dsaPublicKey, hashBytes, new(big.Int).SetBytes(si g.DSASigR.bytes), new(big.Int).SetBytes(sig.DSASigS.bytes)) { 314 if !dsa.Verify(dsaPublicKey, hashBytes, new(big.Int).SetBytes(si g.DSASigR.bytes), new(big.Int).SetBytes(sig.DSASigS.bytes)) {
315 return errors.SignatureError("DSA verification failure") 315 return errors.SignatureError("DSA verification failure")
316 } 316 }
317 return nil 317 return nil
318 default: 318 default:
319 panic("shouldn't happen") 319 panic("shouldn't happen")
320 } 320 }
321 panic("unreachable")
322 } 321 }
323 322
324 // keySignatureHash returns a Hash of the message that needs to be signed for 323 // keySignatureHash returns a Hash of the message that needs to be signed for
325 // pk to assert a subkey relationship to signed. 324 // pk to assert a subkey relationship to signed.
326 func keySignatureHash(pk, signed *PublicKey, sig *Signature) (h hash.Hash, err e rror) { 325 func keySignatureHash(pk, signed *PublicKey, sig *Signature) (h hash.Hash, err e rror) {
327 h = sig.Hash.New() 326 h = sig.Hash.New()
328 if h == nil { 327 if h == nil {
329 return nil, errors.UnsupportedError("hash function") 328 return nil, errors.UnsupportedError("hash function")
330 } 329 }
331 330
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 bitLength = pk.n.bitLength 419 bitLength = pk.n.bitLength
421 case PubKeyAlgoDSA: 420 case PubKeyAlgoDSA:
422 bitLength = pk.p.bitLength 421 bitLength = pk.p.bitLength
423 case PubKeyAlgoElGamal: 422 case PubKeyAlgoElGamal:
424 bitLength = pk.p.bitLength 423 bitLength = pk.p.bitLength
425 default: 424 default:
426 err = errors.InvalidArgumentError("bad public-key algorithm") 425 err = errors.InvalidArgumentError("bad public-key algorithm")
427 } 426 }
428 return 427 return
429 } 428 }
OLDNEW
« no previous file with comments | « openpgp/packet/packet.go ('k') | ssh/channel.go » ('j') | no next file with comments »

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