From a7921d951302c685e5f9872667a1626620fa4f75 Mon Sep 17 00:00:00 2001 From: Emman Date: Thu, 2 Dec 2021 12:57:01 +0800 Subject: [PATCH] typo --- sm2/sm2.go | 16 ++++++++-------- sm2/sm2_test.go | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/sm2/sm2.go b/sm2/sm2.go index 66b604c..4d1fb9c 100644 --- a/sm2/sm2.go +++ b/sm2/sm2.go @@ -55,29 +55,29 @@ const ( MarshalMixed ) -type cipherTextSplicingOrder byte +type ciphertextSplicingOrder byte const ( - C1C3C2 cipherTextSplicingOrder = iota + C1C3C2 ciphertextSplicingOrder = iota C1C2C3 ) // EncrypterOpts encryption options type EncrypterOpts struct { PointMarshalMode pointMarshalMode - CipherTextSplicingOrder cipherTextSplicingOrder + CiphertextSplicingOrder ciphertextSplicingOrder } // DecrypterOpts decryption options type DecrypterOpts struct { - CipherTextSplicingOrder cipherTextSplicingOrder + CipherTextSplicingOrder ciphertextSplicingOrder } -func NewEncrypterOpts(marhsalMode pointMarshalMode, splicingOrder cipherTextSplicingOrder) *EncrypterOpts { +func NewEncrypterOpts(marhsalMode pointMarshalMode, splicingOrder ciphertextSplicingOrder) *EncrypterOpts { return &EncrypterOpts{marhsalMode, splicingOrder} } -func NewDecrypterOpts(splicingOrder cipherTextSplicingOrder) *DecrypterOpts { +func NewDecrypterOpts(splicingOrder ciphertextSplicingOrder) *DecrypterOpts { return &DecrypterOpts{splicingOrder} } @@ -285,7 +285,7 @@ func Encrypt(random io.Reader, pub *ecdsa.PublicKey, msg []byte, opts *Encrypter //A7, C3 = hash(x2||M||y2) c3 := calculateC3(curve, x2, y2, msg) - if opts.CipherTextSplicingOrder == C1C3C2 { + if opts.CiphertextSplicingOrder == C1C3C2 { // c1 || c3 || c2 return append(append(c1, c3...), c2...), nil } @@ -369,7 +369,7 @@ func decrypt(priv *PrivateKey, ciphertext []byte, opts *DecrypterOpts) ([]byte, return msg, nil } -func AdjustCipherTextSplicingOrder(ciphertext []byte, from, to cipherTextSplicingOrder) ([]byte, error) { +func AdjustCipherTextSplicingOrder(ciphertext []byte, from, to ciphertextSplicingOrder) ([]byte, error) { curve := P256() if from == to { return ciphertext, nil diff --git a/sm2/sm2_test.go b/sm2/sm2_test.go index 3c9b018..354b9a5 100644 --- a/sm2/sm2_test.go +++ b/sm2/sm2_test.go @@ -35,8 +35,8 @@ func Test_SplicingOrder(t *testing.T) { tests := []struct { name string plainText string - from cipherTextSplicingOrder - to cipherTextSplicingOrder + from ciphertextSplicingOrder + to ciphertextSplicingOrder }{ // TODO: Add test cases. {"less than 32 1", "encryption standard", C1C2C3, C1C3C2},