All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 01/17] checksum: Add SHA384 and SHA512 hash & hmac types.
@ 2015-07-24  3:26 Andrew Zaborowski
  2015-07-24  3:26 ` [PATCH 02/17] checksum: Add l_checksum_clone API Andrew Zaborowski
                   ` (8 more replies)
  0 siblings, 9 replies; 12+ messages in thread
From: Andrew Zaborowski @ 2015-07-24  3:26 UTC (permalink / raw)
  To: ell

[-- Attachment #1: Type: text/plain, Size: 2196 bytes --]

---
 ell/checksum.c | 20 ++++++++++++++++++--
 ell/checksum.h |  2 ++
 2 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/ell/checksum.c b/ell/checksum.c
index 243470f..882f5f6 100644
--- a/ell/checksum.c
+++ b/ell/checksum.c
@@ -73,7 +73,7 @@ struct sockaddr_alg {
  * Checksum handling
  */
 
-#define is_valid_type(type)  ((type) <= L_CHECKSUM_SHA256)
+#define is_valid_type(type)  ((type) <= L_CHECKSUM_SHA512)
 
 /**
  * l_checksum:
@@ -136,6 +136,12 @@ LIB_EXPORT struct l_checksum *l_checksum_new(enum l_checksum_type type)
 	case L_CHECKSUM_SHA256:
 		name = "sha256";
 		break;
+	case L_CHECKSUM_SHA384:
+		name = "sha384";
+		break;
+	case L_CHECKSUM_SHA512:
+		name = "sha512";
+		break;
 	}
 
 	fd = create_alg(name);
@@ -205,6 +211,12 @@ struct l_checksum *l_checksum_new_hmac(enum l_checksum_type type,
 	case L_CHECKSUM_SHA256:
 		name = "hmac(sha256)";
 		break;
+	case L_CHECKSUM_SHA384:
+		name = "hmac(sha384)";
+		break;
+	case L_CHECKSUM_SHA512:
+		name = "hmac(sha512)";
+		break;
 	}
 
 	fd = create_alg(name);
@@ -338,13 +350,17 @@ LIB_EXPORT char *l_checksum_get_string(struct l_checksum *checksum)
 		{ .name = "md5", .digest_len = 16 },
 		{ .name = "sha1", .digest_len = 20 },
 		{ .name = "sha256", .digest_len = 32 },
+		{ .name = "sha384", .digest_len = 48 },
+		{ .name = "sha512", .digest_len = 64 },
 		{ .name = "cmac(aes)", .digest_len = 16 },
 		{ .name = "hmac(md5)", .digest_len = 16 },
 		{ .name = "hmac(sha1)", .digest_len = 20 },
 		{ .name = "hmac(sha256)", .digest_len = 32 },
+		{ .name = "hmac(sha384)", .digest_len = 48 },
+		{ .name = "hmac(sha512)", .digest_len = 64 },
 		{ .name = NULL, .digest_len = 0 },
 	};
-	unsigned char digest[32];
+	unsigned char digest[64];
 	unsigned int i;
 
 	if (unlikely(!checksum))
diff --git a/ell/checksum.h b/ell/checksum.h
index 8e163c4..c516580 100644
--- a/ell/checksum.h
+++ b/ell/checksum.h
@@ -35,6 +35,8 @@ enum l_checksum_type {
 	L_CHECKSUM_MD5,
 	L_CHECKSUM_SHA1,
 	L_CHECKSUM_SHA256,
+	L_CHECKSUM_SHA384,
+	L_CHECKSUM_SHA512,
 };
 
 struct l_checksum *l_checksum_new(enum l_checksum_type type);
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2015-07-24 15:56 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-24  3:26 [PATCH 01/17] checksum: Add SHA384 and SHA512 hash & hmac types Andrew Zaborowski
2015-07-24  3:26 ` [PATCH 02/17] checksum: Add l_checksum_clone API Andrew Zaborowski
2015-07-24 15:55   ` Denis Kenzior
2015-07-24  3:26 ` [PATCH 03/17] cipher: Add 3DES EDE and AES CBC-mode cipher types Andrew Zaborowski
2015-07-24 15:56   ` Denis Kenzior
2015-07-24  3:26 ` [PATCH 04/17] cipher: Add l_cipher_set_iv Andrew Zaborowski
2015-07-24  3:26 ` [PATCH 05/17] Add ASN.1 BER / DER decoding utilities as asn1-private.h Andrew Zaborowski
2015-07-24  3:26 ` [PATCH 06/17] Add RSA PKCS#1 1.5 assymetric key encryption operations Andrew Zaborowski
2015-07-24  3:26 ` [PATCH 07/17] Add cert.{c,h} for basic X509 certificate operations Andrew Zaborowski
2015-07-24  3:26 ` [PATCH 08/17] cert: Add RSA private key utilities Andrew Zaborowski
2015-07-24  3:26 ` [PATCH 09/17] unit: Add an RSA encryption/decryption test Andrew Zaborowski
2015-07-24 15:50 ` [PATCH 01/17] checksum: Add SHA384 and SHA512 hash & hmac types Denis Kenzior

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.