aboutsummaryrefslogtreecommitdiff
path: root/rsa.c
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2015-06-21 22:17:46 -0400
committerRob Austein <sra@hactrn.net>2015-06-21 22:17:46 -0400
commitbca97e11e8cd4e8236eef3cdabf659963ce9f0cc (patch)
tree1cef06568c7edc96fda8bfc22c66998a8415bf8a /rsa.c
parentf23b4c6fd3ebee70ff7f8df5f088cfe27ff48a29 (diff)
Add digest algorithm IDs.
Diffstat (limited to 'rsa.c')
-rw-r--r--rsa.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/rsa.c b/rsa.c
index ef334b6..320327a 100644
--- a/rsa.c
+++ b/rsa.c
@@ -470,6 +470,9 @@ static hal_error_t extract_component(hal_rsa_key_t key_, const size_t offset,
if (res_len != NULL)
*res_len = len;
+ if (res == NULL)
+ return HAL_OK;
+
if (len > res_max)
return HAL_ERROR_RESULT_TOO_LONG;
@@ -786,6 +789,12 @@ hal_error_t hal_rsa_key_to_der(hal_rsa_key_t key_,
return HAL_OK;
}
+size_t hal_rsa_key_to_der_len(hal_rsa_key_t key_)
+{
+ size_t len = 0;
+ return hal_rsa_key_to_der(key_, NULL, &len, 0) == HAL_OK ? len : 0;
+}
+
hal_error_t hal_rsa_key_from_der(hal_rsa_key_t *key_,
void *keybuf, const size_t keybuf_len,
const uint8_t *der, const size_t der_len)