~john-koepi/ubuntu/trusty/golang/default

« back to all changes in this revision

Viewing changes to src/pkg/crypto/ecdsa/ecdsa.go

  • Committer: Package Import Robot
  • Author(s): Ondřej Surý, Ondřej Surý, Michael Stapelberg
  • Date: 2012-06-28 12:14:15 UTC
  • mfrom: (1.1.15)
  • mto: (3.1.5 experimental) (14.3.1 saucy)
  • mto: This revision was merged to the branch mainline in revision 24.
  • Revision ID: package-import@ubuntu.com-20120628121415-w1b0076ixkarr1ml
[ Ondřej Surý ]
* Imported Upstream version 1.0.2
* Update Vcs fields to reflect new git repository location
* Kill get-orig-source, since 1.0.0, the tarballs can be downloaded
  from webpage

[ Michael Stapelberg ]
* golang-mode: use debian-pkg-add-load-path-item (Closes: #664802)
* Add manpages (Closes: #632964)
* Use updated pt.po from Pedro Ribeiro (Closes: #674958)

Show diffs side-by-side

added added

removed removed

Lines of Context:
66
66
// hashToInt converts a hash value to an integer. There is some disagreement
67
67
// about how this is done. [NSA] suggests that this is done in the obvious
68
68
// manner, but [SECG] truncates the hash to the bit-length of the curve order
69
 
// first. We follow [SECG] because that's what OpenSSL does.
 
69
// first. We follow [SECG] because that's what OpenSSL does. Additionally,
 
70
// OpenSSL right shifts excess bits from the number if the hash is too large
 
71
// and we mirror that too.
70
72
func hashToInt(hash []byte, c elliptic.Curve) *big.Int {
71
73
        orderBits := c.Params().N.BitLen()
72
74
        orderBytes := (orderBits + 7) / 8
75
77
        }
76
78
 
77
79
        ret := new(big.Int).SetBytes(hash)
78
 
        excess := orderBytes*8 - orderBits
 
80
        excess := len(hash)*8 - orderBits
79
81
        if excess > 0 {
80
82
                ret.Rsh(ret, uint(excess))
81
83
        }