sim: Switch to bitflags from enumflags

The bitflags crate seems to be better supported, and doesn't have the
problems getting the results back into the enum type.

Signed-off-by: David Brown <david.brown@linaro.org>
diff --git a/sim/src/main.rs b/sim/src/main.rs
index 614def3..89be7ff 100644
--- a/sim/src/main.rs
+++ b/sim/src/main.rs
@@ -1,8 +1,7 @@
 #[macro_use] extern crate log;
 extern crate ring;
 extern crate env_logger;
-extern crate enumflags;
-#[macro_use] extern crate enumflags_derive;
+#[macro_use] extern crate bitflags;
 extern crate docopt;
 extern crate libc;
 extern crate rand;
diff --git a/sim/src/tlv.rs b/sim/src/tlv.rs
index f637443..ac6ac5d 100644
--- a/sim/src/tlv.rs
+++ b/sim/src/tlv.rs
@@ -10,17 +10,16 @@
 
 use ring::digest;
 
-#[derive(EnumFlags, Copy, Clone, Debug)]
-#[repr(u32)]
-#[allow(non_camel_case_types)]
-pub enum Flags {
-    PIC = 0x000001,
-    SHA256 = 0x000002,
-    PKCS15_RSA2048_SHA256 = 0x000004,
-    ECDSA224_SHA256 = 0x000008,
-    NON_BOOTABLE = 0x000010,
-    ECDSA256_SHA256 = 0x000020,
-    PKCS1_PSS_RSA2048_SHA256 = 0x000040,
+bitflags! {
+    struct Flags: u32 {
+        const FLAG_PIC = 0x000001;
+        const FLAG_SHA256 = 0x000002;
+        const FLAG_PKCS15_RSA2048_SHA256 = 0x000004;
+        const FLAG_ECDSA224_SHA256 = 0x000008;
+        const FLAG_NON_BOOTABLE = 0x000010;
+        const FLAG_ECDSA256_SHA256 = 0x000020;
+        const FLAG_PKCS1_PSS_RSA2048_SHA256 = 0x000040;
+    }
 }
 
 #[repr(u8)]
@@ -44,7 +43,7 @@
     /// Construct a new tlv generator that will only contain a hash of the data.
     pub fn new_hash_only() -> TlvGen {
         TlvGen {
-            flags: Flags::SHA256,
+            flags: FLAG_SHA256,
             kinds: vec![TlvKinds::SHA256],
             size: 4 + 32,
             payload: vec![],
@@ -53,7 +52,7 @@
 
     /// Retrieve the header flags for this configuration.  This can be called at any time.
     pub fn get_flags(&self) -> u32 {
-        self.flags as u32
+        self.flags.bits()
     }
 
     /// Retrieve the size that the TLV will occupy.  This can be called at any time.