Skip to content
Open
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
0f3bfe2
Add crypto extern
hesingh Dec 12, 2019
e9e1785
Fix cpplint issues in crypto.cpp; header file c/c++ issues remain
hesingh Dec 13, 2019
2847992
Fix headers and namespace cpplint issues
hesingh Dec 13, 2019
02c01d5
Fix compile issues
hesingh Dec 13, 2019
4e9d5be
Fix namspace cpplint issue
hesingh Dec 13, 2019
fc17434
Complete adding crypto to simple_switch, linking and building; also a…
hesingh Dec 16, 2019
7d5a5a9
Complete adding crypto to simple_switch, linking and building; also a…
hesingh Dec 16, 2019
30f2879
Restore simple_switch and Makefile.am, add to README.md
hesingh Dec 16, 2019
353b462
Rename diffs file to avoid its lint
hesingh Dec 16, 2019
84a43b5
Add new diffs file
hesingh Dec 16, 2019
fb7b8f3
Fix minor issues
hesingh Dec 16, 2019
e7d89e7
Fix acsec's old P4 mark_to_drop
hesingh Dec 16, 2019
11f02c9
Comment out recirculate after decrypt
hesingh Dec 16, 2019
19656e2
Update README.md now that steps exist how to test crypto extern
hesingh Dec 18, 2019
e1fe58c
delete diffs file and updated README
hesingh Dec 18, 2019
a3c273a
Add more notes to README
hesingh Dec 18, 2019
d32443a
Delete basic.p4 since it's pointed to in the repo
hesingh Dec 19, 2019
9ff1f4d
Sync extern from macsec parent
hesingh Dec 24, 2019
c357ef5
Took care of review comments
hesingh Dec 28, 2019
1dc5f2c
Fix style issue with prior commit
hesingh Dec 28, 2019
f031ac7
Add Makefile to extern code
hesingh Dec 29, 2019
3ca057f
Change code after Antonin's review
hesingh Jan 7, 2020
f187058
Change code after Antonin's review
hesingh Jan 7, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions targets/simple_switch/sample_extern/macsec/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
crypto_SOURCES = crypto.cpp
crypto_LDADD = -lcrypto

CPPFLAGS += -I../../ -fPIC -shared

libexterncrypto.so : $(crypto_SOURCES)
g++ $(CPPFLAGS) $(crypto_SOURCES) -o libexterncrypto.so $(crypto_LDADD)

clean:
rm -rf libexterncrypto.so

Copy link
Member

Choose a reason for hiding this comment

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

Since this extern is a bit complicated, I think we should have a simple C++ test and a make check target in this Makefile to make sure that the extern definition is not broken and that encryption / decryption work properly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Let me think about this one and get back.

25 changes: 25 additions & 0 deletions targets/simple_switch/sample_extern/macsec/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# ADD CRYPTO EXTERN to SIMPLE_SWITCH
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
# ADD CRYPTO EXTERN to SIMPLE_SWITCH
# Add macsec extern to simple_switch


For reference, the extern is implemented in crypto.cpp in this directory.
This cpp code is to be incorporated in
behavioral-model/targets/simple_switch/simple_switch.cpp
Copy link
Member

Choose a reason for hiding this comment

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

That's not accurate. You should instead include the following instructions:

  • configure bmv2 with the --enable-modules flag so that extern definitions can be provided at runtime
  • build the macsec extern as a shared library by running make inside this directory
  • when starting simple_switch, load the shared library with --load-modules libexterncrypto.so

Please also make sure that these instructions work properly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't see a --enable-modules as an arg to simple_switch. How do I configure it then?


The code is crypto.cpp is also available in the repo URL included below
so that testing can be done using MACsec (MAC security) code. A
README.md is available at the repo below with steps for how to test
the code.

https://github.com/uni-tue-kn/p4-macsec

The extern is defined in the following P4 file. Search for ExternCrypt
Copy link
Member

Choose a reason for hiding this comment

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

I recommend copy-pasting the P4 extern type definition here since it's only a few lines, in case the link becomes broken in the future.

for the extern definition. Additionally the extern is used in P4 code
as crypt.validate() which is decryption and crypt.protect() which is
encryption.

https://github.com/uni-tue-kn/p4-macsec/p4/p4/basic.p4

basic.p4 is used to test the cryto extern code with simple_switch.

basic.p4 is compiled using p4c with args shown in
Copy link
Member

Choose a reason for hiding this comment

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

again, please provide the command-line as part of this README, I think it's valuable.


https://github.com/uni-tue-kn/p4-macsec/blob/master/p4/p4/Makefile
Loading