padlock.c 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. * Cryptographic API.
  3. *
  4. * Support for VIA PadLock hardware crypto engine.
  5. *
  6. * Copyright (c) 2006 Michal Ludvig <michal@logix.cz>
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation; either version 2 of the License, or
  11. * (at your option) any later version.
  12. *
  13. */
  14. #include <linux/module.h>
  15. #include <linux/init.h>
  16. #include <linux/errno.h>
  17. #include <linux/crypto.h>
  18. #include <linux/cryptohash.h>
  19. #include <linux/interrupt.h>
  20. #include <linux/kernel.h>
  21. #include <linux/scatterlist.h>
  22. #include "padlock.h"
  23. static int __init padlock_init(void)
  24. {
  25. int success = 0;
  26. if (crypto_has_cipher("aes-padlock", 0, 0))
  27. success++;
  28. if (crypto_has_hash("sha1-padlock", 0, 0))
  29. success++;
  30. if (crypto_has_hash("sha256-padlock", 0, 0))
  31. success++;
  32. if (!success) {
  33. printk(KERN_WARNING PFX "No VIA PadLock drivers have been loaded.\n");
  34. return -ENODEV;
  35. }
  36. printk(KERN_NOTICE PFX "%d drivers are available.\n", success);
  37. return 0;
  38. }
  39. static void __exit padlock_fini(void)
  40. {
  41. }
  42. module_init(padlock_init);
  43. module_exit(padlock_fini);
  44. MODULE_DESCRIPTION("Load all configured PadLock algorithms.");
  45. MODULE_LICENSE("GPL");
  46. MODULE_AUTHOR("Michal Ludvig");