Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

crypto: talitos - rename first/last to first_desc/last_desc

Previous commit introduces a new last_request variable in the context
structure.

Renaming the first/last existing member variable in the context
structure to improve readability.

Cc: stable@vger.kernel.org
Signed-off-by: Paul Louvel <paul.louvel@bootlin.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

authored by

Paul Louvel and committed by
Herbert Xu
a1b80018 655ef638

+23 -23
+23 -23
drivers/crypto/talitos.c
··· 869 869 u8 buf[2][HASH_MAX_BLOCK_SIZE]; 870 870 int buf_idx; 871 871 unsigned int swinit; 872 - unsigned int first; 873 - unsigned int last; 872 + unsigned int first_desc; 873 + unsigned int last_desc; 874 874 unsigned int last_request; 875 875 unsigned int to_hash_later; 876 876 unsigned int nbuf; ··· 889 889 u32 hw_context[TALITOS_MDEU_MAX_CONTEXT_SIZE / sizeof(u32)]; 890 890 u8 buf[HASH_MAX_BLOCK_SIZE]; 891 891 unsigned int swinit; 892 - unsigned int first; 893 - unsigned int last; 892 + unsigned int first_desc; 893 + unsigned int last_desc; 894 894 unsigned int to_hash_later; 895 895 unsigned int nbuf; 896 896 }; ··· 1722 1722 if (desc->next_desc && 1723 1723 desc->ptr[5].ptr != desc2->ptr[5].ptr) 1724 1724 unmap_single_talitos_ptr(dev, &desc2->ptr[5], DMA_FROM_DEVICE); 1725 - if (req_ctx->last) 1725 + if (req_ctx->last_desc) 1726 1726 memcpy(areq->result, req_ctx->hw_context, 1727 1727 crypto_ahash_digestsize(tfm)); 1728 1728 ··· 1759 1759 container_of(desc, struct talitos_edesc, desc); 1760 1760 struct talitos_ahash_req_ctx *req_ctx = ahash_request_ctx(areq); 1761 1761 1762 - if (!req_ctx->last && req_ctx->to_hash_later) { 1762 + if (!req_ctx->last_desc && req_ctx->to_hash_later) { 1763 1763 /* Position any partial block for next update/final/finup */ 1764 1764 req_ctx->buf_idx = (req_ctx->buf_idx + 1) & 1; 1765 1765 req_ctx->nbuf = req_ctx->to_hash_later; ··· 1825 1825 /* first DWORD empty */ 1826 1826 1827 1827 /* hash context in */ 1828 - if (!req_ctx->first || req_ctx->swinit) { 1828 + if (!req_ctx->first_desc || req_ctx->swinit) { 1829 1829 map_single_talitos_ptr_nosync(dev, &desc->ptr[1], 1830 1830 req_ctx->hw_context_size, 1831 1831 req_ctx->hw_context, ··· 1833 1833 req_ctx->swinit = 0; 1834 1834 } 1835 1835 /* Indicate next op is not the first. */ 1836 - req_ctx->first = 0; 1836 + req_ctx->first_desc = 0; 1837 1837 1838 1838 /* HMAC key */ 1839 1839 if (ctx->keylen) ··· 1866 1866 /* fifth DWORD empty */ 1867 1867 1868 1868 /* hash/HMAC out -or- hash context out */ 1869 - if (req_ctx->last) 1869 + if (req_ctx->last_desc) 1870 1870 map_single_talitos_ptr(dev, &desc->ptr[5], 1871 1871 crypto_ahash_digestsize(tfm), 1872 1872 req_ctx->hw_context, DMA_FROM_DEVICE); ··· 1908 1908 if (sg_count > 1) 1909 1909 sync_needed = true; 1910 1910 copy_talitos_ptr(&desc2->ptr[5], &desc->ptr[5], is_sec1); 1911 - if (req_ctx->last) 1911 + if (req_ctx->last_desc) 1912 1912 map_single_talitos_ptr_nosync(dev, &desc->ptr[5], 1913 1913 req_ctx->hw_context_size, 1914 1914 req_ctx->hw_context, ··· 1964 1964 bool is_sec1 = has_ftr_sec1(priv); 1965 1965 u8 *ctx_buf = req_ctx->buf[req_ctx->buf_idx]; 1966 1966 1967 - if (!req_ctx->last && (nbytes + req_ctx->nbuf <= blocksize)) { 1967 + if (!req_ctx->last_desc && (nbytes + req_ctx->nbuf <= blocksize)) { 1968 1968 /* Buffer up to one whole block */ 1969 1969 nents = sg_nents_for_len(req_ctx->request_sl, nbytes); 1970 1970 if (nents < 0) { ··· 1981 1981 nbytes_to_hash = nbytes + req_ctx->nbuf; 1982 1982 to_hash_later = nbytes_to_hash & (blocksize - 1); 1983 1983 1984 - if (req_ctx->last) 1984 + if (req_ctx->last_desc) 1985 1985 to_hash_later = 0; 1986 1986 else if (to_hash_later) 1987 1987 /* There is a partial block. Hash the full block(s) now */ ··· 2041 2041 edesc->desc.hdr = ctx->desc_hdr_template; 2042 2042 2043 2043 /* On last one, request SEC to pad; otherwise continue */ 2044 - if (req_ctx->last) 2044 + if (req_ctx->last_desc) 2045 2045 edesc->desc.hdr |= DESC_HDR_MODE0_MDEU_PAD; 2046 2046 else 2047 2047 edesc->desc.hdr |= DESC_HDR_MODE0_MDEU_CONT; 2048 2048 2049 2049 /* request SEC to INIT hash. */ 2050 - if (req_ctx->first && !req_ctx->swinit) 2050 + if (req_ctx->first_desc && !req_ctx->swinit) 2051 2051 edesc->desc.hdr |= DESC_HDR_MODE0_MDEU_INIT; 2052 2052 2053 2053 /* When the tfm context has a keylen, it's an HMAC. 2054 2054 * A first or last (ie. not middle) descriptor must request HMAC. 2055 2055 */ 2056 - if (ctx->keylen && (req_ctx->first || req_ctx->last)) 2056 + if (ctx->keylen && (req_ctx->first_desc || req_ctx->last_desc)) 2057 2057 edesc->desc.hdr |= DESC_HDR_MODE0_MDEU_HMAC; 2058 2058 2059 2059 return common_nonsnoop_hash(edesc, req_ctx->areq, nbytes_to_hash, ahash_done); ··· 2076 2076 req_ctx->remaining_ahash_request_bytes; 2077 2077 2078 2078 if (req_ctx->last_request) 2079 - req_ctx->last = 1; 2079 + req_ctx->last_desc = 1; 2080 2080 } 2081 2081 2082 2082 err = ahash_process_req_one(req_ctx->areq, ··· 2103 2103 if (nbytes > TALITOS1_MAX_DATA_LEN) 2104 2104 nbytes = TALITOS1_MAX_DATA_LEN; 2105 2105 else if (req_ctx->last_request) 2106 - req_ctx->last = 1; 2106 + req_ctx->last_desc = 1; 2107 2107 } 2108 2108 2109 2109 req_ctx->current_ahash_request_bytes = nbytes; ··· 2124 2124 /* Initialize the context */ 2125 2125 req_ctx->buf_idx = 0; 2126 2126 req_ctx->nbuf = 0; 2127 - req_ctx->first = 1; /* first indicates h/w must init its context */ 2127 + req_ctx->first_desc = 1; /* first_desc indicates h/w must init its context */ 2128 2128 req_ctx->swinit = 0; /* assume h/w init of context */ 2129 2129 size = (crypto_ahash_digestsize(tfm) <= SHA256_DIGEST_SIZE) 2130 2130 ? TALITOS_MDEU_CONTEXT_SIZE_MD5_SHA1_SHA256 2131 2131 : TALITOS_MDEU_CONTEXT_SIZE_SHA384_SHA512; 2132 2132 req_ctx->hw_context_size = size; 2133 2133 req_ctx->last_request = 0; 2134 - req_ctx->last = 0; 2134 + req_ctx->last_desc = 0; 2135 2135 INIT_WORK(&req_ctx->sec1_ahash_process_remaining, sec1_ahash_process_remaining); 2136 2136 2137 2137 dma = dma_map_single(dev, req_ctx->hw_context, req_ctx->hw_context_size, ··· 2224 2224 req_ctx->hw_context_size); 2225 2225 memcpy(export->buf, req_ctx->buf[req_ctx->buf_idx], req_ctx->nbuf); 2226 2226 export->swinit = req_ctx->swinit; 2227 - export->first = req_ctx->first; 2228 - export->last = req_ctx->last; 2227 + export->first_desc = req_ctx->first_desc; 2228 + export->last_desc = req_ctx->last_desc; 2229 2229 export->to_hash_later = req_ctx->to_hash_later; 2230 2230 export->nbuf = req_ctx->nbuf; 2231 2231 ··· 2250 2250 memcpy(req_ctx->hw_context, export->hw_context, size); 2251 2251 memcpy(req_ctx->buf[0], export->buf, export->nbuf); 2252 2252 req_ctx->swinit = export->swinit; 2253 - req_ctx->first = export->first; 2254 - req_ctx->last = export->last; 2253 + req_ctx->first_desc = export->first_desc; 2254 + req_ctx->last_desc = export->last_desc; 2255 2255 req_ctx->to_hash_later = export->to_hash_later; 2256 2256 req_ctx->nbuf = export->nbuf; 2257 2257