jlong JNICALL Java_beecrypt_provider_SHA512_allocParam(JNIEnv* env, jclass dummy) { jlong param = (jlong) malloc(sizeof(sha512Param)); if (param == 0) { jclass ex = (*env)->FindClass(env, "java/lang/OutOfMemoryError"); if (ex) (*env)->ThrowNew(env, ex, (const char*) 0); } sha512Reset((sha512Param*) param); return param; }
int main() { int i, failures = 0; sha512Param param; byte digest[64]; for (i = 0; i < 1; i++) { if (sha512Reset(¶m)) return -1; if (sha512Update(¶m, table[i].input, table[i].input_size)) return -1; if (sha512Digest(¶m, digest)) return -1; if (memcmp(digest, table[i].expect, 64)) { printf("failed test vector %d\n", i+1); failures++; } } return failures; }
void JNICALL Java_beecrypt_provider_SHA512_reset(JNIEnv* env, jclass dummy, jlong param) { sha512Reset((sha512Param*) param); }