Skip to content

Commit

Permalink
Removed duplicated is_metadata_valid_for calls.
Browse files Browse the repository at this point in the history
  • Loading branch information
Wei Dai committed Apr 3, 2021
1 parent 5141277 commit 0d2234f
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions native/src/seal/valcheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ namespace seal
SEAL_NODISCARD bool is_buffer_valid(const GaloisKeys &in);

/**
Check whether the given plaintext data is valid for a given SEALContext.
Check whether the given plaintext data and metadata are valid for a given SEALContext.
If the given SEALContext is not set, the encryption parameters are invalid,
or the plaintext data does not match the SEALContext, this function returns
false. Otherwise, returns true. This function can be slow, as it checks the
Expand All @@ -196,7 +196,7 @@ namespace seal
SEAL_NODISCARD bool is_data_valid_for(const Plaintext &in, const SEALContext &context);

/**
Check whether the given ciphertext data is valid for a given SEALContext.
Check whether the given ciphertext data and metadata are valid for a given SEALContext.
If the given SEALContext is not set, the encryption parameters are invalid,
or the ciphertext data does not match the SEALContext, this function returns
false. Otherwise, returns true. This function can be slow, as it checks the
Expand All @@ -208,7 +208,7 @@ namespace seal
SEAL_NODISCARD bool is_data_valid_for(const Ciphertext &in, const SEALContext &context);

/**
Check whether the given secret key data is valid for a given SEALContext.
Check whether the given secret key data and metadata are valid for a given SEALContext.
If the given SEALContext is not set, the encryption parameters are invalid,
or the secret key data does not match the SEALContext, this function returns
false. Otherwise, returns true. This function can be slow, as it checks the
Expand All @@ -220,7 +220,7 @@ namespace seal
SEAL_NODISCARD bool is_data_valid_for(const SecretKey &in, const SEALContext &context);

/**
Check whether the given public key data is valid for a given SEALContext.
Check whether the given public key data and metadata are valid for a given SEALContext.
If the given SEALContext is not set, the encryption parameters are invalid,
or the public key data does not match the SEALContext, this function returns
false. Otherwise, returns true. This function can be slow, as it checks the
Expand All @@ -232,7 +232,7 @@ namespace seal
SEAL_NODISCARD bool is_data_valid_for(const PublicKey &in, const SEALContext &context);

/**
Check whether the given KSwitchKeys data is valid for a given SEALContext.
Check whether the given KSwitchKeys data and metadata are valid for a given SEALContext.
If the given SEALContext is not set, the encryption parameters are invalid,
or the KSwitchKeys data does not match the SEALContext, this function returns
false. Otherwise, returns true. This function can be slow, as it checks the
Expand All @@ -244,7 +244,7 @@ namespace seal
SEAL_NODISCARD bool is_data_valid_for(const KSwitchKeys &in, const SEALContext &context);

/**
Check whether the given RelinKeys data is valid for a given SEALContext.
Check whether the given RelinKeys data and metadata are valid for a given SEALContext.
If the given SEALContext is not set, the encryption parameters are invalid,
or the RelinKeys data does not match the SEALContext, this function returns
false. Otherwise, returns true. This function can be slow, as it checks the
Expand All @@ -256,7 +256,7 @@ namespace seal
SEAL_NODISCARD bool is_data_valid_for(const RelinKeys &in, const SEALContext &context);

/**
Check whether the given GaloisKeys data is valid for a given SEALContext.
Check whether the given GaloisKeys data and metadata are valid for a given SEALContext.
If the given SEALContext is not set, the encryption parameters are invalid,
or the GaloisKeys data does not match the SEALContext, this function returns
false. Otherwise, returns true. This function can be slow, as it checks the
Expand All @@ -279,7 +279,7 @@ namespace seal
*/
SEAL_NODISCARD inline bool is_valid_for(const Plaintext &in, const SEALContext &context)
{
return is_metadata_valid_for(in, context) && is_buffer_valid(in) && is_data_valid_for(in, context);
return is_buffer_valid(in) && is_data_valid_for(in, context);
}

/**
Expand All @@ -294,7 +294,7 @@ namespace seal
*/
SEAL_NODISCARD inline bool is_valid_for(const Ciphertext &in, const SEALContext &context)
{
return is_metadata_valid_for(in, context) && is_buffer_valid(in) && is_data_valid_for(in, context);
return is_buffer_valid(in) && is_data_valid_for(in, context);
}

/**
Expand All @@ -309,7 +309,7 @@ namespace seal
*/
SEAL_NODISCARD inline bool is_valid_for(const SecretKey &in, const SEALContext &context)
{
return is_metadata_valid_for(in, context) && is_buffer_valid(in) && is_data_valid_for(in, context);
return is_buffer_valid(in) && is_data_valid_for(in, context);
}

/**
Expand All @@ -324,7 +324,7 @@ namespace seal
*/
SEAL_NODISCARD inline bool is_valid_for(const PublicKey &in, const SEALContext &context)
{
return is_metadata_valid_for(in, context) && is_buffer_valid(in) && is_data_valid_for(in, context);
return is_buffer_valid(in) && is_data_valid_for(in, context);
}

/**
Expand All @@ -339,7 +339,7 @@ namespace seal
*/
SEAL_NODISCARD inline bool is_valid_for(const KSwitchKeys &in, const SEALContext &context)
{
return is_metadata_valid_for(in, context) && is_buffer_valid(in) && is_data_valid_for(in, context);
return is_buffer_valid(in) && is_data_valid_for(in, context);
}

/**
Expand All @@ -354,7 +354,7 @@ namespace seal
*/
SEAL_NODISCARD inline bool is_valid_for(const RelinKeys &in, const SEALContext &context)
{
return is_metadata_valid_for(in, context) && is_buffer_valid(in) && is_data_valid_for(in, context);
return is_buffer_valid(in) && is_data_valid_for(in, context);
}

/**
Expand All @@ -369,6 +369,6 @@ namespace seal
*/
SEAL_NODISCARD inline bool is_valid_for(const GaloisKeys &in, const SEALContext &context)
{
return is_metadata_valid_for(in, context) && is_buffer_valid(in) && is_data_valid_for(in, context);
return is_buffer_valid(in) && is_data_valid_for(in, context);
}
} // namespace seal

0 comments on commit 0d2234f

Please sign in to comment.