AppDelegate.m 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /* AppDelegate.m
  2. *
  3. * Copyright (C) 2006-2023 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. #import "AppDelegate.h"
  22. #include <wolfssl/wolfcrypt/settings.h>
  23. #include <wolfcrypt/benchmark/benchmark.h>
  24. #include <wolfcrypt/test/test.h>
  25. @interface AppDelegate ()
  26. @end
  27. @implementation AppDelegate
  28. typedef struct func_args {
  29. int argc;
  30. char** argv;
  31. int return_code;
  32. } func_args;
  33. extern int bench_tls(void);
  34. static func_args args = { 0 } ;
  35. - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
  36. // Override point for customization after application launch.
  37. #if 1
  38. printf("\nwolfCrypt Test:\n");
  39. wolfcrypt_test(&args);
  40. printf("wolfCrypt Test: Return code %d\n", args.return_code);
  41. #else
  42. (void)args;
  43. #endif
  44. #if 1
  45. printf("\nwolfCrypt Benchmark:\n");
  46. benchmark_test(&args);
  47. printf("wolfCrypt Benchmark: Return code %d\n", args.return_code);
  48. #else
  49. (void)args;
  50. #endif
  51. #if 0
  52. bench_tls();
  53. #endif
  54. return YES;
  55. }
  56. - (void)applicationWillResignActive:(UIApplication *)application {
  57. // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
  58. // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
  59. }
  60. - (void)applicationDidEnterBackground:(UIApplication *)application {
  61. // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
  62. // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
  63. }
  64. - (void)applicationWillEnterForeground:(UIApplication *)application {
  65. // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
  66. }
  67. - (void)applicationDidBecomeActive:(UIApplication *)application {
  68. // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
  69. }
  70. - (void)applicationWillTerminate:(UIApplication *)application {
  71. // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
  72. }
  73. @end