Lines Matching full:b0
1048 * Write B0 CCM block to OCS AES HW.
1050 * Note: B0 format is documented in NIST Special Publication 800-38C
1058 u8 b0[16]; /* CCM B0 block is 16 bytes long. */ in ocs_aes_ccm_write_b0() local
1061 /* Initialize B0 to 0. */ in ocs_aes_ccm_write_b0()
1062 memset(b0, 0, sizeof(b0)); in ocs_aes_ccm_write_b0()
1065 * B0[0] is the 'Flags Octet' and has the following structure: in ocs_aes_ccm_write_b0()
1073 b0[0] |= BIT(6); in ocs_aes_ccm_write_b0()
1079 b0[0] |= (((tag_size - 2) / 2) & 0x7) << 3; in ocs_aes_ccm_write_b0()
1085 b0[0] |= iv[0] & 0x7; in ocs_aes_ccm_write_b0()
1087 * Copy the Nonce N from IV to B0; N is located in iv[1]..iv[15 - q] in ocs_aes_ccm_write_b0()
1088 * and must be copied to b0[1]..b0[15-q]. in ocs_aes_ccm_write_b0()
1093 b0[i] = iv[i]; in ocs_aes_ccm_write_b0()
1095 * The rest of B0 must contain Q, i.e., the message length. in ocs_aes_ccm_write_b0()
1097 * start from the end of B0 and we move backward. in ocs_aes_ccm_write_b0()
1099 i = sizeof(b0) - 1; in ocs_aes_ccm_write_b0()
1101 b0[i] = cryptlen & 0xff; in ocs_aes_ccm_write_b0()
1112 /* Now write B0 to OCS AES input buffer. */ in ocs_aes_ccm_write_b0()
1113 for (i = 0; i < sizeof(b0); i++) in ocs_aes_ccm_write_b0()
1114 iowrite8(b0[i], aes_dev->base_reg + in ocs_aes_ccm_write_b0()
1367 /* Form block B0 and write it to the AES/SM4 input buffer. */ in ocs_aes_ccm_op()