MCPcopy Create free account
hub / github.com/F-Stack/f-stack / padlock_cipher_alloc

Function padlock_cipher_alloc

freebsd/crypto/via/padlock_cipher.c:167–182  ·  view source on GitHub ↗

* Function checks if the given buffer is already 16 bytes aligned. * If it is there is no need to allocate new buffer. * If it isn't, new buffer is allocated. */

Source from the content-addressed store, hash-verified

165 * If it isn't, new buffer is allocated.
166 */
167static u_char *
168padlock_cipher_alloc(struct cryptop *crp, int *allocated)
169{
170 u_char *addr;
171
172 addr = crypto_contiguous_subsegment(crp, crp->crp_payload_start,
173 crp->crp_payload_length);
174 if (((uintptr_t)addr & 0xf) == 0) { /* 16 bytes aligned? */
175 *allocated = 0;
176 return (addr);
177 }
178
179 *allocated = 1;
180 addr = malloc(crp->crp_payload_length + 16, M_PADLOCK, M_NOWAIT);
181 return (addr);
182}
183
184int
185padlock_cipher_process(struct padlock_session *ses, struct cryptop *crp,

Callers 1

padlock_cipher_processFunction · 0.85

Calls 2

mallocFunction · 0.85

Tested by

no test coverage detected