bitsupplier.h 2.1 KB

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