Skip to content

Commit

Permalink
Removing references to primitives init
Browse files Browse the repository at this point in the history
This change-set removes references to
primitives.SetSecurityLevel and
primitives.InitSecurityLevel
from core, peer and protos packages.

References to those methods still remain
in other packages and will be removed in subsequent
change-sets.

Change-Id: Ib9aa88aeb225cb705420a8d652e3939e58d5d6cb
Signed-off-by: Angelo De Caro <adc@zurich.ibm.com>
  • Loading branch information
adecaro committed Jan 9, 2017
1 parent 97066b5 commit 7d1b541
Show file tree
Hide file tree
Showing 10 changed files with 0 additions and 41 deletions.
3 changes: 0 additions & 3 deletions core/chaincode/exectransaction_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ import (
putils "github.com/hyperledger/fabric/protos/utils"

"github.com/golang/protobuf/proto"
"github.com/hyperledger/fabric/core/crypto/primitives"
"github.com/hyperledger/fabric/core/ledger/ledgermgmt"
"github.com/hyperledger/fabric/core/peer/msp"
"github.com/hyperledger/fabric/msp"
Expand Down Expand Up @@ -1091,8 +1090,6 @@ var signer msp.SigningIdentity
func TestMain(m *testing.M) {
var err error

primitives.SetSecurityLevel("SHA2", 256)

// setup the MSP manager so that we can sign/verify
mspMgrConfigDir := "../../msp/sampleconfig/"
mspmgmt.LoadFakeSetupWithLocalMspAndTestChainMsp(mspMgrConfigDir)
Expand Down
8 changes: 0 additions & 8 deletions core/crypto/primitives/hash.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,6 @@ func Hash(msg []byte) []byte {
return h.Sum(nil)
}

// HMAC hmacs x using key key
func HMAC(key, x []byte) []byte {
mac := hmac.New(GetDefaultHash(), key)
mac.Write(x)

return mac.Sum(nil)
}

// HMACTruncated hmacs x using key key and truncate to truncation
func HMACTruncated(key, x []byte, truncation int) []byte {
mac := hmac.New(GetDefaultHash(), key)
Expand Down
7 changes: 0 additions & 7 deletions core/endorser/endorser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import (
"github.com/golang/protobuf/proto"
"github.com/hyperledger/fabric/core/chaincode"
"github.com/hyperledger/fabric/core/container"
"github.com/hyperledger/fabric/core/crypto/primitives"
"github.com/hyperledger/fabric/core/peer"
"github.com/hyperledger/fabric/core/peer/msp"
"github.com/hyperledger/fabric/core/util"
Expand Down Expand Up @@ -77,12 +76,6 @@ func initPeer(chainID string) (net.Listener, error) {
return &pb.PeerEndpoint{ID: &pb.PeerID{Name: "testpeer"}, Address: peerAddress}, nil
}

// Install security object for peer
//TODO: integrate new crypto / idp
securityLevel := viper.GetInt("security.level")
hashAlgorithm := viper.GetString("security.hashAlgorithm")
primitives.SetSecurityLevel(hashAlgorithm, securityLevel)

ccStartupTimeout := time.Duration(30000) * time.Millisecond
pb.RegisterChaincodeSupportServer(grpcServer, chaincode.NewChaincodeSupport(getPeerEndpoint, false, ccStartupTimeout))

Expand Down
2 changes: 0 additions & 2 deletions core/peer/fullflow_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import (
"fmt"
"os"

"github.com/hyperledger/fabric/core/crypto/primitives"
"github.com/hyperledger/fabric/core/peer/msp"
"github.com/hyperledger/fabric/core/util"
"github.com/hyperledger/fabric/msp"
Expand Down Expand Up @@ -314,7 +313,6 @@ var signerSerialized []byte

func TestMain(m *testing.M) {
// setup crypto algorithms
primitives.SetSecurityLevel("SHA2", 256)
// setup the MSP manager so that we can sign/verify
mspMgrConfigDir := "../../msp/sampleconfig/"
err := mspmgmt.LoadFakeSetupWithLocalMspAndTestChainMsp(mspMgrConfigDir)
Expand Down
4 changes: 0 additions & 4 deletions core/system_chaincode/escc/endorser_onevalidsignature_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import (
"os"

"github.com/hyperledger/fabric/core/chaincode/shim"
"github.com/hyperledger/fabric/core/crypto/primitives"
"github.com/hyperledger/fabric/core/peer"
"github.com/hyperledger/fabric/core/peer/msp"
"github.com/hyperledger/fabric/core/util"
Expand Down Expand Up @@ -275,9 +274,6 @@ func validateProposalResponse(prBytes []byte, proposal *pb.Proposal, visibility
}

func TestMain(m *testing.M) {
primitives.InitSecurityLevel("SHA2", 256)
// setup the MSP manager so that we can sign/verify
// TODO: determine the config file for the MSP
mspMgrConfigDir := "../../../msp/sampleconfig/"
mspmgmt.LoadFakeSetupWithLocalMspAndTestChainMsp(mspMgrConfigDir)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import (
"os"

"github.com/hyperledger/fabric/core/chaincode/shim"
"github.com/hyperledger/fabric/core/crypto/primitives"
"github.com/hyperledger/fabric/core/peer/msp"
"github.com/hyperledger/fabric/core/util"
"github.com/hyperledger/fabric/msp"
Expand Down Expand Up @@ -101,7 +100,6 @@ var sid []byte
func TestMain(m *testing.M) {
var err error

primitives.InitSecurityLevel("SHA2", 256)
// setup the MSP manager so that we can sign/verify
mspMgrConfigDir := "../../../msp/sampleconfig/"
mspmgmt.LoadFakeSetupWithLocalMspAndTestChainMsp(mspMgrConfigDir)
Expand Down
5 changes: 0 additions & 5 deletions peer/common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import (
"path/filepath"

"github.com/hyperledger/fabric/common/flogging"
"github.com/hyperledger/fabric/core/crypto/primitives"
"github.com/hyperledger/fabric/core/errors"
"github.com/hyperledger/fabric/core/peer"
"github.com/hyperledger/fabric/core/peer/msp"
Expand Down Expand Up @@ -62,10 +61,6 @@ func InitConfig(cmdRoot string) error {

//InitCrypto initializes crypto for this peer
func InitCrypto(mspMgrConfigDir string) error {
// Init the crypto layer
//TODO: integrate new crypto / idp code
primitives.SetSecurityLevel("SHA2", 256)

// FIXME: when this peer joins a chain, it should get the
// config for that chain with the list of MSPs that the
// chain uses; however this is not yet implemented.
Expand Down
5 changes: 0 additions & 5 deletions peer/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import (

"github.com/hyperledger/fabric/common/flogging"
"github.com/hyperledger/fabric/core"
"github.com/hyperledger/fabric/core/crypto/primitives"
"github.com/hyperledger/fabric/peer/chaincode"
"github.com/hyperledger/fabric/peer/clilogging"
"github.com/hyperledger/fabric/peer/common"
Expand Down Expand Up @@ -98,10 +97,6 @@ func main() {
// initialize logging format from core.yaml
flogging.SetLoggingFormat(viper.GetString("logging.format"), logOutput)

// Init the crypto layer
//TODO: integrate new crypto / idp code
primitives.SetSecurityLevel("SHA2", 256)

// Init the MSP
// TODO: determine the location of this config file
var mspMgrConfigDir string
Expand Down
2 changes: 0 additions & 2 deletions protos/testutils/txtestutils.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import (

"path/filepath"

"github.com/hyperledger/fabric/core/crypto/primitives"
"github.com/hyperledger/fabric/core/peer/msp"
"github.com/hyperledger/fabric/msp"
"github.com/hyperledger/fabric/protos/common"
Expand All @@ -36,7 +35,6 @@ var (

func init() {
var err error
primitives.SetSecurityLevel("SHA2", 256)
// setup the MSP manager so that we can sign/verify
mspMgrConfigDir, err := getMSPMgrConfigDir()
if err != nil {
Expand Down
3 changes: 0 additions & 3 deletions protos/utils/proputils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import (
"fmt"
"os"

"github.com/hyperledger/fabric/core/crypto/primitives"
"github.com/hyperledger/fabric/core/peer/msp"
"github.com/hyperledger/fabric/core/util"
"github.com/hyperledger/fabric/msp"
Expand Down Expand Up @@ -294,8 +293,6 @@ var signer msp.SigningIdentity
var signerSerialized []byte

func TestMain(m *testing.M) {
// setup crypto algorithms
primitives.SetSecurityLevel("SHA2", 256)
// setup the MSP manager so that we can sign/verify
mspMgrConfigFile := "../../msp/sampleconfig/"
err := mspmgmt.LoadFakeSetupWithLocalMspAndTestChainMsp(mspMgrConfigFile)
Expand Down

0 comments on commit 7d1b541

Please sign in to comment.