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: sha512_base - Remove partial block helpers

Now that all sha256_base users have been converted to use the API
partial block handling, remove the partial block helpers.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

-64
-64
include/crypto/sha512_base.h
··· 53 53 return 0; 54 54 } 55 55 56 - static inline int sha512_base_do_update(struct shash_desc *desc, 57 - const u8 *data, 58 - unsigned int len, 59 - sha512_block_fn *block_fn) 60 - { 61 - struct sha512_state *sctx = shash_desc_ctx(desc); 62 - unsigned int partial = sctx->count[0] % SHA512_BLOCK_SIZE; 63 - 64 - sctx->count[0] += len; 65 - if (sctx->count[0] < len) 66 - sctx->count[1]++; 67 - 68 - if (unlikely((partial + len) >= SHA512_BLOCK_SIZE)) { 69 - int blocks; 70 - 71 - if (partial) { 72 - int p = SHA512_BLOCK_SIZE - partial; 73 - 74 - memcpy(sctx->buf + partial, data, p); 75 - data += p; 76 - len -= p; 77 - 78 - block_fn(sctx, sctx->buf, 1); 79 - } 80 - 81 - blocks = len / SHA512_BLOCK_SIZE; 82 - len %= SHA512_BLOCK_SIZE; 83 - 84 - if (blocks) { 85 - block_fn(sctx, data, blocks); 86 - data += blocks * SHA512_BLOCK_SIZE; 87 - } 88 - partial = 0; 89 - } 90 - if (len) 91 - memcpy(sctx->buf + partial, data, len); 92 - 93 - return 0; 94 - } 95 - 96 56 static inline int sha512_base_do_update_blocks(struct shash_desc *desc, 97 57 const u8 *data, 98 58 unsigned int len, ··· 98 138 block.b64[bit_offset + 1] = cpu_to_be64(sctx->count[0] << 3); 99 139 block_fn(sctx, block.u8, (bit_offset + 2) * 8 / SHA512_BLOCK_SIZE); 100 140 memzero_explicit(&block, sizeof(block)); 101 - 102 - return 0; 103 - } 104 - 105 - static inline int sha512_base_do_finalize(struct shash_desc *desc, 106 - sha512_block_fn *block_fn) 107 - { 108 - const int bit_offset = SHA512_BLOCK_SIZE - sizeof(__be64[2]); 109 - struct sha512_state *sctx = shash_desc_ctx(desc); 110 - __be64 *bits = (__be64 *)(sctx->buf + bit_offset); 111 - unsigned int partial = sctx->count[0] % SHA512_BLOCK_SIZE; 112 - 113 - sctx->buf[partial++] = 0x80; 114 - if (partial > bit_offset) { 115 - memset(sctx->buf + partial, 0x0, SHA512_BLOCK_SIZE - partial); 116 - partial = 0; 117 - 118 - block_fn(sctx, sctx->buf, 1); 119 - } 120 - 121 - memset(sctx->buf + partial, 0x0, bit_offset - partial); 122 - bits[0] = cpu_to_be64(sctx->count[1] << 3 | sctx->count[0] >> 61); 123 - bits[1] = cpu_to_be64(sctx->count[0] << 3); 124 - block_fn(sctx, sctx->buf, 1); 125 141 126 142 return 0; 127 143 }