Lines Matching refs:skey
34 int xtea_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey) in xtea_setup() argument
39 LTC_ARGCHK(skey != NULL); in xtea_setup()
57 skey->xtea.A[x] = (sum + K[sum&3]) & 0xFFFFFFFFUL; in xtea_setup()
59 skey->xtea.B[x] = (sum + K[(sum>>11)&3]) & 0xFFFFFFFFUL; in xtea_setup()
76 int xtea_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *skey) in xtea_ecb_encrypt() argument
83 LTC_ARGCHK(skey != NULL); in xtea_ecb_encrypt()
88 y = (y + ((((z<<4)^(z>>5)) + z) ^ skey->xtea.A[r])) & 0xFFFFFFFFUL; in xtea_ecb_encrypt()
89 z = (z + ((((y<<4)^(y>>5)) + y) ^ skey->xtea.B[r])) & 0xFFFFFFFFUL; in xtea_ecb_encrypt()
91 y = (y + ((((z<<4)^(z>>5)) + z) ^ skey->xtea.A[r+1])) & 0xFFFFFFFFUL; in xtea_ecb_encrypt()
92 z = (z + ((((y<<4)^(y>>5)) + y) ^ skey->xtea.B[r+1])) & 0xFFFFFFFFUL; in xtea_ecb_encrypt()
94 y = (y + ((((z<<4)^(z>>5)) + z) ^ skey->xtea.A[r+2])) & 0xFFFFFFFFUL; in xtea_ecb_encrypt()
95 z = (z + ((((y<<4)^(y>>5)) + y) ^ skey->xtea.B[r+2])) & 0xFFFFFFFFUL; in xtea_ecb_encrypt()
97 y = (y + ((((z<<4)^(z>>5)) + z) ^ skey->xtea.A[r+3])) & 0xFFFFFFFFUL; in xtea_ecb_encrypt()
98 z = (z + ((((y<<4)^(y>>5)) + y) ^ skey->xtea.B[r+3])) & 0xFFFFFFFFUL; in xtea_ecb_encrypt()
112 int xtea_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key *skey) in xtea_ecb_decrypt() argument
119 LTC_ARGCHK(skey != NULL); in xtea_ecb_decrypt()
124 z = (z - ((((y<<4)^(y>>5)) + y) ^ skey->xtea.B[r])) & 0xFFFFFFFFUL; in xtea_ecb_decrypt()
125 y = (y - ((((z<<4)^(z>>5)) + z) ^ skey->xtea.A[r])) & 0xFFFFFFFFUL; in xtea_ecb_decrypt()
127 z = (z - ((((y<<4)^(y>>5)) + y) ^ skey->xtea.B[r-1])) & 0xFFFFFFFFUL; in xtea_ecb_decrypt()
128 y = (y - ((((z<<4)^(z>>5)) + z) ^ skey->xtea.A[r-1])) & 0xFFFFFFFFUL; in xtea_ecb_decrypt()
130 z = (z - ((((y<<4)^(y>>5)) + y) ^ skey->xtea.B[r-2])) & 0xFFFFFFFFUL; in xtea_ecb_decrypt()
131 y = (y - ((((z<<4)^(z>>5)) + z) ^ skey->xtea.A[r-2])) & 0xFFFFFFFFUL; in xtea_ecb_decrypt()
133 z = (z - ((((y<<4)^(y>>5)) + y) ^ skey->xtea.B[r-3])) & 0xFFFFFFFFUL; in xtea_ecb_decrypt()
134 y = (y - ((((z<<4)^(z>>5)) + z) ^ skey->xtea.A[r-3])) & 0xFFFFFFFFUL; in xtea_ecb_decrypt()
158 symmetric_key skey; in xtea_test()
161 if ((err = xtea_setup(key, 16, 0, &skey)) != CRYPT_OK) { in xtea_test()
164 xtea_ecb_encrypt(pt, tmp[0], &skey); in xtea_test()
165 xtea_ecb_decrypt(tmp[0], tmp[1], &skey); in xtea_test()
173 for (y = 0; y < 1000; y++) xtea_ecb_encrypt(tmp[0], tmp[0], &skey); in xtea_test()
174 for (y = 0; y < 1000; y++) xtea_ecb_decrypt(tmp[0], tmp[0], &skey); in xtea_test()
184 void xtea_done(symmetric_key *skey) in xtea_done() argument