diff --git a/proxy/shadowsocks2022/method_aes128gcm.go b/proxy/shadowsocks2022/method_aes128gcm.go index 5d2d8c8d070..17b0d9904f0 100644 --- a/proxy/shadowsocks2022/method_aes128gcm.go +++ b/proxy/shadowsocks2022/method_aes128gcm.go @@ -62,6 +62,9 @@ func (a AES128GCMMethod) GetUDPClientProcessor(ipsk [][]byte, psk []byte, deriva } return aead } + if len(ipsk) == 0 { + return NewAESUDPClientPacketProcessor(reqSeparateHeaderCipher, respSeparateHeaderCipher, getPacketAEAD, nil), nil + } eihGenerator := newAESEIHGeneratorContainer(len(ipsk), psk, ipsk) getEIH := func(mask []byte) ExtensibleIdentityHeaders { eih, err := eihGenerator.GenerateEIHUDP(derivation, a, mask) diff --git a/proxy/shadowsocks2022/method_aes256gcm.go b/proxy/shadowsocks2022/method_aes256gcm.go index 064ff3b8ee7..26820dc523e 100644 --- a/proxy/shadowsocks2022/method_aes256gcm.go +++ b/proxy/shadowsocks2022/method_aes256gcm.go @@ -62,6 +62,9 @@ func (a AES256GCMMethod) GetUDPClientProcessor(ipsk [][]byte, psk []byte, deriva } return aead } + if len(ipsk) == 0 { + return NewAESUDPClientPacketProcessor(reqSeparateHeaderCipher, respSeparateHeaderCipher, getPacketAEAD, nil), nil + } eihGenerator := newAESEIHGeneratorContainer(len(ipsk), psk, ipsk) getEIH := func(mask []byte) ExtensibleIdentityHeaders { eih, err := eihGenerator.GenerateEIHUDP(derivation, a, mask)