static void print_sig_config() { config_number("g^xy length", g_xy_length); config_key(hasher_name); config_number("Ni length", ni_length); config_number("Nr length", nr_length); }
static void print_sig_config(void) { config_number("g^xy length", g_xy_length); config_key(prf->key); config_number("Ni length", ni_length); config_number("Nr length", nr_length); }
static void gcm_print_config(void) { config_number("Keylen", keylen); config_number("IVlen", ivlen); config_number("PTlen", ptlen); config_number("AADlen", aadlen); config_number("Taglen", taglen); }
static void print_psk_config(void) { config_number("g^xy length", g_xy_length); config_key(hasher_name); config_number("Ni length", ni_length); config_number("Nr length", nr_length); config_number("pre-shared-key length", psk_length); }
static void ikev2_config() { config_number("g^ir length", g_ir_length); config_key(hasher_name); config_number("Ni length",ni_length); config_number("Nr length",nr_length); config_number("DKM length",dkm_length); config_number("Child SA DKM length",child_sa_dkm_length); }
int main(int ac, char **av) { if (!av[1]) printf("need config file\n"), exit(1); if (parse_config_file(av[1]) < 0) printf("cannot parse config file\n"), exit(1); char *type; char *header; char *name; int n; while (scanf("%as %as %as", &type, &header, &name) == 3) { switch (type[0]) { case 'n': if (config_number(header, name, "%d", &n) < 0) printf("Cannot parse number %s %s\n", header, name); else printf("res %d\n", n); break; case 's': printf("res %s\n", config_string(header, name)); break; case 'b': printf("res %d\n", config_bool(header, name)); break; default: printf("unknown type %s\n", type); break; } free(type); free(header); free(name); } return 0; }
/**************************************************************************** * config_disk_interleave ****************************************************************************/ static cw_bool_t config_disk_interleave( struct config *cfg, struct disk_track *dsk_trk) { if (! disk_set_interleave(dsk_trk, config_number(cfg, NULL, 0))) config_error(cfg, "invalid interleave value"); return (CW_BOOL_OK); }
/**************************************************************************** * config_disk_timeout_write ****************************************************************************/ static cw_bool_t config_disk_timeout_write( struct config *cfg, struct disk_track *dsk_trk) { if (! disk_set_timeout_write(dsk_trk, config_number(cfg, NULL, 0))) config_disk_error_timeout(cfg); return (CW_BOOL_OK); }
/**************************************************************************** * config_disk_side_offset ****************************************************************************/ static cw_bool_t config_disk_side_offset( struct config *cfg, struct disk_track *dsk_trk) { if (! disk_set_side_offset(dsk_trk, config_number(cfg, NULL, 0))) debug_error(); config_warning_obsolete(cfg, "side_offset"); return (CW_BOOL_OK); }
/**************************************************************************** * config_disk_trackvalue ****************************************************************************/ static cw_count_t config_disk_trackvalue( struct config *cfg) { cw_count_t track = config_number(cfg, NULL, 0); if (! disk_check_track(track)) config_error(cfg, "invalid track value"); return (track); }
/**************************************************************************** * config_disk_timeout ****************************************************************************/ static cw_bool_t config_disk_timeout( struct config *cfg, struct disk_track *dsk_trk) { cw_count_t val = config_number(cfg, NULL, 0); if (! disk_set_timeout_read(dsk_trk, val)) config_disk_error_timeout(cfg); if (! disk_set_timeout_write(dsk_trk, val)) config_disk_error_timeout(cfg); return (CW_BOOL_OK); }
static void print_config(void) { for (int i = 0; hashes[i]; i++) { if (hashes[i]->hash_digest_len == l) { hash_alg = hashes[i]; break; } } config_number("L", l); if (hash_alg == NULL) { fprintf(stderr, "SHA length %lu not recognised\n", l); } else { fprintf(stderr, "SHA %s with length %lu\n", hash_alg->common.name, l); } }
/**************************************************************************** * config_disk_params ****************************************************************************/ static cw_bool_t config_disk_params( struct config *cfg, struct disk_track *dsk_trk, struct disk_params *dsk_prm, cw_char_t *token, cw_count_t len) { cw_count_t val; cw_bool_t rd = CW_BOOL_TRUE; cw_bool_t wr = CW_BOOL_TRUE; cw_bool_t rw = CW_BOOL_TRUE; if (dsk_prm->ofs >= dsk_prm->size) config_error(cfg, "too many parameters"); if (dsk_prm->type == FORMAT_OPTION_TYPE_BOOLEAN) val = config_boolean(cfg, token, len); else val = config_number(cfg, token, len); if (dsk_prm->fmt_opt_rd != NULL) rd = disk_set_read_option(dsk_trk, dsk_prm->fmt_opt_rd, val, dsk_prm->ofs); if (dsk_prm->fmt_opt_wr != NULL) wr = disk_set_write_option(dsk_trk, dsk_prm->fmt_opt_wr, val, dsk_prm->ofs); if (dsk_prm->fmt_opt_rw != NULL) rw = disk_set_rw_option(dsk_trk, dsk_prm->fmt_opt_rw, val, dsk_prm->ofs); if ((! rd) || (! wr) || (! rw)) config_error(cfg, "invalid parameter value '%s'", token); dsk_prm->ofs++; return (CW_BOOL_OK); }