1. 21 4月, 2015 1 次提交
    • S
      crypto: drbg - replace spinlock with mutex · 76899a41
      Stephan Mueller 提交于
      The creation of a shadow copy is intended to only hold a short term
      lock. But the drawback is that parallel users have a very similar DRBG
      state which only differs by a high-resolution time stamp.
      
      The DRBG will now hold a long term lock. Therefore, the lock is changed
      to a mutex which implies that the DRBG can only be used in process
      context.
      
      The lock now guards the instantiation as well as the entire DRBG
      generation operation. Therefore, multiple callers are fully serialized
      when generating a random number.
      
      As the locking is changed to use a long-term lock to avoid such similar
      DRBG states, the entire creation and maintenance of a shadow copy can be
      removed.
      Signed-off-by: NStephan Mueller <smueller@chronox.de>
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      76899a41
  2. 05 9月, 2014 1 次提交
  3. 26 8月, 2014 1 次提交
  4. 25 8月, 2014 1 次提交
  5. 08 7月, 2014 1 次提交
    • S
      crypto: drbg - Mix a time stamp into DRBG state · 27e4de2b
      Stephan Mueller 提交于
      The current locking approach of the DRBG tries to keep the protected
      code paths very minimal. It is therefore possible that two threads query
      one DRBG instance at the same time. When thread A requests random
      numbers, a shadow copy of the DRBG state is created upon which the
      request for A is processed. After finishing the state for A's request is
      merged back into the DRBG state. If now thread B requests random numbers
      from the same DRBG after the request for thread A is received, but
      before A's shadow state is merged back, the random numbers for B will be
      identical to the ones for A. Please note that the time window is very
      small for this scenario.
      
      To prevent that there is even a theoretical chance for thread A and B
      having the same DRBG state, the current time stamp is provided as
      additional information string for each new request.
      
      The addition of the time stamp as additional information string implies
      that now all generate functions must be capable to process a linked
      list with additional information strings instead of a scalar.
      
      CC: Rafael Aquini <aquini@redhat.com>
      Signed-off-by: NStephan Mueller <smueller@chronox.de>
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      27e4de2b
  6. 04 7月, 2014 1 次提交
  7. 20 6月, 2014 1 次提交
    • S
      crypto: drbg - header file for DRBG · 3e16f959
      Stephan Mueller 提交于
      The header file includes the definition of:
      
      * DRBG data structures with
              - struct drbg_state as main structure
              - struct drbg_core referencing the backend ciphers
              - struct drbg_state_ops callbach handlers for specific code
                supporting the Hash, HMAC, CTR DRBG implementations
              - struct drbg_conc defining a linked list for input data
              - struct drbg_test_data holding the test "entropy" data for CAVS
                testing and testmgr.c
              - struct drbg_gen allowing test data, additional information
                string and personalization string data to be funneled through
                the kernel crypto API -- the DRBG requires additional
                parameters when invoking the reset and random number
                generation requests than intended by the kernel crypto API
      
      * wrapper function to the kernel crypto API functions using struct
        drbg_gen to pass through all data needed for DRBG
      
      * wrapper functions to kernel crypto API functions usable for testing
        code to inject test_data into the DRBG as needed by CAVS testing and
        testmgr.c.
      
      * DRBG flags required for the operation of the DRBG and for selecting
        the particular DRBG type and backend cipher
      
      * getter functions for data from struct drbg_core
      Signed-off-by: NStephan Mueller <smueller@chronox.de>
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      3e16f959