[Asterisk-code-review] res_crypto: make keys reloadable on demand for testing (asterisk[19])
George Joseph
asteriskteam at digium.com
Mon Sep 12 14:56:35 CDT 2022
George Joseph has submitted this change. ( https://gerrit.asterisk.org/c/asterisk/+/19140 )
Change subject: res_crypto: make keys reloadable on demand for testing
......................................................................
res_crypto: make keys reloadable on demand for testing
ASTERISK-30045
Change-Id: If59bbb50c1771084bfe2fef307a6077c90d35ce8
---
M include/asterisk/crypto.h
M res/res_crypto.c
2 files changed, 21 insertions(+), 0 deletions(-)
Approvals:
George Joseph: Looks good to me, approved; Approved for Submit
diff --git a/include/asterisk/crypto.h b/include/asterisk/crypto.h
index 38c413f..7b889e1 100644
--- a/include/asterisk/crypto.h
+++ b/include/asterisk/crypto.h
@@ -180,6 +180,8 @@
AST_OPTIONAL_API(int, ast_crypto_loaded, (void), { return 0; });
+AST_OPTIONAL_API(int, ast_crypto_reload, (void), { return 0; });
+
#if defined(__cplusplus) || defined(c_plusplus)
}
#endif
diff --git a/res/res_crypto.c b/res/res_crypto.c
index 71cc979..19b011d 100644
--- a/res/res_crypto.c
+++ b/res/res_crypto.c
@@ -95,6 +95,8 @@
static AST_RWLIST_HEAD_STATIC(keys, ast_key);
+static void crypto_load(int ifd, int ofd);
+
/*!
* \brief setting of priv key
* \param buf
@@ -465,6 +467,12 @@
return 1;
}
+int AST_OPTIONAL_API_NAME(ast_crypto_reload)(void)
+{
+ crypto_load(-1, -1);
+ return 1;
+}
+
int AST_OPTIONAL_API_NAME(ast_aes_set_encrypt_key)(const unsigned char *key, ast_aes_encrypt_key *ctx)
{
return AES_set_encrypt_key(key, 128, ctx);
--
To view, visit https://gerrit.asterisk.org/c/asterisk/+/19140
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: 19
Gerrit-Change-Id: If59bbb50c1771084bfe2fef307a6077c90d35ce8
Gerrit-Change-Number: 19140
Gerrit-PatchSet: 2
Gerrit-Owner: Philip Prindeville <philipp at redfish-solutions.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20220912/b520588f/attachment.html>
More information about the asterisk-code-review
mailing list