LCOV - code coverage report
Current view: top level - ballet/x509 - fd_x509_mock.c (source / functions) Hit Total Coverage
Test: cov.lcov Lines: 5 5 100.0 %
Date: 2026-09-17 04:28:31 Functions: 1 1 100.0 %

          Line data    Source code
       1             : #include "fd_x509_mock.h"
       2             : 
       3             : static uchar const
       4             : fd_x509_mock_tpl[ FD_X509_MOCK_CERT_SZ ] = {
       5             :   /* Certificate SEQUENCE (3 elem) */
       6             :   0x30, 0x81, 0xf6,
       7             : 
       8             :     /* tbsCertificate TBSCertificate SEQUENCE (8 elem) */
       9             :     0x30, 0x81, 0xa9,
      10             : 
      11             :       /* version [0] (1 elem)  */
      12             :       0xa0, 0x03,
      13             :         /* INTEGER  2 */
      14             :         0x02, 0x01, 0x02,
      15             : 
      16             :       /* serialNumber CertificateSerialNumber INTEGER (62 bit) */
      17             :       0x02, 0x08,
      18             :       0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
      19             : 
      20             :       /* signature AlgorithmIdentifier SEQUENCE (1 elem) */
      21             :       0x30, 0x05,
      22             :         /* algorithm OBJECT IDENTIFIER 1.3.101.112 curveEd25519 (EdDSA 25519 signature algorithm) */
      23             :         0x06, 0x03, 0x2b, 0x65, 0x70,
      24             : 
      25             :       /* issuer Name SEQUENCE (1 elem) */
      26             :       0x30, 0x16,
      27             :         /* RelativeDistinguishedName SET (1 elem) */
      28             :         0x31, 0x14,
      29             :           /* AttributeTypeAndValue SEQUENCE (2 elem) */
      30             :           0x30, 0x12,
      31             :             /* type AttributeType OBJECT IDENTIFIER 2.5.4.3 commonName (X.520 DN component) */
      32             :             0x06, 0x03, 0x55, 0x04, 0x03,
      33             :             /* value AttributeValue [?] UTF8String Solana node */
      34             :             0x0c, 0x0b, 0x53, 0x6f, 0x6c, 0x61, 0x6e, 0x61, 0x20, 0x6e, 0x6f, 0x64, 0x65,
      35             : 
      36             :       /* validity Validity SEQUENCE (2 elem) */
      37             :       0x30, 0x20,
      38             :         /* notBefore Time UTCTime 1970-01-01 00:00:00 UTC */
      39             :         0x17, 0x0d, 0x37, 0x30, 0x30, 0x31, 0x30, 0x31, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x5a,
      40             :         /* notAfter Time GeneralizedTime 4096-01-01 00:00:00 UTC */
      41             :         0x18, 0x0f, 0x34, 0x30, 0x39, 0x36, 0x30, 0x31, 0x30, 0x31, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x5a,
      42             : 
      43             :       /* subject Name SEQUENCE (0 elem) */
      44             :       0x30, 0x00,
      45             : 
      46             :       /* subjectPublicKeyInfo SubjectPublicKeyInfo SEQUENCE (2 elem) */
      47             :       0x30, 0x2a,
      48             :         /* algorithm AlgorithmIdentifier SEQUENCE (1 elem) */
      49             :         0x30, 0x05,
      50             :           /* algorithm OBJECT IDENTIFIER 1.3.101.112 curveEd25519 (EdDSA 25519 signature algorithm) */
      51             :           0x06, 0x03, 0x2b, 0x65, 0x70,
      52             :         /* subjectPublicKey BIT STRING (256 bit) */
      53             :         0x03, 0x21, 0x00,
      54      300777 :         #define FD_X509_MOCK_PUBKEY_OFF (0x64)
      55             :         0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
      56             :         0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
      57             :         0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
      58             :         0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
      59             : 
      60             :       /* extensions [3] (1 elem) */
      61             :       0xa3, 0x29,
      62             :         /* Extensions SEQUENCE (2 elem) */
      63             :         0x30, 0x27,
      64             :           /* Extension SEQUENCE (3 elem) */
      65             :           0x30, 0x17,
      66             :             /* extnID OBJECT IDENTIFIER 2.5.29.17 subjectAltName (X.509 extension) */
      67             :             0x06, 0x03, 0x55, 0x1d, 0x11,
      68             :             /* critical BOOLEAN true */
      69             :             0x01, 0x01, 0xff,
      70             :             /* extnValue OCTET STRING (13 byte) encapsulating */
      71             :             0x04, 0x0d,
      72             :               /* SEQUENCE (1 elem) */
      73             :               0x30, 0x0b,
      74             :               /* [2] (9 byte) localhost */
      75             :               0x82, 0x09,
      76             :               0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x68, 0x6f, 0x73, 0x74,
      77             : 
      78             :           /* Extension SEQUENCE (3 elem) */
      79             :           0x30, 0x0c,
      80             :             /* extnID OBJECT IDENTIFIER 2.5.29.19 basicConstraints (X.509 extension) */
      81             :             0x06, 0x03, 0x55, 0x1d, 0x13,
      82             :             /* critical BOOLEAN true */
      83             :             0x01, 0x01, 0xff,
      84             :             /* extnValue OCTET STRING (2 byte) encapsulating */
      85             :             0x04, 0x02,
      86             :               /* SEQUENCE (0 elem) */
      87             :               0x30, 0x00,
      88             : 
      89             :     /* signatureAlgorithm AlgorithmIdentifier SEQUENCE (1 elem) */
      90             :     0x30, 0x05,
      91             :       /* algorithm OBJECT IDENTIFIER 1.3.101.112 curveEd25519 (EdDSA 25519 signature algorithm) */
      92             :       0x06, 0x03, 0x2b, 0x65, 0x70,
      93             :       /* signature BIT STRING (512 bit) */
      94             :       0x03, 0x41, 0x00,
      95             :       0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
      96             :       0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
      97             :       0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
      98             :       0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
      99             :       0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
     100             :       0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
     101             :       0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
     102             :       0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
     103             : };
     104             : 
     105             : void
     106             : fd_x509_mock_cert( uchar buf[ static FD_X509_MOCK_CERT_SZ ],
     107      300777 :                    uchar public_key[ static 32 ] ) {
     108      300777 :   fd_memcpy( buf, fd_x509_mock_tpl, FD_X509_MOCK_CERT_SZ );
     109      300777 :   fd_memcpy( buf+FD_X509_MOCK_PUBKEY_OFF, public_key, 32UL );
     110      300777 : }

Generated by: LCOV version 1.14