Sfoglia il codice sorgente

gcrypt: replace local fixups with core helpers

Daniel-Constantin Mierla 1 anno fa
parent
commit
022da99ca2
1 ha cambiato i file con 2 aggiunte e 48 eliminazioni
  1. 2 48
      src/modules/gcrypt/gcrypt_mod.c

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