Project

General

Profile

Bug #12796

pcks11_softtoken C_GetMechanismList() should validate its arguments

Added by Jason King about 1 month ago. Updated 24 days ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
lib - userland libraries
Start date:
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:

Description

Using Google's pkcs11 test suite against , it crashes running C_GetMechanismList() if pulCount is NULL. Per the spec, this must always be non-NULL and CKR_ARGUMENTS_BAD is the correct error code for improper arguments.

History

#1

Updated by Jason King 25 days ago

  • Subject changed from pcks11_softtoken C_GetMechanismList() should validate it's arguments to pcks11_softtoken C_GetMechanismList() should validate its arguments
#2

Updated by Jason King 25 days ago

Googles's PKCS#11 test suite crashes during the PKCS11Test.GetMechanismListFailInvalid test due to this bug:

root@pi:/ws/pkcs11test (unwrap)# pstack core
core 'core' of 1751:    ./pkcs11test -m pkcs11_softtoken.so.1 -l /usr/lib/security/amd64
 fffffc7feecdba5c C_GetMechanismList (73ba80, fffffc7fffdf2a88, 0) + 5c
 000000000062dc3f _ZN7testing8internal38HandleSehExceptionsInMethodIfSupportedINS_4TestEvEET0_PT_MS4_FS3_vEPKc () + 69
 0000000000628fd2 _ZN7testing8internal35HandleExceptionsInMethodIfSupportedINS_4TestEvEET0_PT_MS4_FS3_vEPKc () + 4f
 0000000000617c25 _ZN7testing4Test3RunEv () + d3
 000000000061836b _ZN7testing8TestInfo3RunEv () + 107
 00000000006188f0 _ZN7testing8TestCase3RunEv () + 106
 000000000061cf57 _ZN7testing8internal12UnitTestImpl11RunAllTestsEv () + 29b
 000000000062ef7b _ZN7testing8internal38HandleSehExceptionsInMethodIfSupportedINS0_12UnitTestImplEbEET0_PT_MS4_FS3_vEPKc () + 69
 0000000000629f52 _ZN7testing8internal35HandleExceptionsInMethodIfSupportedINS0_12UnitTestImplEbEET0_PT_MS4_FS3_vEPKc () + 4f
 000000000061c0a3 _ZN7testing8UnitTest3RunEv () + 73
 000000000057a9c7 main () + 78d
 0000000000579ac3 _start_crt () + 83
 0000000000579a28 _start () + 18

With the fix, the test passes (it still crashes in _ later_ tests, but those are due to #12856 and few other bugs).

#3

Updated by Electric Monk 24 days ago

  • Status changed from New to Closed
  • % Done changed from 0 to 100

git commit 989c147e4f8311ee853a577bac8009cc7ffc4a73

commit  989c147e4f8311ee853a577bac8009cc7ffc4a73
Author: Jason King <jason.king@joyent.com>
Date:   2020-06-15T17:48:01.000Z

    12796 pcks11_softtoken C_GetMechanismList() should validate its arguments
    Reviewed by: Andrew Stormont <andyjstormont@gmail.com>
    Reviewed by: Sebastian Wiedenroth <wiedi@frubar.net>
    Reviewed by: Juraj Lutter <juraj@lutter.sk>
    Approved by: Dan McDonald <danmcd@joyent.com>

Also available in: Atom PDF