Skip to content

Commit

Permalink
Add no_std support (#7)
Browse files Browse the repository at this point in the history
* Add no_std support

* Don't depend on dependencies' std features in std
  • Loading branch information
oberien authored Aug 30, 2022
1 parent 178ad06 commit 7d6d4f4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@ keywords = ["encryption", "xts"]
exclude = ["test_files"]

[features]
default = ["std"]
std = []
openssl_tests = ["openssl"]

[dependencies]
cipher = "0.4"
byteorder = "1"
byteorder = { version = "1", default-features = false }
# Is actually a dev-dependency enabled only for/by openssl_tests, but dev-dependencies can't be
# optional
openssl = { version = "0.10", optional = true }
Expand Down
6 changes: 4 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![cfg_attr(not(feature = "std"), no_std)]

/*!
[XTS block mode](https://en.wikipedia.org/wiki/Disk_encryption_theory#XEX-based_tweaked-codebook_mode_with_ciphertext_stealing_(XTS)) implementation in Rust.
Expand Down Expand Up @@ -122,8 +124,8 @@ xts.decrypt_area(&mut buffer[0x400..0xC00], 0x200, 2, get_nintendo_tweak);
```
*/

use std::convert::TryFrom;
use std::convert::TryInto;
use core::convert::TryFrom;
use core::convert::TryInto;

use byteorder::{ByteOrder, LittleEndian};
use cipher::generic_array::typenum::Unsigned;
Expand Down

0 comments on commit 7d6d4f4

Please sign in to comment.