Module: kamailio
Branch: master
Commit: baa177556514cd7cdb794740a1bfd6e47ea814d1
URL: 
https://github.com/kamailio/kamailio/commit/baa177556514cd7cdb794740a1bfd6e47ea814d1

Author: Daniel-Constantin Mierla <mico...@gmail.com>
Committer: Daniel-Constantin Mierla <mico...@gmail.com>
Date: 2024-04-01T07:56:26+02:00

crupto: replace local fixup functions with core helpers

---

Modified: src/modules/crypto/crypto_mod.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/baa177556514cd7cdb794740a1bfd6e47ea814d1.diff
Patch: 
https://github.com/kamailio/kamailio/commit/baa177556514cd7cdb794740a1bfd6e47ea814d1.patch

---

diff --git a/src/modules/crypto/crypto_mod.c b/src/modules/crypto/crypto_mod.c
index b3fba9c005a..f3e644000f9 100644
--- a/src/modules/crypto/crypto_mod.c
+++ b/src/modules/crypto/crypto_mod.c
@@ -58,10 +58,8 @@ static void mod_destroy(void);
 
 static int w_crypto_aes_encrypt(
                sip_msg_t *msg, char *inb, char *keyb, char *outb);
-static int fixup_crypto_aes_encrypt(void **param, int param_no);
 static int w_crypto_aes_decrypt(
                sip_msg_t *msg, char *inb, char *keyb, char *outb);
-static int fixup_crypto_aes_decrypt(void **param, int param_no);
 
 static int w_crypto_nio_in(sip_msg_t *msg, char *p1, char *p2);
 static int w_crypto_nio_out(sip_msg_t *msg, char *p1, char *p2);
@@ -86,9 +84,9 @@ str _crypto_netio_key = STR_NULL;
 
 static cmd_export_t cmds[] = {
                {"crypto_aes_encrypt", (cmd_function)w_crypto_aes_encrypt, 3,
-                               fixup_crypto_aes_encrypt, 0, ANY_ROUTE},
+                               fixup_spve2_pvar, fixup_free_spve2_pvar, 
ANY_ROUTE},
                {"crypto_aes_decrypt", (cmd_function)w_crypto_aes_decrypt, 3,
-                               fixup_crypto_aes_decrypt, 0, ANY_ROUTE},
+                               fixup_spve2_pvar, fixup_free_spve2_pvar, 
ANY_ROUTE},
                {"crypto_netio_in", (cmd_function)w_crypto_nio_in, 0, 0, 0, 
ANY_ROUTE},
                {"crypto_netio_out", (cmd_function)w_crypto_nio_out, 0, 0, 0,
                                ANY_ROUTE},
@@ -345,28 +343,6 @@ static int w_crypto_aes_encrypt(
        return ki_crypto_aes_encrypt_helper(msg, &ins, &keys, dst);
 }
 
-/**
- *
- */
-static int fixup_crypto_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;
-}
-
 /**
  *
  */
@@ -590,29 +566,6 @@ static int w_crypto_aes_decrypt(
        return ki_crypto_aes_decrypt_helper(msg, &ins, &keys, dst);
 }
 
-/**
- *
- */
-static int fixup_crypto_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;
-}
-
-
 /**
  * testing function
  */

_______________________________________________
Kamailio (SER) - Development Mailing List
To unsubscribe send an email to sr-dev-le...@lists.kamailio.org

Reply via email to