main(int argc, char *argv[]) { int i; struct db_sa *gsp = NULL; struct db_sa *sa1 = NULL; struct db_sa *sa2 = NULL; struct alg_info_ike *aii; err_t ugh; progname = argv[0]; leak_detective=1; tool_init_log(); init_crypto(); aii = alg_info_ike_create_from_str("3des", &ugh); gsp = oakley_alg_makedb(aii , &oakley_sadb[POLICY_RSASIG >> POLICY_ISAKMP_SHIFT] , -1); sa_print(gsp); tool_close_log(); exit(0); }
main(int argc, char *argv[]){ int i; struct db_sa *gsp = NULL; struct db_sa *sa1 = NULL; struct db_sa *sa2 = NULL; struct alg_info_ike *aii; char err_buf[256]; /* ??? big enough? */ EF_PROTECT_FREE = 1; EF_FREE_WIPES = 1; progname = argv[0]; leak_detective = 1; tool_init_log(); init_crypto(); aii = alg_info_ike_create_from_str("3des", err_buf, sizeof(err_buf)); gsp = oakley_alg_makedb(aii, &oakley_sadb[POLICY_RSASIG >> POLICY_ISAKMP_SHIFT], FALSE); sa_print(gsp); sa_v2_convert(&gsp); sa_v2_print(gsp); tool_close_log(); free_sa(&gsp); exit(0); }
static int doit(unsigned protoid, const char *str) { struct alg_info *ai; enum_names *enames, *anames, *gnames; const char *err; int i; switch (protoid) { case PROTO_IPSEC_ESP: { struct alg_info_esp *ai_esp; struct esp_info *esp_info; enames=&esp_transformid_names; anames=&auth_alg_names; gnames=NULL; ai_esp=alg_info_esp_create_from_str(str, &err); ai = (struct alg_info *) ai_esp; if (!ai) goto err; alg_info_addref(ai); ALG_INFO_ESP_FOREACH(ai_esp, esp_info, i) { printf("(%d = \"%s\" [%d], ", esp_info->esp_ealg_id, enum_name(enames, esp_info->esp_ealg_id), esp_info->esp_ealg_keylen); printf("%d = \"%s\" [%d])\n", esp_info->esp_aalg_id, enum_name(anames, esp_info->esp_aalg_id), esp_info->esp_aalg_keylen); } break; } case PROTO_ISAKMP: { struct alg_info_ike *ai_ike; struct ike_info *ike_info; enames=&oakley_enc_names; anames=&oakley_hash_names; gnames=&oakley_group_names; ai_ike = alg_info_ike_create_from_str(str, &err); ai = (struct alg_info *) ai_ike; if (!ai) goto err; alg_info_addref(ai); ALG_INFO_IKE_FOREACH(ai_ike, ike_info, i) { printf("(%d = \"%s\" [%d], ", ike_info->ike_ealg, enum_name(enames, ike_info->ike_ealg), ike_info->ike_eklen); printf("%d = \"%s\" [%d], ", ike_info->ike_halg, enum_name(anames, ike_info->ike_halg), ike_info->ike_hklen); printf("%d = \"%s\")\n", ike_info->ike_modp, ike_info->ike_modp ? enum_name(gnames, ike_info->ike_modp): "<default>"); } break; }