[prev in list] [next in list] [prev in thread] [next in thread] 

List:       sr-dev
Subject:    [sr-dev] git:master:022da99c: gcrypt: replace local fixups with core helpers
From:       Daniel-Constantin Mierla via sr-dev <sr-dev () lists ! kamailio ! org>
Date:       2024-03-30 17:25:36
Message-ID: E1rqcSW-0006fK-PQ () www ! kamailio ! org
[Download RAW message or body]

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

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/022da99ca22efbf226d89234edb3f9883bd89bb2.diff
Patch: https://github.com/kamailio/kamailio/commit/022da99ca22efbf226d89234edb3f9883bd89bb2.patch

---

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;
-}
-
 
 /**
  *

_______________________________________________
Kamailio (SER) - Development Mailing List
To unsubscribe send an email to sr-dev-leave@lists.kamailio.org
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic