aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/eet
diff options
context:
space:
mode:
authorCedric BAIL <cedric.bail@samsung.com>2015-03-17 08:50:05 +0100
committerCedric BAIL <cedric@osg.samsung.com>2015-03-17 09:58:17 +0100
commit97c703cdafe0aef85d48bd968635dd50586f1f2f (patch)
tree111c02cc2a5a88191f6b9e3841f740f9a715a233 /src/lib/eet
parentecore_con: initialize emile cipher support on demand. (diff)
downloadefl-97c703cdafe0aef85d48bd968635dd50586f1f2f.tar.gz
eet: initialize emile on demand.
Diffstat (limited to 'src/lib/eet')
-rw-r--r--src/lib/eet/eet_cipher.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/lib/eet/eet_cipher.c b/src/lib/eet/eet_cipher.c
index 8fb2cb4eca..e625a5e713 100644
--- a/src/lib/eet/eet_cipher.c
+++ b/src/lib/eet/eet_cipher.c
@@ -90,6 +90,8 @@ eet_identity_open(const char *certificate_file,
gnutls_datum_t load_file = { NULL, 0 };
char pass[1024];
+ if (!emile_cipher_init()) return NULL;
+
/* Init */
if (!(key = malloc(sizeof(Eet_Key))))
goto on_error;
@@ -189,6 +191,8 @@ on_error:
EVP_PKEY *pkey = NULL;
X509 *cert = NULL;
+ if (!emile_cipher_init()) return NULL;
+
/* Load the X509 certificate in memory. */
fp = fopen(certificate_file, "r");
if (!fp)
@@ -244,6 +248,8 @@ on_error:
EAPI void
eet_identity_close(Eet_Key *key)
{
+ if (!emile_cipher_init()) return ;
+
#ifdef HAVE_SIGNATURE
if (!key || (key->references > 0))
return;
@@ -286,6 +292,8 @@ eet_identity_print(Eet_Key *key,
if (!key)
return;
+ if (!emile_cipher_init()) return ;
+
if (key->private_key)
{
if (gnutls_x509_privkey_export_rsa_raw(key->private_key,
@@ -354,6 +362,8 @@ on_error:
if (!key)
return;
+ if (!emile_cipher_init()) return ;
+
rsa = EVP_PKEY_get1_RSA(key->private_key);
if (rsa)
{
@@ -473,6 +483,8 @@ eet_identity_sign(FILE *fp,
if (!fp || !key || !key->certificate || !key->private_key)
return EET_ERROR_BAD_OBJECT;
+ if (!emile_cipher_init()) return EET_ERROR_NOT_IMPLEMENTED;
+
/* Get the file size. */
fd = fileno(fp);
if (fd < 0)
@@ -639,6 +651,8 @@ eet_identity_check(const void *data_base,
if (signature_length < sizeof(int) * 3)
return NULL;
+ if (!emile_cipher_init()) return NULL;
+
/* Get the header */
memcpy(&magic, header, sizeof(int));
memcpy(&sign_len, header+1, sizeof(int));
@@ -801,6 +815,8 @@ eet_identity_certificate_print(const unsigned char *certificate,
return;
}
+ if (!emile_cipher_init()) return ;
+
# ifdef HAVE_GNUTLS
gnutls_datum_t datum;
gnutls_x509_crt_t cert;