@@ -26,40 +26,40 @@ int parse_pkcs12_certificate(
2626
2727 bio = BIO_new_mem_buf (data , (int )length );
2828 if (!bio ) {
29- * error_message = strdup ( "Failed to create BIO." ) ;
29+ * error_message = "Failed to create BIO." ;
3030 goto cleanup ;
3131 }
3232 p12 = d2i_PKCS12_bio (bio , NULL );
3333 if (!p12 ) {
34- * error_message = strdup ( "Failed to parse PKCS12." ) ;
34+ * error_message = "Failed to parse PKCS12." ;
3535 goto cleanup ;
3636 }
3737
3838 if (!PKCS12_parse (p12 , NULL , & pkey , & cert , & ca )) {
39- * error_message = strdup ( "Failed to parse PKCS12 structure." ) ;
39+ * error_message = "Failed to parse PKCS12 structure." ;
4040 goto cleanup ;
4141 }
4242
4343 // Check if the key is ED25519
4444 int sig_alg = X509_get_signature_nid (cert );
4545 if (sig_alg != NID_ED25519 ) {
46- * error_message = strdup ( "Certificate signature algorithm is not ED25519." ) ;
46+ * error_message = "Certificate signature algorithm is not ED25519." ;
4747 goto cleanup ;
4848 }
4949
5050 // Extract public key
5151 if (EVP_PKEY_get_raw_public_key (pkey , NULL , public_key_len ) <= 0 ) {
52- * error_message = strdup ( "Failed to get public key length." ) ;
52+ * error_message = "Failed to get public key length." ;
5353 goto cleanup ;
5454 }
5555 * public_key = (unsigned char * )malloc (* public_key_len );
5656 if (!* public_key ) {
57- * error_message = strdup ( "Failed to allocate memory for public key." ) ;
57+ * error_message = "Failed to allocate memory for public key." ;
5858 goto cleanup ;
5959 }
6060
6161 if (EVP_PKEY_get_raw_public_key (pkey , * public_key , public_key_len ) <= 0 ) {
62- * error_message = strdup ( "Failed to extract public key." ) ;
62+ * error_message = "Failed to extract public key." ;
6363 goto cleanup ;
6464 }
6565
@@ -78,7 +78,7 @@ int parse_pkcs12_certificate(
7878 }
7979
8080 if (!* alt_name ) {
81- * error_message = strdup ( "No alternative name found." ) ;
81+ * error_message = "No alternative name found." ;
8282 goto cleanup ;
8383 }
8484
0 commit comments