Skip to content

Commit

Permalink
fix: length registration record should be OPAQUE_REGISTRATION_RECORD_…
Browse files Browse the repository at this point in the history
…LEN (#40)

The record received from opaque_FinalizeRequest and send to opaque_StoreUserRecord has length OPAQUE_REGISTRATION_RECORD_LEN
  • Loading branch information
krispypen authored Jul 10, 2024
1 parent 36d38d0 commit 2ee006c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions java/jni.c
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ static jobject c_finalizeReg(JNIEnv *env, jobject obj, jbyteArray sec_, jbyteArr
getids(env, ids_, &ids, &gc);

uint8_t export_key[crypto_hash_sha512_BYTES];
uint8_t rec[OPAQUE_USER_RECORD_LEN];
uint8_t rec[OPAQUE_REGISTRATION_RECORD_LEN];

if(0!=opaque_FinalizeRequest(sec, pub, &ids, rec, export_key)) {
exception(env,"opaque register() failed...");
Expand Down Expand Up @@ -428,7 +428,7 @@ static jbyteArray c_storeRec(JNIEnv *env, jobject obj, jbyteArray sec_, jbyteArr
sec = (char*) sec_jb;

size_t recU_len= (*env)->GetArrayLength(env, recU_);
if(recU_len<=OPAQUE_REGISTRATION_RECORD_LEN) {
if(recU_len!=OPAQUE_REGISTRATION_RECORD_LEN) {
exception(env, "recU has invalid size");
return NULL;
}
Expand Down

0 comments on commit 2ee006c

Please sign in to comment.