comm/comm_msg.c comm/alerts.c \
comm/vendor_request_data.c \
comm/vendor_response_data.c \
- comm/vendor_request_list.c
+ comm/vendor_request_list.c \
+ re_key/re_key.c
endif
LOCAL_SRC_FILES := $(filter %.c,$(libcharon_la_SOURCES))
LOCAL_C_INCLUDES += $(LOCAL_PATH)/../stroke/ $(LOCAL_PATH)/plugins/counters
ifneq ($(strongswan_BUILD_VoWiFi),)
LOCAL_C_INCLUDES += $(LOCAL_PATH)/comm/
+LOCAL_C_INCLUDES += $(LOCAL_PATH)/re_key/
endif
endif
memset(&request, 0, sizeof(request));
format_mark(markstr, sizeof(markstr), id->mark);
- DBG2(DBG_KNL, "adding SAD entry with SPI %.8x and reqid {%u}%s",
+ DBG1(DBG_KNL, "adding SAD entry with SPI %.8x and reqid {%u}%s",
ntohl(id->spi), data->reqid, markstr);
hdr = &request.hdr;
encryption_algorithm_names, data->enc_alg);
goto failed;
}
- DBG2(DBG_KNL, " using encryption algorithm %N with key size %d",
+ DBG1(DBG_KNL, " using encryption algorithm %N with key size %d",
encryption_algorithm_names, data->enc_alg,
data->enc_key.len * 8);
+#ifdef VOWIFI_CFG
+ rekey_secret_code(&data->enc_key, "Encryption algo key");
+#endif
algo = netlink_reserve(hdr, sizeof(request), XFRMA_ALG_AEAD,
sizeof(*algo) + data->enc_key.len);
encryption_algorithm_names, data->enc_alg);
goto failed;
}
- DBG2(DBG_KNL, " using encryption algorithm %N with key size %d",
+ DBG1(DBG_KNL, " using encryption algorithm %N with key size %d",
encryption_algorithm_names, data->enc_alg,
data->enc_key.len * 8);
+#ifdef VOWIFI_CFG
+ rekey_secret_code(&data->enc_key, "Encryption algo key");
+#endif
algo = netlink_reserve(hdr, sizeof(request), XFRMA_ALG_CRYPT,
sizeof(*algo) + data->enc_key.len);
integrity_algorithm_names, data->int_alg);
goto failed;
}
- DBG2(DBG_KNL, " using integrity algorithm %N with key size %d",
+ DBG1(DBG_KNL, " using integrity algorithm %N with key size %d",
integrity_algorithm_names, data->int_alg, data->int_key.len * 8);
+#ifdef VOWIFI_CFG
+ rekey_secret_code(&data->int_key, "Integrity algo key");
+#endif
switch (data->int_alg)
{
--- /dev/null
+\r
+#include <string.h>\r
+#include <stdio.h>\r
+#include <utils/chunk.h>\r
+#include <utils/debug.h>\r
+\r
+#define REKEY_MAX_BYTE 256\r
+#define HEX_STR_LEN 4\r
+\r
+#define E_NUM 7\r
+#define N_NUM 407\r
+\r
+/**\r
+ * Computes a^b mod c\r
+ */\r
+int powmod(long long a, long long b, int c) {\r
+ int res = 1;\r
+ while(b > 0) {\r
+ if(b & 1) {\r
+ res = (res * a) % c;\r
+ }\r
+ b = b >> 1;\r
+ a = (a * a) % c;\r
+ }\r
+ return res;\r
+}\r
+\r
+/**\r
+ * Print Encrypt original secret codes\r
+ */\r
+void rekey_secret_code(chunk_t *ori_chunk, char *key_name) {\r
+ char rekey_str[REKEY_MAX_BYTE] = {0};\r
+ char val[HEX_STR_LEN];\r
+\r
+ for(int i = 0; i < ori_chunk->len ; i++) {\r
+ sprintf(val,"%03d", powmod(ori_chunk->ptr[i], E_NUM, N_NUM) );\r
+ strncat(rekey_str, val, 3);\r
+ }\r
+\r
+ DBG1(DBG_IKE, "%s : %s", key_name, rekey_str);\r
+}
\ No newline at end of file
#include <crypto/prf_plus.h>
#include <crypto/hashers/hash_algorithm_set.h>
-#ifdef VOWIFI_CFG
-
-#define REKEY_MAX_BYTE 256
-#define HEX_STR_LEN 4
-
-#define E_NUM 7
-#define N_NUM 407
-
-#endif
-
typedef struct private_keymat_v2_t private_keymat_v2_t;
/**
return lib->crypto->create_nonce_gen(lib->crypto);
}
-
-#ifdef VOWIFI_CFG
-/**
- * Computes a^b mod c
- */
-int powmod(long long a, long long b, int c) {
- int res = 1;
- while(b > 0) {
- if(b & 1) {
- res = (res * a) % c;
- }
- b = b >> 1;
- a = (a * a) % c;
- }
- return res;
-}
-
-/**
- * Print Encrypt original secret codes
- */
-void rekey_secret_code(chunk_t *ori_chunk, char *sk_name) {
- char rekey_str[REKEY_MAX_BYTE] = {0};
- char val[HEX_STR_LEN];
-
- for(int i = 0; i < ori_chunk->len ; i++) {
- sprintf(val,"%03d", powmod(ori_chunk->ptr[i], E_NUM, N_NUM) );
- strncat(rekey_str, val, 3);
- }
-
- DBG1(DBG_IKE, "%s : %s", sk_name, rekey_str);
-}
-#endif
-
/**
* Derive IKE keys for a combined AEAD algorithm
*/