New version of the test.c file, this time working as intended. Tested in an amd64 hirsute VM.
** Description changed: [Description] The Opencryptoki Soft token does not check if an EC key is valid when an EC key is created via C_CreateObject, nor when C_DeriveKey is used with ECDH public data. This may allow one to perform Invalid Curve Attacks. Fix: https://github.com/opencryptoki/opencryptoki/commit/4e3b43c3d8844402c04a66b55c6c940f965109f0 (SOFT: Check the EC Key on C_CreateObject and C_DeriveKey) This commit should apply smooth on top of OCK 3.16.0, but also on OCK 3.15.0 or 3.15.1. EC support has been introduced in the Soft token with OCK 3.15.0. So all OCK versions >= 3.15.0 are affected. Earlier OCK releases are not affected. This problem need only to be fixed with 21.04 wherer 3.15.1 is included. [Test Plan] - ?? + DO THIS IN A THROWAWAY VM!!! The cleanup routine in the test isn't itself + well tested :) + First step is to prepare the default software-based slot for the tests. + We'll setup the user password to be 1234 (hardcoded in the testfile). + We're assuming the opencryptoki configuration is the default one (i.e. software-based backend at slot 3), in which case the SO password is by default 87654321 + + $ sudo apt install opencryptoki + $ sudo pkcsconf -c 3 -u + + When this is done, install the lib headers (libopencryptoki-dev), + download the test file provided in the comments (named 'test.c' in the + following command) and compile it + + $ gcc test.c -o sru-test -lopencryptoki + + Finally, run the binary as root. The return code will be 0 if the + incorrect key is rejected, 56 if not. + + $ sudo ./sru-test [Where problems could occur] Even assuming the underlying code is perfectly correct, the update increases the API surface of the library slightly, which could provoke namespace clashes where none existed before. If the EC checking code isn't correct, the soft token implementation might reject some valid keys that would have previously gone through. ** Attachment added: "test.c" https://bugs.launchpad.net/ubuntu/+source/opencryptoki/+bug/1928780/+attachment/5515281/+files/test.c ** Changed in: opencryptoki (Ubuntu Hirsute) Status: New => In Progress ** Description changed: [Description] The Opencryptoki Soft token does not check if an EC key is valid when an EC key is created via C_CreateObject, nor when C_DeriveKey is used with ECDH public data. This may allow one to perform Invalid Curve Attacks. Fix: https://github.com/opencryptoki/opencryptoki/commit/4e3b43c3d8844402c04a66b55c6c940f965109f0 (SOFT: Check the EC Key on C_CreateObject and C_DeriveKey) This commit should apply smooth on top of OCK 3.16.0, but also on OCK 3.15.0 or 3.15.1. EC support has been introduced in the Soft token with OCK 3.15.0. So all OCK versions >= 3.15.0 are affected. Earlier OCK releases are not affected. This problem need only to be fixed with 21.04 wherer 3.15.1 is included. [Test Plan] DO THIS IN A THROWAWAY VM!!! The cleanup routine in the test isn't itself well tested :) First step is to prepare the default software-based slot for the tests. We'll setup the user password to be 1234 (hardcoded in the testfile). We're assuming the opencryptoki configuration is the default one (i.e. software-based backend at slot 3), in which case the SO password is by default 87654321 $ sudo apt install opencryptoki $ sudo pkcsconf -c 3 -u When this is done, install the lib headers (libopencryptoki-dev), - download the test file provided in the comments (named 'test.c' in the + download the test file provided in the comment #9 (named 'test.c' in the following command) and compile it $ gcc test.c -o sru-test -lopencryptoki Finally, run the binary as root. The return code will be 0 if the incorrect key is rejected, 56 if not. $ sudo ./sru-test [Where problems could occur] Even assuming the underlying code is perfectly correct, the update increases the API surface of the library slightly, which could provoke namespace clashes where none existed before. If the EC checking code isn't correct, the soft token implementation might reject some valid keys that would have previously gone through. -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1928780 Title: [UBUNTU 21.04] openCryptoki: Soft token does not check if an EC key is valid To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu-z-systems/+bug/1928780/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs