Skip to content

Security Extension#1

Open
radwasherif wants to merge 11 commits into
masterfrom
spse-new
Open

Security Extension#1
radwasherif wants to merge 11 commits into
masterfrom
spse-new

Conversation

@radwasherif
Copy link
Copy Markdown
Owner

@radwasherif radwasherif commented Feb 14, 2020

This change is Reviewable

radwasherif and others added 7 commits February 13, 2020 11:10
created SPSE as a specialized Extension layer struct, to keep pointer to authenticator buffer
added ExtensionDataToSPSELayer to create SPSE layer out of spse.Extn
create SCIONLayer with serialization logic to replace spkt.WriteScnPacket
added Key field, Sum and Verify functions (now only with AES-CMAC) to spse.Extn
…directly to enable storing pointer to MAC buffer
@radwasherif radwasherif added the WIP work in progress label Feb 14, 2020
Comment thread go/lib/layers/extensions_layer.go Outdated
Type uint8
Class common.L4ProtocolType
Data []byte
AuthenticatedBytes common.RawBytes
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[]byte instead.
I am not convinced we need the authenticated bytes directly inside the extension representation.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can indeed just store those bytes in local buffers. But we would need to return those buffers to the caller somehow, and thus we violated the signature of SerializeTo. This is part of the argument for why I don't think gopacket does much for us here.

Comment thread go/lib/layers/extensions_layer.go
Comment thread go/lib/layers/extensions_layer.go Outdated
Comment thread go/lib/snet/packet_conn.go Outdated
Comment thread go/lib/snet/scion_layer.go Outdated
Comment thread go/lib/snet/scion_layer_test.go Outdated
Comment thread go/lib/snet/scion_layer_test.go Outdated
SCIONPacketInfo: pktInf,
}
s := NewSCIONLayer(pkt)
s.Serialize()
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't check s.Bytes later. How do we know Serialize is correct?

Comment thread go/lib/snet/scion_layer_test.go Outdated
if err != nil {
t.Fatal(err.Error())
}
t.Log(bf.Bytes())
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove all these calls to Log

Comment thread go/lib/snet/scion_layer_test.go Outdated
t.Fatalf("Length should be %d, but is %d", len(bytes), len(s.Bytes))
}
for i := range s.Bytes[:n] {
if bytes[i] != s.Bytes[i] {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bytes.Compare


}
}
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to check serialization/deserialization, as well as the authenticators. For that, we should have more than 1 e2e extension and more than 1 hbh extension; with and without spse.

Radwa Sherif Abdelbar and others added 2 commits February 18, 2020 22:25
- Refactored ExtensionDataToSPSE
- Replaced 3 with common.ExtnSubHdrLen in extensions
- Replaced common.RawBytes with []byte
- Replaced Type and Class fields with one Type field of type common.ExtnType in extensions
- Removed multiple append calls from SCIONLayer.serialize
Added Serialize() function to SCIONPacket to abstract away SCIONLayer
Changed SCIONLayer to scionLayer (private)
Copy link
Copy Markdown

@juagargi juagargi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ATM braccept fails to build.

Reviewed 4 of 14 files at r1, 7 of 10 files at r2.
Reviewable status: 5 of 13 files reviewed, 26 unresolved discussions (waiting on @juagargi and @radwasherif)


go/lib/layers/extensions.go, line 295 at r2 (raw file):

	extn spse.Extn) (*SPSE, error) {
	bytes, err := extn.Pack()
	authStartOffset := spse.SecModeLength + len(extn.Metadata)

no need for a variable, just call it inline. Same for the other variable below.


go/lib/layers/extensions.go, line 300 at r2 (raw file):

Previously, radwasherif (Radwa Sherif) wrote…

Done

👍


go/lib/layers/extensions_layer.go, line 149 at r2 (raw file):

Previously, radwasherif (Radwa Sherif) wrote…

Done.

I still see the 3 instead of common.ExtnSubHdrLen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

WIP work in progress

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants