Print this page
4185 New hash algorithm support

*** 20,29 **** --- 20,30 ---- */ /* * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ + /* Copyright 2013 Saso Kiselkov. All rights reserved. */ #ifndef _SYS_SHA2_H #define _SYS_SHA2_H #include <sys/types.h> /* for uint_* */
*** 37,46 **** --- 38,51 ---- #define SHA256_DIGEST_LENGTH 32 /* SHA256 digest length in bytes */ #define SHA384_DIGEST_LENGTH 48 /* SHA384 digest length in bytes */ #define SHA512_DIGEST_LENGTH 64 /* SHA512 digest length in bytes */ + /* Truncated versions of SHA-512 according to FIPS-180-4, section 5.3.6 */ + #define SHA512_224_DIGEST_LENGTH 28 /* SHA512/224 digest length */ + #define SHA512_256_DIGEST_LENGTH 32 /* SHA512/256 digest length */ + #define SHA256_HMAC_BLOCK_SIZE 64 /* SHA256-HMAC block size */ #define SHA512_HMAC_BLOCK_SIZE 128 /* SHA512-HMAC block size */ #define SHA256 0 #define SHA256_HMAC 1
*** 49,58 **** --- 54,65 ---- #define SHA384_HMAC 4 #define SHA384_HMAC_GEN 5 #define SHA512 6 #define SHA512_HMAC 7 #define SHA512_HMAC_GEN 8 + #define SHA512_224 9 + #define SHA512_256 10 /* * SHA2 context. * The contents of this structure are a private interface between the * Init/Update/Final calls of the functions defined below.
*** 128,138 **** SHA384_MECH_INFO_TYPE, /* SUN_CKM_SHA384 */ SHA384_HMAC_MECH_INFO_TYPE, /* SUN_CKM_SHA384_HMAC */ SHA384_HMAC_GEN_MECH_INFO_TYPE, /* SUN_CKM_SHA384_HMAC_GENERAL */ SHA512_MECH_INFO_TYPE, /* SUN_CKM_SHA512 */ SHA512_HMAC_MECH_INFO_TYPE, /* SUN_CKM_SHA512_HMAC */ ! SHA512_HMAC_GEN_MECH_INFO_TYPE /* SUN_CKM_SHA512_HMAC_GENERAL */ } sha2_mech_type_t; #endif /* _SHA2_IMPL */ #ifdef __cplusplus --- 135,147 ---- SHA384_MECH_INFO_TYPE, /* SUN_CKM_SHA384 */ SHA384_HMAC_MECH_INFO_TYPE, /* SUN_CKM_SHA384_HMAC */ SHA384_HMAC_GEN_MECH_INFO_TYPE, /* SUN_CKM_SHA384_HMAC_GENERAL */ SHA512_MECH_INFO_TYPE, /* SUN_CKM_SHA512 */ SHA512_HMAC_MECH_INFO_TYPE, /* SUN_CKM_SHA512_HMAC */ ! SHA512_HMAC_GEN_MECH_INFO_TYPE, /* SUN_CKM_SHA512_HMAC_GENERAL */ ! SHA512_224_MECH_INFO_TYPE, /* SUN_CKM_SHA512_224 */ ! SHA512_256_MECH_INFO_TYPE /* SUN_CKM_SHA512_256 */ } sha2_mech_type_t; #endif /* _SHA2_IMPL */ #ifdef __cplusplus