31 Mar, 2016

1 commit


23 Mar, 2016

1 commit

  • Despite what the DocBook comment to pkcs7_validate_trust() says, the
    *_trusted argument is never set to false.

    pkcs7_validate_trust() only positively sets *_trusted upon encountering
    a trusted PKCS#7 SignedInfo block.

    This is quite unfortunate since its callers, system_verify_data() for
    example, depend on pkcs7_validate_trust() clearing *_trusted on non-trust.

    Indeed, UBSAN splats when attempting to load the uninitialized local
    variable 'trusted' from system_verify_data() in pkcs7_validate_trust():

    UBSAN: Undefined behaviour in crypto/asymmetric_keys/pkcs7_trust.c:194:14
    load of value 82 is not a valid value for type '_Bool'
    [...]
    Call Trace:
    [] dump_stack+0xbc/0x117
    [] ? _atomic_dec_and_lock+0x169/0x169
    [] ubsan_epilogue+0xd/0x4e
    [] __ubsan_handle_load_invalid_value+0x111/0x158
    [] ? val_to_string.constprop.12+0xcf/0xcf
    [] ? x509_request_asymmetric_key+0x114/0x370
    [] ? kfree+0x220/0x370
    [] ? public_key_verify_signature_2+0x32/0x50
    [] pkcs7_validate_trust+0x524/0x5f0
    [] system_verify_data+0xca/0x170
    [] ? top_trace_array+0x9b/0x9b
    [] ? __vfs_read+0x279/0x3d0
    [] mod_verify_sig+0x1ff/0x290
    [...]

    The implication is that pkcs7_validate_trust() effectively grants trust
    when it really shouldn't have.

    Fix this by explicitly setting *_trusted to false at the very beginning
    of pkcs7_validate_trust().

    Cc:
    Signed-off-by: Nicolai Stange
    Signed-off-by: Herbert Xu

    Nicolai Stange
     

19 Mar, 2016

1 commit

  • Merge second patch-bomb from Andrew Morton:

    - a couple of hotfixes

    - the rest of MM

    - a new timer slack control in procfs

    - a couple of procfs fixes

    - a few misc things

    - some printk tweaks

    - lib/ updates, notably to radix-tree.

    - add my and Nick Piggin's old userspace radix-tree test harness to
    tools/testing/radix-tree/. Matthew said it was a godsend during the
    radix-tree work he did.

    - a few code-size improvements, switching to __always_inline where gcc
    screwed up.

    - partially implement character sets in sscanf

    * emailed patches from Andrew Morton : (118 commits)
    sscanf: implement basic character sets
    lib/bug.c: use common WARN helper
    param: convert some "on"/"off" users to strtobool
    lib: add "on"/"off" support to kstrtobool
    lib: update single-char callers of strtobool()
    lib: move strtobool() to kstrtobool()
    include/linux/unaligned: force inlining of byteswap operations
    include/uapi/linux/byteorder, swab: force inlining of some byteswap operations
    include/asm-generic/atomic-long.h: force inlining of some atomic_long operations
    usb: common: convert to use match_string() helper
    ide: hpt366: convert to use match_string() helper
    ata: hpt366: convert to use match_string() helper
    power: ab8500: convert to use match_string() helper
    power: charger_manager: convert to use match_string() helper
    drm/edid: convert to use match_string() helper
    pinctrl: convert to use match_string() helper
    device property: convert to use match_string() helper
    lib/string: introduce match_string() helper
    radix-tree tests: add test for radix_tree_iter_next
    radix-tree tests: add regression3 test
    ...

    Linus Torvalds
     

18 Mar, 2016

