09 Aug, 2016

1 commit


08 Aug, 2016

1 commit

  • On 32-bit (e.g. with m68k-linux-gnu-gcc-4.1):

    crypto/sha3_generic.c:27: warning: integer constant is too large for ‘long’ type
    crypto/sha3_generic.c:28: warning: integer constant is too large for ‘long’ type
    crypto/sha3_generic.c:29: warning: integer constant is too large for ‘long’ type
    crypto/sha3_generic.c:29: warning: integer constant is too large for ‘long’ type
    crypto/sha3_generic.c:31: warning: integer constant is too large for ‘long’ type
    crypto/sha3_generic.c:31: warning: integer constant is too large for ‘long’ type
    crypto/sha3_generic.c:32: warning: integer constant is too large for ‘long’ type
    crypto/sha3_generic.c:32: warning: integer constant is too large for ‘long’ type
    crypto/sha3_generic.c:32: warning: integer constant is too large for ‘long’ type
    crypto/sha3_generic.c:33: warning: integer constant is too large for ‘long’ type
    crypto/sha3_generic.c:33: warning: integer constant is too large for ‘long’ type
    crypto/sha3_generic.c:34: warning: integer constant is too large for ‘long’ type
    crypto/sha3_generic.c:34: warning: integer constant is too large for ‘long’ type

    Fixes: 53964b9ee63b7075 ("crypto: sha3 - Add SHA-3 hash algorithm")
    Signed-off-by: Geert Uytterhoeven
    Signed-off-by: Herbert Xu

    Geert Uytterhoeven
     

28 Jul, 2016

1 commit

  • Pull random driver updates from Ted Ts'o:
    "A number of improvements for the /dev/random driver; the most
    important is the use of a ChaCha20-based CRNG for /dev/urandom, which
    is faster, more efficient, and easier to make scalable for
    silly/abusive userspace programs that want to read from /dev/urandom
    in a tight loop on NUMA systems.

    This set of patches also improves entropy gathering on VM's running on
    Microsoft Azure, and will take advantage of a hw random number
    generator (if present) to initialize the /dev/urandom pool"

    (It turns out that the random tree hadn't been in linux-next this time
    around, because it had been dropped earlier as being too quiet. Oh
    well).

    * tag 'random_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/random:
    random: strengthen input validation for RNDADDTOENTCNT
    random: add backtracking protection to the CRNG
    random: make /dev/urandom scalable for silly userspace programs
    random: replace non-blocking pool with a Chacha20-based CRNG
    random: properly align get_random_int_hash
    random: add interrupt callback to VMBus IRQ handler
    random: print a warning for the first ten uninitialized random users
    random: initialize the non-blocking pool via add_hwgenerator_randomness()

    Linus Torvalds
     

27 Jul, 2016

1 commit

  • Pull crypto updates from Herbert Xu:
    "Here is the crypto update for 4.8:

    API:
    - first part of skcipher low-level conversions
    - add KPP (Key-agreement Protocol Primitives) interface.

    Algorithms:
    - fix IPsec/cryptd reordering issues that affects aesni
    - RSA no longer does explicit leading zero removal
    - add SHA3
    - add DH
    - add ECDH
    - improve DRBG performance by not doing CTR by hand

    Drivers:
    - add x86 AVX2 multibuffer SHA256/512
    - add POWER8 optimised crc32c
    - add xts support to vmx
    - add DH support to qat
    - add RSA support to caam
    - add Layerscape support to caam
    - add SEC1 AEAD support to talitos
    - improve performance by chaining requests in marvell/cesa
    - add support for Araneus Alea I USB RNG
    - add support for Broadcom BCM5301 RNG
    - add support for Amlogic Meson RNG
    - add support Broadcom NSP SoC RNG"

    * 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6: (180 commits)
    crypto: vmx - Fix aes_p8_xts_decrypt build failure
    crypto: vmx - Ignore generated files
    crypto: vmx - Adding support for XTS
    crypto: vmx - Adding asm subroutines for XTS
    crypto: skcipher - add comment for skcipher_alg->base
    crypto: testmgr - Print akcipher algorithm name
    crypto: marvell - Fix wrong flag used for GFP in mv_cesa_dma_add_iv_op
    crypto: nx - off by one bug in nx_of_update_msc()
    crypto: rsa-pkcs1pad - fix rsa-pkcs1pad request struct
    crypto: scatterwalk - Inline start/map/done
    crypto: scatterwalk - Remove unnecessary BUG in scatterwalk_start
    crypto: scatterwalk - Remove unnecessary advance in scatterwalk_pagedone
    crypto: scatterwalk - Fix test in scatterwalk_done
    crypto: api - Optimise away crypto_yield when hard preemption is on
    crypto: scatterwalk - add no-copy support to copychunks
    crypto: scatterwalk - Remove scatterwalk_bytes_sglen
    crypto: omap - Stop using crypto scatterwalk_bytes_sglen
    crypto: skcipher - Remove top-level givcipher interface
    crypto: user - Remove crypto_lookup_skcipher call
    crypto: cts - Convert to skcipher
    ...

    Linus Torvalds
     

