Skip to content

Commit

Permalink
Added CKM_SHA224 support
Browse files Browse the repository at this point in the history
  • Loading branch information
fxdupont committed May 23, 2016
1 parent e476540 commit f251f22
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions checks/checks.c
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,8 @@ void runInfoCheck(unsigned int counter) {
assert(rv == CKR_OK);
rv = C_GetMechanismInfo(slotWithToken, CKM_SHA_1, &info);
assert(rv == CKR_OK);
rv = C_GetMechanismInfo(slotWithToken, CKM_SHA224, &info);
assert(rv == CKR_OK);
rv = C_GetMechanismInfo(slotWithToken, CKM_SHA256, &info);
assert(rv == CKR_OK);
rv = C_GetMechanismInfo(slotWithToken, CKM_SHA384, &info);
Expand Down
3 changes: 3 additions & 0 deletions src/lib/cryptoki_compat/pkcs11.h
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,9 @@ typedef unsigned long ck_mechanism_type_t;
#define CKM_SHA256 (0x250)
#define CKM_SHA256_HMAC (0x251)
#define CKM_SHA256_HMAC_GENERAL (0x252)
#define CKM_SHA224 (0x255)
#define CKM_SHA224_HMAC (0x256)
#define CKM_SHA224_HMAC_GENERAL (0x257)
#define CKM_SHA384 (0x260)
#define CKM_SHA384_HMAC (0x261)
#define CKM_SHA384_HMAC_GENERAL (0x262)
Expand Down
4 changes: 4 additions & 0 deletions src/lib/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1271,6 +1271,10 @@ CK_RV C_DigestInit(CK_SESSION_HANDLE hSession, CK_MECHANISM_PTR pMechanism) {
mechSize = 20;
hashFunc = new Botan::SHA_160;
break;
case CKM_SHA224:
mechSize = 28;
hashFunc = new Botan::SHA_224;
break;
case CKM_SHA256:
mechSize = 32;
hashFunc = new Botan::SHA_256;
Expand Down
2 changes: 2 additions & 0 deletions src/lib/mechanisms.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ static CK_MECHANISM_TYPE supportedMechanisms[] = {
CKM_MD5,
CKM_RIPEMD160,
CKM_SHA_1,
CKM_SHA224,
CKM_SHA256,
CKM_SHA384,
CKM_SHA512,
Expand Down Expand Up @@ -108,6 +109,7 @@ CK_RV getMechanismInfo(CK_MECHANISM_TYPE type, CK_MECHANISM_INFO_PTR pInfo) {
case CKM_MD5:
case CKM_RIPEMD160:
case CKM_SHA_1:
case CKM_SHA224:
case CKM_SHA256:
case CKM_SHA384:
case CKM_SHA512:
Expand Down

0 comments on commit f251f22

Please sign in to comment.