Lines Matching +full:- +full:j
5 * SPDX-License-Identifier: Apache-2.0
40 /* b field is assumed to have the nonce already present in bytes 1-13 */
45 int i, j, err; in ccm_calculate_X0() local
48 b[0] = (((mic_size - 2) / 2) << 3) | ((!!aad_len) << 6) | 0x01; in ccm_calculate_X0()
65 j = 0; in ccm_calculate_X0()
69 b[i] = X0[i] ^ aad[j]; in ccm_calculate_X0()
70 i++, j++; in ccm_calculate_X0()
73 aad_len -= 16; in ccm_calculate_X0()
82 for (; i < aad_len; i++, j++) { in ccm_calculate_X0()
83 b[i] = X0[i] ^ aad[j]; in ccm_calculate_X0()
105 int err, j, i; in ccm_auth() local
126 for (j = 0; j < blk_cnt; j++) { in ccm_auth()
127 /* X_1 = e(AppKey, X_0 ^ Payload[0-15]) */ in ccm_auth()
128 if (j + 1 == blk_cnt) { in ccm_auth()
130 b[i] = Xn[i] ^ cleartext_msg[(j * 16) + i]; in ccm_auth()
133 memcpy(&b[i], &Xn[i], 16 - i); in ccm_auth()
135 xor16(b, Xn, &cleartext_msg[j * 16]); in ccm_auth()
157 size_t i, j; in ccm_crypt() local
169 for (j = 0; j < blk_cnt; j++) { in ccm_crypt()
171 sys_put_be16(j + 1, &a_i[14]); in ccm_crypt()
178 /* Encrypted = Payload[0-15] ^ C_1 */ in ccm_crypt()
179 if (j < blk_cnt - 1) { in ccm_crypt()
180 xor16(&out_msg[j * 16], s_i, &in_msg[j * 16]); in ccm_crypt()
183 out_msg[(j * 16) + i] = in ccm_crypt()
184 in_msg[(j * 16) + i] ^ s_i[i]; in ccm_crypt()
198 return -EINVAL; in bt_ccm_decrypt()
206 return -EBADMSG; in bt_ccm_decrypt()
225 return -EINVAL; in bt_ccm_encrypt()