Skip to content

x/crypto: AcceptSecContext always given first outputToken from InitSecContext #43875

Closed
@9072997

Description

@9072997

What version of Go are you using (go version)?

go version go1.15.7 windows/amd64

Does this issue reproduce with the latest release?

I believe 1.15.7 to be the latest release, so yes?

What operating system and processor architecture are you using (go env)?

go env Output
set GO111MODULE=
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\jpenn\AppData\Local\go-build
set GOENV=C:\Users\jpenn\AppData\Roaming\go\env
set GOEXE=.exe
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=C:\Users\jpenn\go\pkg\mod
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=C:\Users\jpenn\go
set GOPRIVATE=
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=c:\go
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLDIR=c:\go\pkg\tool\windows_amd64
set GCCGO=gccgo
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0 -fdebug-prefix-map=C:\Users\jpenn\AppData\Local\Temp\go-build470606270=/tmp/go-build -gno-record-gcc-switches

What did you do?

See this program.

This is a dumb and broken implementation of GSSAPIServer and GSSAPIClient for use with crypto/ssh, but it exposes what I think is a bug. As I understand it, InitSecContext and AcceptSecContext should be called back-and-forth, each being given the outputToken of the other. This does not appear to be what is happening. Instead it looks like AcceptSecContext is always given the first outputToken returned by InitSecContext.

What did you expect to see?

CLIENT: InitSecContext(host@HostnameSuppliedByClient, [], false): [100] true 
SERVER: AcceptSecContext([100]): [50 1], UsernameDeterminedByServer, true, 
CLIENT: InitSecContext(host@HostnameSuppliedByClient, [50 1], false): [101] true 
SERVER: AcceptSecContext([101]): [51 2], UsernameDeterminedByServer, true, 
CLIENT: InitSecContext(host@HostnameSuppliedByClient, [51 2], false): [102] true 
SERVER: AcceptSecContext([102]): [52 3], UsernameDeterminedByServer, true, 
CLIENT: InitSecContext(host@HostnameSuppliedByClient, [52 3], false): [103] true 
SERVER: AcceptSecContext([103]): [53 4], UsernameDeterminedByServer, true, 
CLIENT: InitSecContext(host@HostnameSuppliedByClient, [53 4], false): [104] true 
SERVER: AcceptSecContext([104]): [54 5], UsernameDeterminedByServer, true, 
CLIENT: InitSecContext(host@HostnameSuppliedByClient, [54 5], false): [105] true 
SERVER: AcceptSecContext([105]): [55 6], UsernameDeterminedByServer, true, 
CLIENT: InitSecContext(host@HostnameSuppliedByClient, [55 6], false): [106] true 
SERVER: AcceptSecContext([106]): [56 7], UsernameDeterminedByServer, true, 
CLIENT: InitSecContext(host@HostnameSuppliedByClient, [56 7], false): [107] true 
SERVER: AcceptSecContext([107]): [57 8], UsernameDeterminedByServer, true, 
CLIENT: InitSecContext(host@HostnameSuppliedByClient, [57 8], false): [108] true 
SERVER: AcceptSecContext([108]): [58 9], UsernameDeterminedByServer, true, 
CLIENT: InitSecContext(host@HostnameSuppliedByClient, [58 9], false): [109] true 
SERVER: AcceptSecContext([109]): [59 10], UsernameDeterminedByServer, true, 
CLIENT: InitSecContext(host@HostnameSuppliedByClient, [59 10], false): [] false 
...

What did you see instead?

CLIENT: InitSecContext(host@HostnameSuppliedByClient, [], false): [100] true 
SERVER: AcceptSecContext([100]): [50 1], UsernameDeterminedByServer, true, 
CLIENT: InitSecContext(host@HostnameSuppliedByClient, [50 1], false): [101] true 
SERVER: AcceptSecContext([100]): [50 2], UsernameDeterminedByServer, true, 
CLIENT: InitSecContext(host@HostnameSuppliedByClient, [50 2], false): [102] true 
SERVER: AcceptSecContext([100]): [50 3], UsernameDeterminedByServer, true, 
CLIENT: InitSecContext(host@HostnameSuppliedByClient, [50 3], false): [103] true 
SERVER: AcceptSecContext([100]): [50 4], UsernameDeterminedByServer, true, 
CLIENT: InitSecContext(host@HostnameSuppliedByClient, [50 4], false): [104] true 
SERVER: AcceptSecContext([100]): [50 5], UsernameDeterminedByServer, true, 
CLIENT: InitSecContext(host@HostnameSuppliedByClient, [50 5], false): [105] true 
SERVER: AcceptSecContext([100]): [50 6], UsernameDeterminedByServer, true, 
CLIENT: InitSecContext(host@HostnameSuppliedByClient, [50 6], false): [106] true 
SERVER: AcceptSecContext([100]): [50 7], UsernameDeterminedByServer, true, 
CLIENT: InitSecContext(host@HostnameSuppliedByClient, [50 7], false): [107] true 
SERVER: AcceptSecContext([100]): [50 8], UsernameDeterminedByServer, true, 
CLIENT: InitSecContext(host@HostnameSuppliedByClient, [50 8], false): [108] true 
SERVER: AcceptSecContext([100]): [50 9], UsernameDeterminedByServer, true, 
CLIENT: InitSecContext(host@HostnameSuppliedByClient, [50 9], false): [109] true 
SERVER: AcceptSecContext([100]): [50 10], UsernameDeterminedByServer, true, 
CLIENT: InitSecContext(host@HostnameSuppliedByClient, [50 10], false): [] false 
...

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions