Skip to contentSkip to conversation

lib: Add tst_crypto and tst_netlink libs

PATCH New Richard Palethorpe 3 participants 9 messages Jul 5, 2018 – Jul 19, 2018 Library code

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/3 lib: Add tst_crypto and tst_netlink libs

Add a helper library for dealing with the crypto subsystem.

---

Changes from V2 (which was a long time ago, sorry):
* Merged netlink lib into the header files.
* Move linux/cryptouser.h definitions to lapi/cryptouser.h and use the system definitions where possible.
* Move the retries parameter into the session struct and give it a default value so that most users can ignore it.
* Use usleep instead of nanosleep for simplicity.
* Use unsigned int for netlink data length.
* Convert the documentation comments into Doxygen format because it looks like the preferred format.

I have also included a Doxygen config file which may be ignored as it should probably be handled in a seperate patch series. However it can be used to check that the comments produce working documentation.

Discussion about documentation format is here:
https://github.com/linux-test-project/ltp/issues/262

 configure.ac              |   1 +
 include/lapi/cryptouser.h | 121 ++++++++++++++++++++++++++++++++++++++++++++
 include/tst_crypto.h      | 124 ++++++++++++++++++++++++++++++++++++++++++++++
 include/tst_netlink.h     |  99 ++++++++++++++++++++++++++++++++++++
 lib/tst_crypto.c          | 121 ++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 466 insertions(+)
 create mode 100644 include/lapi/cryptouser.h
 create mode 100644 include/tst_crypto.h
 create mode 100644 include/tst_netlink.h
 create mode 100644 lib/tst_crypto.c
