//Open session. Required for every crypto operation CK_SESSION_HANDLE hSession;

rv = C_OpenSession( 0, 0, NULL, NULL, );

//Set mechanism – type of crypto operation

CK_MECHANISM digestMechanism = { 0, NULL, 0 }; digestMechanism.mechanism = CKM_SHA256;

//Initialize crypto operation rv = C_DigestInit( hSession, );

//prepare input and output buffers uint8_t input[] = {'a', 'b', 'c'}; uint8_t digest[64];

uint32_t inputlen = sizeof( input ); uint64_t digestlen = sizeof( digest )

//Invoke crypto operation

rv = C_Digest( hSession, input, inputlen, digest, );

// Close crypto session

rv = C_CloseSession( hSession )

//Call this at the end of all crypto operations rv = C_Finalize( NULL_PTR );

8Overview

Page 8
Image 8
HP UX Kernel Cryptographic Module (KCM) manual Overview