** API and ABI modifications:
GNUTLS_CERT_SIGNATURE_FAILURE: Added
+gnutls_load_file: Added
gnutls_pubkey_verify_hash2: Added
gnutls_pkcs12_simple_parse: Added
gnutls_certificate_set_x509_system_trust: Added
#include <gnutls_state.h>
#include <gnutls_datum.h>
#include <extras/randomart.h>
+#include <read-file.h>
/**
* gnutls_random_art:
{
res->params_func = func;
}
+
+/**
+ * gnutls_load_file:
+ * @filename: the name of the file to load
+ * @data: Where the file will be stored
+ *
+ * This function will load a file into a datum.
+ * The returned data are allocated using gnutls_malloc().
+ *
+ * Returns: On success, %GNUTLS_E_SUCCESS (0) is returned, otherwise
+ * an error code is returned.
+ *
+ **/
+int gnutls_load_file(const char* filename, gnutls_datum_t * data)
+{
+size_t len;
+
+ data->data = (void*)read_binary_file(filename, &len);
+ if (data->data == NULL)
+ return GNUTLS_E_FILE_ERROR;
+
+ if (malloc != gnutls_malloc)
+ {
+ void* tmp = gnutls_malloc(len);
+
+ memcpy(tmp, data->data, len);
+ free(data->data);
+ data->data = tmp;
+ }
+
+ data->size = len;
+
+ return 0;
+}
time_t expiration,
unsigned int flags);
+ /* Other help functions */
+int gnutls_load_file(const char* filename, gnutls_datum_t * data);
/* Gnutls error codes. The mapping to a TLS alert is also shown in
* comments.