View Issue Details

IDProjectCategoryView StatusLast Update
0009953Talerqtartpublic2025-05-13 14:39
Reporterfefe Assigned ToFlorian Dold  
PrioritynormalSeverityminorReproducibilityhave not tried
Status assignedResolutionopen 
Summary0009953: unexplained numeric constants in js_talercrypto_eddsa_sign
DescriptionIn tart_module.c:

 595 unsigned char sk[crypto_sign_SECRETKEYBYTES];
 596 unsigned char pk[crypto_sign_PUBLICKEYBYTES];
 597 unsigned char sig[64];

Why 64?

 605 seed = JS_GetArrayBuffer(ctx, &seed_size, argv[1]);
 606 if (!seed) {
 607 return JS_EXCEPTION;
 608 }
 609 if (seed_size != 32) {
 610 return JS_ThrowTypeError(ctx, "invalid private key size");
 611 }

Why 32? Also the error string is probably wrong because crypto_sign_SECRETKEYBYTES is 64 not 32.

 617 res = crypto_sign_detached((uint8_t *)sig,
 618 NULL,
 619 (uint8_t *)data,
 620 data_size,
 621 sk);

The second argument (NULL here) is supposed to return the size of the signature (always 64).

 625 return make_js_ta_copy(ctx, sig, 64);

This looks like it is meant to be algorithm agnostic (calls crypto_sign_detached instead of crypto_sign_ed25519_detached), but what if a future version of libsodium changes the algorithm and thus the sizes change too? Maybe better call the ed25519 function directly?
TagsNo tags attached.

Activities

There are no notes attached to this issue.

Issue History

Date Modified Username Field Change
2025-05-13 14:12 fefe New Issue
2025-05-13 14:39 Christian Grothoff Assigned To => Florian Dold
2025-05-13 14:39 Christian Grothoff Status new => assigned