1 // Copyright 2021 Google LLC 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 // 15 /////////////////////////////////////////////////////////////////////////////// 16 17 #ifndef TINK_EXPERIMENTAL_PQCRYPTO_SIGNATURE_SUBTLE_DILITHIUM_AVX2_VERIFY_H_ 18 #define TINK_EXPERIMENTAL_PQCRYPTO_SIGNATURE_SUBTLE_DILITHIUM_AVX2_VERIFY_H_ 19 20 #include <memory> 21 #include <string> 22 23 #include "absl/strings/string_view.h" 24 #include "tink/experimental/pqcrypto/signature/subtle/dilithium_key.h" 25 #include "tink/internal/fips_utils.h" 26 #include "tink/public_key_verify.h" 27 #include "tink/util/statusor.h" 28 29 namespace crypto { 30 namespace tink { 31 namespace subtle { 32 33 class DilithiumAvx2Verify : public PublicKeyVerify { 34 public: 35 static crypto::tink::util::StatusOr<std::unique_ptr<PublicKeyVerify>> New( 36 DilithiumPublicKeyPqclean public_key); 37 38 // Verifies that 'signature' is a digital signature for 'data'. 39 crypto::tink::util::Status Verify(absl::string_view signature, 40 absl::string_view data) const override; 41 42 static constexpr crypto::tink::internal::FipsCompatibility kFipsStatus = 43 crypto::tink::internal::FipsCompatibility::kNotFips; 44 45 private: DilithiumAvx2Verify(DilithiumPublicKeyPqclean public_key)46 explicit DilithiumAvx2Verify(DilithiumPublicKeyPqclean public_key) 47 : public_key_(public_key) {} 48 49 DilithiumPublicKeyPqclean public_key_; 50 }; 51 52 } // namespace subtle 53 } // namespace tink 54 } // namespace crypto 55 56 #endif // TINK_EXPERIMENTAL_PQCRYPTO_SIGNATURE_SUBTLE_DILITHIUM_AVX2_VERIFY_H_ 57