3 commits

  • CMA allocation should be guaranteed to succeed by definition, but,
    unfortunately, it would be failed sometimes. It is hard to track down
    the problem, because it is related to page reference manipulation and we
    don't have any facility to analyze it.

    This patch adds tracepoints to track down page reference manipulation.
    With it, we can find exact reason of failure and can fix the problem.
    Following is an example of tracepoint output. (note: this example is
    stale version that printing flags as the number. Recent version will
    print it as human readable string.)

    -9018 [004] 92.678375: page_ref_set: pfn=0x17ac9 flags=0x0 count=1 mapcount=0 mapping=(nil) mt=4 val=1
    -9018 [004] 92.678378: kernel_stack:
    => get_page_from_freelist (ffffffff81176659)
    => __alloc_pages_nodemask (ffffffff81176d22)
    => alloc_pages_vma (ffffffff811bf675)
    => handle_mm_fault (ffffffff8119e693)
    => __do_page_fault (ffffffff810631ea)
    => trace_do_page_fault (ffffffff81063543)
    => do_async_page_fault (ffffffff8105c40a)
    => async_page_fault (ffffffff817581d8)
    [snip]
    -9018 [004] 92.678379: page_ref_mod: pfn=0x17ac9 flags=0x40048 count=2 mapcount=1 mapping=0xffff880015a78dc1 mt=4 val=1
    [snip]
    ...
    ...
    -9131 [001] 93.174468: test_pages_isolated: start_pfn=0x17800 end_pfn=0x17c00 fin_pfn=0x17ac9 ret=fail
    [snip]
    -9018 [004] 93.174843: page_ref_mod_and_test: pfn=0x17ac9 flags=0x40068 count=0 mapcount=0 mapping=0xffff880015a78dc1 mt=4 val=-1 ret=1
    => release_pages (ffffffff8117c9e4)
    => free_pages_and_swap_cache (ffffffff811b0697)
    => tlb_flush_mmu_free (ffffffff81199616)
    => tlb_finish_mmu (ffffffff8119a62c)
    => exit_mmap (ffffffff811a53f7)
    => mmput (ffffffff81073f47)
    => do_exit (ffffffff810794e9)
    => do_group_exit (ffffffff81079def)
    => SyS_exit_group (ffffffff81079e74)
    => entry_SYSCALL_64_fastpath (ffffffff817560b6)

    This output shows that problem comes from exit path. In exit path, to
    improve performance, pages are not freed immediately. They are gathered
    and processed by batch. During this process, migration cannot be
    possible and CMA allocation is failed. This problem is hard to find
    without this page reference tracepoint facility.

    Enabling this feature bloat kernel text 30 KB in my configuration.

    text data bss dec hex filename
    12127327 2243616 1507328 15878271 f2487f vmlinux_disabled
    12157208 2258880 1507328 15923416 f2f8d8 vmlinux_enabled

    Note that, due to header file dependency problem between mm.h and
    tracepoint.h, this feature has to open code the static key functions for
    tracepoints. Proposed by Steven Rostedt in following link.

    https://lkml.org/lkml/2015/12/9/699

    [arnd@arndb.de: crypto/async_pq: use __free_page() instead of put_page()]
    [iamjoonsoo.kim@lge.com: fix build failure for xtensa]
    [akpm@linux-foundation.org: tweak Kconfig text, per Vlastimil]
    Signed-off-by: Joonsoo Kim
    Acked-by: Michal Nazarewicz
    Acked-by: Vlastimil Babka
    Cc: Minchan Kim
    Cc: Mel Gorman
    Cc: "Kirill A. Shutemov"
    Cc: Sergey Senozhatsky
    Acked-by: Steven Rostedt
    Signed-off-by: Arnd Bergmann
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joonsoo Kim
     
  • Pull security layer updates from James Morris:
    "There are a bunch of fixes to the TPM, IMA, and Keys code, with minor
    fixes scattered across the subsystem.

    IMA now requires signed policy, and that policy is also now measured
    and appraised"

    * 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security: (67 commits)
    X.509: Make algo identifiers text instead of enum
    akcipher: Move the RSA DER encoding check to the crypto layer
    crypto: Add hash param to pkcs1pad
    sign-file: fix build with CMS support disabled
    MAINTAINERS: update tpmdd urls
    MODSIGN: linux/string.h should be #included to get memcpy()
    certs: Fix misaligned data in extra certificate list
    X.509: Handle midnight alternative notation in GeneralizedTime
    X.509: Support leap seconds
    Handle ISO 8601 leap seconds and encodings of midnight in mktime64()
    X.509: Fix leap year handling again
    PKCS#7: fix unitialized boolean 'want'
    firmware: change kernel read fail to dev_dbg()
    KEYS: Use the symbol value for list size, updated by scripts/insert-sys-cert
    KEYS: Reserve an extra certificate symbol for inserting without recompiling
    modsign: hide openssl output in silent builds
    tpm_tis: fix build warning with tpm_tis_resume
    ima: require signed IMA policy
    ima: measure and appraise the IMA policy itself
    ima: load policy using path
    ...

    Linus Torvalds
     
  • Pull crypto update from Herbert Xu:
    "Here is the crypto update for 4.6:

    API:
    - Convert remaining crypto_hash users to shash or ahash, also convert
    blkcipher/ablkcipher users to skcipher.
    - Remove crypto_hash interface.
    - Remove crypto_pcomp interface.
    - Add crypto engine for async cipher drivers.
    - Add akcipher documentation.
    - Add skcipher documentation.

    Algorithms:
    - Rename crypto/crc32 to avoid name clash with lib/crc32.
    - Fix bug in keywrap where we zero the wrong pointer.

    Drivers:
    - Support T5/M5, T7/M7 SPARC CPUs in n2 hwrng driver.
    - Add PIC32 hwrng driver.
    - Support BCM6368 in bcm63xx hwrng driver.
    - Pack structs for 32-bit compat users in qat.
    - Use crypto engine in omap-aes.
    - Add support for sama5d2x SoCs in atmel-sha.
    - Make atmel-sha available again.
    - Make sahara hashing available again.
    - Make ccp hashing available again.
    - Make sha1-mb available again.
    - Add support for multiple devices in ccp.
    - Improve DMA performance in caam.
    - Add hashing support to rockchip"

    * 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6: (116 commits)
    crypto: qat - remove redundant arbiter configuration
    crypto: ux500 - fix checks of error code returned by devm_ioremap_resource()
    crypto: atmel - fix checks of error code returned by devm_ioremap_resource()
    crypto: qat - Change the definition of icp_qat_uof_regtype
    hwrng: exynos - use __maybe_unused to hide pm functions
    crypto: ccp - Add abstraction for device-specific calls
    crypto: ccp - CCP versioning support
    crypto: ccp - Support for multiple CCPs
    crypto: ccp - Remove check for x86 family and model
    crypto: ccp - memset request context to zero during import
    lib/mpi: use "static inline" instead of "extern inline"
    lib/mpi: avoid assembler warning
    hwrng: bcm63xx - fix non device tree compatibility
    crypto: testmgr - allow rfc3686 aes-ctr variants in fips mode.
    crypto: qat - The AE id should be less than the maximal AE number
    lib/mpi: Endianness fix
    crypto: rockchip - add hash support for crypto engine in rk3288
    crypto: xts - fix compile errors
    crypto: doc - add skcipher API documentation
    crypto: doc - update AEAD AD handling
    ...

    Linus Torvalds
     