23 Jul, 2016

1 commit


22 Jul, 2016

1 commit


21 Jul, 2016

1 commit


19 Jul, 2016

2 commits


18 Jul, 2016

26 commits

  • This patch inlines the functions scatterwalk_start, scatterwalk_map
    and scatterwalk_done as they're all tiny and mostly used by the block
    cipher walker.

    Signed-off-by: Herbert Xu

    Herbert Xu
     
  • Nothing bad will happen even if sg->length is zero, so there is
    no point in keeping this BUG_ON in scatterwalk_start.

    Signed-off-by: Herbert Xu

    Herbert Xu
     
  • The offset advance in scatterwalk_pagedone not only is unnecessary,
    but it was also buggy when it was needed by scatterwalk_copychunks.
    As the latter has long ago been fixed to call scatterwalk_advance
    directly, we can remove this unnecessary offset adjustment.

    Signed-off-by: Herbert Xu

    Herbert Xu
     
  • When there is more data to be processed, the current test in
    scatterwalk_done may prevent us from calling pagedone even when
    we should.

    In particular, if we're on an SG entry spanning multiple pages
    where the last page is not a full page, we will incorrectly skip
    calling pagedone on the second last page.

    This patch fixes this by adding a separate test for whether we've
    reached the end of a page.

    Cc: stable@vger.kernel.org
    Signed-off-by: Herbert Xu

    Herbert Xu
     
  • The function ablkcipher_done_slow is pretty much identical to
    scatterwalk_copychunks except that it doesn't actually copy as
    the processing hasn't been completed yet.

    This patch allows scatterwalk_copychunks to be used in this case
    by specifying out == 2.

    Signed-off-by: Herbert Xu

    Herbert Xu
     
  • This patch removes the now unused scatterwalk_bytes_sglen. Anyone
    using this out-of-tree should switch over to sg_nents_for_len.

    Signed-off-by: Herbert Xu

    Herbert Xu
     
  • This patch removes the old crypto_grab_skcipher helper and replaces
    it with crypto_grab_skcipher2.

    As this is the final entry point into givcipher this patch also
    removes all traces of the top-level givcipher interface, including
    all implicit IV generators such as chainiv.

    The bottom-level givcipher interface remains until the drivers
    using it are converted.

    Signed-off-by: Herbert Xu

    Herbert Xu
     
  • As there are no more kernel users of built-in IV generators we
    can remove the special lookup for skciphers.

    Signed-off-by: Herbert Xu

    Herbert Xu
     
  • This patch converts cts over to the skcipher interface. It also
    optimises the implementation to use one CBC operation for all but
    the last block, which is then processed separately.

    Signed-off-by: Herbert Xu

    Herbert Xu
     
  • The default null blkcipher is no longer used and can now be removed.

    Signed-off-by: Herbert Xu

    Herbert Xu
     
  • The blkcipher null object is no longer used and can now be removed.

    Signed-off-by: Herbert Xu

    Herbert Xu
     
  • This patch replaces use of the obsolete blkcipher with skcipher.

    Signed-off-by: Herbert Xu

    Herbert Xu
     
  • This patch replaces use of the obsolete blkcipher with skcipher.

    Signed-off-by: Herbert Xu

    Herbert Xu
     
  • This patch adds an skcipher null object alongside the existing
    null blkcipher so that IV generators using it can switch over
    to skcipher.

    Signed-off-by: Herbert Xu

    Herbert Xu
     
  • This patch converts chacha20poly1305 to use the new skcipher
    interface as opposed to ablkcipher.

    It also fixes a buglet where we may end up with an async poly1305
    when the user asks for a async algorithm. This shouldn't be a
    problem yet as there aren't any async implementations of poly1305
    out there.

    Signed-off-by: Herbert Xu

    Herbert Xu
     
  • This patch converts gcm to use the new skcipher interface as opposed
    to ablkcipher.

    Signed-off-by: Herbert Xu

    Herbert Xu
     
  • This patch converts ccm to use the new skcipher interface as opposed
    to ablkcipher.

    Signed-off-by: Herbert Xu

    Herbert Xu
     
  • This patch converts rfc3686 to use the new skcipher interface as
    opposed to ablkcipher.

    Signed-off-by: Herbert Xu

    Herbert Xu
     
  • This patch converts authencesn to use the new skcipher interface as
    opposed to ablkcipher.

    It also fixes a little bug where if a sync version of authencesn
    is requested we may still end up using an async ahash. This should
    have no effect as none of the authencesn users can request for a
    sync authencesn.

    Signed-off-by: Herbert Xu

    Herbert Xu
     
  • This patch converts authenc to use the new skcipher interface as
    opposed to ablkcipher.

    It also fixes a little bug where if a sync version of authenc
    is requested we may still end up using an async ahash. This should
    have no effect as none of the authenc users can request for a
    sync authenc.

    Signed-off-by: Herbert Xu

    Herbert Xu
     
  • This patch adds a chunk size parameter to aead algorithms, just
    like the chunk size for skcipher algorithms.

    However, unlike skcipher we do not currently export this to AEAD
    users. It is only meant to be used by AEAD implementors for now.

    Signed-off-by: Herbert Xu

    Herbert Xu
     
  • Current the default null skcipher is actually a crypto_blkcipher.
    This patch creates a synchronous crypto_skcipher version of the
    null cipher which unfortunately has to settle for the name skcipher2.

    Signed-off-by: Herbert Xu

    Herbert Xu
     
  • This patch allows skcipher algorithms and instances to be created
    and registered with the crypto API. They are accessible through
    the top-level skcipher interface, along with ablkcipher/blkcipher
    algorithms and instances.

    This patch also introduces a new parameter called chunk size
    which is meant for ciphers such as CTR and CTS which ostensibly
    can handle arbitrary lengths, but still behave like block ciphers
    in that you can only process a partial block at the very end.

    For these ciphers the block size will continue to be set to 1
    as it is now while the chunk size will be set to the underlying
    block size.

    Signed-off-by: Herbert Xu

    Herbert Xu
     
  • Arbitrary X.509 certificates without authority key identifiers (AKIs)
    can be added to "trusted" keyrings, including IMA or EVM certs loaded
    from the filesystem. Signature verification is currently bypassed for
    certs without AKIs.

    Trusted keys were recently refactored, and this bug is not present in
    4.6.

    restrict_link_by_signature should return -ENOKEY (no matching parent
    certificate found) if the certificate being evaluated has no AKIs,
    instead of bypassing signature checks and returning 0 (new certificate
    accepted).

    Reported-by: Petko Manolov
    Signed-off-by: Mat Martineau
    Signed-off-by: David Howells
    Signed-off-by: James Morris

    Mat Martineau
     
  • Commit e68503bd68 forgot to set digest_len and thus cause the following
    error reported by kexec when launching a crash kernel:

    kexec_file_load failed: Bad message

    Fixes: e68503bd68 (KEYS: Generalise system_verify_data() to provide access to internal content)
    Signed-off-by: Lans Zhang
    Tested-by: Dave Young
    Signed-off-by: David Howells
    Cc: Baoquan He
    Cc: Vivek Goyal
    cc: kexec@lists.infradead.org
    cc: linux-crypto@vger.kernel.org
    Signed-off-by: James Morris

    Lans Zhang
     
  • This fix resolves the following kernel panic if an empty or missing
    AuthorityKeyIdentifier is encountered and DEBUG is defined in
    pkcs7_verify.c.

    [ 459.041989] PKEY: pkcs7_verify_sig_chain()
    [ 459.041999] PKCS7: verify Sample DB Certificate for SCP: 01
    [ 459.042002] PKCS7: - issuer Sample KEK Certificate for SCP
    [ 459.042014] BUG: unable to handle kernel NULL pointer dereference at (null)
    [ 459.042135] IP: [] pkcs7_verify+0x72c/0x7f0
    [ 459.042217] PGD 739e6067 PUD 77719067 PMD 0
    [ 459.042286] Oops: 0000 [#1] PREEMPT SMP
    [ 459.042328] Modules linked in:
    [ 459.042368] CPU: 0 PID: 474 Comm: kexec Not tainted 4.7.0-rc7-WR8.0.0.0_standard+ #18
    [ 459.042462] Hardware name: To be filled by O.E.M. To be filled by O.E.M./Aptio CRB, BIOS 5.6.5 10/09/2014
    [ 459.042586] task: ffff880073a50000 ti: ffff8800738e8000 task.ti: ffff8800738e8000
    [ 459.042675] RIP: 0010:[] [] pkcs7_verify+0x72c/0x7f0
    [ 459.042784] RSP: 0018:ffff8800738ebd58 EFLAGS: 00010246
    [ 459.042845] RAX: 0000000000000000 RBX: ffff880076b7da80 RCX: 0000000000000006
    [ 459.042929] RDX: 0000000000000001 RSI: ffffffff81c85001 RDI: ffffffff81ca00a9
    [ 459.043014] RBP: ffff8800738ebd98 R08: 0000000000000400 R09: ffff8800788a304c
    [ 459.043098] R10: 0000000000000000 R11: 00000000000060ca R12: ffff8800769a2bc0
    [ 459.043182] R13: ffff880077358300 R14: 0000000000000000 R15: ffff8800769a2dc0
    [ 459.043268] FS: 00007f24cc741700(0000) GS:ffff880074e00000(0000) knlGS:0000000000000000
    [ 459.043365] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    [ 459.043431] CR2: 0000000000000000 CR3: 0000000073a36000 CR4: 00000000001006f0
    [ 459.043514] Stack:
    [ 459.043530] 0000000000000000 ffffffbf00000020 31ffffff813e68b0 0000000000000002
    [ 459.043644] ffff8800769a2bc0 0000000000000000 00000000007197b8 0000000000000002
    [ 459.043756] ffff8800738ebdd8 ffffffff81153fb1 0000000000000000 0000000000000000
    [ 459.043869] Call Trace:
    [ 459.043898] [] verify_pkcs7_signature+0x61/0x140
    [ 459.043974] [] verify_pefile_signature+0x2cb/0x830
    [ 459.044052] [] ? verify_pefile_signature+0x830/0x830
    [ 459.044134] [] bzImage64_verify_sig+0x15/0x20
    [ 459.046332] [] arch_kexec_kernel_verify_sig+0x29/0x40
    [ 459.048552] [] SyS_kexec_file_load+0x1f4/0x6c0
    [ 459.050768] [] ? __do_page_fault+0x1b6/0x550
    [ 459.052996] [] entry_SYSCALL_64_fastpath+0x17/0x93
    [ 459.055242] Code: e8 0a d6 ff ff 85 c0 0f 88 7a fb ff ff 4d 39 fd 4d 89 7d 08 74 45 4d 89 fd e9 14 fe ff ff 4d 8b 76 08 31 c0 48 c7 c7 a9 00 ca 81 0f b7 36 49 8d 56 02 e8 d0 91 d6 ff 4d 8b 3c 24 4d 85 ff 0f
    [ 459.060535] RIP [] pkcs7_verify+0x72c/0x7f0
    [ 459.063040] RSP
    [ 459.065456] CR2: 0000000000000000
    [ 459.075998] ---[ end trace c15f0e897cda28dc ]---

    Signed-off-by: Lans Zhang
    Signed-off-by: David Howells
    Cc: Dave Young
    Cc: Baoquan He
    Cc: Vivek Goyal
    cc: linux-crypto@vger.kernel.org
    cc: kexec@lists.infradead.org
    Signed-off-by: James Morris

    Lans Zhang
     

05 Jul, 2016

4 commits


03 Jul, 2016

1 commit

  • As the software RSA implementation now produces fixed-length
    output, we need to eliminate leading zeros in the calling code
    instead.

    This patch does just that for pkcs1pad signature verification.

    Fixes: 9b45b7bba3d2 ("crypto: rsa - Generate fixed-length output")
    Reported-by: Stephan Mueller
    Signed-off-by: Herbert Xu

    Herbert Xu