public inbox for iwd@lists.linux.dev
 help / color / mirror / Atom feed
From: James Prestwood <prestwoj at gmail.com>
To: iwd at lists.01.org
Subject: [PATCH 1/4] crypto: use void* args for aes_siv_{encrypt,decrypt}
Date: Mon, 22 Nov 2021 12:44:22 -0800	[thread overview]
Message-ID: <20211122204425.3567479-1-prestwoj@gmail.com> (raw)

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

This makes these APIs more flexible for other storage types
---
 src/crypto.c | 8 ++++----
 src/crypto.h | 8 ++++----
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/crypto.c b/src/crypto.c
index 3f516940..c5bf6fe1 100644
--- a/src/crypto.c
+++ b/src/crypto.c
@@ -321,9 +321,9 @@ static bool s2v(struct l_checksum *cmac, struct iovec *iov, size_t iov_len,
 /*
  * RFC 5297 Section 2.6 - SIV Encrypt
  */
-bool aes_siv_encrypt(const uint8_t *key, size_t key_len, const uint8_t *in,
+bool aes_siv_encrypt(const void *key, size_t key_len, const void *in,
 			size_t in_len, struct iovec *ad, size_t num_ad,
-			uint8_t *out)
+			void *out)
 {
 	struct l_checksum *cmac;
 	struct l_cipher *ctr;
@@ -374,9 +374,9 @@ free_ctr:
 	return false;
 }
 
-bool aes_siv_decrypt(const uint8_t *key, size_t key_len, const uint8_t *in,
+bool aes_siv_decrypt(const void *key, size_t key_len, const void *in,
 			size_t in_len, struct iovec *ad, size_t num_ad,
-			uint8_t *out)
+			void *out)
 {
 	struct l_checksum *cmac;
 	struct l_cipher *ctr;
diff --git a/src/crypto.h b/src/crypto.h
index d359da61..eb48fe5b 100644
--- a/src/crypto.h
+++ b/src/crypto.h
@@ -83,12 +83,12 @@ bool aes_wrap(const uint8_t *kek, const uint8_t *in, size_t len, uint8_t *out);
 bool arc4_skip(const uint8_t *key, size_t key_len, size_t skip,
 		const uint8_t *in, size_t len, uint8_t *out);
 
-bool aes_siv_encrypt(const uint8_t *key, size_t key_len, const uint8_t *in,
+bool aes_siv_encrypt(const void *key, size_t key_len, const void *in,
 			size_t in_len, struct iovec *ad, size_t num_ad,
-			uint8_t *out);
-bool aes_siv_decrypt(const uint8_t *key, size_t key_len, const uint8_t *in,
+			void *out);
+bool aes_siv_decrypt(const void *key, size_t key_len, const void *in,
 			size_t in_len, struct iovec *ad, size_t num_ad,
-			uint8_t *out);
+			void *out);
 
 int crypto_cipher_key_len(enum crypto_cipher cipher);
 int crypto_cipher_tk_bits(enum crypto_cipher cipher);
-- 
2.31.1

             reply	other threads:[~2021-11-22 20:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-22 20:44 James Prestwood [this message]
  -- strict thread matches above, loose matches on Subject: below --
2021-11-22 21:35 [PATCH 1/4] crypto: use void* args for aes_siv_{encrypt,decrypt} Denis Kenzior

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211122204425.3567479-1-prestwoj@gmail.com \
    --to=iwd@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox