github.com/hxx258456/ccgo@v0.0.5-0.20230213014102-48b35f46f66f/sm4/modes.go (about)

     1  package sm4
     2  
     3  import "crypto/cipher"
     4  
     5  // cbcDecAble is implemented by cipher.Blocks that can provide an optimized
     6  // implementation of CBC decryption through the cipher.BlockMode interface.
     7  // See crypto/cipher/cbc.go.
     8  type cbcDecAble interface {
     9  	NewCBCDecrypter(iv []byte) cipher.BlockMode
    10  }
    11  
    12  // ctrAble is implemented by cipher.Blocks that can provide an optimized
    13  // implementation of CTR through the cipher.Stream interface.
    14  // See crypto/cipher/ctr.go.
    15  type ctrAble interface {
    16  	NewCTR(iv []byte) cipher.Stream
    17  }
    18  
    19  // gcmAble is implemented by cipher.Blocks that can provide an optimized
    20  // implementation of GCM through the AEAD interface.
    21  // See crypto/cipher/gcm.go.
    22  type gcmAble interface {
    23  	NewGCM(nonceSize, tagSize int) (cipher.AEAD, error)
    24  }