Lines Matching refs:ch
66 cbc_encrypt(cbc_handle_t *ch, uint8_t *data, size_t datalen, in cbc_encrypt() argument
73 if (!IS_P2ALIGNED(datalen, ch->blocklen)) { in cbc_encrypt()
80 for (i = 0; i < datalen; i += ch->blocklen) { in cbc_encrypt()
81 cbc_xorblock(lastp, thisp, ch->blocklen); in cbc_encrypt()
83 ch->encrypt(ch->ks, thisp); in cbc_encrypt()
85 thisp += ch->blocklen; in cbc_encrypt()
88 bcopy(lastp, IV, ch->blocklen); in cbc_encrypt()
93 cbc_decrypt(cbc_handle_t *ch, uint8_t *data, size_t datalen, in cbc_decrypt() argument
101 if (!IS_P2ALIGNED(datalen, ch->blocklen)) { in cbc_decrypt()
108 for (i = 0; i < datalen; i += ch->blocklen) { in cbc_decrypt()
111 bcopy(thisp, cbcblock, ch->blocklen); in cbc_decrypt()
114 ch->decrypt(ch->ks, thisp); in cbc_decrypt()
116 cbc_xorblock(lastp, thisp, ch->blocklen); in cbc_decrypt()
119 bcopy(cbcblock, lastp, ch->blocklen); in cbc_decrypt()
120 thisp += ch->blocklen; in cbc_decrypt()
127 cbc_makehandle(cbc_handle_t *ch, void *cookie, uint32_t keysize, in cbc_makehandle() argument
132 ch->ks = cookie; in cbc_makehandle()
133 ch->keylen = keysize; in cbc_makehandle()
134 ch->blocklen = blocksize; in cbc_makehandle()
135 ch->ivlen = ivsize; in cbc_makehandle()
136 ch->encrypt = encrypt; in cbc_makehandle()
137 ch->decrypt = decrypt; in cbc_makehandle()