[dev.boringcrypto] crypto: move crypto/internal/boring imports to reduce merge conflicts

As suggested by dmitshur@, move them to their own block so they don't
conflict with changes in the upstream imports.

Change-Id: Id46fb7c766066c406023b0355f4c3c860166f0fe
Reviewed-on: https://go-review.googlesource.com/c/go/+/181277
Run-TryBot: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
This commit is contained in:
Filippo Valsorda 2019-06-07 13:48:42 -04:00
parent 324f8365be
commit 9bf9e7d4b2
16 changed files with 38 additions and 18 deletions

View file

@ -6,11 +6,12 @@ package aes
import ( import (
"crypto/cipher" "crypto/cipher"
"crypto/internal/boring"
"crypto/internal/subtle" "crypto/internal/subtle"
"strconv" "strconv"
) )
import "crypto/internal/boring"
// The AES block size in bytes. // The AES block size in bytes.
const BlockSize = 16 const BlockSize = 16

View file

@ -8,11 +8,12 @@ package aes
import ( import (
"crypto/cipher" "crypto/cipher"
"crypto/internal/boring"
"crypto/internal/subtle" "crypto/internal/subtle"
"internal/cpu" "internal/cpu"
) )
import "crypto/internal/boring"
// defined in asm_*.s // defined in asm_*.s
//go:noescape //go:noescape

View file

