/* * Show IKE algorithms for * - this connection (result from ike= string) * - newest SA */ void ike_alg_show_connection(struct connection *c, const char *instance) { struct state *st; if (c->alg_info_ike) { char buf[1024]; alg_info_snprint(buf, sizeof(buf) - 1, (struct alg_info *)c->alg_info_ike); whack_log(RC_COMMENT, "\"%s\"%s: IKE algorithms wanted: %s", c->name, instance, buf); alg_info_snprint_ike(buf, sizeof(buf), c->alg_info_ike); whack_log(RC_COMMENT, "\"%s\"%s: IKE algorithms found: %s", c->name, instance, buf); } st = state_with_serialno(c->newest_isakmp_sa); if (st != NULL) { static char encbuf[ENUM_SHOW_BUF_LEN]; static char prfbuf[ENUM_SHOW_BUF_LEN]; static char integbuf[ENUM_SHOW_BUF_LEN]; static char groupbuf[ENUM_SHOW_BUF_LEN]; if (!st->st_ikev2) { /* IKEv1 */ whack_log(RC_COMMENT, "\"%s\"%s: IKE algorithm newest: %s_%03d-%s-%s", c->name, instance, strip_prefix(enum_showb(&oakley_enc_names, st->st_oakley.encrypt, encbuf, sizeof(encbuf)), "OAKLEY_"), /* st->st_oakley.encrypter->keydeflen, */ st->st_oakley.enckeylen, strip_prefix(enum_showb(&oakley_hash_names, st->st_oakley.prf_hash, prfbuf, sizeof(prfbuf)), "OAKLEY_"), strip_prefix(enum_showb(&oakley_group_names, st->st_oakley.group->group, groupbuf, sizeof(groupbuf)), "OAKLEY_GROUP_")); } else { /* IKEv2 */ whack_log(RC_COMMENT, "\"%s\"%s: IKEv2 algorithm newest: %s_%03d-%s-%s-%s", c->name, instance, enum_showb(&ikev2_trans_type_encr_names, st->st_oakley.encrypt, encbuf, sizeof(encbuf)), /* st->st_oakley.encrypter->keydeflen, */ st->st_oakley.enckeylen, enum_showb(&ikev2_trans_type_integ_names, st->st_oakley.integ_hash, integbuf, sizeof(integbuf)), enum_showb(&ikev2_trans_type_prf_names, st->st_oakley.prf_hash, prfbuf, sizeof(prfbuf)), strip_prefix(enum_showb(&oakley_group_names, st->st_oakley.group->group, groupbuf, sizeof(groupbuf)), "OAKLEY_GROUP_")); } } }
/* * Show IKE algorithms for * - this connection (result from ike= string) * - newest SA */ void ike_alg_show_connection(const struct connection *c, const char *instance) { const struct state *st; if (c->alg_info_ike != NULL) { char buf[1024]; alg_info_ike_snprint(buf, sizeof(buf) - 1, c->alg_info_ike); whack_log(RC_COMMENT, "\"%s\"%s: IKE algorithms wanted: %s", c->name, instance, buf); alg_info_snprint_ike(buf, sizeof(buf), c->alg_info_ike); whack_log(RC_COMMENT, "\"%s\"%s: IKE algorithms found: %s", c->name, instance, buf); } st = state_with_serialno(c->newest_isakmp_sa); if (st != NULL) { struct esb_buf encbuf, prfbuf, integbuf, groupbuf; if (!st->st_ikev2) { /* IKEv1 */ whack_log(RC_COMMENT, "\"%s\"%s: IKE algorithm newest: %s_%03d-%s-%s", c->name, instance, enum_show_shortb(&oakley_enc_names, st->st_oakley.encrypt, &encbuf), /* st->st_oakley.encrypter->keydeflen, */ st->st_oakley.enckeylen, enum_show_shortb(&oakley_hash_names, st->st_oakley.prf_hash, &prfbuf), enum_show_shortb(&oakley_group_names, st->st_oakley.group->group, &groupbuf)); } else { /* IKEv2 */ whack_log(RC_COMMENT, "\"%s\"%s: IKEv2 algorithm newest: %s_%03d-%s-%s-%s", c->name, instance, enum_showb(&ikev2_trans_type_encr_names, st->st_oakley.encrypt, &encbuf), /* st->st_oakley.encrypter->keydeflen, */ st->st_oakley.enckeylen, enum_showb(&ikev2_trans_type_integ_names, st->st_oakley.integ_hash, &integbuf), enum_showb(&ikev2_trans_type_prf_names, st->st_oakley.prf_hash, &prfbuf), enum_show_shortb(&oakley_group_names, st->st_oakley.group->group, &groupbuf)); } } }
/* * Show IKE algorithms for * - this connection (result from ike= string) * - newest SA */ void ike_alg_show_connection(struct connection *c, const char *instance) { char buf[256]; struct state *st; if (c->alg_info_ike) { alg_info_snprint(buf, sizeof(buf), (struct alg_info *)c->alg_info_ike); whack_log(RC_COMMENT , "\"%s\"%s: IKE algorithms wanted: %s" , c->name , instance , buf); } if (c->alg_info_ike) { alg_info_snprint_ike(buf, sizeof(buf), c->alg_info_ike); whack_log(RC_COMMENT , "\"%s\"%s: IKE algorithms found: %s" , c->name , instance , buf); } st = state_with_serialno(c->newest_isakmp_sa); if (st) whack_log(RC_COMMENT , "\"%s\"%s: IKE algorithm newest: %s_%d-%s-%s" , c->name , instance , enum_show(&oakley_enc_names, st->st_oakley.encrypt) +7 /* strlen("OAKLEY_") */ /* , st->st_oakley.encrypter->keydeflen */ , st->st_oakley.enckeylen , enum_show(&oakley_hash_names, st->st_oakley.hash) +7 /* strlen("OAKLEY_") */ , enum_show(&oakley_group_names, st->st_oakley.group->group) +13 /* strlen("OAKLEY_GROUP_") */ ); }