lightduer_random.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /**
  2. * Copyright (2017) Baidu Inc. All rights reserved.
  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. // Author: Su Hao (suhao@baidu.com)
  17. //
  18. // Description: The random APIs.
  19. #ifndef BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_SOURCE_BAIDU_CA_RANDOM_H
  20. #define BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_SOURCE_BAIDU_CA_RANDOM_H
  21. #include "lightduer_types.h"
  22. #ifdef __cplusplus
  23. extern "C" {
  24. #endif
  25. /*
  26. * Obtain the random number
  27. *
  28. * @Return duer_s32_t, the random number.
  29. */
  30. DUER_INT duer_s32_t duer_random(void);
  31. /*
  32. * The random callbacks
  33. * Return the random number
  34. * 0, means random got fail
  35. */
  36. typedef duer_s32_t (*duer_random_f)();
  37. /*
  38. * Initial the random callback for Baidu CA
  39. *
  40. * @Param f_random, in, the function obtain the random
  41. */
  42. DUER_EXT void duer_random_init(duer_random_f f_random);
  43. #ifdef __cplusplus
  44. }
  45. #endif
  46. #endif // BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_SOURCE_BAIDU_CA_RANDOM_H