Skip to content

Commit 7d1b541

Browse files
committed
Removing references to primitives init
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 <[email protected]>
1 parent 97066b5 commit 7d1b541

File tree

10 files changed

+0
-41
lines changed

10 files changed

+0
-41
lines changed

core/chaincode/exectransaction_test.go

-3
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ import (
3737
putils "github.com/hyperledger/fabric/protos/utils"
3838

3939
"github.com/golang/protobuf/proto"
40-
"github.com/hyperledger/fabric/core/crypto/primitives"
4140
"github.com/hyperledger/fabric/core/ledger/ledgermgmt"
4241
"github.com/hyperledger/fabric/core/peer/msp"
4342
"github.com/hyperledger/fabric/msp"
@@ -1091,8 +1090,6 @@ var signer msp.SigningIdentity
10911090
func TestMain(m *testing.M) {
10921091
var err error
10931092

1094-
primitives.SetSecurityLevel("SHA2", 256)
1095-
10961093
// setup the MSP manager so that we can sign/verify
10971094
mspMgrConfigDir := "../../msp/sampleconfig/"
10981095
mspmgmt.LoadFakeSetupWithLocalMspAndTestChainMsp(mspMgrConfigDir)

core/crypto/primitives/hash.go

-8
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,6 @@ func Hash(msg []byte) []byte {
4848
return h.Sum(nil)
4949
}
5050

51-
// HMAC hmacs x using key key
52-
func HMAC(key, x []byte) []byte {
53-
mac := hmac.New(GetDefaultHash(), key)
54-
mac.Write(x)
55-
56-
return mac.Sum(nil)
57-
}
58-
5951
// HMACTruncated hmacs x using key key and truncate to truncation
6052
func HMACTruncated(key, x []byte, truncation int) []byte {
6153
mac := hmac.New(GetDefaultHash(), key)

core/endorser/endorser_test.go

-7
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ import (
2828
"github.com/golang/protobuf/proto"
2929
"github.com/hyperledger/fabric/core/chaincode"
3030
"github.com/hyperledger/fabric/core/container"
31-
"github.com/hyperledger/fabric/core/crypto/primitives"
3231
"github.com/hyperledger/fabric/core/peer"
3332
"github.com/hyperledger/fabric/core/peer/msp"
3433
"github.com/hyperledger/fabric/core/util"
@@ -77,12 +76,6 @@ func initPeer(chainID string) (net.Listener, error) {
7776
return &pb.PeerEndpoint{ID: &pb.PeerID{Name: "testpeer"}, Address: peerAddress}, nil
7877
}
7978

80-
// Install security object for peer
81-
//TODO: integrate new crypto / idp
82-
securityLevel := viper.GetInt("security.level")
83-
hashAlgorithm := viper.GetString("security.hashAlgorithm")
84-
primitives.SetSecurityLevel(hashAlgorithm, securityLevel)
85-
8679
ccStartupTimeout := time.Duration(30000) * time.Millisecond
8780
pb.RegisterChaincodeSupportServer(grpcServer, chaincode.NewChaincodeSupport(getPeerEndpoint, false, ccStartupTimeout))
8881

core/peer/fullflow_test.go

-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import (
2424
"fmt"
2525
"os"
2626

27-
"github.com/hyperledger/fabric/core/crypto/primitives"
2827
"github.com/hyperledger/fabric/core/peer/msp"
2928
"github.com/hyperledger/fabric/core/util"
3029
"github.com/hyperledger/fabric/msp"
@@ -314,7 +313,6 @@ var signerSerialized []byte
314313

315314
func TestMain(m *testing.M) {
316315
// setup crypto algorithms
317-
primitives.SetSecurityLevel("SHA2", 256)
318316
// setup the MSP manager so that we can sign/verify
319317
mspMgrConfigDir := "../../msp/sampleconfig/"
320318
err := mspmgmt.LoadFakeSetupWithLocalMspAndTestChainMsp(mspMgrConfigDir)

core/system_chaincode/escc/endorser_onevalidsignature_test.go

-4
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import (
2424
"os"
2525

2626
"github.com/hyperledger/fabric/core/chaincode/shim"
27-
"github.com/hyperledger/fabric/core/crypto/primitives"
2827
"github.com/hyperledger/fabric/core/peer"
2928
"github.com/hyperledger/fabric/core/peer/msp"
3029
"github.com/hyperledger/fabric/core/util"
@@ -275,9 +274,6 @@ func validateProposalResponse(prBytes []byte, proposal *pb.Proposal, visibility
275274
}
276275

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

core/system_chaincode/vscc/validator_onevalidsignature_test.go

-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import (
2222
"os"
2323

2424
"github.com/hyperledger/fabric/core/chaincode/shim"
25-
"github.com/hyperledger/fabric/core/crypto/primitives"
2625
"github.com/hyperledger/fabric/core/peer/msp"
2726
"github.com/hyperledger/fabric/core/util"
2827
"github.com/hyperledger/fabric/msp"
@@ -101,7 +100,6 @@ var sid []byte
101100
func TestMain(m *testing.M) {
102101
var err error
103102

104-
primitives.InitSecurityLevel("SHA2", 256)
105103
// setup the MSP manager so that we can sign/verify
106104
mspMgrConfigDir := "../../../msp/sampleconfig/"
107105
mspmgmt.LoadFakeSetupWithLocalMspAndTestChainMsp(mspMgrConfigDir)

peer/common/common.go

-5
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import (
2222
"path/filepath"
2323

2424
"github.com/hyperledger/fabric/common/flogging"
25-
"github.com/hyperledger/fabric/core/crypto/primitives"
2625
"github.com/hyperledger/fabric/core/errors"
2726
"github.com/hyperledger/fabric/core/peer"
2827
"github.com/hyperledger/fabric/core/peer/msp"
@@ -62,10 +61,6 @@ func InitConfig(cmdRoot string) error {
6261

6362
//InitCrypto initializes crypto for this peer
6463
func InitCrypto(mspMgrConfigDir string) error {
65-
// Init the crypto layer
66-
//TODO: integrate new crypto / idp code
67-
primitives.SetSecurityLevel("SHA2", 256)
68-
6964
// FIXME: when this peer joins a chain, it should get the
7065
// config for that chain with the list of MSPs that the
7166
// chain uses; however this is not yet implemented.

peer/main.go

-5
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ import (
3030

3131
"github.com/hyperledger/fabric/common/flogging"
3232
"github.com/hyperledger/fabric/core"
33-
"github.com/hyperledger/fabric/core/crypto/primitives"
3433
"github.com/hyperledger/fabric/peer/chaincode"
3534
"github.com/hyperledger/fabric/peer/clilogging"
3635
"github.com/hyperledger/fabric/peer/common"
@@ -98,10 +97,6 @@ func main() {
9897
// initialize logging format from core.yaml
9998
flogging.SetLoggingFormat(viper.GetString("logging.format"), logOutput)
10099

101-
// Init the crypto layer
102-
//TODO: integrate new crypto / idp code
103-
primitives.SetSecurityLevel("SHA2", 256)
104-
105100
// Init the MSP
106101
// TODO: determine the location of this config file
107102
var mspMgrConfigDir string

protos/testutils/txtestutils.go

-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import (
2222

2323
"path/filepath"
2424

25-
"github.com/hyperledger/fabric/core/crypto/primitives"
2625
"github.com/hyperledger/fabric/core/peer/msp"
2726
"github.com/hyperledger/fabric/msp"
2827
"github.com/hyperledger/fabric/protos/common"
@@ -36,7 +35,6 @@ var (
3635

3736
func init() {
3837
var err error
39-
primitives.SetSecurityLevel("SHA2", 256)
4038
// setup the MSP manager so that we can sign/verify
4139
mspMgrConfigDir, err := getMSPMgrConfigDir()
4240
if err != nil {

protos/utils/proputils_test.go

-3
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import (
2525
"fmt"
2626
"os"
2727

28-
"github.com/hyperledger/fabric/core/crypto/primitives"
2928
"github.com/hyperledger/fabric/core/peer/msp"
3029
"github.com/hyperledger/fabric/core/util"
3130
"github.com/hyperledger/fabric/msp"
@@ -294,8 +293,6 @@ var signer msp.SigningIdentity
294293
var signerSerialized []byte
295294

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

0 commit comments

Comments
 (0)