Beispiel #1
0
Datei: bee.c Projekt: bugant/bee
CK_RV init_user(const char *module, CK_USER_TYPE user, const unsigned char *pin, bee *b)
{
    CK_RV error = CKR_GENERAL_ERROR;
    CK_MECHANISM_PTR sym, asym;
    attrs *a_sym, *a_pub, *a_priv;

    sym = (CK_MECHANISM_PTR) malloc(sizeof(CK_MECHANISM));
    asym = (CK_MECHANISM_PTR) malloc(sizeof(CK_MECHANISM));
    a_sym = (attrs*) malloc(sizeof(attrs));
    a_pub = (attrs*) malloc(sizeof(attrs));
    a_priv = (attrs*) malloc(sizeof(attrs));
    if (!sym || !asym || !a_sym || !a_pub || !a_priv)
    {
	CKRLOG("bee cannot allocate memory for default mechanisms", error);
	return error;
    }

    sym->mechanism = DEFAULT_SYM_M;
    sym->pParameter = NULL_PTR;
    sym->ulParameterLen = 0;

    asym->mechanism = DEFAULT_ASYM_M;
    asym->pParameter = NULL_PTR;
    asym->ulParameterLen = 0;

    init_attrs(a_sym);
    init_attrs(a_pub);
    init_attrs(a_priv);

    return init_and_configure(module, user, pin, sym, asym, a_sym, a_pub, a_priv, b);
}
Beispiel #2
0
bool init_all_attrs()
{
    init_attrs(player_attrs, sizeof(player_attrs)/sizeof(CAttr), player_attr_type_table, player_attr_name_table);
    init_attrs(item_attrs, sizeof(item_attrs) / sizeof(CAttr), item_attr_type_table, item_attr_name_table);

    return true;
}
Beispiel #3
0
void load_effects(
	EFFECT effects[],       int neffects,
	const char *paths[],    int npaths,
	const char *astrs[],    int nastrs,
	const char *ustrs[],    int nustrs)
{
	GLenum shader_types[] = {GL_VERTEX_SHADER, GL_GEOMETRY_SHADER, GL_FRAGMENT_SHADER};
	int nsh = LENGTH(shader_types); //Number of shader types.
	char *shader_texts[npaths];
	read_in_shaders(paths, shader_texts, npaths);

	for (int i = 0; i < neffects; i++) {
		GLuint program_handle = glCreateProgram();
		int offset = i*nsh;

		if (compile_effect(&paths[offset], &shader_texts[offset], shader_types, nsh, program_handle) == 0) {
			init_attrs(program_handle, astrs, effects[i].attr, nastrs);
			init_unifs(program_handle, ustrs, effects[i].unif, nustrs);
			glDeleteProgram(effects[i].handle); //Delete old program
			effects[i].handle = program_handle; //Store handle to new program
		} else {
			glDeleteProgram(program_handle);
			printf("Program [%s, %s] failed.\n", paths[i*nsh], paths[i*nsh + 2]);
		}
	}

	for (int i = 0; i < LENGTH(shader_texts); i++)
		if (shader_texts[i] != NULL)
			free(shader_texts[i]);
}
Beispiel #4
0
CK_RV find_objects_by_name(bee b, const char *name, CK_OBJECT_HANDLE_PTR *found, CK_ULONG_PTR how_many)
{
    attrs search_me;
    init_attrs(&search_me);
    add_attribute(&search_me, CKA_LABEL, (CK_VOID_PTR) name, strlen(name));

    return find_objects(b, search_me, found, how_many);
}
Beispiel #5
0
int main(int argc, char **argv)
{
  struct mace_options opt;
  Plist clauses;
  Mace_results results;

  /* Following says whether to ignore unregognized set/clear/assigns. */
  BOOL prover_compatability_mode = member_args(argc, argv, "-c");

  init_standard_ladr();
  init_mace_options(&opt);  /* We must do this before calling usage_message. */
  init_attrs();

  if (member_args(argc, argv, "help") ||
      member_args(argc, argv, "-help")) {
    usage_message(stderr, &opt);
    exit(1);
  }

  print_banner(argc, argv, PROGRAM_NAME, PROGRAM_VERSION, PROGRAM_DATE, FALSE);
  set_program_name(PROGRAM_NAME);   /* for conditional input */

  signal(SIGINT,  mace4_sig_handler);
  signal(SIGUSR1, mace4_sig_handler);
  signal(SIGSEGV, mace4_sig_handler);

  clauses = read_mace4_input(argc, argv, prover_compatability_mode, &opt);

  print_separator(stdout, "CLAUSES FOR SEARCH", TRUE);
  fwrite_clause_list(stdout, clauses, "mace4_clauses", CL_FORM_BARE);
  print_separator(stdout, "end of clauses for search", TRUE);

  results = mace4(clauses, &opt);

  mace4_exit(results->return_code);  /* print messages and exit */

  exit(0);  /* won't happen */

}  /* main */