Lines Matching full:skey
405 @param skey The key in as scheduled by this function.
409 static int _cast5_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey)
411 int cast5_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey)
419 LTC_ARGCHK(skey != NULL);
447 skey->cast5.K[i++] = S5[GB(z, 0x8)] ^ S6[GB(z, 0x9)] ^ S7[GB(z, 0x7)] ^ S8[GB(z, 0x6)] ^ S5[GB(z, 0x2)];
448 skey->cast5.K[i++] = S5[GB(z, 0xA)] ^ S6[GB(z, 0xB)] ^ S7[GB(z, 0x5)] ^ S8[GB(z, 0x4)] ^ S6[GB(z, 0x6)];
449 skey->cast5.K[i++] = S5[GB(z, 0xC)] ^ S6[GB(z, 0xd)] ^ S7[GB(z, 0x3)] ^ S8[GB(z, 0x2)] ^ S7[GB(z, 0x9)];
450 skey->cast5.K[i++] = S5[GB(z, 0xE)] ^ S6[GB(z, 0xF)] ^ S7[GB(z, 0x1)] ^ S8[GB(z, 0x0)] ^ S8[GB(z, 0xc)];
456 skey
457 skey->cast5.K[i++] = S5[GB(x, 0x1)] ^ S6[GB(x, 0x0)] ^ S7[GB(x, 0xe)] ^ S8[GB(x, 0xf)] ^ S6[GB(x, 0xd)];
458 skey->cast5.K[i++] = S5[GB(x, 0x7)] ^ S6[GB(x, 0x6)] ^ S7[GB(x, 0x8)] ^ S8[GB(x, 0x9)] ^ S7[GB(x, 0x3)];
459 skey->cast5.K[i++] = S5[GB(x, 0x5)] ^ S6[GB(x, 0x4)] ^ S7[GB(x, 0xa)] ^ S8[GB(x, 0xb)] ^ S8[GB(x, 0x7)];
466 skey->cast5.K[i++] = S5[GB(z, 0x3)] ^ S6[GB(z, 0x2)] ^ S7[GB(z, 0xc)] ^ S8[GB(z, 0xd)] ^ S5[GB(z, 0x9)];
467 skey->cast5.K[i++] = S5[GB(z, 0x1)] ^ S6[GB(z, 0x0)] ^ S7[GB(z, 0xe)] ^ S8[GB(z, 0xf)] ^ S6[GB(z, 0xc)];
468 skey->cast5.K[i++] = S5[GB(z, 0x7)] ^ S6[GB(z, 0x6)] ^ S7[GB(z, 0x8)] ^ S8[GB(z, 0x9)] ^ S7[GB(z, 0x2)];
469 skey->cast5.K[i++] = S5[GB(z, 0x5)] ^ S6[GB(z, 0x4)] ^ S7[GB(z, 0xa)] ^ S8[GB(z, 0xb)] ^ S8[GB(z, 0x6)];
475 skey->cast5.K[i++] = S5[GB(x, 0x8)] ^ S6[GB(x, 0x9)] ^ S7[GB(x, 0x7)] ^ S8[GB(x, 0x6)] ^ S5[GB(x, 0x3)];
476 skey->cast5.K[i++] = S5[GB(x, 0xa)] ^ S6[GB(x, 0xb)] ^ S7[GB(x, 0x5)] ^ S8[GB(x, 0x4)] ^ S6[GB(x, 0x7)];
477 skey->cast5.K[i++] = S5[GB(x, 0xc)] ^ S6[GB(x, 0xd)] ^ S7[GB(x, 0x3)] ^ S8[GB(x, 0x2)] ^ S7[GB(x, 0x8)];
478 skey->cast5.K[i++] = S5[GB(x, 0xe)] ^ S6[GB(x, 0xf)] ^ S7[GB(x, 0x1)] ^ S8[GB(x, 0x0)] ^ S8[GB(x, 0xd)];
481 skey->cast5.keylen = keylen;
493 int cast5_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey)
496 z = _cast5_setup(key, keylen, num_rounds, skey);
536 @param skey The key as scheduled
539 static int _cast5_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *skey)
541 int cast5_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *skey)
548 LTC_ARGCHK(skey != NULL);
552 L ^= FI(R, skey->cast5.K[0], skey->cast5.K[16]);
553 R ^= FII(L, skey->cast5.K[1], skey->cast5.K[17]);
554 L ^= FIII(R, skey->cast5.K[2], skey->cast5.K[18]);
555 R ^= FI(L, skey->cast5.K[3], skey->cast5.K[19]);
556 L ^= FII(R, skey->cast5.K[4], skey->cast5.K[20]);
557 R ^= FIII(L, skey->cast5.K[5], skey->cast5.K[21]);
558 L ^= FI(R, skey->cast5.K[6], skey->cast5.K[22]);
559 R ^= FII(L, skey->cast5.K[7], skey->cast5.K[23]);
560 L ^= FIII(R, skey->cast5.K[8], skey->cast5.K[24]);
561 R ^= FI(L, skey->cast5.K[9], skey->cast5.K[25]);
562 L ^= FII(R, skey->cast5.K[10], skey->cast5.K[26]);
563 R ^= FIII(L, skey->cast5.K[11], skey->cast5.K[27]);
564 if (skey->cast5.keylen > 10) {
565 L ^= FI(R, skey->cast5.K[12], skey->cast5.K[28]);
566 R ^= FII(L, skey->cast5.K[13], skey->cast5.K[29]);
567 L ^= FIII(R, skey->cast5.K[14], skey->cast5.K[30]);
568 R ^= FI(L, skey->cast5.K[15], skey->cast5.K[31]);
577 int cast5_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *skey)
579 int err =_cast5_ecb_encrypt(pt,ct,skey);
589 @param skey The key as scheduled
592 static int _cast5_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key *skey)
594 int cast5_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key *skey)
601 LTC_ARGCHK(skey != NULL);
605 if (skey->cast5.keylen > 10) {
606 R ^= FI(L, skey->cast5.K[15], skey->cast5.K[31]);
607 L ^= FIII(R, skey->cast5.K[14], skey->cast5.K[30]);
608 R ^= FII(L, skey->cast5.K[13], skey->cast5.K[29]);
609 L ^= FI(R, skey->cast5.K[12], skey->cast5.K[28]);
611 R ^= FIII(L, skey->cast5.K[11], skey->cast5.K[27]);
612 L ^= FII(R, skey->cast5.K[10], skey->cast5.K[26]);
613 R ^= FI(L, skey->cast5.K[9], skey->cast5.K[25]);
614 L ^= FIII(R, skey->cast5.K[8], skey->cast5.K[24]);
615 R ^= FII(L, skey->cast5.K[7], skey->cast5.K[23]);
616 L ^= FI(R, skey->cast5.K[6], skey->cast5.K[22]);
617 R ^= FIII(L, skey->cast5.K[5], skey->cast5.K[21]);
618 L ^= FII(R, skey->cast5.K[4], skey->cast5.K[20]);
619 R ^= FI(L, skey->cast5.K[3], skey->cast5.K[19]);
620 L ^= FIII(R, skey->cast5.K[2], skey->cast5.K[18]);
621 R ^= FII(L, skey->cast5.K[1], skey->cast5.K[17]);
622 L ^= FI(R, skey->cast5.K[0], skey->cast5.K[16]);
630 int cast5_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key *skey)
632 int err = _cast5_ecb_decrypt(ct,pt,skey);
694 @param skey The scheduled key
696 void cast5_done(symmetric_key *skey)