04 Mar, 2016

3 commits

  • Make the identifier public key and digest algorithm fields text instead of
    enum.

    Signed-off-by: David Howells
    Acked-by: Herbert Xu

    David Howells
     
  • Move the RSA EMSA-PKCS1-v1_5 encoding from the asymmetric-key public_key
    subtype to the rsa crypto module's pkcs1pad template. This means that the
    public_key subtype no longer has any dependencies on public key type.

    To make this work, the following changes have been made:

    (1) The rsa pkcs1pad template is now used for RSA keys. This strips off the
    padding and returns just the message hash.

    (2) In a previous patch, the pkcs1pad template gained an optional second
    parameter that, if given, specifies the hash used. We now give this,
    and pkcs1pad checks the encoded message E(M) for the EMSA-PKCS1-v1_5
    encoding and verifies that the correct digest OID is present.

    (3) The crypto driver in crypto/asymmetric_keys/rsa.c is now reduced to
    something that doesn't care about what the encryption actually does
    and and has been merged into public_key.c.

    (4) CONFIG_PUBLIC_KEY_ALGO_RSA is gone. Module signing must set
    CONFIG_CRYPTO_RSA=y instead.

    Thoughts:

    (*) Should the encoding style (eg. raw, EMSA-PKCS1-v1_5) also be passed to
    the padding template? Should there be multiple padding templates
    registered that share most of the code?

    Signed-off-by: David Howells
    Signed-off-by: Tadeusz Struk
    Acked-by: Herbert Xu

    David Howells
     
  • This adds hash param to pkcs1pad.
    The pkcs1pad template can work with or without the hash.
    When hash param is provided then the verify operation will
    also verify the output against the known digest.

    Signed-off-by: Tadeusz Struk
    Signed-off-by: David Howells
    Acked-by: Herbert Xu

    Tadeusz Struk
     

