Lines Matching +full:is +full:- +full:decoded +full:- +full:cs
17 * how to encode a sample stream to 64-bit blocks that will be encryped
19 * first of all, data is collected until a block of 9 samples are received.
20 * of course, a packet may have much more than 9 sample, but is may have
21 * not excacly the multiple of 9 samples. if there is a rest, the next
24 * the block is then converted to 9 uLAW samples without the least sigificant
25 * bit. the result is a 7-bit encoded sample.
39 * the missing bit 0 of the last byte is filled with some
44 * the result will be converted into 9 bytes. the bit 7 is used for
45 * checksumme (CS) for sync (0, 1) and for the last bit:
53 * CS 4(4) 4(3) 4(2) 4(1) 4(0) 5(7) 5(6)
54 * CS 5(5) 5(4) 5(3) 5(2) 5(1) 5(0) 6(7)
55 * CS 6(6) 6(5) 6(4) 6(3) 6(2) 6(1) 6(0)
58 * the checksum is used to detect transmission errors and frame drops.
60 * synchronisation of received block is done by shifting the upper bit of each
62 * (10000), this is used to find the sync. only if sync has been found, the
64 * sum is calculated. if it is incorrect the block is dropped.
67 * if the last block is corrupt, the current decoded block is repeated
73 * crypto-api for faster implementation
344 * Round loop unrolling macros, S is a pointer to a S-Box array
361 * every block with 9 samples is encrypted
366 int i = 0, j = dsp->bf_crypt_pos; in dsp_bf_encrypt()
367 u8 *bf_data_in = dsp->bf_data_in; in dsp_bf_encrypt()
368 u8 *bf_crypt_out = dsp->bf_crypt_out; in dsp_bf_encrypt()
369 u32 *P = dsp->bf_p; in dsp_bf_encrypt()
370 u32 *S = dsp->bf_s; in dsp_bf_encrypt()
372 u32 cs; in dsp_bf_encrypt() local
420 /* calculate 3-bit checksumme */ in dsp_bf_encrypt()
421 cs = yl ^ (yl >> 3) ^ (yl >> 6) ^ (yl >> 9) ^ (yl >> 12) ^ (yl >> 15) in dsp_bf_encrypt()
436 bf_crypt_out[5] = ((yr >> 22) & 0x7f) | ((cs << 5) & 0x80); in dsp_bf_encrypt()
437 bf_crypt_out[6] = ((yr >> 15) & 0x7f) | ((cs << 6) & 0x80); in dsp_bf_encrypt()
438 bf_crypt_out[7] = ((yr >> 8) & 0x7f) | (cs << 7); in dsp_bf_encrypt()
443 dsp->bf_crypt_pos = j; in dsp_bf_encrypt()
450 * every block with 9 bytes is decrypted
456 u8 j = dsp->bf_decrypt_in_pos; in dsp_bf_decrypt()
457 u8 k = dsp->bf_decrypt_out_pos; in dsp_bf_decrypt()
458 u8 *bf_crypt_inring = dsp->bf_crypt_inring; in dsp_bf_decrypt()
459 u8 *bf_data_out = dsp->bf_data_out; in dsp_bf_decrypt()
460 u16 sync = dsp->bf_sync; in dsp_bf_decrypt()
461 u32 *P = dsp->bf_p; in dsp_bf_decrypt()
462 u32 *S = dsp->bf_s; in dsp_bf_decrypt()
465 u8 cs, cs0, cs1, cs2; in dsp_bf_decrypt() local
481 j -= 9; in dsp_bf_decrypt()
498 /* calculate 3-bit checksumme */ in dsp_bf_decrypt()
499 cs = yl ^ (yl >> 3) ^ (yl >> 6) ^ (yl >> 9) ^ (yl >> 12) ^ (yl >> 15) in dsp_bf_decrypt()
505 /* check if frame is valid */ in dsp_bf_decrypt()
506 if ((cs & 0x7) != (((cs2 >> 5) & 4) | ((cs1 >> 6) & 2) | (cs0 >> 7))) { in dsp_bf_decrypt()
510 "checksumme is not correct\n"); in dsp_bf_decrypt()
546 k = 0; /* start with new decoded frame */ in dsp_bf_decrypt()
550 dsp->bf_decrypt_in_pos = j; in dsp_bf_decrypt()
551 dsp->bf_decrypt_out_pos = k; in dsp_bf_decrypt()
552 dsp->bf_sync = sync; in dsp_bf_decrypt()
590 * The margin of keylen must be 4-56 bytes.
598 u32 *P = (u32 *)dsp->bf_p; in dsp_bf_init()
599 u32 *S = (u32 *)dsp->bf_s; in dsp_bf_init()
607 dsp->bf_crypt_out[i] = 0xff; in dsp_bf_init()
608 dsp->bf_data_out[i] = dsp_silence; in dsp_bf_init()
611 dsp->bf_crypt_pos = 0; in dsp_bf_init()
612 dsp->bf_decrypt_in_pos = 0; in dsp_bf_init()
613 dsp->bf_decrypt_out_pos = 0; in dsp_bf_init()
614 dsp->bf_sync = 0x1ff; in dsp_bf_init()
615 dsp->bf_enable = 1; in dsp_bf_init()
617 /* Copy the initialization s-boxes */ in dsp_bf_init()
622 /* Set the p-boxes */ in dsp_bf_init()
666 dsp->bf_enable = 0; in dsp_bf_cleanup()