README 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. README - ocf-linux-20100325
  2. ---------------------------
  3. This README provides instructions for getting ocf-linux compiled and
  4. operating in a generic linux environment. For other information you
  5. might like to visit the home page for this project:
  6. http://ocf-linux.sourceforge.net/
  7. Adding OCF to linux
  8. -------------------
  9. Not much in this file for now, just some notes. I usually build
  10. the ocf support as modules but it can be built into the kernel as
  11. well. To use it:
  12. * mknod /dev/crypto c 10 70
  13. * to add OCF to your kernel source, you have two options. Apply
  14. the kernel specific patch:
  15. cd linux-2.4*; gunzip < ocf-linux-24-XXXXXXXX.patch.gz | patch -p1
  16. cd linux-2.6*; gunzip < ocf-linux-26-XXXXXXXX.patch.gz | patch -p1
  17. if you do one of the above, then you can proceed to the next step,
  18. or you can do the above process by hand with using the patches against
  19. linux-2.4.35 and 2.6.33 to include the ocf code under crypto/ocf.
  20. Here's how to add it:
  21. for 2.4.35 (and later)
  22. cd linux-2.4.35/crypto
  23. tar xvzf ocf-linux.tar.gz
  24. cd ..
  25. patch -p1 < crypto/ocf/patches/linux-2.4.35-ocf.patch
  26. for 2.6.23 (and later), find the kernel patch specific (or nearest)
  27. to your kernel versions and then:
  28. cd linux-2.6.NN/crypto
  29. tar xvzf ocf-linux.tar.gz
  30. cd ..
  31. patch -p1 < crypto/ocf/patches/linux-2.6.NN-ocf.patch
  32. It should be easy to take this patch and apply it to other more
  33. recent versions of the kernels. The same patches should also work
  34. relatively easily on kernels as old as 2.6.11 and 2.4.18.
  35. * under 2.4 if you are on a non-x86 platform, you may need to:
  36. cp linux-2.X.x/include/asm-i386/kmap_types.h linux-2.X.x/include/asm-YYY
  37. so that you can build the kernel crypto support needed for the cryptosoft
  38. driver.
  39. * For simplicity you should enable all the crypto support in your kernel
  40. except for the test driver. Likewise for the OCF options. Do not
  41. enable OCF crypto drivers for HW that you do not have (for example
  42. ixp4xx will not compile on non-Xscale systems).
  43. * make sure that cryptodev.h (from ocf-linux.tar.gz) is installed as
  44. crypto/cryptodev.h in an include directory that is used for building
  45. applications for your platform. For example on a host system that
  46. might be:
  47. /usr/include/crypto/cryptodev.h
  48. * patch your openssl-0.9.8n code with the openssl-0.9.8n.patch.
  49. (NOTE: there is no longer a need to patch ssh). The patch is against:
  50. openssl-0_9_8e
  51. If you need a patch for an older version of openssl, you should look
  52. to older OCF releases. This patch is unlikely to work on older
  53. openssl versions.
  54. openssl-0.9.8n.patch
  55. - enables --with-cryptodev for non BSD systems
  56. - adds -cpu option to openssl speed for calculating CPU load
  57. under linux
  58. - fixes null pointer in openssl speed multi thread output.
  59. - fixes test keys to work with linux crypto's more stringent
  60. key checking.
  61. - adds MD5/SHA acceleration (Ronen Shitrit), only enabled
  62. with the --with-cryptodev-digests option
  63. - fixes bug in engine code caching.
  64. * build crypto-tools-XXXXXXXX.tar.gz if you want to try some of the BSD
  65. tools for testing OCF (ie., cryptotest).
  66. How to load the OCF drivers
  67. ---------------------------
  68. First insert the base modules:
  69. insmod ocf
  70. insmod cryptodev
  71. You can then install the software OCF driver with:
  72. insmod cryptosoft
  73. and one or more of the OCF HW drivers with:
  74. insmod safe
  75. insmod hifn7751
  76. insmod ixp4xx
  77. ...
  78. all the drivers take a debug option to enable verbose debug so that
  79. you can see what is going on. For debug you load them as:
  80. insmod ocf crypto_debug=1
  81. insmod cryptodev cryptodev_debug=1
  82. insmod cryptosoft swcr_debug=1
  83. You may load more than one OCF crypto driver but then there is no guarantee
  84. as to which will be used.
  85. You can also enable debug at run time on 2.6 systems with the following:
  86. echo 1 > /sys/module/ocf/parameters/crypto_debug
  87. echo 1 > /sys/module/cryptodev/parameters/cryptodev_debug
  88. echo 1 > /sys/module/cryptosoft/parameters/swcr_debug
  89. echo 1 > /sys/module/hifn7751/parameters/hifn_debug
  90. echo 1 > /sys/module/safe/parameters/safe_debug
  91. echo 1 > /sys/module/ixp4xx/parameters/ixp_debug
  92. ...
  93. Testing the OCF support
  94. -----------------------
  95. run "cryptotest", it should do a short test for a couple of
  96. des packets. If it does everything is working.
  97. If this works, then ssh will use the driver when invoked as:
  98. ssh -c 3des username@host
  99. to see for sure that it is operating, enable debug as defined above.
  100. To get a better idea of performance run:
  101. cryptotest 100 4096
  102. There are more options to cryptotest, see the help.
  103. It is also possible to use openssl to test the speed of the crypto
  104. drivers.
  105. openssl speed -evp des -engine cryptodev -elapsed
  106. openssl speed -evp des3 -engine cryptodev -elapsed
  107. openssl speed -evp aes128 -engine cryptodev -elapsed
  108. and multiple threads (10) with:
  109. openssl speed -evp des -engine cryptodev -elapsed -multi 10
  110. openssl speed -evp des3 -engine cryptodev -elapsed -multi 10
  111. openssl speed -evp aes128 -engine cryptodev -elapsed -multi 10
  112. for public key testing you can try:
  113. cryptokeytest
  114. openssl speed -engine cryptodev rsa -elapsed
  115. openssl speed -engine cryptodev dsa -elapsed
  116. David McCullough
  117. [email protected]