Module: kamailio Branch: master Commit: 022da99ca22efbf226d89234edb3f9883bd89bb2 URL: https://github.com/kamailio/kamailio/commit/022da99ca22efbf226d89234edb3f988...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: 2024-03-30T18:24:35+01:00
gcrypt: replace local fixups with core helpers
---
Modified: src/modules/gcrypt/gcrypt_mod.c
---
Diff: https://github.com/kamailio/kamailio/commit/022da99ca22efbf226d89234edb3f988... Patch: https://github.com/kamailio/kamailio/commit/022da99ca22efbf226d89234edb3f988...
---
diff --git a/src/modules/gcrypt/gcrypt_mod.c b/src/modules/gcrypt/gcrypt_mod.c index 69be4432535..c75e6b905b4 100644 --- a/src/modules/gcrypt/gcrypt_mod.c +++ b/src/modules/gcrypt/gcrypt_mod.c @@ -45,10 +45,8 @@ static void mod_destroy(void);
static int w_gcrypt_aes_encrypt( sip_msg_t *msg, char *inb, char *keyb, char *outb); -static int fixup_gcrypt_aes_encrypt(void **param, int param_no); static int w_gcrypt_aes_decrypt( sip_msg_t *msg, char *inb, char *keyb, char *outb); -static int fixup_gcrypt_aes_decrypt(void **param, int param_no);
/* init vector value */ static str _gcrypt_init_vector = str_init("SIP/2.0 is RFC3261"); @@ -59,9 +57,9 @@ static int _gcrypt_aes_mode = GCRY_CIPHER_MODE_ECB; /* clang-format off */ static cmd_export_t cmds[] = { {"gcrypt_aes_encrypt", (cmd_function)w_gcrypt_aes_encrypt, 3, - fixup_gcrypt_aes_encrypt, 0, ANY_ROUTE}, + fixup_spve2_pvar, fixup_free_spve2_pvar, ANY_ROUTE}, {"gcrypt_aes_decrypt", (cmd_function)w_gcrypt_aes_decrypt, 3, - fixup_gcrypt_aes_decrypt, 0, ANY_ROUTE}, + fixup_spve2_pvar, fixup_free_spve2_pvar, ANY_ROUTE}, {0, 0, 0, 0, 0, 0} };
@@ -260,28 +258,6 @@ static int w_gcrypt_aes_encrypt( return ki_gcrypt_aes_encrypt_helper(msg, &ins, &keys, dst); }
-/** - * - */ -static int fixup_gcrypt_aes_encrypt(void **param, int param_no) -{ - if(param_no == 1 || param_no == 2) { - if(fixup_spve_null(param, 1) < 0) - return -1; - return 0; - } else if(param_no == 3) { - if(fixup_pvar_null(param, 1) != 0) { - LM_ERR("failed to fixup result pvar\n"); - return -1; - } - if(((pv_spec_t *)(*param))->setf == NULL) { - LM_ERR("result pvar is not writeble\n"); - return -1; - } - } - return 0; -} - /** * */ @@ -422,28 +398,6 @@ static int w_gcrypt_aes_decrypt( return ki_gcrypt_aes_decrypt_helper(msg, &ins, &keys, dst); }
-/** - * - */ -static int fixup_gcrypt_aes_decrypt(void **param, int param_no) -{ - if(param_no == 1 || param_no == 2) { - if(fixup_spve_null(param, 1) < 0) - return -1; - return 0; - } else if(param_no == 3) { - if(fixup_pvar_null(param, 1) != 0) { - LM_ERR("failed to fixup result pvar\n"); - return -1; - } - if(((pv_spec_t *)(*param))->setf == NULL) { - LM_ERR("result pvar is not writeble\n"); - return -1; - } - } - return 0; -} -
/** *