Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

crypto-mac: update to 2018 edition #108

Merged
merged 1 commit into from
May 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion crypto-mac/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
[package]
name = "crypto-mac"
description = "Trait for Message Authentication Code (MAC) algorithms"
version = "0.8.0"
authors = ["RustCrypto Developers"]
license = "MIT OR Apache-2.0"
description = "Trait for Message Authentication Code (MAC) algorithms"
edition = "2018"
documentation = "https://docs.rs/crypto-mac"
repository = "https://github.com/RustCrypto/traits"
keywords = ["crypto", "mac"]
Expand Down
4 changes: 4 additions & 0 deletions crypto-mac/src/dev.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//! Development-related functionality

/// Define test
#[macro_export]
macro_rules! new_test {
($name:ident, $test_name:expr, $mac:ty) => {
Expand Down Expand Up @@ -51,6 +54,7 @@ macro_rules! new_test {
};
}

/// Define benchmark
#[macro_export]
macro_rules! bench {
($name:ident, $engine:path, $bs:expr) => {
Expand Down
4 changes: 2 additions & 2 deletions crypto-mac/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ pub struct MacError;
pub struct InvalidKeyLength;

impl fmt::Display for MacError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str("failed MAC verification")
}
}

impl fmt::Display for InvalidKeyLength {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str("invalid key length")
}
}
Expand Down
23 changes: 13 additions & 10 deletions crypto-mac/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,28 +1,31 @@
//! This crate provides trait for Message Authentication Code (MAC) algorithms.

#![no_std]
#![forbid(unsafe_code)]
#![doc(html_logo_url = "https://raw.githubusercontent.com/RustCrypto/meta/master/logo_small.png")]
pub extern crate generic_array;
extern crate subtle;
#![forbid(unsafe_code)]
#![warn(missing_docs, rust_2018_idioms)]

#[cfg(feature = "dev")]
pub extern crate blobby;
#[cfg(feature = "std")]
extern crate std;

use generic_array::typenum::Unsigned;
use generic_array::{ArrayLength, GenericArray};
use subtle::{Choice, ConstantTimeEq};

#[cfg(feature = "dev")]
pub mod dev;

mod errors;

pub use errors::{InvalidKeyLength, MacError};
pub use crate::errors::{InvalidKeyLength, MacError};
pub use generic_array;

use generic_array::typenum::Unsigned;
use generic_array::{ArrayLength, GenericArray};
use subtle::{Choice, ConstantTimeEq};

/// The `Mac` trait defines methods for a Message Authentication algorithm.
pub trait Mac: Clone {
/// Output size of the [`Mac`]
type OutputSize: ArrayLength<u8>;

/// Keys size of the [`Mac`]
type KeySize: ArrayLength<u8>;

/// Create new MAC instance from key with fixed size.
Expand Down