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 #include "fcp/secagg/shared/input_vector_specification.h"
18
19 #include <string>
20
21 #include "fcp/base/monitoring.h"
22 #include "fcp/secagg/shared/secagg_vector.h"
23
24 namespace fcp {
25 namespace secagg {
26
InputVectorSpecification(const std::string & name,int length,uint64_t modulus)27 InputVectorSpecification::InputVectorSpecification(const std::string& name,
28 int length, uint64_t modulus)
29 : name_(name), length_(length), modulus_(modulus) {
30 FCP_CHECK(length >= 0) << "Length must be >= 0, given value was" << length;
31 FCP_CHECK(modulus > 1 && modulus <= SecAggVector::kMaxModulus)
32 << "The specified modulus is not valid: must be > 1 and <= "
33 << SecAggVector::kMaxModulus << ", supplied value : " << modulus;
34 }
35
36 } // namespace secagg
37 } // namespace fcp
38