1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// Copyright 2020 Contributors to the Parsec project.
// SPDX-License-Identifier: Apache-2.0
//! # PsaHashCompare operation
//!
//! Compute the hash value of a message and compare it with a reference value.

use crate::operations::psa_algorithm::Hash;
use derivative::Derivative;

/// Native object for hash compare operations.
#[derive(Derivative)]
#[derivative(Debug)]
pub struct Operation {
    /// The hash algorithm to compute.
    pub alg: Hash,
    /// The input to hash.
    #[derivative(Debug = "ignore")]
    pub input: zeroize::Zeroizing<Vec<u8>>,
    /// The reference hash value.
    #[derivative(Debug = "ignore")]
    pub hash: zeroize::Zeroizing<Vec<u8>>,
}

/// Native object for hash compare result.
#[derive(Debug, Default, Copy, Clone)]
pub struct Result;