OPENSSL_ia32cap.3ossl 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. .\" -*- mode: troff; coding: utf-8 -*-
  2. .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43)
  3. .\"
  4. .\" Standard preamble:
  5. .\" ========================================================================
  6. .de Sp \" Vertical space (when we can't use .PP)
  7. .if t .sp .5v
  8. .if n .sp
  9. ..
  10. .de Vb \" Begin verbatim text
  11. .ft CW
  12. .nf
  13. .ne \\$1
  14. ..
  15. .de Ve \" End verbatim text
  16. .ft R
  17. .fi
  18. ..
  19. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>.
  20. .ie n \{\
  21. . ds C` ""
  22. . ds C' ""
  23. 'br\}
  24. .el\{\
  25. . ds C`
  26. . ds C'
  27. 'br\}
  28. .\"
  29. .\" Escape single quotes in literal strings from groff's Unicode transform.
  30. .ie \n(.g .ds Aq \(aq
  31. .el .ds Aq '
  32. .\"
  33. .\" If the F register is >0, we'll generate index entries on stderr for
  34. .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
  35. .\" entries marked with X<> in POD. Of course, you'll have to process the
  36. .\" output yourself in some meaningful fashion.
  37. .\"
  38. .\" Avoid warning from groff about undefined register 'F'.
  39. .de IX
  40. ..
  41. .nr rF 0
  42. .if \n(.g .if rF .nr rF 1
  43. .if (\n(rF:(\n(.g==0)) \{\
  44. . if \nF \{\
  45. . de IX
  46. . tm Index:\\$1\t\\n%\t"\\$2"
  47. ..
  48. . if !\nF==2 \{\
  49. . nr % 0
  50. . nr F 2
  51. . \}
  52. . \}
  53. .\}
  54. .rr rF
  55. .\" ========================================================================
  56. .\"
  57. .IX Title "OPENSSL_IA32CAP 3ossl"
  58. .TH OPENSSL_IA32CAP 3ossl 2025-01-17 3.4.0 OpenSSL
  59. .\" For nroff, turn off justification. Always turn off hyphenation; it makes
  60. .\" way too many mistakes in technical documents.
  61. .if n .ad l
  62. .nh
  63. .SH NAME
  64. OPENSSL_ia32cap \- the x86[_64] processor capabilities vector
  65. .SH SYNOPSIS
  66. .IX Header "SYNOPSIS"
  67. .Vb 1
  68. \& env OPENSSL_ia32cap=... <application>
  69. .Ve
  70. .SH DESCRIPTION
  71. .IX Header "DESCRIPTION"
  72. OpenSSL supports a range of x86[_64] instruction set extensions. These
  73. extensions are denoted by individual bits in capability vector returned
  74. by processor in EDX:ECX register pair after executing CPUID instruction
  75. with EAX=1 input value (see Intel Application Note #241618). This vector
  76. is copied to memory upon toolkit initialization and used to choose
  77. between different code paths to provide optimal performance across wide
  78. range of processors. For the moment of this writing following bits are
  79. significant:
  80. .IP "bit #4 denoting presence of Time-Stamp Counter." 4
  81. .IX Item "bit #4 denoting presence of Time-Stamp Counter."
  82. .PD 0
  83. .IP "bit #19 denoting availability of CLFLUSH instruction;" 4
  84. .IX Item "bit #19 denoting availability of CLFLUSH instruction;"
  85. .IP "bit #20, reserved by Intel, is used to choose among RC4 code paths;" 4
  86. .IX Item "bit #20, reserved by Intel, is used to choose among RC4 code paths;"
  87. .IP "bit #23 denoting MMX support;" 4
  88. .IX Item "bit #23 denoting MMX support;"
  89. .IP "bit #24, FXSR bit, denoting availability of XMM registers;" 4
  90. .IX Item "bit #24, FXSR bit, denoting availability of XMM registers;"
  91. .IP "bit #25 denoting SSE support;" 4
  92. .IX Item "bit #25 denoting SSE support;"
  93. .IP "bit #26 denoting SSE2 support;" 4
  94. .IX Item "bit #26 denoting SSE2 support;"
  95. .IP "bit #28 denoting Hyperthreading, which is used to distinguish cores with shared cache;" 4
  96. .IX Item "bit #28 denoting Hyperthreading, which is used to distinguish cores with shared cache;"
  97. .IP "bit #30, reserved by Intel, denotes specifically Intel CPUs;" 4
  98. .IX Item "bit #30, reserved by Intel, denotes specifically Intel CPUs;"
  99. .IP "bit #33 denoting availability of PCLMULQDQ instruction;" 4
  100. .IX Item "bit #33 denoting availability of PCLMULQDQ instruction;"
  101. .IP "bit #41 denoting SSSE3, Supplemental SSE3, support;" 4
  102. .IX Item "bit #41 denoting SSSE3, Supplemental SSE3, support;"
  103. .IP "bit #43 denoting AMD XOP support (forced to zero on non-AMD CPUs);" 4
  104. .IX Item "bit #43 denoting AMD XOP support (forced to zero on non-AMD CPUs);"
  105. .IP "bit #54 denoting availability of MOVBE instruction;" 4
  106. .IX Item "bit #54 denoting availability of MOVBE instruction;"
  107. .IP "bit #57 denoting AES-NI instruction set extension;" 4
  108. .IX Item "bit #57 denoting AES-NI instruction set extension;"
  109. .IP "bit #58, XSAVE bit, lack of which in combination with MOVBE is used to identify Atom Silvermont core;" 4
  110. .IX Item "bit #58, XSAVE bit, lack of which in combination with MOVBE is used to identify Atom Silvermont core;"
  111. .IP "bit #59, OSXSAVE bit, denoting availability of YMM registers;" 4
  112. .IX Item "bit #59, OSXSAVE bit, denoting availability of YMM registers;"
  113. .IP "bit #60 denoting AVX extension;" 4
  114. .IX Item "bit #60 denoting AVX extension;"
  115. .IP "bit #62 denoting availability of RDRAND instruction;" 4
  116. .IX Item "bit #62 denoting availability of RDRAND instruction;"
  117. .PD
  118. .PP
  119. For example, in 32\-bit application context clearing bit #26 at run-time
  120. disables high-performance SSE2 code present in the crypto library, while
  121. clearing bit #24 disables SSE2 code operating on 128\-bit XMM register
  122. bank. You might have to do the latter if target OpenSSL application is
  123. executed on SSE2 capable CPU, but under control of OS that does not
  124. enable XMM registers. Historically address of the capability vector copy
  125. was exposed to application through \fBOPENSSL_ia32cap_loc()\fR, but not
  126. anymore. Now the only way to affect the capability detection is to set
  127. \&\fBOPENSSL_ia32cap\fR environment variable prior target application start. To
  128. give a specific example, on Intel P4 processor
  129. \&\f(CW\*(C`env OPENSSL_ia32cap=0x16980010 apps/openssl\*(C'\fR, or better yet
  130. \&\f(CW\*(C`env OPENSSL_ia32cap=~0x1000000 apps/openssl\*(C'\fR would achieve the desired
  131. effect. Alternatively you can reconfigure the toolkit with no\-sse2
  132. option and recompile.
  133. .PP
  134. Less intuitive is clearing bit #28, or ~0x10000000 in the "environment
  135. variable" terms. The truth is that it's not copied from CPUID output
  136. verbatim, but is adjusted to reflect whether or not the data cache is
  137. actually shared between logical cores. This in turn affects the decision
  138. on whether or not expensive countermeasures against cache-timing attacks
  139. are applied, most notably in AES assembler module.
  140. .PP
  141. The capability vector is further extended with EBX value returned by
  142. CPUID with EAX=7 and ECX=0 as input. Following bits are significant:
  143. .IP "bit #64+3 denoting availability of BMI1 instructions, e.g. ANDN;" 4
  144. .IX Item "bit #64+3 denoting availability of BMI1 instructions, e.g. ANDN;"
  145. .PD 0
  146. .IP "bit #64+5 denoting availability of AVX2 instructions;" 4
  147. .IX Item "bit #64+5 denoting availability of AVX2 instructions;"
  148. .IP "bit #64+8 denoting availability of BMI2 instructions, e.g. MULX and RORX;" 4
  149. .IX Item "bit #64+8 denoting availability of BMI2 instructions, e.g. MULX and RORX;"
  150. .IP "bit #64+16 denoting availability of AVX512F extension;" 4
  151. .IX Item "bit #64+16 denoting availability of AVX512F extension;"
  152. .IP "bit #64+17 denoting availability of AVX512DQ extension;" 4
  153. .IX Item "bit #64+17 denoting availability of AVX512DQ extension;"
  154. .IP "bit #64+18 denoting availability of RDSEED instruction;" 4
  155. .IX Item "bit #64+18 denoting availability of RDSEED instruction;"
  156. .IP "bit #64+19 denoting availability of ADCX and ADOX instructions;" 4
  157. .IX Item "bit #64+19 denoting availability of ADCX and ADOX instructions;"
  158. .IP "bit #64+21 denoting availability of VPMADD52[LH]UQ instructions, aka AVX512IFMA extension;" 4
  159. .IX Item "bit #64+21 denoting availability of VPMADD52[LH]UQ instructions, aka AVX512IFMA extension;"
  160. .IP "bit #64+29 denoting availability of SHA extension;" 4
  161. .IX Item "bit #64+29 denoting availability of SHA extension;"
  162. .IP "bit #64+30 denoting availability of AVX512BW extension;" 4
  163. .IX Item "bit #64+30 denoting availability of AVX512BW extension;"
  164. .IP "bit #64+31 denoting availability of AVX512VL extension;" 4
  165. .IX Item "bit #64+31 denoting availability of AVX512VL extension;"
  166. .IP "bit #64+41 denoting availability of VAES extension;" 4
  167. .IX Item "bit #64+41 denoting availability of VAES extension;"
  168. .IP "bit #64+42 denoting availability of VPCLMULQDQ extension;" 4
  169. .IX Item "bit #64+42 denoting availability of VPCLMULQDQ extension;"
  170. .PD
  171. .PP
  172. To control this extended capability word use \f(CW\*(C`:\*(C'\fR as delimiter when
  173. setting up \fBOPENSSL_ia32cap\fR environment variable. For example assigning
  174. \&\f(CW\*(C`:~0x20\*(C'\fR would disable AVX2 code paths, and \f(CW\*(C`:0\*(C'\fR \- all post-AVX
  175. extensions.
  176. .SH "RETURN VALUES"
  177. .IX Header "RETURN VALUES"
  178. Not available.
  179. .SH COPYRIGHT
  180. .IX Header "COPYRIGHT"
  181. Copyright 2004\-2021 The OpenSSL Project Authors. All Rights Reserved.
  182. .PP
  183. Licensed under the Apache License 2.0 (the "License"). You may not use
  184. this file except in compliance with the License. You can obtain a copy
  185. in the file LICENSE in the source distribution or at
  186. <https://www.openssl.org/source/license.html>.