29 Feb, 2016

4 commits

  • The ASN.1 GeneralizedTime object carries an ISO 8601 format date and time.
    The time is permitted to show midnight as 00:00 or 24:00 (the latter being
    equivalent of 00:00 of the following day).

    The permitted value is checked in x509_decode_time() but the actual
    handling is left to mktime64().

    Without this patch, certain X.509 certificates will be rejected and could
    lead to an unbootable kernel.

    Note that with this patch we also permit any 24:mm:ss time and extend this
    to UTCTime, which whilst not strictly correct don't permit much leeway in
    fiddling date strings.

    Reported-by: Rudolf Polzer
    Signed-off-by: David Howells
    Acked-by: Arnd Bergmann
    cc: David Woodhouse
    cc: John Stultz

    David Howells
     
  • The format of ASN.1 GeneralizedTime seems to be specified by ISO 8601
    [X.680 46.3] and this apparently supports leap seconds (ie. the seconds
    field is 60). It's not entirely clear that ASN.1 expects it, but we can
    relax the seconds check slightly for GeneralizedTime.

    This results in us passing a time with sec as 60 to mktime64(), which
    handles it as being a duplicate of the 0th second of the next minute.

    We can't really do otherwise without giving the kernel much greater
    knowledge of where all the leap seconds are. Unfortunately, this would
    require change the mapping of the kernel's current-time-in-seconds.

    UTCTime, however, only supports a seconds value in the range 00-59, but for
    the sake of simplicity allow this with UTCTime also.

    Without this patch, certain X.509 certificates will be rejected,
    potentially making a kernel unbootable.

    Reported-by: Rudolf Polzer
    Signed-off-by: David Howells
    Acked-by: Arnd Bergmann
    cc: David Woodhouse
    cc: John Stultz

    David Howells
     
  • There are still a couple of minor issues in the X.509 leap year handling:

    (1) To avoid doing a modulus-by-400 in addition to a modulus-by-100 when
    determining whether the year is a leap year or not, I divided the year
    by 100 after doing the modulus-by-100, thereby letting the compiler do
    one instruction for both, and then did a modulus-by-4.

    Unfortunately, I then passed the now-modified year value to mktime64()
    to construct a time value.

    Since this isn't a fast path and since mktime64() does a bunch of
    divisions, just condense down to "% 400". It's also easier to read.

    (2) The default month length for any February where the year doesn't
    divide by four exactly is obtained from the month_length[] array where
    the value is 29, not 28.

    This is fixed by altering the table.

    Reported-by: Rudolf Polzer
    Signed-off-by: David Howells
    Acked-by: David Woodhouse
    Acked-by: Arnd Bergmann
    cc: stable@vger.kernel.org

    David Howells
     
  • The boolean want is not initialized and hence garbage. The default should
    be false (later it is only set to true on tne sinfo->authattrs check).

    Found with static analysis using CoverityScan

    Signed-off-by: Colin Ian King
    Signed-off-by: David Howells

    Colin Ian King
     

28 Feb, 2016

1 commit


17 Feb, 2016

