1 /* 2 * Copyright 2018 Google LLC 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef FCP_SECAGG_SHARED_INPUT_VECTOR_SPECIFICATION_H_ 18 #define FCP_SECAGG_SHARED_INPUT_VECTOR_SPECIFICATION_H_ 19 20 #include <cstdint> 21 #include <string> 22 23 #include "absl/base/attributes.h" 24 25 namespace fcp { 26 namespace secagg { 27 28 // Used to specify the name and either: 29 // 30 // 1. For the original protocol, the length and bit width of each input vector 31 // which the protocol will aggregate. 32 // 2. For the RLWE version, the length, the polynomial degree, and the modulus 33 // for each input vector. In this case the length must be a multiple of the 34 // degree. 35 class InputVectorSpecification { 36 public: 37 InputVectorSpecification(const std::string& name, int length, 38 uint64_t modulus); 39 40 virtual ~InputVectorSpecification() = default; 41 name()42 ABSL_MUST_USE_RESULT inline const std::string& name() const { return name_; } 43 length()44 ABSL_MUST_USE_RESULT inline int length() const { return length_; } 45 modulus()46 ABSL_MUST_USE_RESULT inline uint64_t modulus() const { return modulus_; } 47 48 private: 49 const std::string name_; 50 const int length_; 51 const uint64_t modulus_; 52 }; 53 54 } // namespace secagg 55 } // namespace fcp 56 57 #endif // FCP_SECAGG_SHARED_INPUT_VECTOR_SPECIFICATION_H_ 58