Add ecdsa signing support

Since ring does not yet support ecdsa signing, a thin layer was added
to allow the simulator to call tinycrypt's signing routine.

Signed-off-by: Fabio Utzig <utzig@apache.org>
diff --git a/sim/mcuboot-sys/src/c.rs b/sim/mcuboot-sys/src/c.rs
index dd2aac3..9f364cb 100644
--- a/sim/mcuboot-sys/src/c.rs
+++ b/sim/mcuboot-sys/src/c.rs
@@ -44,6 +44,17 @@
     unsafe { raw::BOOT_MAX_ALIGN as usize }
 }
 
+pub fn ecdsa256_sign(privkey: &[u8], hash: &[u8]) -> Result<[u8; 64], &'static str> {
+    unsafe {
+        let mut signature: [u8; 64] = [0; 64];
+        if raw::ecdsa256_sign_(privkey.as_ptr(), hash.as_ptr(),
+                               hash.len() as u32, signature.as_mut_ptr()) == 1 {
+            return Ok(signature);
+        }
+        return Err("Failed signature generation");
+    }
+}
+
 mod raw {
     use area::CAreaDesc;
     use libc;
@@ -60,5 +71,9 @@
 
         pub static BOOT_MAGIC_SZ: u32;
         pub static BOOT_MAX_ALIGN: u32;
+
+        pub fn ecdsa256_sign_(privkey: *const u8, hash: *const u8,
+                              hash_len: libc::c_uint,
+                              signature: *mut u8) -> libc::c_int;
     }
 }