Procházet zdrojové kódy

Update crypto_set API

Also few leftovers from cfg is removed and version of totempg is
increased to 5 to reflect all changes we made

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Fabio M. Di Nitto <fdinitto@redhat.com>
Jan Friesse před 14 roky
rodič
revize
3b7c2f0588

+ 1 - 1
configure.ac

@@ -209,7 +209,7 @@ LINT_FLAGS="-weak -unrecog +posixlib +ignoresigns -fcnuse \
 	-badflag -D__gnuc_va_list=va_list -D__attribute\(x\)="
 	-badflag -D__gnuc_va_list=va_list -D__attribute\(x\)="
 
 
 # default libraries SONAME
 # default libraries SONAME
-SOMAJOR="4"
+SOMAJOR="5"
 SOMINOR="0"
 SOMINOR="0"
 SOMICRO="0"
 SOMICRO="0"
 SONAME="${SOMAJOR}.${SOMINOR}.${SOMICRO}"
 SONAME="${SOMAJOR}.${SOMINOR}.${SOMICRO}"

+ 2 - 1
exec/totemiba.c

@@ -1253,7 +1253,8 @@ static void timer_function_netif_check_timeout (
 
 
 int totemiba_crypto_set (
 int totemiba_crypto_set (
 	void *iba_context,
 	void *iba_context,
-	unsigned int type)
+	const char *cipher_type,
+	const char *hash_type)
 {
 {
 	struct totemiba_instance *instance = (struct totemiba_instance *)iba_context;
 	struct totemiba_instance *instance = (struct totemiba_instance *)iba_context;
 	int res = 0;
 	int res = 0;

+ 2 - 1
exec/totemiba.h

@@ -108,7 +108,8 @@ extern int totemiba_token_target_set (
 
 
 extern int totemiba_crypto_set (
 extern int totemiba_crypto_set (
 	void *iba_context,
 	void *iba_context,
-	unsigned int type);
+	const char *cipher_type,
+	const char *hash_type);
 
 
 extern int totemiba_recv_mcast_empty (
 extern int totemiba_recv_mcast_empty (
 	void *iba_context);
 	void *iba_context);

+ 4 - 2
exec/totemmrp.c

@@ -212,10 +212,12 @@ int totemmrp_ifaces_get (
 }
 }
 
 
 int totemmrp_crypto_set (
 int totemmrp_crypto_set (
-	unsigned int type)
+	const char *cipher_type,
+	const char *hash_type)
 {
 {
 	return totemsrp_crypto_set (totemsrp_context,
 	return totemsrp_crypto_set (totemsrp_context,
-				    type);
+				    cipher_type,
+				    hash_type);
 }
 }
 
 
 unsigned int totemmrp_my_nodeid_get (void)
 unsigned int totemmrp_my_nodeid_get (void)

+ 1 - 1
exec/totemmrp.h

@@ -113,7 +113,7 @@ extern unsigned int totemmrp_my_nodeid_get (void);
 
 
 extern int totemmrp_my_family_get (void);
 extern int totemmrp_my_family_get (void);
 
 
-extern int totemmrp_crypto_set (unsigned int);
+extern int totemmrp_crypto_set (const char *cipher_type, const char *hash_type);
 
 
 extern int totemmrp_ring_reenable (void);
 extern int totemmrp_ring_reenable (void);
 
 

+ 6 - 3
exec/totemnet.c

@@ -116,7 +116,8 @@ struct transport {
 
 
 	int (*crypto_set) (
 	int (*crypto_set) (
 		void *transport_context,
 		void *transport_context,
-		unsigned int type);
+		const char *cipher_type,
+		const char *hash_type);
 
 
 	int (*recv_mcast_empty) (
 	int (*recv_mcast_empty) (
 		void *transport_context);
 		void *transport_context);
@@ -244,12 +245,14 @@ static void totemnet_instance_initialize (
 
 
 int totemnet_crypto_set (
 int totemnet_crypto_set (
 	void *net_context,
 	void *net_context,
-	 unsigned int type)
+	const char *cipher_type,
+	const char *hash_type)
 {
 {
 	struct totemnet_instance *instance = (struct totemnet_instance *)net_context;
 	struct totemnet_instance *instance = (struct totemnet_instance *)net_context;
 	int res = 0;
 	int res = 0;
 
 
-	res = instance->transport->crypto_set (instance->transport_context, type);
+	res = instance->transport->crypto_set (instance->transport_context,
+	    cipher_type, hash_type);
 
 
 	return res;
 	return res;
 }
 }

+ 2 - 1
exec/totemnet.h

@@ -118,7 +118,8 @@ extern int totemnet_token_target_set (
 
 
 extern int totemnet_crypto_set (
 extern int totemnet_crypto_set (
 	void *net_context,
 	void *net_context,
-	unsigned int type);
+	const char *cipher_type,
+	const char *hash_type);
 
 
 extern int totemnet_recv_mcast_empty (
 extern int totemnet_recv_mcast_empty (
 	void *net_context);
 	void *net_context);

+ 3 - 3
exec/totempg.c

@@ -1384,12 +1384,12 @@ void* totempg_get_stats (void)
 }
 }
 
 
 int totempg_crypto_set (
 int totempg_crypto_set (
-	unsigned int type)
+	const char *cipher_type,
+	const char *hash_type)
 {
 {
 	int res;
 	int res;
 
 
-	res = totemmrp_crypto_set (
-		type);
+	res = totemmrp_crypto_set (cipher_type, hash_type);
 
 
 	return (res);
 	return (res);
 }
 }

+ 3 - 2
exec/totemrrp.c

@@ -2080,12 +2080,13 @@ int totemrrp_ifaces_get (
 
 
 int totemrrp_crypto_set (
 int totemrrp_crypto_set (
 	void *rrp_context,
 	void *rrp_context,
-	unsigned int type)
+	const char *cipher_type,
+	const char *hash_type)
 {
 {
 	struct totemrrp_instance *instance = (struct totemrrp_instance *)rrp_context;
 	struct totemrrp_instance *instance = (struct totemrrp_instance *)rrp_context;
 	int res;
 	int res;
 
 
-	res = totemnet_crypto_set(instance->net_handles[0], type);
+	res = totemnet_crypto_set(instance->net_handles[0], cipher_type, hash_type);
 
 
 	return (res);
 	return (res);
 }
 }

+ 2 - 1
exec/totemrrp.h

@@ -130,7 +130,8 @@ extern int totemrrp_ifaces_get (
 
 
 extern int totemrrp_crypto_set (
 extern int totemrrp_crypto_set (
 	void *rrp_context,
 	void *rrp_context,
-	unsigned int type);
+	const char *cipher_type,
+	const char *hash_type);
 
 
 extern int totemrrp_ring_reenable (
 extern int totemrrp_ring_reenable (
 	void *rrp_context,
 	void *rrp_context,

+ 3 - 2
exec/totemsrp.c

@@ -1032,12 +1032,13 @@ finish:
 
 
 int totemsrp_crypto_set (
 int totemsrp_crypto_set (
 	void *srp_context,
 	void *srp_context,
-	unsigned int type)
+	const char *cipher_type,
+	const char *hash_type)
 {
 {
 	struct totemsrp_instance *instance = (struct totemsrp_instance *)srp_context;
 	struct totemsrp_instance *instance = (struct totemsrp_instance *)srp_context;
 	int res;
 	int res;
 
 
-	res = totemrrp_crypto_set(instance->totemrrp_context, type);
+	res = totemrrp_crypto_set(instance->totemrrp_context, cipher_type, hash_type);
 
 
 	return (res);
 	return (res);
 }
 }

+ 2 - 1
exec/totemsrp.h

@@ -114,7 +114,8 @@ extern int totemsrp_my_family_get (
 
 
 extern int totemsrp_crypto_set (
 extern int totemsrp_crypto_set (
 	void *srp_context,
 	void *srp_context,
-	unsigned int type);
+	const char *cipher_type,
+	const char *hash_type);
 
 
 extern int totemsrp_ring_reenable (
 extern int totemsrp_ring_reenable (
 	void *srp_context);
 	void *srp_context);

+ 2 - 1
exec/totemudp.c

@@ -238,7 +238,8 @@ do {												\
 
 
 int totemudp_crypto_set (
 int totemudp_crypto_set (
 	void *udp_context,
 	void *udp_context,
-	 unsigned int type)
+	const char *cipher_type,
+	const char *hash_type)
 {
 {
 
 
 	return (0);
 	return (0);

+ 2 - 1
exec/totemudp.h

@@ -108,7 +108,8 @@ extern int totemudp_token_target_set (
 
 
 extern int totemudp_crypto_set (
 extern int totemudp_crypto_set (
 	void *udp_context,
 	void *udp_context,
-	unsigned int type);
+	const char *cipher_type,
+	const char *hash_type);
 
 
 extern int totemudp_recv_mcast_empty (
 extern int totemudp_recv_mcast_empty (
 	void *udp_context);
 	void *udp_context);

+ 2 - 1
exec/totemudpu.c

@@ -226,7 +226,8 @@ do {												\
 
 
 int totemudpu_crypto_set (
 int totemudpu_crypto_set (
 	void *udpu_context,
 	void *udpu_context,
-	 unsigned int type)
+	const char *cipher_type,
+	const char *hash_type)
 {
 {
 
 
 	return (0);
 	return (0);

+ 2 - 1
exec/totemudpu.h

@@ -108,7 +108,8 @@ extern int totemudpu_token_target_set (
 
 
 extern int totemudpu_crypto_set (
 extern int totemudpu_crypto_set (
 	void *udpu_context,
 	void *udpu_context,
-	unsigned int type);
+	const char *cipher_type,
+	const char *hash_type);
 
 
 extern int totemudpu_recv_mcast_empty (
 extern int totemudpu_recv_mcast_empty (
 	void *udpu_context);
 	void *udpu_context);

+ 0 - 5
include/corosync/cfg.h

@@ -157,11 +157,6 @@ corosync_cfg_local_get (
 	corosync_cfg_handle_t handle,
 	corosync_cfg_handle_t handle,
 	unsigned int *local_nodeid);
 	unsigned int *local_nodeid);
 
 
-cs_error_t
-corosync_cfg_crypto_set (
-	corosync_cfg_handle_t handle,
-	unsigned int type);
-
 #ifdef __cplusplus
 #ifdef __cplusplus
 }
 }
 #endif
 #endif

+ 1 - 1
include/corosync/coroapi.h

@@ -241,7 +241,7 @@ struct corosync_api_v1 {
 
 
 	const char *(*totem_ip_print) (const struct totem_ip_address *addr);
 	const char *(*totem_ip_print) (const struct totem_ip_address *addr);
 
 
-	int (*totem_crypto_set) (unsigned int type);
+	int (*totem_crypto_set) (const char *cipher_type, const char *hash_type);
 
 
 	int (*totem_callback_token_create) (
 	int (*totem_callback_token_create) (
 		void **handle_out,
 		void **handle_out,

+ 0 - 9
include/corosync/ipc_cfg.h

@@ -141,15 +141,6 @@ struct res_lib_cfg_local_get {
 	mar_uint32_t local_nodeid __attribute__((aligned(8)));
 	mar_uint32_t local_nodeid __attribute__((aligned(8)));
 };
 };
 
 
-struct req_lib_cfg_crypto_set {
-	struct qb_ipc_response_header header __attribute__((aligned(8)));
-	mar_uint32_t type __attribute__((aligned(8)));
-};
-
-struct res_lib_cfg_crypto_set {
-	struct qb_ipc_response_header header __attribute__((aligned(8)));
-};
-
 typedef enum {
 typedef enum {
 	AIS_AMF_ADMINISTRATIVETARGET_SERVICEUNIT = 0,
 	AIS_AMF_ADMINISTRATIVETARGET_SERVICEUNIT = 0,
 	AIS_AMF_ADMINISTRATIVETARGET_SERVICEGROUP = 1,
 	AIS_AMF_ADMINISTRATIVETARGET_SERVICEGROUP = 1,

+ 1 - 1
include/corosync/totem/totempg.h

@@ -153,7 +153,7 @@ extern unsigned int totempg_my_nodeid_get (void);
 
 
 extern int totempg_my_family_get (void);
 extern int totempg_my_family_get (void);
 
 
-extern int totempg_crypto_set (unsigned int type);
+extern int totempg_crypto_set (const char *cipher_type, const char *hash_type);
 
 
 extern int totempg_ring_reenable (void);
 extern int totempg_ring_reenable (void);