@ -21,17 +21,20 @@ import (
"crypto/aes" "crypto/aes"
"crypto/cipher" "crypto/cipher"
"crypto/elliptic" "crypto/elliptic"
"crypto/internal/boring"
"crypto/sha512" "crypto/sha512"
"encoding/asn1" "encoding/asn1"
"errors" "errors"
"io" "io"
"math/big" "math/big"
"unsafe"
"crypto/internal/randutil" "crypto/internal/randutil"
) )
import (
"crypto/internal/boring"
"unsafe"
)
// A invertible implements fast inverse mod Curve.Params().N // A invertible implements fast inverse mod Curve.Params().N
type invertible interface { type invertible interface {
// Inverse returns the inverse of k in GF(P) // Inverse returns the inverse of k in GF(P)

View file

@ -22,11 +22,12 @@ timing side-channels:
package hmac package hmac
import ( import (
"crypto/internal/boring"
"crypto/subtle" "crypto/subtle"
"hash" "hash"
) )
import "crypto/internal/boring"
// FIPS 198-1: // FIPS 198-1:
// https://csrc.nist.gov/publications/fips/fips198-1/FIPS-198-1_final.pdf // https://csrc.nist.gov/publications/fips/fips198-1/FIPS-198-1_final.pdf

View file

@ -13,7 +13,6 @@ import (
"bufio" "bufio"
"crypto/aes" "crypto/aes"
"crypto/cipher" "crypto/cipher"
"crypto/internal/boring"
"encoding/binary" "encoding/binary"
"io" "io"
"os" "os"
@ -23,6 +22,8 @@ import (
"time" "time"
) )
import "crypto/internal/boring"
const urandomDevice = "/dev/urandom" const urandomDevice = "/dev/urandom"
// Easy implementation: read from /dev/urandom. // Easy implementation: read from /dev/urandom.

View file

@ -6,7 +6,6 @@ package rsa
import ( import (
"crypto" "crypto"
"crypto/internal/boring"
"crypto/subtle" "crypto/subtle"
"errors" "errors"
"io" "io"
@ -15,6 +14,8 @@ import (
"crypto/internal/randutil" "crypto/internal/randutil"
) )
import "crypto/internal/boring"
// This file implements encryption and decryption using PKCS#1 v1.5 padding. // This file implements encryption and decryption using PKCS#1 v1.5 padding.
// PKCS1v15DecrypterOpts is for passing options to PKCS#1 v1.5 decryption using // PKCS1v15DecrypterOpts is for passing options to PKCS#1 v1.5 decryption using

View file

@ -11,13 +11,14 @@ package rsa
import ( import (
"bytes" "bytes"
"crypto" "crypto"
"crypto/internal/boring"
"errors" "errors"
"hash" "hash"
"io" "io"
"math/big" "math/big"
) )
import "crypto/internal/boring"
func emsaPSSEncode(mHash []byte, emBits int, salt []byte, hash hash.Hash) ([]byte, error) { func emsaPSSEncode(mHash []byte, emBits int, salt []byte, hash hash.Hash) ([]byte, error) {
// See [1], section 9.1.1 // See [1], section 9.1.1
hLen := hash.Size() hLen := hash.Size()

View file

@ -24,7 +24,6 @@ package rsa
import ( import (
"crypto" "crypto"
"crypto/internal/boring"
"crypto/rand" "crypto/rand"
"crypto/subtle" "crypto/subtle"
"errors" "errors"
@ -32,11 +31,15 @@ import (
"io" "io"
"math" "math"
"math/big" "math/big"
"unsafe"
"crypto/internal/randutil" "crypto/internal/randutil"
) )
import (
"crypto/internal/boring"
"unsafe"
)
var bigZero = big.NewInt(0) var bigZero = big.NewInt(0)
var bigOne = big.NewInt(1) var bigOne = big.NewInt(1)

View file

@ -7,7 +7,6 @@ package rsa
import ( import (
"bytes" "bytes"
"crypto" "crypto"
"crypto/internal/boring"
"crypto/rand" "crypto/rand"
"crypto/sha1" "crypto/sha1"
"crypto/sha256" "crypto/sha256"
@ -16,6 +15,8 @@ import (
"testing" "testing"
) )
import "crypto/internal/boring"
func TestKeyGeneration(t *testing.T) { func TestKeyGeneration(t *testing.T) {
for _, size := range []int{128, 1024, 2048, 3072} { for _, size := range []int{128, 1024, 2048, 3072} {
priv, err := GenerateKey(rand.Reader, size) priv, err := GenerateKey(rand.Reader, size)

View file

@ -8,7 +8,6 @@ package sha1
import ( import (
"bytes" "bytes"
"crypto/internal/boring"
"crypto/rand" "crypto/rand"
"encoding" "encoding"
"fmt" "fmt"
@ -17,6 +16,8 @@ import (
"testing" "testing"
) )
import "crypto/internal/boring"
type sha1Test struct { type sha1Test struct {
out string out string
in string in string

View file

@ -8,12 +8,13 @@ package sha256
import ( import (
"crypto" "crypto"
"crypto/internal/boring"
"encoding/binary" "encoding/binary"
"errors" "errors"
"hash" "hash"
) )
import "crypto/internal/boring"
func init() { func init() {
crypto.RegisterHash(crypto.SHA224, New224) crypto.RegisterHash(crypto.SHA224, New224)
crypto.RegisterHash(crypto.SHA256, New) crypto.RegisterHash(crypto.SHA256, New)

View file

@ -8,7 +8,6 @@ package sha256
import ( import (
"bytes" "bytes"
"crypto/internal/boring"
"crypto/rand" "crypto/rand"
"encoding" "encoding"
"fmt" "fmt"
@ -17,6 +16,8 @@ import (
"testing" "testing"
) )
import "crypto/internal/boring"
type sha256Test struct { type sha256Test struct {
out string out string
in string in string

View file

@ -12,12 +12,13 @@ package sha512
import ( import (
"crypto" "crypto"
"crypto/internal/boring"
"encoding/binary" "encoding/binary"
"errors" "errors"
"hash" "hash"
) )
import "crypto/internal/boring"
func init() { func init() {
crypto.RegisterHash(crypto.SHA384, New384) crypto.RegisterHash(crypto.SHA384, New384)
crypto.RegisterHash(crypto.SHA512, New) crypto.RegisterHash(crypto.SHA512, New)

View file

@ -8,7 +8,6 @@ package sha512
import ( import (
"bytes" "bytes"
"crypto/internal/boring"
"crypto/rand" "crypto/rand"
"encoding" "encoding"
"encoding/hex" "encoding/hex"
@ -18,6 +17,8 @@ import (
"testing" "testing"
) )
import "crypto/internal/boring"
type sha512Test struct { type sha512Test struct {
out string out string
in string in string

View file

@ -10,7 +10,6 @@ import (
"crypto/cipher" "crypto/cipher"
"crypto/des" "crypto/des"
"crypto/hmac" "crypto/hmac"
"crypto/internal/boring"
"crypto/rc4" "crypto/rc4"
"crypto/sha1" "crypto/sha1"
"crypto/sha256" "crypto/sha256"
@ -19,6 +18,8 @@ import (
"hash" "hash"
) )
import "crypto/internal/boring"
// a keyAgreement implements the client and server side of a TLS key agreement // a keyAgreement implements the client and server side of a TLS key agreement
// protocol by generating and processing key exchange messages. // protocol by generating and processing key exchange messages.
type keyAgreement interface { type keyAgreement interface {

View file

@ -7,7 +7,6 @@ package tls
import ( import (
"container/list" "container/list"
"crypto" "crypto"
"crypto/internal/boring"
"crypto/rand" "crypto/rand"
"crypto/sha512" "crypto/sha512"
"crypto/x509" "crypto/x509"
@ -23,6 +22,8 @@ import (
"time" "time"
) )
import "crypto/internal/boring"
const ( const (
VersionSSL30 = 0x0300 VersionSSL30 = 0x0300
VersionTLS10 = 0x0301 VersionTLS10 = 0x0301