• Home
  • Raw
  • Download

Lines Matching refs:skey

280     #define S1 skey->twofish.S[0]
281 #define S2 skey->twofish.S[1]
282 #define S3 skey->twofish.S[2]
283 #define S4 skey->twofish.S[3]
346 static int _twofish_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey) in _twofish_setup() argument
348 int twofish_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey) in _twofish_setup()
359 LTC_ARGCHK(skey != NULL); in _twofish_setup()
385 rs_mult(M+(x*8), skey->twofish.S+(x*4)); in _twofish_setup()
407 skey->twofish.K[x+x] = (A + B) & 0xFFFFFFFFUL; in _twofish_setup()
410 skey->twofish.K[x+x+1] = ROLc(B + B + A, 9); in _twofish_setup()
419 skey->twofish.S[0][x] = mds_column_mult(sbox(1, (sbox(0, tmpx0 ^ S[0]) ^ S[4])),0); in _twofish_setup()
420 skey->twofish.S[1][x] = mds_column_mult(sbox(0, (sbox(0, tmpx1 ^ S[1]) ^ S[5])),1); in _twofish_setup()
421 skey->twofish.S[2][x] = mds_column_mult(sbox(1, (sbox(1, tmpx0 ^ S[2]) ^ S[6])),2); in _twofish_setup()
422 skey->twofish.S[3][x] = mds_column_mult(sbox(0, (sbox(1, tmpx1 ^ S[3]) ^ S[7])),3); in _twofish_setup()
428skey->twofish.S[0][x] = mds_column_mult(sbox(1, (sbox(0, sbox(0, tmpx1 ^ S[0]) ^ S[4]) ^ S[8])),0); in _twofish_setup()
429skey->twofish.S[1][x] = mds_column_mult(sbox(0, (sbox(0, sbox(1, tmpx1 ^ S[1]) ^ S[5]) ^ S[9])),1); in _twofish_setup()
430skey->twofish.S[2][x] = mds_column_mult(sbox(1, (sbox(1, sbox(0, tmpx0 ^ S[2]) ^ S[6]) ^ S[10])),2… in _twofish_setup()
431skey->twofish.S[3][x] = mds_column_mult(sbox(0, (sbox(1, sbox(1, tmpx0 ^ S[3]) ^ S[7]) ^ S[11])),3… in _twofish_setup()
437skey->twofish.S[0][x] = mds_column_mult(sbox(1, (sbox(0, sbox(0, sbox(1, tmpx1 ^ S[0]) ^ S[4]) ^ S… in _twofish_setup()
438skey->twofish.S[1][x] = mds_column_mult(sbox(0, (sbox(0, sbox(1, sbox(1, tmpx0 ^ S[1]) ^ S[5]) ^ S… in _twofish_setup()
439skey->twofish.S[2][x] = mds_column_mult(sbox(1, (sbox(1, sbox(0, sbox(0, tmpx0 ^ S[2]) ^ S[6]) ^ S… in _twofish_setup()
440skey->twofish.S[3][x] = mds_column_mult(sbox(0, (sbox(1, sbox(1, sbox(0, tmpx1 ^ S[3]) ^ S[7]) ^ S… in _twofish_setup()
447 case 4 : skey->twofish.start = 0; break; in _twofish_setup()
448 case 3 : skey->twofish.start = 1; break; in _twofish_setup()
449 default: skey->twofish.start = 2; break; in _twofish_setup()
456 int twofish_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey) in twofish_setup() argument
459 x = _twofish_setup(key, keylen, num_rounds, skey); in twofish_setup()
473 static int _twofish_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *skey) in _twofish_ecb_encrypt() argument
475 int twofish_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *skey) in _twofish_ecb_encrypt()
486 LTC_ARGCHK(skey != NULL); in _twofish_ecb_encrypt()
489 S1 = skey->twofish.S[0]; in _twofish_ecb_encrypt()
490 S2 = skey->twofish.S[1]; in _twofish_ecb_encrypt()
491 S3 = skey->twofish.S[2]; in _twofish_ecb_encrypt()
492 S4 = skey->twofish.S[3]; in _twofish_ecb_encrypt()
497 a ^= skey->twofish.K[0]; in _twofish_ecb_encrypt()
498 b ^= skey->twofish.K[1]; in _twofish_ecb_encrypt()
499 c ^= skey->twofish.K[2]; in _twofish_ecb_encrypt()
500 d ^= skey->twofish.K[3]; in _twofish_ecb_encrypt()
502 k = skey->twofish.K + 8; in _twofish_ecb_encrypt()
504 t2 = g1_func(b, skey); in _twofish_ecb_encrypt()
505 t1 = g_func(a, skey) + t2; in _twofish_ecb_encrypt()
509 t2 = g1_func(d, skey); in _twofish_ecb_encrypt()
510 t1 = g_func(c, skey) + t2; in _twofish_ecb_encrypt()
517 ta = c ^ skey->twofish.K[4]; in _twofish_ecb_encrypt()
518 tb = d ^ skey->twofish.K[5]; in _twofish_ecb_encrypt()
519 tc = a ^ skey->twofish.K[6]; in _twofish_ecb_encrypt()
520 td = b ^ skey->twofish.K[7]; in _twofish_ecb_encrypt()
530 int twofish_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *skey) in twofish_ecb_encrypt() argument
532 int err = _twofish_ecb_encrypt(pt, ct, skey); in twofish_ecb_encrypt()
546 static int _twofish_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key *skey) in _twofish_ecb_decrypt() argument
548 int twofish_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key *skey) in _twofish_ecb_decrypt()
559 LTC_ARGCHK(skey != NULL); in _twofish_ecb_decrypt()
562 S1 = skey->twofish.S[0]; in _twofish_ecb_decrypt()
563 S2 = skey->twofish.S[1]; in _twofish_ecb_decrypt()
564 S3 = skey->twofish.S[2]; in _twofish_ecb_decrypt()
565 S4 = skey->twofish.S[3]; in _twofish_ecb_decrypt()
573 a = tc ^ skey->twofish.K[6]; in _twofish_ecb_decrypt()
574 b = td ^ skey->twofish.K[7]; in _twofish_ecb_decrypt()
575 c = ta ^ skey->twofish.K[4]; in _twofish_ecb_decrypt()
576 d = tb ^ skey->twofish.K[5]; in _twofish_ecb_decrypt()
578 k = skey->twofish.K + 36; in _twofish_ecb_decrypt()
580 t2 = g1_func(d, skey); in _twofish_ecb_decrypt()
581 t1 = g_func(c, skey) + t2; in _twofish_ecb_decrypt()
585 t2 = g1_func(b, skey); in _twofish_ecb_decrypt()
586 t1 = g_func(a, skey) + t2; in _twofish_ecb_decrypt()
593 a ^= skey->twofish.K[0]; in _twofish_ecb_decrypt()
594 b ^= skey->twofish.K[1]; in _twofish_ecb_decrypt()
595 c ^= skey->twofish.K[2]; in _twofish_ecb_decrypt()
596 d ^= skey->twofish.K[3]; in _twofish_ecb_decrypt()
605 int twofish_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key *skey) in twofish_ecb_decrypt() argument
607 int err =_twofish_ecb_decrypt(ct, pt, skey); in twofish_ecb_decrypt()
685 void twofish_done(symmetric_key *skey) in twofish_done() argument