1. 04 Nov, 2022 3 commits
    • Anirudh Venkataramanan's avatar
      crypto: tcrypt - Drop module name from print string · a2ef5630
      Anirudh Venkataramanan authored
      The pr_fmt() define includes KBUILD_MODNAME, and so there's no need
      for pr_err() to also print it. Drop module name from the print string.
      Signed-off-by: default avatarAnirudh Venkataramanan <anirudh.venkataramanan@intel.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      a2ef5630
    • Anirudh Venkataramanan's avatar
      crypto: tcrypt - Use pr_info/pr_err · 837a99f5
      Anirudh Venkataramanan authored
      Currently, there's mixed use of printk() and pr_info()/pr_err(). The latter
      prints the module name (because pr_fmt() is defined so) but the former does
      not. As a result there's inconsistency in the printed output. For example:
      
      modprobe mode=211:
      
      [...] test 0 (160 bit key, 16 byte blocks): 1 operation in 2320 cycles (16 bytes)
      [...] test 1 (160 bit key, 64 byte blocks): 1 operation in 2336 cycles (64 bytes)
      
      modprobe mode=215:
      
      [...] tcrypt: test 0 (160 bit key, 16 byte blocks): 1 operation in 2173 cycles (16 bytes)
      [...] tcrypt: test 1 (160 bit key, 64 byte blocks): 1 operation in 2241 cycles (64 bytes)
      
      Replace all instances of printk() with pr_info()/pr_err() so that the
      module name is printed consistently.
      Signed-off-by: default avatarAnirudh Venkataramanan <anirudh.venkataramanan@intel.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      837a99f5
    • Anirudh Venkataramanan's avatar
      crypto: tcrypt - Use pr_cont to print test results · fdaeb224
      Anirudh Venkataramanan authored
      For some test cases, a line break gets inserted between the test banner
      and the results. For example, with mode=211 this is the output:
      
      [...]
            testing speed of rfc4106(gcm(aes)) (rfc4106-gcm-aesni) encryption
      [...] test 0 (160 bit key, 16 byte blocks):
      [...] 1 operation in 2373 cycles (16 bytes)
      
      --snip--
      
      [...]
            testing speed of gcm(aes) (generic-gcm-aesni) encryption
      [...] test 0 (128 bit key, 16 byte blocks):
      [...] 1 operation in 2338 cycles (16 bytes)
      
      Similar behavior is seen in the following cases as well:
      
        modprobe tcrypt mode=212
        modprobe tcrypt mode=213
        modprobe tcrypt mode=221
        modprobe tcrypt mode=300 sec=1
        modprobe tcrypt mode=400 sec=1
      
      This doesn't happen with mode=215:
      
      [...] tcrypt:
                    testing speed of multibuffer rfc4106(gcm(aes)) (rfc4106-gcm-aesni) encryption
      [...] tcrypt: test 0 (160 bit key, 16 byte blocks): 1 operation in 2215 cycles (16 bytes)
      
      --snip--
      
      [...] tcrypt:
                    testing speed of multibuffer gcm(aes) (generic-gcm-aesni) encryption
      [...] tcrypt: test 0 (128 bit key, 16 byte blocks): 1 operation in 2191 cycles (16 bytes)
      
      This print inconsistency is because printk() is used instead of pr_cont()
      in a few places. Change these to be pr_cont().
      
      checkpatch warns that pr_cont() shouldn't be used. This can be ignored in
      this context as tcrypt already uses pr_cont().
      Signed-off-by: default avatarAnirudh Venkataramanan <anirudh.venkataramanan@intel.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      fdaeb224
  2. 28 Oct, 2022 35 commits
  3. 21 Oct, 2022 2 commits
    • Tomas Marek's avatar
      hwrng: stm32 - fix read of the last word · e64f57e8
      Tomas Marek authored
      The stm32_rng_read() function samples TRNG by 4 bytes until at
      least 5 bytes are free in the input buffer. The last four bytes
      are never read. For example, 60 bytes are returned in case the
      input buffer size is 64 bytes.
      
      Read until at least 4 bytes are free in the input buffer. Fill
      the buffer entirely in case the buffer size is divisible by 4.
      
      Cc: Oleg Karfich <oleg.karfich@wago.com>
      Signed-off-by: default avatarTomas Marek <tomas.marek@elrest.cz>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      e64f57e8
    • Tomas Marek's avatar
      hwrng: stm32 - fix number of returned bytes on read · 7e11a4fc
      Tomas Marek authored
      The stm32_rng_read() function uses `retval` variable as a counter of
      generated random bytes. However, the same variable is used to store
      a result of the polling function in case the driver is waiting until
      the TRNG is ready. The TRNG generates random numbers by 16B. One
      loop read 4B. So, the function calls the polling every 16B, i.e.
      every 4th loop. The `retval` counter is reset on poll call and only
      number of bytes read after the last poll call is returned to the
      caller. The remaining sampled random bytes (for example 48 out of
      64 in case 64 bytes are read) are not used.
      
      Use different variable to store the polling function result and
      do not overwrite `retval` counter.
      
      Cc: Oleg Karfich <oleg.karfich@wago.com>
      Signed-off-by: default avatarTomas Marek <tomas.marek@elrest.cz>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      7e11a4fc