Lines Matching refs:walk

43 static int hash_walk_next(struct crypto_hash_walk *walk)  in hash_walk_next()  argument
45 unsigned int alignmask = walk->alignmask; in hash_walk_next()
46 unsigned int offset = walk->offset; in hash_walk_next()
47 unsigned int nbytes = min(walk->entrylen, in hash_walk_next()
50 if (walk->flags & CRYPTO_ALG_ASYNC) in hash_walk_next()
51 walk->data = kmap(walk->pg); in hash_walk_next()
53 walk->data = kmap_atomic(walk->pg); in hash_walk_next()
54 walk->data += offset; in hash_walk_next()
63 walk->entrylen -= nbytes; in hash_walk_next()
67 static int hash_walk_new_entry(struct crypto_hash_walk *walk) in hash_walk_new_entry() argument
71 sg = walk->sg; in hash_walk_new_entry()
72 walk->offset = sg->offset; in hash_walk_new_entry()
73 walk->pg = sg_page(walk->sg) + (walk->offset >> PAGE_SHIFT); in hash_walk_new_entry()
74 walk->offset = offset_in_page(walk->offset); in hash_walk_new_entry()
75 walk->entrylen = sg->length; in hash_walk_new_entry()
77 if (walk->entrylen > walk->total) in hash_walk_new_entry()
78 walk->entrylen = walk->total; in hash_walk_new_entry()
79 walk->total -= walk->entrylen; in hash_walk_new_entry()
81 return hash_walk_next(walk); in hash_walk_new_entry()
84 int crypto_hash_walk_done(struct crypto_hash_walk *walk, int err) in crypto_hash_walk_done() argument
86 unsigned int alignmask = walk->alignmask; in crypto_hash_walk_done()
87 unsigned int nbytes = walk->entrylen; in crypto_hash_walk_done()
89 walk->data -= walk->offset; in crypto_hash_walk_done()
91 if (nbytes && walk->offset & alignmask && !err) { in crypto_hash_walk_done()
92 walk->offset = ALIGN(walk->offset, alignmask + 1); in crypto_hash_walk_done()
93 walk->data += walk->offset; in crypto_hash_walk_done()
96 ((unsigned int)(PAGE_SIZE)) - walk->offset); in crypto_hash_walk_done()
97 walk->entrylen -= nbytes; in crypto_hash_walk_done()
102 if (walk->flags & CRYPTO_ALG_ASYNC) in crypto_hash_walk_done()
103 kunmap(walk->pg); in crypto_hash_walk_done()
105 kunmap_atomic(walk->data); in crypto_hash_walk_done()
110 crypto_yield(walk->flags); in crypto_hash_walk_done()
117 walk->offset = 0; in crypto_hash_walk_done()
118 walk->pg++; in crypto_hash_walk_done()
119 return hash_walk_next(walk); in crypto_hash_walk_done()
122 if (!walk->total) in crypto_hash_walk_done()
125 walk->sg = sg_next(walk->sg); in crypto_hash_walk_done()
127 return hash_walk_new_entry(walk); in crypto_hash_walk_done()
132 struct crypto_hash_walk *walk) in crypto_hash_walk_first() argument
134 walk->total = req->nbytes; in crypto_hash_walk_first()
136 if (!walk->total) { in crypto_hash_walk_first()
137 walk->entrylen = 0; in crypto_hash_walk_first()
141 walk->alignmask = crypto_ahash_alignmask(crypto_ahash_reqtfm(req)); in crypto_hash_walk_first()
142 walk->sg = req->src; in crypto_hash_walk_first()
143 walk->flags = req->base.flags & CRYPTO_TFM_REQ_MASK; in crypto_hash_walk_first()
145 return hash_walk_new_entry(walk); in crypto_hash_walk_first()
150 struct crypto_hash_walk *walk) in crypto_ahash_walk_first() argument
152 walk->total = req->nbytes; in crypto_ahash_walk_first()
154 if (!walk->total) { in crypto_ahash_walk_first()
155 walk->entrylen = 0; in crypto_ahash_walk_first()
159 walk->alignmask = crypto_ahash_alignmask(crypto_ahash_reqtfm(req)); in crypto_ahash_walk_first()
160 walk->sg = req->src; in crypto_ahash_walk_first()
161 walk->flags = req->base.flags & CRYPTO_TFM_REQ_MASK; in crypto_ahash_walk_first()
162 walk->flags |= CRYPTO_ALG_ASYNC; in crypto_ahash_walk_first()
166 return hash_walk_new_entry(walk); in crypto_ahash_walk_first()
171 struct crypto_hash_walk *walk, in crypto_hash_walk_first_compat() argument
174 walk->total = len; in crypto_hash_walk_first_compat()
176 if (!walk->total) { in crypto_hash_walk_first_compat()
177 walk->entrylen = 0; in crypto_hash_walk_first_compat()
181 walk->alignmask = crypto_hash_alignmask(hdesc->tfm); in crypto_hash_walk_first_compat()
182 walk->sg = sg; in crypto_hash_walk_first_compat()
183 walk->flags = hdesc->flags & CRYPTO_TFM_REQ_MASK; in crypto_hash_walk_first_compat()
185 return hash_walk_new_entry(walk); in crypto_hash_walk_first_compat()