Skip to content

Commit

Permalink
Merge pull request #3 from caveman99/master
Browse files Browse the repository at this point in the history
init the certificate serial with a random value
  • Loading branch information
thebentern authored Nov 21, 2022
2 parents 6575098 + 3a6ddec commit 23665b3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/SSLCert.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,9 @@ static int cert_write(SSLCert &certCtx, std::string dn, std::string validityFrom
goto error_after_cert;
}

// Initialize the serial number
// generate random serial number
mbedtls_mpi_init( &serial );
stepRes = mbedtls_mpi_read_string( &serial, 10, "1" );
stepRes = mbedtls_mpi_fill_random( &serial, 10, mbedtls_ctr_drbg_random, &ctr_drbg );
if (stepRes != 0) {
funcRes = HTTPS_SERVER_ERROR_CERTGEN_SERIAL;
goto error_after_cert_serial;
Expand Down

0 comments on commit 23665b3

Please sign in to comment.