418 * ccm_remainder_len from last time will not be part of the
419 * MAC. Otherwise, it would have already been taken out
420 * when this call is made last time.
421 */
422 size_t pt_part = pt_len - pd_len - ctx->ccm_remainder_len;
423
424 mac_len = length - pt_part;
425
426 ctx->ccm_processed_mac_len = mac_len;
427 bcopy(data + pt_part, ctx->ccm_mac_input_buf, mac_len);
428
429 if (pt_part + ctx->ccm_remainder_len < block_size) {
430 /*
431 * since this is last of the ciphertext, will
432 * just decrypt with it here
433 */
434 bcopy(datap, &((uint8_t *)ctx->ccm_remainder)
435 [ctx->ccm_remainder_len], pt_part);
436 ctx->ccm_remainder_len += pt_part;
437 ccm_decrypt_incomplete_block(ctx, encrypt_block);
438 ctx->ccm_remainder_len = 0;
439 ctx->ccm_processed_data_len += pt_part;
440 return (CRYPTO_SUCCESS);
441 } else {
442 /* let rest of the code handle this */
443 length = pt_part;
444 }
445 } else if (length + ctx->ccm_remainder_len < block_size) {
446 /* accumulate bytes here and return */
447 bcopy(datap,
448 (uint8_t *)ctx->ccm_remainder + ctx->ccm_remainder_len,
449 length);
450 ctx->ccm_remainder_len += length;
451 ctx->ccm_copy_to = datap;
452 return (CRYPTO_SUCCESS);
453 }
454
455 do {
456 /* Unprocessed data from last call. */
457 if (ctx->ccm_remainder_len > 0) {
458 need = block_size - ctx->ccm_remainder_len;
459
|
418 * ccm_remainder_len from last time will not be part of the
419 * MAC. Otherwise, it would have already been taken out
420 * when this call is made last time.
421 */
422 size_t pt_part = pt_len - pd_len - ctx->ccm_remainder_len;
423
424 mac_len = length - pt_part;
425
426 ctx->ccm_processed_mac_len = mac_len;
427 bcopy(data + pt_part, ctx->ccm_mac_input_buf, mac_len);
428
429 if (pt_part + ctx->ccm_remainder_len < block_size) {
430 /*
431 * since this is last of the ciphertext, will
432 * just decrypt with it here
433 */
434 bcopy(datap, &((uint8_t *)ctx->ccm_remainder)
435 [ctx->ccm_remainder_len], pt_part);
436 ctx->ccm_remainder_len += pt_part;
437 ccm_decrypt_incomplete_block(ctx, encrypt_block);
438 ctx->ccm_processed_data_len += ctx->ccm_remainder_len;
439 ctx->ccm_remainder_len = 0;
440 return (CRYPTO_SUCCESS);
441 } else {
442 /* let rest of the code handle this */
443 length = pt_part;
444 }
445 } else if (length + ctx->ccm_remainder_len < block_size) {
446 /* accumulate bytes here and return */
447 bcopy(datap,
448 (uint8_t *)ctx->ccm_remainder + ctx->ccm_remainder_len,
449 length);
450 ctx->ccm_remainder_len += length;
451 ctx->ccm_copy_to = datap;
452 return (CRYPTO_SUCCESS);
453 }
454
455 do {
456 /* Unprocessed data from last call. */
457 if (ctx->ccm_remainder_len > 0) {
458 need = block_size - ctx->ccm_remainder_len;
459
|