const EVP_MD *md;
md = EVP_get_digestbyname(algorithm);
if(md == NULL) {
- *error_r = t_strdup_printf("Invalid digest %s", algorithm);
+ if (error_r != NULL)
+ *error_r = t_strdup_printf("Invalid digest %s", algorithm);
return FALSE;
}
/* allocate context */
/* determine MD */
const EVP_MD* md = EVP_get_digestbyname(hash);
if (md == NULL) {
- *error_r = t_strdup_printf("Invalid digest %s", hash);
+ if (error_r != NULL)
+ *error_r = t_strdup_printf("Invalid digest %s", hash);
return FALSE;
}
if (cipher != NULL) {
algo = EVP_get_cipherbyname(cipher);
if (algo == NULL) {
- *error_r = t_strdup_printf("Invalid cipher %s", cipher);
+ if (error_r != NULL)
+ *error_r = t_strdup_printf("Invalid cipher %s", cipher);
return FALSE;
}
}
EVP_PKEY_set1_EC_KEY(pk, eck);
EC_KEY_free(eck);
} else {
- *error_r = "Invalid private key";
+ if (error_r != NULL)
+ *error_r = "Invalid private key";
return FALSE;
}