[sr-dev] git:master:8dc55f2a: crypto: declare variable at top of function

Daniel-Constantin Mierla miconda at gmail.com
Fri Jan 22 09:42:41 CET 2016


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

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2016-01-22T09:40:58+01:00

crypto: declare variable at top of function

- declaration inside for loop is invalid in <C99
- reported by Victor Seva

---

Modified: modules/crypto/crypto_mod.c

---

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

---

diff --git a/modules/crypto/crypto_mod.c b/modules/crypto/crypto_mod.c
index fdf21fe..84b6239 100644
--- a/modules/crypto/crypto_mod.c
+++ b/modules/crypto/crypto_mod.c
@@ -272,6 +272,7 @@ int crypto_aes_init(unsigned char *key_data, int key_data_len,
 		unsigned char *salt, EVP_CIPHER_CTX *e_ctx, EVP_CIPHER_CTX *d_ctx)
 {
 	int i, nrounds = 5;
+	int x;
 	unsigned char key[32], iv[32];
 
 	/*
@@ -287,10 +288,10 @@ int crypto_aes_init(unsigned char *key_data, int key_data_len,
 		return -1;
 	}
 
-	for(int x = 0; x<32; ++x)
+	for(x = 0; x<32; ++x)
 		LM_DBG("key: %x iv: %x \n", key[x], iv[x]);
 
-	for(int x = 0; x<8; ++x)
+	for(x = 0; x<8; ++x)
 		LM_DBG("salt: %x\n", salt[x]);
 
 	if(e_ctx) {




More information about the sr-dev mailing list