components/openssl/openssl-1.0.0/engines/t4/eng_t4.c
changeset 580 abb7ba207fc9
parent 537 10bd3a98a582
child 603 1b966e9a6b03
equal deleted inserted replaced
579:085a881269b8 580:abb7ba207fc9
   907  */
   907  */
   908 /* ARGSUSED */
   908 /* ARGSUSED */
   909 static int
   909 static int
   910 t4_bind(ENGINE *e)
   910 t4_bind(ENGINE *e)
   911 {
   911 {
   912 	static int aes_engage = -1;
   912 	static int aes_engage = -1, digest_engage = -1;
   913 
   913 
   914 	if (aes_engage == -1) {
   914 	if (aes_engage == -1) {
   915 		aes_engage = (t4_aes_instructions_present() != 0);
   915 		aes_engage = (t4_aes_instructions_present() != 0);
   916 	}
   916 	}
       
   917 	if (digest_engage == -1) {
       
   918 		digest_engage = (t4_digest_instructions_present() != 0);
       
   919 	}
   917 
   920 
   918 #ifdef DEBUG_T4
   921 #ifdef DEBUG_T4
   919 	(void) fprintf(stderr,
   922 	(void) fprintf(stderr,
   920 	    "t4_bind: engage aes=%d\n", aes_engage);
   923 	    "t4_bind: engage aes=%d, digest=%d\n", aes_engage, digest_engage);
   921 #endif
   924 #endif
   922 
   925 
   923 #ifndef  SOLARIS_NO_AES_CTR
   926 #ifndef  SOLARIS_NO_AES_CTR
   924 	/*
   927 	/*
   925 	 * We must do this before we start working with slots since we need all
   928 	 * We must do this before we start working with slots since we need all
   946 	if (!ENGINE_set_id(e, ENGINE_T4_ID) ||
   949 	if (!ENGINE_set_id(e, ENGINE_T4_ID) ||
   947 	    !ENGINE_set_name(e,
   950 	    !ENGINE_set_name(e,
   948 	    aes_engage ? ENGINE_T4_NAME: ENGINE_NO_T4_NAME) ||
   951 	    aes_engage ? ENGINE_T4_NAME: ENGINE_NO_T4_NAME) ||
   949 	    !ENGINE_set_init_function(e, t4_init) ||
   952 	    !ENGINE_set_init_function(e, t4_init) ||
   950 	    (aes_engage && !ENGINE_set_ciphers(e, t4_get_all_ciphers)) ||
   953 	    (aes_engage && !ENGINE_set_ciphers(e, t4_get_all_ciphers)) ||
       
   954 	    (digest_engage && !ENGINE_set_digests(e, t4_get_all_digests)) ||
   951 	    !ENGINE_set_destroy_function(e, t4_destroy)) {
   955 	    !ENGINE_set_destroy_function(e, t4_destroy)) {
   952 		T4_FREE_AES_CTR_NIDS;
   956 		T4_FREE_AES_CTR_NIDS;
   953 		return (0);
   957 		return (0);
   954 	}
   958 	}
   955 
   959