2 commits

  • The patch centralizes the XTS key check logic into the service function
    xts_check_key which is invoked from the different XTS implementations.
    With this, the XTS implementations in ARM, ARM64, PPC and S390 have now
    a sanity check for the XTS keys similar to the other arches.

    In addition, this service function received a check to ensure that the
    key != the tweak key which is mandated by FIPS 140-2 IG A.9. As the
    check is not present in the standards defining XTS, it is only enforced
    in FIPS mode of the kernel.

    Signed-off-by: Stephan Mueller
    Signed-off-by: Herbert Xu

    Stephan Mueller
     
  • (2nd try that adds missing , to build.)

    Signed-off-by: Marcus Meissner
    Signed-off-by: Herbert Xu

    Marcus Meissner
     

10 Feb, 2016

1 commit


09 Feb, 2016

1 commit


06 Feb, 2016

10 commits

  • Some more authenc() wrapped algorithms are FIPS compliant, tag
    them as such.

    Signed-off-by: Marcus Meissner
    Acked-by: Stephan Mueller
    Signed-off-by: Herbert Xu

    Marcus Meissner
     
  • __test_aead() reads MAX_IVLEN bytes from template[i].iv, but the
    actual length of the initialisation vector can be shorter.
    The length of the IV is already calculated earlier in the
    function. Let's just reuses that. Also the IV length is currently
    calculated several time for no reason. Let's fix that too.
    This fix an out-of-bound error detected by KASan.

    Signed-off-by: Jerome Marchand
    Signed-off-by: Herbert Xu

    Jerome Marchand
     
  • Modify __test_hash() so that hash import/export can be tested
    from within the kernel. The test is unconditionally done when
    a struct hash_testvec has its .np > 1.

    v3: make the test unconditional
    v2: Leverage template[i].np as suggested by Tim Chen

    Signed-off-by: Rui Wang
    Signed-off-by: Herbert Xu

    Wang, Rui Y
     
  • This patch converts the module verification code to the new akcipher API.

    Signed-off-by: Tadeusz Struk
    Signed-off-by: Herbert Xu

    Tadeusz Struk
     
  • This patch removes all traces of the crypto_hash interface, now
    that everyone has switched over to shash or ahash.

    Signed-off-by: Herbert Xu

    Herbert Xu
     
  • This patch removes the last user of the obsolete crypto_hash
    interface, tcrypt, by simply switching it over to ahash. In
    fact it already has all the code there so it's just a matter
    of calling the ahash speed test code with the right mask.

    Signed-off-by: Herbert Xu

    Herbert Xu
     
  • The async path cannot use MAY_BACKLOG because it is not meant to
    block, which is what MAY_BACKLOG does. On the other hand, both
    the sync and async paths can make use of MAY_SLEEP.

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

    Herbert Xu
     
  • Any access to non-constant bits of the private context must be
    done under the socket lock, in particular, this includes ctx->req.

    This patch moves such accesses under the lock, and fetches the
    tfm from the parent socket which is guaranteed to be constant,
    rather than from ctx->req.

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

    Herbert Xu
     
  • The async path in algif_skcipher assumes that the crypto completion
    function will be called with the original request. This is not
    necessarily the case. In fact there is no need for this anyway
    since we already embed information into the request with struct
    skcipher_async_req.

    This patch adds a pointer to that struct and then passes it as
    the data to the callback function.

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

    Herbert Xu
     
  • We miss to take the crypto_alg_sem semaphore when traversing the
    crypto_alg_list for CRYPTO_MSG_GETALG dumps. This allows a race with
    crypto_unregister_alg() removing algorithms from the list while we're
    still traversing it, thereby leading to a use-after-free as show below:

    [ 3482.071639] general protection fault: 0000 [#1] SMP
    [ 3482.075639] Modules linked in: aes_x86_64 glue_helper lrw ablk_helper cryptd gf128mul ipv6 pcspkr serio_raw virtio_net microcode virtio_pci virtio_ring virtio sr_mod cdrom [last unloaded: aesni_intel]
    [ 3482.075639] CPU: 1 PID: 11065 Comm: crconf Not tainted 4.3.4-grsec+ #126
    [ 3482.075639] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.7.5-20140531_083030-gandalf 04/01/2014
    [ 3482.075639] task: ffff88001cd41a40 ti: ffff88001cd422c8 task.ti: ffff88001cd422c8
    [ 3482.075639] RIP: 0010:[] [] strncpy+0x13/0x30
    [ 3482.075639] RSP: 0018:ffff88001f713b60 EFLAGS: 00010202
    [ 3482.075639] RAX: ffff88001f6c4430 RBX: ffff88001f6c43a0 RCX: ffff88001f6c4430
    [ 3482.075639] RDX: 0000000000000040 RSI: fefefefefefeff16 RDI: ffff88001f6c4430
    [ 3482.075639] RBP: ffff88001f713b60 R08: ffff88001f6c4470 R09: ffff88001f6c4480
    [ 3482.075639] R10: 0000000000000002 R11: 0000000000000246 R12: ffff88001ce2aa28
    [ 3482.075639] R13: ffff880000093700 R14: ffff88001f5e4bf8 R15: 0000000000003b20
    [ 3482.075639] FS: 0000033826fa2700(0000) GS:ffff88001e900000(0000) knlGS:0000000000000000
    [ 3482.075639] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    [ 3482.075639] CR2: ffffffffff600400 CR3: 00000000139ec000 CR4: 00000000001606f0
    [ 3482.075639] Stack:
    [ 3482.075639] ffff88001f713bd8 ffffffff936ccd00 ffff88001e5c4200 ffff880000093700
    [ 3482.075639] ffff88001f713bd0 ffffffff938ef4bf 0000000000000000 0000000000003b20
    [ 3482.075639] ffff88001f5e4bf8 ffff88001f5e4848 0000000000000000 0000000000003b20
    [ 3482.075639] Call Trace:
    [ 3482.075639] [] crypto_report_alg+0xc0/0x3e0
    [ 3482.075639] [] ? __alloc_skb+0x16f/0x300
    [ 3482.075639] [] crypto_dump_report+0x6a/0x90
    [ 3482.075639] [] netlink_dump+0x147/0x2e0
    [ 3482.075639] [] __netlink_dump_start+0x159/0x190
    [ 3482.075639] [] crypto_user_rcv_msg+0xc3/0x130
    [ 3482.075639] [] ? crypto_report_alg+0x3e0/0x3e0
    [ 3482.075639] [] ? alg_test_crc32c+0x120/0x120
    [ 3482.075639] [] ? __netlink_lookup+0xd5/0x120
    [ 3482.075639] [] ? crypto_add_alg+0x1d0/0x1d0
    [ 3482.075639] [] netlink_rcv_skb+0xe1/0x130
    [ 3482.075639] [] crypto_netlink_rcv+0x28/0x40
    [ 3482.075639] [] netlink_unicast+0x108/0x180
    [ 3482.075639] [] netlink_sendmsg+0x541/0x770
    [ 3482.075639] [] sock_sendmsg+0x21/0x40
    [ 3482.075639] [] SyS_sendto+0xf3/0x130
    [ 3482.075639] [] ? bad_area_nosemaphore+0x13/0x20
    [ 3482.075639] [] ? __do_page_fault+0x80/0x3a0
    [ 3482.075639] [] entry_SYSCALL_64_fastpath+0x12/0x6e
    [ 3482.075639] Code: 88 4a ff 75 ed 5d 48 0f ba 2c 24 3f c3 66 66 2e 0f 1f 84 00 00 00 00 00 55 48 85 d2 48 89 f8 48 89 f9 4c 8d 04 17 48 89 e5 74 15 b6 16 80 fa 01 88 11 48 83 de ff 48 83 c1 01 4c 39 c1 75 eb
    [ 3482.075639] RIP [] strncpy+0x13/0x30

    To trigger the race run the following loops simultaneously for a while:
    $ while : ; do modprobe aesni-intel; rmmod aesni-intel; done
    $ while : ; do crconf show all > /dev/null; done

    Fix the race by taking the crypto_alg_sem read lock, thereby preventing
    crypto_unregister_alg() from modifying the algorithm list during the
    dump.

    This bug has been detected by the PaX memory sanitize feature.

    Cc: stable@vger.kernel.org
    Signed-off-by: Mathias Krause
    Cc: Steffen Klassert
    Cc: PaX Team
    Signed-off-by: Herbert Xu

    Mathias Krause
     

01 Feb, 2016

2 commits

  • We're clearing the wrong memory. The memory corruption is likely
    harmless because we weren't going to use that stack memory again but not
    zeroing is a potential information leak.

    Fixes: e28facde3c39 ('crypto: keywrap - add key wrapping block chaining mode')
    Signed-off-by: Dan Carpenter
    Acked-by: Stephan Mueller
    Signed-off-by: Herbert Xu

    Dan Carpenter
     
  • Now block cipher engines need to implement and maintain their own queue/thread
    for processing requests, moreover currently helpers provided for only the queue
    itself (in crypto_enqueue_request() and crypto_dequeue_request()) but they
    don't help with the mechanics of driving the hardware (things like running the
    request immediately, DMA map it or providing a thread to process the queue in)
    even though a lot of that code really shouldn't vary that much from device to
    device.

    Thus this patch provides a mechanism for pushing requests to the hardware
    as it becomes free that drivers could use. And this framework is patterned
    on the SPI code and has worked out well there.
    (https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/
    drivers/spi/spi.c?id=ffbbdd21329f3e15eeca6df2d4bc11c04d9d91c0)

    Signed-off-by: Baolin Wang
    Signed-off-by: Herbert Xu

    Baolin Wang
     

