• Eneas U de Queiroz's avatar
    crypto: qce - save a sg table slot for result buf · 3ee50c89
    Eneas U de Queiroz authored
    When ctr-aes-qce is used for gcm-mode, an extra sg entry for the
    authentication tag is present, causing trouble when the qce driver
    prepares the dst-results sg table for dma.
    
    It computes the number of entries needed with sg_nents_for_len, leaving
    out the tag entry.  Then it creates a sg table with that number plus
    one, used to store a result buffer.
    
    When copying the sg table, there's no limit to the number of entries
    copied, so the extra slot is filled with the authentication tag sg.
    When the driver tries to add the result sg, the list is full, and it
    returns EINVAL.
    
    By limiting the number of sg entries copied to the dest table, the slot
    for the result buffer is guaranteed to be unused.
    Signed-off-by: default avatarEneas U de Queiroz <cotequeiroz@gmail.com>
    Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
    3ee50c89
dma.h 1.34 KB