02 Dec, 2010

1 commit


26 May, 2010

1 commit

  • Use ERR_CAST(x) rather than ERR_PTR(PTR_ERR(x)). The former makes more
    clear what is the purpose of the operation, which otherwise looks like a
    no-op.

    The semantic patch that makes this change is as follows:
    (http://coccinelle.lip6.fr/)

    //
    @@
    type T;
    T x;
    identifier f;
    @@

    T f (...) { }

    @@
    expression x;
    @@

    - ERR_PTR(PTR_ERR(x))
    + ERR_CAST(x)
    //

    Signed-off-by: Julia Lawall
    Signed-off-by: Herbert Xu

    Julia Lawall
     

20 May, 2010

1 commit


26 Apr, 2010

1 commit

  • When Steffen originally wrote the authenc async hash patch, he
    correctly had EINPROGRESS checks in place so that we did not invoke
    the original completion handler with it.

    Unfortuantely I told him to remove it before the patch was applied.

    As only MAY_BACKLOG request completion handlers are required to
    handle EINPROGRESS completions, those checks are really needed.

    This patch restores them.

    Reported-by: Sebastian Andrzej Siewior
    Signed-off-by: Herbert Xu

    Herbert Xu
     

03 Mar, 2010

1 commit

  • In crypto_authenc_encrypt() we save the IV behind the ablkcipher
    request. To save space on the request, we overwrite the ablkcipher
    request with a ahash request after encryption. So the IV may be
    overwritten by the ahash request. This patch fixes this by placing
    the IV in front of the ablkcipher/ahash request.

    Signed-off-by: Steffen Klassert
    Signed-off-by: Herbert Xu

    Steffen Klassert
     

02 Mar, 2010

1 commit


16 Feb, 2010

1 commit


05 Aug, 2009

1 commit


14 Jul, 2009

1 commit


15 Jan, 2009

1 commit

  • As it is if an algorithm with a zero-length IV is used (e.g.,
    NULL encryption) with authenc, authenc may generate an SG entry
    of length zero, which will trigger a BUG check in the hash layer.

    This patch fixes it by skipping the IV SG generation if the IV
    size is zero.

    Signed-off-by: Herbert Xu

    Herbert Xu
     

25 Dec, 2008

1 commit


22 Aug, 2008

1 commit

  • Authenc works in two stages for encryption, it first encrypts and
    then computes an ICV. The context memory of the request is used
    by both operations. The problem is that when an asynchronous
    encryption completes, we will compute the ICV and then reread the
    context memory of the encryption to get the original request.

    It just happens that we have a buffer of 16 bytes in front of the
    request pointer, so ICVs of 16 bytes (such as SHA1) do not trigger
    the bug. However, any attempt to uses a larger ICV instantly kills
    the machine when the first asynchronous encryption is completed.

    This patch fixes this by saving the request pointer before we start
    the ICV computation.

    Signed-off-by: Herbert Xu

    Herbert Xu
     

01 May, 2008

1 commit

  • crypto_authenc_givencrypt_done uses req->data as struct aead_givcrypt_request,
    while it really points to a struct aead_request, causing this crash:

    BUG: unable to handle kernel paging request at 6b6b6b6b
    IP: [] :authenc:crypto_authenc_genicv+0x23/0x109
    *pde = 00000000
    Oops: 0000 [#1] PREEMPT DEBUG_PAGEALLOC
    Modules linked in: hifn_795x authenc esp4 aead xfrm4_mode_tunnel sha1_generic hmac crypto_hash]

    Pid: 3074, comm: ping Not tainted (2.6.25 #4)
    EIP: 0060:[] EFLAGS: 00010296 CPU: 0
    EIP is at crypto_authenc_genicv+0x23/0x109 [authenc]
    EAX: daa04690 EBX: daa046e0 ECX: dab0a100 EDX: daa046b0
    ESI: 6b6b6b6b EDI: dc872054 EBP: c033ff60 ESP: c033ff0c
    DS: 007b ES: 007b FS: 0000 GS: 0033 SS: 0068
    Process ping (pid: 3074, ti=c033f000 task=db883a80 task.ti=dab6c000)
    Stack: 00000000 daa046b0 c0215a3e daa04690 dab0a100 00000000 ffffffff db9fd7f0
    dba208c0 dbbb1720 00000001 daa04720 00000001 c033ff54 c0119ca9 dc852a75
    c033ff60 c033ff60 daa046e0 00000000 00000001 c033ff6c dc87527b 00000001
    Call Trace:
    [] ? dev_alloc_skb+0x14/0x29
    [] ? printk+0x15/0x17
    [] ? crypto_authenc_givencrypt_done+0x1a/0x27 [authenc]
    [] ? hifn_process_ready+0x34a/0x352 [hifn_795x]
    [] ? rhine_napipoll+0x3f2/0x3fd [via_rhine]
    [] ? hifn_check_for_completion+0x4d/0xa6 [hifn_795x]
    [] ? hifn_tasklet_callback+0xa/0xc [hifn_795x]
    [] ? tasklet_action+0x3f/0x66
    [] ? __do_softirq+0x38/0x7a
    [] ? do_softirq+0x3e/0x71
    [] ? irq_exit+0x2c/0x65
    [] ? smp_apic_timer_interrupt+0x5f/0x6a
    [] ? apic_timer_interrupt+0x28/0x30
    [] ? hifn_handle_req+0x44a/0x50d [hifn_795x]
    ...

    Signed-off-by: Patrick McHardy
    Signed-off-by: Herbert Xu

    Patrick McHardy
     

11 Jan, 2008

12 commits

  • This patch implements the givencrypt function for authenc. It simply
    calls the givencrypt operation on the underlying cipher instead of encrypt.

    Signed-off-by: Herbert Xu

    Herbert Xu
     
  • This patch converts the authenc algorithm over to crypto_grab_skcipher
    which is a prerequisite for IV generation.

    This patch also changes authenc to set its ASYNC status depending on
    the ASYNC status of the underlying skcipher.

    Signed-off-by: Herbert Xu

    Herbert Xu
     
  • This patch merges the common hashing code between encryption and decryption.

    Signed-off-by: Herbert Xu

    Herbert Xu
     
  • This patch changes setkey to use RTA_OK to check the validity of the
    setkey request.

    Signed-off-by: Herbert Xu

    Herbert Xu
     
  • The ivsize should be fetched from ablkcipher, not blkcipher.

    Signed-off-by: Herbert Xu

    Herbert Xu
     
  • The scatterwalk infrastructure is used by algorithms so it needs to
    move out of crypto for future users that may live in drivers/crypto
    or asm/*/crypto.

    Signed-off-by: Herbert Xu

    Herbert Xu
     
  • This patch changes gcm/authenc to return EBADMSG instead of EINVAL for
    ICV mismatches. This convention has already been adopted by IPsec.

    Signed-off-by: Herbert Xu

    Herbert Xu
     
  • The previous code incorrectly included the hash in the verification which
    also meant that we'd crash and burn when it comes to actually verifying
    the hash since we'd go past the end of the SG list.

    This patch fixes that by subtracting authsize from cryptlen at the start.

    Signed-off-by: Herbert Xu

    Herbert Xu
     
  • Having enckeylen as a template parameter makes it a pain for hardware
    devices that implement ciphers with many key sizes since each one would
    have to be registered separately.

    Since the authenc algorithm is mainly used for legacy purposes where its
    key is going to be constructed out of two separate keys, we can in fact
    embed this value into the key itself.

    This patch does this by prepending an rtnetlink header to the key that
    contains the encryption key length.

    Signed-off-by: Herbert Xu

    Herbert Xu
     
  • As it is authsize is an algorithm paramter which cannot be changed at
    run-time. This is inconvenient because hardware that implements such
    algorithms would have to register each authsize that they support
    separately.

    Since authsize is a property common to all AEAD algorithms, we can add
    a function setauthsize that sets it at run-time, just like setkey.

    This patch does exactly that and also changes authenc so that authsize
    is no longer a parameter of its template.

    Signed-off-by: Herbert Xu

    Herbert Xu
     
  • Since alignment masks are always one less than a power of two, we can
    use binary or to find their maximum.

    Signed-off-by: Herbert Xu

    Herbert Xu
     
  • Up until now we have ablkcipher algorithms have been identified as
    type BLKCIPHER with the ASYNC bit set. This is suboptimal because
    ablkcipher refers to two things. On the one hand it refers to the
    top-level ablkcipher interface with requests. On the other hand it
    refers to and algorithm type underneath.

    As it is you cannot request a synchronous block cipher algorithm
    with the ablkcipher interface on top. This is a problem because
    we want to be able to eventually phase out the blkcipher top-level
    interface.

    This patch fixes this by making ABLKCIPHER its own type, just as
    we have distinct types for HASH and DIGEST. The type it associated
    with the algorithm implementation only.

    Which top-level interface is used for synchronous block ciphers is
    then determined by the mask that's used. If it's a specific mask
    then the old blkcipher interface is given, otherwise we go with the
    new ablkcipher interface.

    Signed-off-by: Herbert Xu

    Herbert Xu
     

23 Nov, 2007

1 commit


11 Oct, 2007

2 commits

  • We do not allow spaces in algorithm names or parameters. Thanks to Joy Latten
    for pointing this out.

    Signed-off-by: Herbert Xu

    Herbert Xu
     
  • This patch adds the authenc algorithm which constructs an AEAD algorithm
    from an asynchronous block cipher and a hash. The construction is done
    by concatenating the encrypted result from the cipher with the output
    from the hash, as is used by the IPsec ESP protocol.

    The authenc algorithm exists as a template with four parameters:

    authenc(auth, authsize, enc, enckeylen).

    The authentication algorithm, the authentication size (i.e., truncating
    the output of the authentication algorithm), the encryption algorithm,
    and the encryption key length. Both the size field and the key length
    field are in bytes. For example, AES-128 with SHA1-HMAC would be
    represented by

    authenc(hmac(sha1), 12, cbc(aes), 16)

    The key for the authenc algorithm is the concatenation of the keys for
    the authentication algorithm with the encryption algorithm. For the
    above example, if a key of length 36 bytes is given, then hmac(sha1)
    would receive the first 20 bytes while the last 16 would be given to
    cbc(aes).

    Signed-off-by: Herbert Xu

    Herbert Xu