1 /*############################################################################ 2 # Copyright 2016-2017 Intel Corporation 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 #ifndef EPID_COMMON_BITSUPPLIER_H_ 17 #define EPID_COMMON_BITSUPPLIER_H_ 18 /*! 19 * \file 20 * \brief Random data supplier interface. 21 */ 22 23 #if defined(_WIN32) || defined(_WIN64) 24 #define __STDCALL __stdcall 25 #else 26 #define __STDCALL 27 #endif 28 29 /// Generates random data. 30 /*! 31 The SDK provides the ::BitSupplier as a function 32 prototype so that you will know the requirements for your 33 own implementation of a random number generator. 34 35 You need to pass a pointer to your 36 implementation of the random number generator into 37 methods that require it. 38 39 For an example of how a BitSupplier is created, see 40 the `signmsg` example. 41 42 \param[out] rand_data destination buffer for random data 43 generated by BitSupplier. The buffer will receive 44 `num_bits` of random data. 45 \param[in] num_bits specifies the size of the random 46 data, in bits, to be generated. 47 \param[in] user_data user data that will be passed to the 48 random number generator. The usage of this data is specific 49 to the implementation of the BitSupplier. For example, this 50 could be used to pass a pointer to a data structure 51 that maintains state across calls to your BitSupplier. 52 53 \returns zero on success and non-zero value on error. 54 55 \ingroup EpidCommon 56 */ 57 typedef int(__STDCALL* BitSupplier)(unsigned int* rand_data, int num_bits, 58 void* user_data); 59 60 #endif // EPID_COMMON_BITSUPPLIER_H_ 61