configure.ac +1 -0
index 9208f1c6c..844d454dd 100644
@@ -37,6 +37,7 @@ AC_CHECK_HEADERS([ \
     keyutils.h \
     linux/can.h \
     linux/dccp.h \
+    linux/cryptouser.h \
     linux/genetlink.h \
     linux/keyctl.h \
     linux/if_packet.h \
include/lapi/cryptouser.h new file +121 -0

121 lines not on this page · raw message

include/tst_crypto.h new file +124 -0

124 lines not on this page · raw message

include/tst_netlink.h new file +99 -0

99 lines not on this page · raw message

lib/tst_crypto.c new file +121 -0

121 lines not on this page · raw message

Signature · 1 line
2.16.3
#1 lore raw

PATCH v3 2/3 Add pcrypt_aead01 CVE-2017-18075

---
 runtest/crypto                          |  1 +
 runtest/cve                             |  1 +
 testcases/kernel/crypto/.gitignore      |  1 +
 testcases/kernel/crypto/Makefile        | 22 +++++++++
 testcases/kernel/crypto/pcrypt_aead01.c | 84 +++++++++++++++++++++++++++++++++
 5 files changed, 109 insertions(+)
 create mode 100644 runtest/crypto
 create mode 100644 testcases/kernel/crypto/.gitignore
 create mode 100644 testcases/kernel/crypto/Makefile
 create mode 100644 testcases/kernel/crypto/pcrypt_aead01.c
runtest/crypto new file +1 -0
new file mode 100644
index 000000000..e5ba61e5e
@@ -0,0 +1 @@
+pcrypt_aead01 pcrypt_aead01
runtest/cve +1 -0
index c7f438be2..58d8f12b2 100644
@@ -32,5 +32,6 @@ cve-2017-5754 meltdown
 cve-2017-17052 cve-2017-17052
 cve-2017-16939 cve-2017-16939
 cve-2017-17053 cve-2017-17053
+cve-2017-18075 pcrypt_aead01
 cve-2018-5803 sctp_big_chunk
 cve-2018-1000001 getcwd05
testcases/kernel/crypto/.gitignore new file +1 -0
new file mode 100644
index 000000000..fafe5c972
@@ -0,0 +1 @@
+pcrypt_aead01
testcases/kernel/crypto/Makefile new file +22 -0
new file mode 100644
index 000000000..76f9308c2
@@ -0,0 +1,22 @@
+# Copyright (c) 2017 Linux Test Project
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+top_srcdir		?= ../../..
+
+include $(top_srcdir)/include/mk/testcases.mk
+
+CFLAGS			+= -D_GNU_SOURCE
+
+include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/crypto/pcrypt_aead01.c new file +84 -0

84 lines not on this page · raw message

Signature · 1 line
2.16.3
#2 lore raw

PATCH v3 3/3 Add Doxygen configuration

In reply to Richard Palethorpe

Basic Doxygen configuration for C with a few non-default settings.

---
 doc/.gitignore |    1 +
 doc/Doxyfile   | 2442 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 2443 insertions(+)
 create mode 100644 doc/.gitignore
 create mode 100644 doc/Doxyfile
doc/.gitignore new file +1 -0
new file mode 100644
index 000000000..8c6492ca8
@@ -0,0 +1 @@
+api/
doc/Doxyfile new file +2442 -0

2,442 lines not on this page · raw message

Signature · 1 line
2.16.3
#3 lore raw

PATCH v3 3/3 Add Doxygen configuration

Hi!

Quoted 1 line

Basic Doxygen configuration for C with a few non-default settings.

Not that this is a bad thing quite contrary actually, but it's quite confusing that this is a 3/3 of this patchset.

Haven you send this by a mistake?

Signature · 2 lines
Cyril Hrubis
[email protected]
#4 lore raw

PATCH v3 3/3 Add Doxygen configuration

Hello,

Quoted 7 lines · Cyril Hrubis

Hi!

Quoted 1 line

Basic Doxygen configuration for C with a few non-default settings.

Not that this is a bad thing quite contrary actually, but it's quite confusing that this is a 3/3 of this patchset.

Haven you send this by a mistake?

Nope, but maybe I should have included a covering letter. I mentioned that it is not part of the patch set in the notes on the first commit. I just included it so that you can easily verify the documentation comments if you want to do that.

Signature · 2 lines
Thank you,
Richard.
#5 lore raw

PATCH v3 3/3 Add Doxygen configuration

Hi!

Quoted 9 lines
Quoted 4 lines

Not that this is a bad thing quite contrary actually, but it's quite confusing that this is a 3/3 of this patchset.

Haven you send this by a mistake?

Nope, but maybe I should have included a covering letter. I mentioned that it is not part of the patch set in the notes on the first commit. I just included it so that you can easily verify the documentation comments if you want to do that.

Ah, I missed that note in the first commit.

Hmm, if we decide to go that way we should probably get this in with all the bells and whistles in a separate patchset. I.e. add doxygen target to the doc/Makefile, convert the headers we have and introduce the config.

Signature · 2 lines
Cyril Hrubis
[email protected]
#6 lore raw

PATCH v3 3/3 Add Doxygen configuration

Hello,

Quoted 11 lines · Cyril Hrubis

Hi!

Quoted 9 lines
Quoted 4 lines

Not that this is a bad thing quite contrary actually, but it's quite confusing that this is a 3/3 of this patchset.

Haven you send this by a mistake?

Nope, but maybe I should have included a covering letter. I mentioned that it is not part of the patch set in the notes on the first commit. I just included it so that you can easily verify the documentation comments if you want to do that.

Quoted 6 lines

Ah, I missed that note in the first commit.

Hmm, if we decide to go that way we should probably get this in with all the bells and whistles in a separate patchset. I.e. add doxygen target to the doc/Makefile, convert the headers we have and introduce the config.

Are you saying that you want me to submit the patch with the documentation in the kernel format, then submit another patch set updating all the documentation later?

Signature · 2 lines
Thank you,
Richard.
#7 lore raw

PATCH v3 3/3 Add Doxygen configuration

Hi!

Quoted 12 lines
Quoted 12 lines
Quoted 9 lines
Quoted 4 lines

Not that this is a bad thing quite contrary actually, but it's quite confusing that this is a 3/3 of this patchset.

Haven you send this by a mistake?

Nope, but maybe I should have included a covering letter. I mentioned that it is not part of the patch set in the notes on the first commit. I just included it so that you can easily verify the documentation comments if you want to do that.

Ah, I missed that note in the first commit.

Quoted 8 lines
Quoted 4 lines

Hmm, if we decide to go that way we should probably get this in with all the bells and whistles in a separate patchset. I.e. add doxygen target to the doc/Makefile, convert the headers we have and introduce the config.

Are you saying that you want me to submit the patch with the documentation in the kernel format, then submit another patch set updating all the documentation later?

Actually I do not care that much about the format at this point, as far as we do not parse it automatically anything human-readable will do...

Signature · 2 lines
Cyril Hrubis
[email protected]
#8 lore raw

PATCH v3 1/3 lib: Add tst_crypto and tst_netlink libs

In reply to Richard Palethorpe

Hi!

lib/tst_crypto.c line 35

Quoted 9 lines
lib/tst_crypto.c new file +9 -0
+void tst_crypto_open(struct tst_crypto_session *ses)
+{
+	TEST(socket(AF_NETLINK, SOCK_DGRAM, NETLINK_CRYPTO));
+	if (TEST_RETURN < 0 && TEST_ERRNO == EPROTONOSUPPORT) {
+		tst_brk(TCONF | TTERRNO, "NETLINK_CRYPTO is probably disabled");
+	} else if (TEST_RETURN < 0) {
+		tst_brk(TBROK | TTERRNO,
+			"socket(AF_NETLINK, SOCK_DGRAM, NETLINK_CRYPTO)");
+	}

I got rid of this else branch, since we call tst_brk() in the first if it's not needed at all, and pushed both patches, thanks.

Signature · 2 lines
Cyril Hrubis
[email protected]