crypto: use void* args for aes_siv_{encrypt,decrypt}
James Prestwood
PATCH 1/4 crypto: use void* args for aes_siv_{encrypt,decrypt}
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(-)
src/crypto.c +4 -4
@@ -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;
src/crypto.h +4 -4
@@ -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);
Signature · 1 line
2.31.1
James Prestwood
PATCH 2/4 crypto: use void* for hkdf_expand
This makes it more flexible for other storage types
--- src/crypto.c | 2 +- src/crypto.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
src/crypto.c +1 -1
@@ -860,7 +860,7 @@ bool hkdf_extract(enum l_checksum_type type, const void *key,return (ret == (int ) dlen); } -bool hkdf_expand (enum l_checksum_type type,const uint8_t *key,size_t key_len, +bool hkdf_expand (enum l_checksum_type type,const void *key,size_t key_len,const char *info,void *out,size_t out_len) {return prf_plus (type, key, key_len, info, out, out_len,0 );
src/crypto.h +1 -1
@@ -122,7 +122,7 @@ bool prf_plus(enum l_checksum_type type, const void *key, size_t key_len,bool hkdf_extract (enum l_checksum_type type,const void *key,size_t key_len,uint8_t num_args,void *out, ...); -bool hkdf_expand (enum l_checksum_type type,const uint8_t *key,size_t key_len, +bool hkdf_expand (enum l_checksum_type type,const void *key,size_t key_len,const char *info,void *out,size_t out_len); bool crypto_derive_pairwise_ptk(const uint8_t *pmk, size_t pmk_len,
Signature · 1 line
2.31.1
James Prestwood
PATCH 3/4 auto-t: iwd.py: use args[0] for station debug interface
In reply to James PrestwoodPassing *args, **kwargs into StationDebug ended up initializing the class with Station properties since devices can be initialized from existing property dictionaries. Since the object path is all StationDebug needs, pass args[0] instead.
--- autotests/util/iwd.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
autotests/util/iwd.py +1 -1
@@ -287,7 +287,7 @@ class Device(IWDDBusAbstract): IWDDBusAbstract.__init__(self, *args, **kwargs) - self._station_debug = StationDebug(*args, **kwargs) + self._station_debug = StationDebug(args[0]) @property def _wps_manager(self):
Signature · 1 line
2.31.1
James Prestwood
PATCH 4/4 wiphy: make wiphy work queue reentrancy safe
In reply to James PrestwoodNow both the do_work and destroy callback can safely insert new work items without causing problems.
--- src/wiphy.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
src/wiphy.c +9 -1
@@ -118,6 +118,7 @@ struct wiphy {char regdom_country[2 ];/* Work queue for this radio */ struct l_queue *work; +bool work_in_callback; bool support_scheduled_scan:1; bool support_rekey_offload:1;
@@ -1924,14 +1925,19 @@ static void wiphy_radio_work_next(struct wiphy *wiphy) work->priority =INT_MIN ;l_debug ("Starting work item %u" , work->id); + + wiphy->work_in_callback = true; done = work->ops->do_work (work); + wiphy->work_in_callback = false;if (done) { work->id =0 ;l_queue_remove (wiphy->work, work); + wiphy->work_in_callback = true;destroy_work (work); + wiphy->work_in_callback = false;wiphy_radio_work_next (wiphy); }
@@ -1961,7 +1967,7 @@ uint32_t wiphy_radio_work_insert(struct wiphy *wiphy,l_queue_insert (wiphy->work, item, insert_by_priority,NULL ); -if (l_queue_length (wiphy->work) ==1 ) +if (l_queue_length (wiphy->work) ==1 && !wiphy->work_in_callback)wiphy_radio_work_next (wiphy);return item->id;
@@ -1999,7 +2005,9 @@ void wiphy_radio_work_done(struct wiphy *wiphy, uint32_t id) item->id =0 ; + wiphy->work_in_callback = true;destroy_work (item); + wiphy->work_in_callback = false;if (next)wiphy_radio_work_next (wiphy);
Signature · 1 line
2.31.1
Denis Kenzior
Hi James,
Quoted 6 lines · James Prestwood
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(-)
All applied, thanks.
Regards,
-Denis