Merge pull request #783 from harshavardhana/pr_out_crypto_cleanup_remove_unused_functions

crypto/cleanup: remove unused functions
This commit is contained in:
Harshavardhana 2015-07-29 13:12:04 -07:00
commit 6be5a2fb7e
7 changed files with 14 additions and 35 deletions

View file

@ -66,7 +66,7 @@ func block(dig *digest, p []byte) {
case cpu.HasSSE41() == true:
blockSSE(dig, p)
default:
blockSoftware(dig, p)
blockGeneric(dig, p)
}
}

View file

@ -17,6 +17,7 @@
package sha256
import (
"hash"
"io"
"crypto/sha256"
@ -45,3 +46,8 @@ func Sum(reader io.Reader) ([]byte, error) {
}
return d.Sum(nil), nil
}
// New returns a new hash.Hash computing SHA256.
func New() hash.Hash {
return sha256.New()
}

View file

@ -44,7 +44,7 @@ func blockAVX2(dig *digest, p []byte) {
C.sha256_transform_rorx((*C.char)(unsafe.Pointer(&p[0])), (*C.uint32_t)(unsafe.Pointer(&dig.h[0])), (C.ulong)(len(p)/64))
}
func blockSoftware(dig *digest, p []byte) {
func blockGeneric(dig *digest, p []byte) {
var w [64]uint32
h0, h1, h2, h3, h4, h5, h6, h7 := dig.h[0], dig.h[1], dig.h[2], dig.h[3], dig.h[4], dig.h[5], dig.h[6], dig.h[7]
for len(p) >= chunk {

View file

@ -52,17 +52,6 @@ func Sum(reader io.Reader) ([]byte, error) {
return d.Sum(nil), nil
}
// SumStream - similar to 'Sum()' but returns a [sha512.Size]byte
func SumStream(reader io.Reader) ([sha512.Size]byte, error) {
var returnValue [sha512.Size]byte
sumSlice, err := Sum(reader)
if err != nil {
return returnValue, err
}
copy(returnValue[:], sumSlice)
return returnValue, err
}
// New returns a new hash.Hash computing SHA512.
func New() hash.Hash {
return sha512.New()

View file

@ -53,7 +53,7 @@ func block(dig *digest, p []byte) {
case cpu.HasSSE41() == true:
blockSSE(dig, p)
default:
blockSoftware(dig, p)
blockGeneric(dig, p)
}
}
@ -182,14 +182,3 @@ func Sum(reader io.Reader) ([]byte, error) {
}
return h.Sum(nil), nil
}
// SumStream - similar to 'Sum()' but returns a [Size]byte
func SumStream(reader io.Reader) ([Size]byte, error) {
var returnValue [Size]byte
sumSlice, err := Sum(reader)
if err != nil {
return returnValue, err
}
copy(returnValue[:], sumSlice)
return returnValue, err
}

View file

@ -17,6 +17,7 @@
package sha512
import (
"hash"
"io"
"crypto/sha512"
@ -51,13 +52,7 @@ func Sum(reader io.Reader) ([]byte, error) {
return d.Sum(nil), nil
}
// SumStream - similar to 'Sum()' but returns a [sha512.Size]byte
func SumStream(reader io.Reader) ([sha512.Size]byte, error) {
var returnValue [sha512.Size]byte
sumSlice, err := Sum(reader)
if err != nil {
return returnValue, err
}
copy(returnValue[:], sumSlice)
return returnValue, err
// New returns a new hash.Hash computing SHA512.
func New() hash.Hash {
return sha512.New()
}

View file

@ -46,7 +46,7 @@ func blockAVX2(dig *digest, p []byte) {
C.sha512_transform_rorx(unsafe.Pointer(&p[0]), unsafe.Pointer(&dig.h[0]), (C.uint64_t)(len(p)/chunk))
}
func blockSoftware(dig *digest, p []byte) {
func blockGeneric(dig *digest, p []byte) {
var w [80]uint64
h0, h1, h2, h3, h4, h5, h6, h7 := dig.h[0], dig.h[1], dig.h[2], dig.h[3], dig.h[4], dig.h[5], dig.h[6], dig.h[7]
for len(p) >= chunk {