wolfssl_dummy.c 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /* wolfssl_dummy.c
  2. *
  3. * Copyright (C) 2006-2024 wolfSSL Inc.
  4. *
  5. * This file is part of wolfSSL.
  6. *
  7. * wolfSSL is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 2 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * wolfSSL is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
  20. */
  21. #include <wolfssl/wolfcrypt/wc_port.h>
  22. static int tick = 0;
  23. #define YEAR ( \
  24. ((__DATE__)[7] - '0') * 1000 + \
  25. ((__DATE__)[8] - '0') * 100 + \
  26. ((__DATE__)[9] - '0') * 10 + \
  27. ((__DATE__)[10] - '0') * 1 \
  28. )
  29. #define MONTH ( \
  30. __DATE__[2] == 'n' ? (__DATE__[1] == 'a' ? 1 : 6) \
  31. : __DATE__[2] == 'b' ? 2 \
  32. : __DATE__[2] == 'r' ? (__DATE__[0] == 'M' ? 3 : 4) \
  33. : __DATE__[2] == 'y' ? 5 \
  34. : __DATE__[2] == 'l' ? 7 \
  35. : __DATE__[2] == 'g' ? 8 \
  36. : __DATE__[2] == 'p' ? 9 \
  37. : __DATE__[2] == 't' ? 10 \
  38. : __DATE__[2] == 'v' ? 11 \
  39. : 12 \
  40. )
  41. time_t time(time_t *t)
  42. {
  43. (void)t;
  44. return ((YEAR-1970)*365+30*MONTH)*24*60*60 + tick++;
  45. }
  46. #include <ctype.h>
  47. int strncasecmp(const char *s1, const char * s2, unsigned int sz)
  48. {
  49. for( ; sz>0; sz--)
  50. if(toupper(s1++) != toupper(s2++))
  51. return 1;
  52. return 0;
  53. }
  54. #if !defined(WOLFSSL_RENESAS_TSIP)
  55. /* dummy return true when char is alphanumeric character */
  56. int isascii(const char *s)
  57. {
  58. return isalnum(s);
  59. }
  60. #endif