int main(void) { int i; if (check_for_aes_instructions() == 0) { printf("no AES instructions detected! - stopping the test app\n"); return 1; } printf("AES instructions detected\n"); for (i=1;i<4096;i+=i*3/2) { printf("testing %d blocks,AES-128: %s",i,(test128(i) != TEST_PASS) ? "FAIL" : "PASS"); printf(",AES-192: %s",(test192(i) != TEST_PASS) ? "FAIL" : "PASS"); printf(",AES-256: %s",(test256(i) != TEST_PASS) ? "FAIL" : "PASS"); printf("\n"); } for (i=1;i<4096;i+=i*3/2) { printf("testing %d blocks,AES-128-CBC: %s",i,(test128_CBC(i) != TEST_PASS) ? "FAIL" : "PASS"); printf(",AES-192-CBC: %s",(test192_CBC(i) != TEST_PASS) ? "FAIL" : "PASS"); printf(",AES-256-CBC: %s\n",(test256_CBC(i) != TEST_PASS) ? "FAIL" : "PASS"); printf("\n"); } return 0; }
tDecAES::tDecAES(nOperationModeAES opmode, const u8 key[], nKeyLengthAES keylen) { // See if this CPU supports the Intel AES-NI instruction set (implemented in assembly (ASM)). bool useFastASM = check_for_aes_instructions(); // Call init. m_init(opmode, key, keylen, useFastASM); }
/** * Function to check if hardware supports AESNI */ JNIEXPORT jint JNICALL Java_com_android_org_bouncycastle_crypto_paddings_PaddedBufferedBlockCipher_checkAesNI(JNIEnv *env, jobject thisObj) { return check_for_aes_instructions(); }
bool tDecAES::canRunFastASM() { return check_for_aes_instructions(); }