LCOV - code coverage report
Current view: top level - disco/keyguard - fd_keyguard_bls.c (source / functions) Hit Total Coverage
Test: cov.lcov Lines: 15 15 100.0 %
Date: 2026-11-12 04:25:03 Functions: 1 1 100.0 %

          Line data    Source code
       1             : #include "fd_keyguard_bls.h"
       2             : #include "../../ballet/ed25519/fd_ed25519.h"
       3             : 
       4             : void FD_FN_SENSITIVE
       5             : fd_keyguard_bls_key_derive( fd_keyguard_bls_key_t * key,
       6             :                             uchar const             ed25519_public_key[ static 32 ],
       7             :                             uchar const             ed25519_private_key[ static 32 ],
       8         564 :                             fd_sha512_t *           sha ) {
       9         564 :   uchar check_public_key[ 32 ];
      10         564 :   fd_ed25519_public_from_private( check_public_key, ed25519_private_key, sha );
      11         564 :   if( FD_UNLIKELY( memcmp( check_public_key, ed25519_public_key, 32UL ) ) )
      12           6 :     FD_LOG_EMERG(( "The public key in the key file does not match the public key derived from the private key. "
      13         564 :                    "Firedancer will not use the key pair to sign as it might leak the private key." ));
      14             : 
      15         558 :   static char const derive_msg[] = "bls-key-derive-alpenglow";
      16             : 
      17         558 :   uchar ikm[ FD_ED25519_SIG_SZ ];
      18         558 :   fd_ed25519_sign( ikm, (uchar const *)derive_msg, sizeof(derive_msg)-1UL, ed25519_public_key, ed25519_private_key, sha );
      19         558 :   fd_bls_sec_derive( &key->secret_key, ikm, sizeof(ikm) );
      20         558 :   fd_memzero_explicit( ikm, sizeof(ikm) );
      21             : 
      22         558 :   fd_bls_pub_t public_key[1];
      23         558 :   fd_bls_sec_to_pub( &key->secret_key, public_key );
      24         558 :   fd_bls_pub_compress( public_key, key->public_key );
      25         558 : }

Generated by: LCOV version 1.14