2020-08-10 15:00:09 -04:00
|
|
|
// This file is Copyright its original authors, visible in version control
|
|
|
|
// history.
|
|
|
|
//
|
|
|
|
// This file is licensed under the Apache License, Version 2.0 <LICENSE-APACHE
|
|
|
|
// or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
|
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option.
|
|
|
|
// You may not use this file except in accordance with one or both of these
|
|
|
|
// licenses.
|
|
|
|
|
2019-01-17 17:36:49 -05:00
|
|
|
macro_rules! hash_to_message {
|
|
|
|
($slice: expr) => {
|
|
|
|
{
|
2022-02-17 19:29:59 +00:00
|
|
|
#[cfg(not(fuzzing))]
|
2019-01-17 17:36:49 -05:00
|
|
|
{
|
2020-04-27 16:51:59 +02:00
|
|
|
::bitcoin::secp256k1::Message::from_slice($slice).unwrap()
|
2019-01-17 17:36:49 -05:00
|
|
|
}
|
2022-02-17 19:29:59 +00:00
|
|
|
#[cfg(fuzzing)]
|
2019-01-17 17:36:49 -05:00
|
|
|
{
|
2020-04-27 16:51:59 +02:00
|
|
|
match ::bitcoin::secp256k1::Message::from_slice($slice) {
|
2019-01-17 17:36:49 -05:00
|
|
|
Ok(msg) => msg,
|
2020-04-27 16:51:59 +02:00
|
|
|
Err(_) => ::bitcoin::secp256k1::Message::from_slice(&[1; 32]).unwrap()
|
2019-01-17 17:36:49 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|