30 Jan, 2016

3 commits


27 Jan, 2016

3 commits

  • When building the jitterentropy driver by itself, we get a link error
    when CRYPTO_RNG is not enabled as well:

    crypto/built-in.o: In function `jent_mod_init':
    jitterentropy-kcapi.c:(.init.text+0x98): undefined reference to `crypto_register_rng'
    crypto/built-in.o: In function `jent_mod_exit':
    jitterentropy-kcapi.c:(.exit.text+0x60): undefined reference to `crypto_unregister_rng'

    This adds a 'select CRYPTO_RNG' to CRYPTO_JITTERENTROPY to ensure the API
    is always there when it's used, not just when DRBG is also enabled.
    CRYPTO_DRBG would set it implicitly through CRYPTO_JITTERENTROPY now,
    but this leaves it in place to make it explicit what the driver does.

    Signed-off-by: Arnd Bergmann
    Signed-off-by: Herbert Xu

    Arnd Bergmann
     
  • It is unused now, so remove it.

    Signed-off-by: Joonsoo Kim
    Signed-off-by: Herbert Xu

    Joonsoo Kim
     
  • The has_key logic is wrong for shash algorithms as they always
    have a setkey function. So we should instead be testing against
    shash_no_setkey.

    Fixes: a5596d633278 ("crypto: hash - Add crypto_ahash_has_setkey")
    Cc: stable@vger.kernel.org
    Reported-by: Stephan Mueller
    Signed-off-by: Herbert Xu
    Tested-by: Stephan Mueller

    Herbert Xu
     

26 Jan, 2016

1 commit

  • The ghash and poly1305 hash implementations can be enabled when
    CONFIG_CRYPTO_HASH is turned off, causing a link error:

    crypto/built-in.o: In function `ghash_mod_init':
    (.init.text+0xd0): undefined reference to `crypto_register_shash'
    crypto/built-in.o: In function `ghash_mod_exit':
    (.exit.text+0xb4): undefined reference to `crypto_unregister_shash'
    crypto/built-in.o: In function `poly1305_mod_init':
    (.init.text+0xb4): undefined reference to `crypto_register_shash'
    crypto/built-in.o: In function `poly1305_mod_exit':
    (.exit.text+0x98): undefined reference to `crypto_unregister_shash'

    This adds an explicit 'select', like all other hashes have it.

    Signed-off-by: Arnd Bergmann
    Signed-off-by: Herbert Xu

    Arnd Bergmann
     

25 Jan, 2016

3 commits