[Cryptech-Commits] [sw/libhal] 01/05: Fix hal_rpc_pkey_match() calling convention.
git at cryptech.is
git at cryptech.is
Wed Nov 2 05:32:25 UTC 2016
This is an automated email from the git hooks/post-receive script.
sra at hactrn.net pushed a commit to branch ksng
in repository sw/libhal.
commit e391580e079af9506764d2efd5b9ab868e59f33d
Author: Rob Austein <sra at hactrn.net>
AuthorDate: Tue Nov 1 17:36:58 2016 -0400
Fix hal_rpc_pkey_match() calling convention.
Old calling sequence didn't quite work, caller had no sane way to know
how large the buffer needed to be. Revised sequence is similar to
what the PKCS #11 C_FindObject() call does: return the next batch of
UUIDs, up to the number specified, end of data indicated by getting
back something less than a full block of UUIDs.
---
ks_flash.c | 7 ++-----
ks_volatile.c | 7 ++-----
2 files changed, 4 insertions(+), 10 deletions(-)
diff --git a/ks_flash.c b/ks_flash.c
index e4d82ff..952253e 100644
--- a/ks_flash.c
+++ b/ks_flash.c
@@ -1183,10 +1183,7 @@ static hal_error_t ks_match(hal_ks_t *ks,
else if (err != HAL_OK)
return err;
- while (*result_len < result_max) {
-
- if (++i >= db.ksi.used)
- return HAL_OK;
+ while (*result_len < result_max && ++i < db.ksi.used) {
unsigned b = db.ksi.index[i];
@@ -1251,7 +1248,7 @@ static hal_error_t ks_match(hal_ks_t *ks,
possible = 0;
}
- return HAL_ERROR_RESULT_TOO_LONG;
+ return HAL_OK;
}
static hal_error_t ks_set_attribute(hal_ks_t *ks,
diff --git a/ks_volatile.c b/ks_volatile.c
index 2e6ea3e..c416263 100644
--- a/ks_volatile.c
+++ b/ks_volatile.c
@@ -414,10 +414,7 @@ static hal_error_t ks_match(hal_ks_t *ks,
else if (err != HAL_OK)
return err;
- while (*result_len < result_max) {
-
- if (++i >= ksv->db->ksi.used)
- return HAL_OK;
+ while (*result_len < result_max && ++i < ksv->db->ksi.used) {
unsigned b = ksv->db->ksi.index[i];
@@ -466,7 +463,7 @@ static hal_error_t ks_match(hal_ks_t *ks,
++*result_len;
}
- return HAL_ERROR_RESULT_TOO_LONG;
+ return HAL_OK;
}
static hal_error_t ks_set_attribute(hal_ks_t *ks,
More information about the Commits
mailing list