Skip to content

Commit 5c451f7

Browse files
authored
Merge pull request #207 from sorpaas/sp-message-zero
Allow all-zero messages
2 parents 89541ec + 9250ae4 commit 5c451f7

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

src/lib.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -492,10 +492,6 @@ impl Message {
492492
/// [secure signature](https://twitter.com/pwuille/status/1063582706288586752).
493493
#[inline]
494494
pub fn from_slice(data: &[u8]) -> Result<Message, Error> {
495-
if data == [0; constants::MESSAGE_SIZE] {
496-
return Err(Error::InvalidMessage);
497-
}
498-
499495
match data.len() {
500496
constants::MESSAGE_SIZE => {
501497
let mut ret = [0; constants::MESSAGE_SIZE];
@@ -1087,10 +1083,7 @@ mod tests {
10871083
Err(InvalidMessage));
10881084
assert_eq!(Message::from_slice(&[0; constants::MESSAGE_SIZE + 1]),
10891085
Err(InvalidMessage));
1090-
assert_eq!(
1091-
Message::from_slice(&[0; constants::MESSAGE_SIZE]),
1092-
Err(InvalidMessage)
1093-
);
1086+
assert!(Message::from_slice(&[0; constants::MESSAGE_SIZE]).is_ok());
10941087
assert!(Message::from_slice(&[1; constants::MESSAGE_SIZE]).is_ok());
10951088
}
10961089

0 commit comments

Comments
 (0)