Skip to content
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

RPC: Message-Based Encryption and Signing Functions: pParameter can be "either an input or an output parameter" #613

Open
uhhhh2 opened this issue Dec 15, 2023 · 0 comments

Comments

@uhhhh2
Copy link

uhhhh2 commented Dec 15, 2023

According to 5.9.3 C_EncryptMessageBegin:

CK_DECLARE_FUNCTION(CK_RV, C_EncryptMessageBegin)( 
    CK_SESSION_HANDLE hSession,
    CK_VOID_PTR pParameter,
    CK_ULONG ulParameterLen,
    CK_BYTE_PTR pAssociatedData,
    CK_ULONG ulAssociatedDataLen
);

C_EncryptMessageBegin begins a multiple-part message encryption operation. hSession is the session’s handle; pParameter and ulParameterLen specify any mechanism-specific parameters for the message encryption operation; pAssociatedData and ulAssociatedDataLen specify the associated data for an AEAD mechanism.

Typically, pParameter is an initialization vector (IV) or nonce. Depending on the mechanism parameter passed to C_MessageEncryptInit, pParameter may be either an input or an output parameter For example, if the mechanism parameter specifies an IV generator mechanism, the IV generated by the IV generator will be output to the pParameter buffer.

From the above description, pParameter can be either an input or an output.

However, the RPC Server seems to only process the parameter as an input (in between BEGIN_CALL and PROCESS_CALL), not as an output (in between PROCESS_CALL and END_CALL).

Similar issues affect the other message-based encryption and message-based signing functions that involve a pParameter.

The issues only apply to message-based encryption and message-based signing, not message-based decryption and message-based verifying.

According to 5.11.3 C_DecryptMessageBegin:

Unlike the pParameter parameter of C_EncryptMessageBegin, pParameter is always an input parameter.

@uhhhh2 uhhhh2 changed the title RPC: EncryptMessageBegin: pParameter can be "either an input or an output parameter" RPC: Message-Based Encryption Functions: pParameter can be "either an input or an output parameter" Dec 15, 2023
@uhhhh2 uhhhh2 changed the title RPC: Message-Based Encryption Functions: pParameter can be "either an input or an output parameter" RPC: Message-Based Encryption and Signing Functions: pParameter can be "either an input or an output parameter" Dec 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants