You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

cpu.go 7.7 kB

Add single sign-on support via SSPI on Windows (#8463) * Add single sign-on support via SSPI on Windows * Ensure plugins implement interface * Ensure plugins implement interface * Move functions used only by the SSPI auth method to sspi_windows.go * Field SSPISeparatorReplacement of AuthenticationForm should not be required via binding, as binding will insist the field is non-empty even if another login type is selected * Fix breaking of oauth authentication on download links. Do not create new session with SSPI authentication on download links. * Update documentation for the new 'SPNEGO with SSPI' login source * Mention in documentation that ROOT_URL should contain the FQDN of the server * Make sure that Contexter is not checking for active login sources when the ORM engine is not initialized (eg. when installing) * Always initialize and free SSO methods, even if they are not enabled, as a method can be activated while the app is running (from Authentication sources) * Add option in SSPIConfig for removing of domains from logon names * Update helper text for StripDomainNames option * Make sure handleSignIn() is called after a new user object is created by SSPI auth method * Remove default value from text of form field helper Co-Authored-By: Lauris BH <lauris@nix.lv> * Remove default value from text of form field helper Co-Authored-By: Lauris BH <lauris@nix.lv> * Remove default value from text of form field helper Co-Authored-By: Lauris BH <lauris@nix.lv> * Only make a query to the DB to check if SSPI is enabled on handlers that need that information for templates * Remove code duplication * Log errors in ActiveLoginSources Co-Authored-By: Lauris BH <lauris@nix.lv> * Revert suffix of randomly generated E-mails for Reverse proxy authentication Co-Authored-By: Lauris BH <lauris@nix.lv> * Revert unneeded white-space change in template Co-Authored-By: Lauris BH <lauris@nix.lv> * Add copyright comments at the top of new files * Use loopback name for randomly generated emails * Add locale tag for the SSPISeparatorReplacement field with proper casing * Revert casing of SSPISeparatorReplacement field in locale file, moving it up, next to other form fields * Update docs/content/doc/features/authentication.en-us.md Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com> * Remove Priority() method and define the order in which SSO auth methods should be executed in one place * Log authenticated username only if it's not empty * Rephrase helper text for automatic creation of users * Return error if more than one active SSPI auth source is found * Change newUser() function to return error, letting caller log/handle the error * Move isPublicResource, isPublicPage and handleSignIn functions outside SSPI auth method to allow other SSO methods to reuse them if needed * Refactor initialization of the list containing SSO auth methods * Validate SSPI settings on POST * Change SSPI to only perform authentication on its own login page, API paths and download links. Leave Toggle middleware to redirect non authenticated users to login page * Make 'Default language' in SSPI config empty, unless changed by admin * Show error if admin tries to add a second authentication source of type SSPI * Simplify declaration of global variable * Rebuild gitgraph.js on Linux * Make sure config values containing only whitespace are not accepted
5 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. // Copyright 2018 The Go Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. // Package cpu implements processor feature detection for
  5. // various CPU architectures.
  6. package cpu
  7. // Initialized reports whether the CPU features were initialized.
  8. //
  9. // For some GOOS/GOARCH combinations initialization of the CPU features depends
  10. // on reading an operating specific file, e.g. /proc/self/auxv on linux/arm
  11. // Initialized will report false if reading the file fails.
  12. var Initialized bool
  13. // CacheLinePad is used to pad structs to avoid false sharing.
  14. type CacheLinePad struct{ _ [cacheLineSize]byte }
  15. // X86 contains the supported CPU features of the
  16. // current X86/AMD64 platform. If the current platform
  17. // is not X86/AMD64 then all feature flags are false.
  18. //
  19. // X86 is padded to avoid false sharing. Further the HasAVX
  20. // and HasAVX2 are only set if the OS supports XMM and YMM
  21. // registers in addition to the CPUID feature bit being set.
  22. var X86 struct {
  23. _ CacheLinePad
  24. HasAES bool // AES hardware implementation (AES NI)
  25. HasADX bool // Multi-precision add-carry instruction extensions
  26. HasAVX bool // Advanced vector extension
  27. HasAVX2 bool // Advanced vector extension 2
  28. HasBMI1 bool // Bit manipulation instruction set 1
  29. HasBMI2 bool // Bit manipulation instruction set 2
  30. HasERMS bool // Enhanced REP for MOVSB and STOSB
  31. HasFMA bool // Fused-multiply-add instructions
  32. HasOSXSAVE bool // OS supports XSAVE/XRESTOR for saving/restoring XMM registers.
  33. HasPCLMULQDQ bool // PCLMULQDQ instruction - most often used for AES-GCM
  34. HasPOPCNT bool // Hamming weight instruction POPCNT.
  35. HasRDRAND bool // RDRAND instruction (on-chip random number generator)
  36. HasRDSEED bool // RDSEED instruction (on-chip random number generator)
  37. HasSSE2 bool // Streaming SIMD extension 2 (always available on amd64)
  38. HasSSE3 bool // Streaming SIMD extension 3
  39. HasSSSE3 bool // Supplemental streaming SIMD extension 3
  40. HasSSE41 bool // Streaming SIMD extension 4 and 4.1
  41. HasSSE42 bool // Streaming SIMD extension 4 and 4.2
  42. _ CacheLinePad
  43. }
  44. // ARM64 contains the supported CPU features of the
  45. // current ARMv8(aarch64) platform. If the current platform
  46. // is not arm64 then all feature flags are false.
  47. var ARM64 struct {
  48. _ CacheLinePad
  49. HasFP bool // Floating-point instruction set (always available)
  50. HasASIMD bool // Advanced SIMD (always available)
  51. HasEVTSTRM bool // Event stream support
  52. HasAES bool // AES hardware implementation
  53. HasPMULL bool // Polynomial multiplication instruction set
  54. HasSHA1 bool // SHA1 hardware implementation
  55. HasSHA2 bool // SHA2 hardware implementation
  56. HasCRC32 bool // CRC32 hardware implementation
  57. HasATOMICS bool // Atomic memory operation instruction set
  58. HasFPHP bool // Half precision floating-point instruction set
  59. HasASIMDHP bool // Advanced SIMD half precision instruction set
  60. HasCPUID bool // CPUID identification scheme registers
  61. HasASIMDRDM bool // Rounding double multiply add/subtract instruction set
  62. HasJSCVT bool // Javascript conversion from floating-point to integer
  63. HasFCMA bool // Floating-point multiplication and addition of complex numbers
  64. HasLRCPC bool // Release Consistent processor consistent support
  65. HasDCPOP bool // Persistent memory support
  66. HasSHA3 bool // SHA3 hardware implementation
  67. HasSM3 bool // SM3 hardware implementation
  68. HasSM4 bool // SM4 hardware implementation
  69. HasASIMDDP bool // Advanced SIMD double precision instruction set
  70. HasSHA512 bool // SHA512 hardware implementation
  71. HasSVE bool // Scalable Vector Extensions
  72. HasASIMDFHM bool // Advanced SIMD multiplication FP16 to FP32
  73. _ CacheLinePad
  74. }
  75. // ARM contains the supported CPU features of the current ARM (32-bit) platform.
  76. // All feature flags are false if:
  77. // 1. the current platform is not arm, or
  78. // 2. the current operating system is not Linux.
  79. var ARM struct {
  80. _ CacheLinePad
  81. HasSWP bool // SWP instruction support
  82. HasHALF bool // Half-word load and store support
  83. HasTHUMB bool // ARM Thumb instruction set
  84. Has26BIT bool // Address space limited to 26-bits
  85. HasFASTMUL bool // 32-bit operand, 64-bit result multiplication support
  86. HasFPA bool // Floating point arithmetic support
  87. HasVFP bool // Vector floating point support
  88. HasEDSP bool // DSP Extensions support
  89. HasJAVA bool // Java instruction set
  90. HasIWMMXT bool // Intel Wireless MMX technology support
  91. HasCRUNCH bool // MaverickCrunch context switching and handling
  92. HasTHUMBEE bool // Thumb EE instruction set
  93. HasNEON bool // NEON instruction set
  94. HasVFPv3 bool // Vector floating point version 3 support
  95. HasVFPv3D16 bool // Vector floating point version 3 D8-D15
  96. HasTLS bool // Thread local storage support
  97. HasVFPv4 bool // Vector floating point version 4 support
  98. HasIDIVA bool // Integer divide instruction support in ARM mode
  99. HasIDIVT bool // Integer divide instruction support in Thumb mode
  100. HasVFPD32 bool // Vector floating point version 3 D15-D31
  101. HasLPAE bool // Large Physical Address Extensions
  102. HasEVTSTRM bool // Event stream support
  103. HasAES bool // AES hardware implementation
  104. HasPMULL bool // Polynomial multiplication instruction set
  105. HasSHA1 bool // SHA1 hardware implementation
  106. HasSHA2 bool // SHA2 hardware implementation
  107. HasCRC32 bool // CRC32 hardware implementation
  108. _ CacheLinePad
  109. }
  110. // PPC64 contains the supported CPU features of the current ppc64/ppc64le platforms.
  111. // If the current platform is not ppc64/ppc64le then all feature flags are false.
  112. //
  113. // For ppc64/ppc64le, it is safe to check only for ISA level starting on ISA v3.00,
  114. // since there are no optional categories. There are some exceptions that also
  115. // require kernel support to work (DARN, SCV), so there are feature bits for
  116. // those as well. The minimum processor requirement is POWER8 (ISA 2.07).
  117. // The struct is padded to avoid false sharing.
  118. var PPC64 struct {
  119. _ CacheLinePad
  120. HasDARN bool // Hardware random number generator (requires kernel enablement)
  121. HasSCV bool // Syscall vectored (requires kernel enablement)
  122. IsPOWER8 bool // ISA v2.07 (POWER8)
  123. IsPOWER9 bool // ISA v3.00 (POWER9)
  124. _ CacheLinePad
  125. }
  126. // S390X contains the supported CPU features of the current IBM Z
  127. // (s390x) platform. If the current platform is not IBM Z then all
  128. // feature flags are false.
  129. //
  130. // S390X is padded to avoid false sharing. Further HasVX is only set
  131. // if the OS supports vector registers in addition to the STFLE
  132. // feature bit being set.
  133. var S390X struct {
  134. _ CacheLinePad
  135. HasZARCH bool // z/Architecture mode is active [mandatory]
  136. HasSTFLE bool // store facility list extended
  137. HasLDISP bool // long (20-bit) displacements
  138. HasEIMM bool // 32-bit immediates
  139. HasDFP bool // decimal floating point
  140. HasETF3EH bool // ETF-3 enhanced
  141. HasMSA bool // message security assist (CPACF)
  142. HasAES bool // KM-AES{128,192,256} functions
  143. HasAESCBC bool // KMC-AES{128,192,256} functions
  144. HasAESCTR bool // KMCTR-AES{128,192,256} functions
  145. HasAESGCM bool // KMA-GCM-AES{128,192,256} functions
  146. HasGHASH bool // KIMD-GHASH function
  147. HasSHA1 bool // K{I,L}MD-SHA-1 functions
  148. HasSHA256 bool // K{I,L}MD-SHA-256 functions
  149. HasSHA512 bool // K{I,L}MD-SHA-512 functions
  150. HasSHA3 bool // K{I,L}MD-SHA3-{224,256,384,512} and K{I,L}MD-SHAKE-{128,256} functions
  151. HasVX bool // vector facility
  152. HasVXE bool // vector-enhancements facility 1
  153. _ CacheLinePad
  154. }