1 // Copyright 2020 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 #ifndef TINK_SUBTLE_PRF_PRF_SET_UTIL_H_ 17 #define TINK_SUBTLE_PRF_PRF_SET_UTIL_H_ 18 19 #include <memory> 20 21 #include "tink/prf/prf_set.h" 22 #include "tink/subtle/mac/stateful_mac.h" 23 #include "tink/subtle/prf/streaming_prf.h" 24 25 namespace crypto { 26 namespace tink { 27 namespace subtle { 28 29 // Creates a Prf from a StreamingPrf, taking ownership of the StreamingPrf. 30 std::unique_ptr<Prf> CreatePrfFromStreamingPrf( 31 std::unique_ptr<StreamingPrf> streaming_prf); 32 // Creates a Prf from a StatefulMacFactory, taking ownership of the factory. 33 // Note that this should only be used with StatefulMacs that actually are a Prf, 34 // like HMAC and CMAC and not with any MACs that are non-deterministic or that 35 // do not produce output indistinguishable from random numbers. 36 std::unique_ptr<Prf> CreatePrfFromStatefulMacFactory( 37 std::unique_ptr<StatefulMacFactory> mac_factory); 38 39 } // namespace subtle 40 } // namespace tink 41 } // namespace crypto 42 43 #endif // TINK_SUBTLE_PRF_PRF_SET_UTIL_H_ 44