@@ -423,15 +423,14 @@ sign_hash(Crypt::PK::ECC self, SV * data, const char * hash_name = NULL, const c
423423 STRLEN data_len = 0 ;
424424 ltc_ecc_sig_opts sig_opts = { .prng = &self->pstate , .wprng = self->pindex , .type = LTC_ECCSIG_ANSIX962, .recid = &r, .rfc6979_hash_alg = NULL };
425425
426- // Handle dual signature modes for backward compatibility
427- // For sign_hash_*: if only 2 params passed, treat second as RFC6979 hash
426+ /* Handle dual signature modes for backward compatibility: if only 2 params passed, treat second as RFC6979 hash */
428427 if ((ix == 0 || ix == 3 || ix == 4 ) && hash_name != NULL && hash_rfc6979_name == NULL ) {
429428 hash_rfc6979_name = hash_name;
430429 }
431430
432431 data_ptr = (unsigned char *)SvPVbyte (data, data_len);
433432 if (ix == 1 || ix == 2 ) {
434- // for backward compatibility, if hash_name is NULL, use SHA1
433+ /* for backward compatibility, if hash_name is NULL, use SHA1 */
435434 if (hash_name == NULL ) {
436435 hash_name = " SHA1" ;
437436 }
@@ -444,14 +443,10 @@ sign_hash(Crypt::PK::ECC self, SV * data, const char * hash_name = NULL, const c
444443 }
445444
446445 if (hash_rfc6979_name != NULL ) {
446+ /* deterministic signing */
447447 hash_rfc6979_id = cryptx_internal_find_hash (hash_rfc6979_name);
448448 if (hash_rfc6979_id == -1 ) croak (" FATAL: find_hash failed for rfc6979 hash '%s'" , hash_rfc6979_name);
449449 sig_opts.rfc6979_hash_alg = hash_descriptor[hash_rfc6979_id].name ;
450- } else {
451- // Clear any previously set RFC6979 hash to ensure non-deterministic signing
452- // when RFC6979 parameter is not provided. This prevents hidden state from
453- // previous method calls affecting current signature behavior.
454- sig_opts.rfc6979_hash_alg = NULL ;
455450 }
456451
457452 if (ix == 2 || ix == 3 ) {
0 commit comments