}
/**
- * The message digest SHA256 - hcrypto
+ * The message digest SHA384 - hcrypto
+ *
+ * @return the message digest type.
+ *
+ * @ingroup hcrypto_evp
+ */
+
+const EVP_MD *
+EVP_hcrypto_sha384(void)
+{
+ static const struct hc_evp_md sha384 = {
+ 48,
+ 128,
+ sizeof(SHA384_CTX),
+ (hc_evp_md_init)SHA384_Init,
+ (hc_evp_md_update)SHA384_Update,
+ (hc_evp_md_final)SHA384_Final,
+ NULL
+ };
+ return &sha384;
+}
+
+/**
+ * The message digest SHA512 - hcrypto
*
* @return the message digest type.
*
#define EVP_hcrypto_md5 hc_EVP_hcrypto_md5
#define EVP_hcrypto_sha1 hc_EVP_hcrypto_sha1
#define EVP_hcrypto_sha256 hc_EVP_hcrypto_sha256
+#define EVP_hcrypto_sha384 hc_EVP_hcrypto_sha384
#define EVP_hcrypto_sha512 hc_EVP_hcrypto_sha512
#define EVP_hcrypto_des_cbc hc_EVP_hcrypto_des_cbc
#define EVP_hcrypto_des_ede3_cbc hc_EVP_hcrypto_des_ede3_cbc
const EVP_MD * EVP_hcrypto_md5(void);
const EVP_MD * EVP_hcrypto_sha1(void);
const EVP_MD * EVP_hcrypto_sha256(void);
+const EVP_MD * EVP_hcrypto_sha384(void);
const EVP_MD * EVP_hcrypto_sha512(void);
const EVP_CIPHER * EVP_hcrypto_rc4(void);
return EVP_DEF_OP(HCRYPTO_DEF_PROVIDER, sha256);
}
+/**
+ * The message digest SHA384
+ *
+ * @return the message digest type.
+ *
+ * @ingroup hcrypto_evp
+ */
+
+const EVP_MD *
+EVP_sha384(void)
+{
+ hcrypto_validate();
+ return EVP_DEF_OP(HCRYPTO_DEF_PROVIDER, sha384);
+}
+
+/**
+ * The message digest SHA512
+ *
+ * @return the message digest type.
+ *
+ * @ingroup hcrypto_evp
+ */
+
const EVP_MD *
EVP_sha512(void)
{
#define EVP_sha hc_EVP_sha
#define EVP_sha1 hc_EVP_sha1
#define EVP_sha256 hc_EVP_sha256
+#define EVP_sha384 hc_EVP_sha384
#define EVP_sha512 hc_EVP_sha512
#define PKCS5_PBKDF2_HMAC_SHA1 hc_PKCS5_PBKDF2_HMAC_SHA1
#define EVP_BytesToKey hc_EVP_BytesToKey
const EVP_MD *EVP_sha(void);
const EVP_MD *EVP_sha1(void);
const EVP_MD *EVP_sha256(void);
+const EVP_MD *EVP_sha384(void);
const EVP_MD *EVP_sha512(void);
const EVP_CIPHER * EVP_aes_128_cbc(void);
hc_EVP_sha
hc_EVP_sha1
hc_EVP_sha256
+ hc_EVP_sha384
hc_EVP_sha512
;! hc_EVP_cc_md2
(void (*)(void*, void*))SHA256_Final,
EVP_sha256
};
-#ifdef HAVE_SHA384
struct hash_foo sha384 = {
"SHA-384",
sizeof(SHA384_CTX),
48,
(void (*)(void*))SHA384_Init,
(void (*)(void*,const void*, size_t))SHA384_Update,
- (void (*)(void*, void*))SHA384_Final
+ (void (*)(void*, void*))SHA384_Final,
+ EVP_sha384
};
-#endif
struct hash_foo sha512 = {
"SHA-512",
sizeof(SHA512_CTX),
{ NULL }
};
-#ifdef HAVE_SHA384
struct test sha384_tests[] = {
{ "abc",
{ 0xcb,0x00,0x75,0x3f,0x45,0xa3,0x5e,0x8b,
0xae,0x97,0xdd,0xd8,0x7f,0x3d,0x89,0x85}},
{NULL}
};
-#endif
struct test sha512_tests[] = {
{ "abc",
hash_test(&md2, md2_tests) +
hash_test(&md4, md4_tests) +
hash_test(&md5, md5_tests) +
- hash_test(&sha1, sha1_tests)
- + hash_test(&sha256, sha256_tests)
-#ifdef HAVE_SHA384
- + hash_test(&sha384, sha384_tests)
-#endif
- + hash_test(&sha512, sha512_tests);
+ hash_test(&sha1, sha1_tests) +
+ hash_test(&sha256, sha256_tests) +
+ hash_test(&sha384, sha384_tests) +
+ hash_test(&sha512, sha512_tests);
}
void SHA512_Update (SHA512_CTX *, const void *, size_t);
void SHA512_Final (void *, SHA512_CTX *);
+#define SHA384_DIGEST_LENGTH 48
+
+typedef struct hc_sha512state SHA384_CTX;
+
+void SHA384_Init (SHA384_CTX *);
+void SHA384_Update (SHA384_CTX *, const void *, size_t);
+void SHA384_Final (void *, SHA384_CTX *);
+
#endif /* HEIM_SHA_H */
}
}
}
+
+void
+SHA384_Init(SHA384_CTX *m)
+{
+ m->sz[0] = 0;
+ m->sz[1] = 0;
+ A = 0xcbbb9d5dc1059ed8;
+ B = 0x629a292a367cd507;
+ C = 0x9159015a3070dd17;
+ D = 0x152fecd8f70e5939;
+ E = 0x67332667ffc00b31;
+ F = 0x8eb44a8768581511;
+ G = 0xdb0c2e0d64f98fa7;
+ H = 0x47b5481dbefa4fa4;
+}
+
+void
+SHA384_Update (SHA384_CTX *m, const void *v, size_t len)
+{
+ SHA512_Update(m, v, len);
+}
+
+void
+SHA384_Final (void *res, SHA384_CTX *m)
+{
+ unsigned char data[SHA512_DIGEST_LENGTH];
+ SHA512_Final(data, m);
+ memcpy(res, data, SHA384_DIGEST_LENGTH);
+}
+
hc_EVP_sha;
hc_EVP_sha1;
hc_EVP_sha256;
+ hc_EVP_sha384;
hc_EVP_sha512;
hc_EVP_cc_md2;
hc_EVP_hcrypto_md5;
hc_EVP_hcrypto_sha1;
hc_EVP_hcrypto_sha256;
+ hc_EVP_hcrypto_sha384;
hc_EVP_hcrypto_sha512;
hc_EVP_hcrypto_des_ede3_cbc;
hc_EVP_hcrypto_aes_128_cbc;