-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add more unit test to cover code_pkcs11.c #195
Add more unit test to cover code_pkcs11.c #195
Conversation
5c7bdfa
to
da9e3a8
Compare
} | ||
|
||
if( xResult == CKR_OK ) | ||
{ | ||
xResult = xInitializePKCS11(); | ||
} | ||
xResult = C_GetFunctionList( &pxFunctionList ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move C_GetFunctionList call here for CBMC check.
@@ -295,19 +275,30 @@ CK_RV xInitializePkcs11Session( CK_SESSION_HANDLE * pxSession ) | |||
} | |||
|
|||
/* Open a PKCS #11 session. */ | |||
if( ( xResult == CKR_OK ) && ( pxSlotId != NULL ) && ( xSlotCount >= 1UL ) ) | |||
if( ( xResult == CKR_OK ) && ( xSlotCount >= 1UL ) ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
( pxSlotId != NULL ) is a redundant check since the value xResult ensure this won't be NULL.
{ | ||
/* We will take the first slot available. | ||
* If your application has multiple slots, insert logic | ||
* for selecting an appropriate slot here. | ||
*/ | ||
xResult = prvOpenSession( pxSession, pxSlotId[ 0 ] ); | ||
if( pxFunctionList->C_OpenSession != NULL ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unwind prvOpenSession here to reuse the pxFunctionList
|
||
if( ulCalls == 3 ) | ||
{ | ||
xResult = CKR_OK; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This assignment is not needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will cover this in PR #196
Description
Add more unit test to cover code_pkcs11.c
In this PR:
prvOpenSession
since it is only used inxInitializePkcs11Session
andpxFunctionList
is already obtained in this function.xInitializePkcs11Token
.C_GetFunctionList
checkTest Steps
N/A
Checklist:
Related Issue
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.