Skip to content

Commit

Permalink
Drop deprecated stream ciphers
Browse files Browse the repository at this point in the history
  • Loading branch information
riobard committed Jan 31, 2020
1 parent a1418d5 commit e255022
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 374 deletions.
37 changes: 0 additions & 37 deletions core/cipher.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"strings"

"github.com/riobard/go-shadowsocks2/shadowaead"
"github.com/riobard/go-shadowsocks2/shadowstream"
)

type Cipher interface {
Expand Down Expand Up @@ -38,30 +37,12 @@ var aeadList = map[string]struct {
"AEAD_CHACHA20_POLY1305": {32, shadowaead.Chacha20Poly1305},
}

// List of stream ciphers: key size in bytes and constructor
var streamList = map[string]struct {
KeySize int
New func(key []byte) (shadowstream.Cipher, error)
}{
"AES-128-CTR": {16, shadowstream.AESCTR},
"AES-192-CTR": {24, shadowstream.AESCTR},
"AES-256-CTR": {32, shadowstream.AESCTR},
"AES-128-CFB": {16, shadowstream.AESCFB},
"AES-192-CFB": {24, shadowstream.AESCFB},
"AES-256-CFB": {32, shadowstream.AESCFB},
"CHACHA20-IETF": {32, shadowstream.Chacha20IETF},
"XCHACHA20": {32, shadowstream.Xchacha20},
}

// ListCipher returns a list of available cipher names sorted alphabetically.
func ListCipher() []string {
var l []string
for k := range aeadList {
l = append(l, k)
}
for k := range streamList {
l = append(l, k)
}
sort.Strings(l)
return l
}
Expand Down Expand Up @@ -94,17 +75,6 @@ func PickCipher(name string, key []byte, password string) (Cipher, error) {
return &aeadCipher{aead}, err
}

if choice, ok := streamList[name]; ok {
if len(key) == 0 {
key = kdf(password, choice.KeySize)
}
if len(key) != choice.KeySize {
return nil, shadowstream.KeySizeError(choice.KeySize)
}
ciph, err := choice.New(key)
return &streamCipher{ciph}, err
}

return nil, ErrCipherNotSupported
}

Expand All @@ -115,13 +85,6 @@ func (aead *aeadCipher) PacketConn(c net.PacketConn) net.PacketConn {
return shadowaead.NewPacketConn(c, aead)
}

type streamCipher struct{ shadowstream.Cipher }

func (ciph *streamCipher) StreamConn(c net.Conn) net.Conn { return shadowstream.NewConn(c, ciph) }
func (ciph *streamCipher) PacketConn(c net.PacketConn) net.PacketConn {
return shadowstream.NewPacketConn(c, ciph)
}

// dummy cipher does not encrypt

type dummy struct{}
Expand Down
92 changes: 0 additions & 92 deletions shadowstream/cipher.go

This file was deleted.

2 changes: 0 additions & 2 deletions shadowstream/doc.go

This file was deleted.

80 changes: 0 additions & 80 deletions shadowstream/packet.go

This file was deleted.

Loading

0 comments on commit e255022

Please sign in to comment.