Lines Matching refs:walk
45 static int hash_walk_next(struct crypto_hash_walk *walk) in hash_walk_next() argument
47 unsigned int alignmask = walk->alignmask; in hash_walk_next()
48 unsigned int offset = walk->offset; in hash_walk_next()
49 unsigned int nbytes = min(walk->entrylen, in hash_walk_next()
52 if (walk->flags & CRYPTO_ALG_ASYNC) in hash_walk_next()
53 walk->data = kmap(walk->pg); in hash_walk_next()
55 walk->data = kmap_atomic(walk->pg); in hash_walk_next()
56 walk->data += offset; in hash_walk_next()
65 walk->entrylen -= nbytes; in hash_walk_next()
69 static int hash_walk_new_entry(struct crypto_hash_walk *walk) in hash_walk_new_entry() argument
73 sg = walk->sg; in hash_walk_new_entry()
74 walk->offset = sg->offset; in hash_walk_new_entry()
75 walk->pg = sg_page(walk->sg) + (walk->offset >> PAGE_SHIFT); in hash_walk_new_entry()
76 walk->offset = offset_in_page(walk->offset); in hash_walk_new_entry()
77 walk->entrylen = sg->length; in hash_walk_new_entry()
79 if (walk->entrylen > walk->total) in hash_walk_new_entry()
80 walk->entrylen = walk->total; in hash_walk_new_entry()
81 walk->total -= walk->entrylen; in hash_walk_new_entry()
83 return hash_walk_next(walk); in hash_walk_new_entry()
86 int crypto_hash_walk_done(struct crypto_hash_walk *walk, int err) in crypto_hash_walk_done() argument
88 unsigned int alignmask = walk->alignmask; in crypto_hash_walk_done()
90 walk->data -= walk->offset; in crypto_hash_walk_done()
92 if (walk->entrylen && (walk->offset & alignmask) && !err) { in crypto_hash_walk_done()
95 walk->offset = ALIGN(walk->offset, alignmask + 1); in crypto_hash_walk_done()
96 nbytes = min(walk->entrylen, in crypto_hash_walk_done()
97 (unsigned int)(PAGE_SIZE - walk->offset)); in crypto_hash_walk_done()
99 walk->entrylen -= nbytes; in crypto_hash_walk_done()
100 walk->data += walk->offset; in crypto_hash_walk_done()
105 if (walk->flags & CRYPTO_ALG_ASYNC) in crypto_hash_walk_done()
106 kunmap(walk->pg); in crypto_hash_walk_done()
108 kunmap_atomic(walk->data); in crypto_hash_walk_done()
113 crypto_yield(walk->flags); in crypto_hash_walk_done()
119 if (walk->entrylen) { in crypto_hash_walk_done()
120 walk->offset = 0; in crypto_hash_walk_done()
121 walk->pg++; in crypto_hash_walk_done()
122 return hash_walk_next(walk); in crypto_hash_walk_done()
125 if (!walk->total) in crypto_hash_walk_done()
128 walk->sg = sg_next(walk->sg); in crypto_hash_walk_done()
130 return hash_walk_new_entry(walk); in crypto_hash_walk_done()
135 struct crypto_hash_walk *walk) in crypto_hash_walk_first() argument
137 walk->total = req->nbytes; in crypto_hash_walk_first()
139 if (!walk->total) { in crypto_hash_walk_first()
140 walk->entrylen = 0; in crypto_hash_walk_first()
144 walk->alignmask = crypto_ahash_alignmask(crypto_ahash_reqtfm(req)); in crypto_hash_walk_first()
145 walk->sg = req->src; in crypto_hash_walk_first()
146 walk->flags = req->base.flags & CRYPTO_TFM_REQ_MASK; in crypto_hash_walk_first()
148 return hash_walk_new_entry(walk); in crypto_hash_walk_first()
153 struct crypto_hash_walk *walk) in crypto_ahash_walk_first() argument
155 walk->total = req->nbytes; in crypto_ahash_walk_first()
157 if (!walk->total) { in crypto_ahash_walk_first()
158 walk->entrylen = 0; in crypto_ahash_walk_first()
162 walk->alignmask = crypto_ahash_alignmask(crypto_ahash_reqtfm(req)); in crypto_ahash_walk_first()
163 walk->sg = req->src; in crypto_ahash_walk_first()
164 walk->flags = req->base.flags & CRYPTO_TFM_REQ_MASK; in crypto_ahash_walk_first()
165 walk->flags |= CRYPTO_ALG_ASYNC; in crypto_ahash_walk_first()
169 return hash_walk_new_entry(walk); in crypto_ahash_walk_first()