• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.10.1/Security-57031.1.35/SecurityTests/cspxutils/utilLib/

Lines Matching defs:cipher

15 static void dumpChainBuf(cipherInstance *cipher, char *op)
18 int columns = cipher->blockLen / 32;
23 printf("%02x ", cipher->chainBlock[t][j]);
71 int _cipherInit( cipherInstance *cipher,
81 cipher->mode = mode;
85 cipher->blockLen = blockLen;
92 cipher->chainBlock[t][j] = IV[t+4*j];
96 dumpChainBuf(cipher, "init ");
101 int _blockEncrypt(cipherInstance *cipher,
114 if (cipher == NULL ||
115 (cipher->mode != MODE_ECB && cipher->mode != MODE_CBC) ||
116 (cipher->blockLen != 128 && cipher->blockLen != 192 && cipher->blockLen != 256)) {
120 numBlocks = inputLen/cipher->blockLen;
121 blockSizeBytes = cipher->blockLen / 8;
122 columns = cipher->blockLen / 32;
124 switch (cipher->mode) {
130 cipher->chainBlock[t][j] = input[4*j+t];
132 _rijndaelEncrypt (cipher->chainBlock, key->keyLen, cipher->blockLen, key->keySched);
136 outBuffer[4*j+t] = (BYTE) cipher->chainBlock[t][j];
140 dumpChainBuf(cipher, "encr ECB");
150 cipher->chainBlock[t][j] ^= input[4*j+t];
152 _rijndaelEncrypt (cipher->chainBlock, key->keyLen, cipher->blockLen, key->keySched);
156 outBuffer[4*j+t] = (BYTE) cipher->chainBlock[t][j];
161 dumpChainBuf(cipher, "encr CBC");
168 return numBlocks*cipher->blockLen;
171 int _blockDecrypt(cipherInstance *cipher,
180 if (cipher == NULL ||
183 cipher->blockLen != key->blockLen) {
193 if (cipher == NULL ||
194 (cipher->mode != MODE_ECB && cipher->mode != MODE_CBC) ||
195 (cipher->blockLen != 128 && cipher->blockLen != 192 && cipher->blockLen != 256)) {
199 numBlocks = inputLen/cipher->blockLen;
200 blockSizeBytes = cipher->blockLen / 8;
201 columns = cipher->blockLen / 32;
203 switch (cipher->mode) {
211 _rijndaelDecrypt (block, key->keyLen, cipher->blockLen, key->keySched);
219 dumpChainBuf(cipher, "decr ECB");
233 _rijndaelDecrypt (block, key->keyLen, cipher->blockLen, key->keySched);
243 outBuffer[4*j+t] = (block[t][j] ^ cipher->chainBlock[t][j]);
246 memmove(cipher->chainBlock, cblock, 4 * MAXBC);
249 dumpChainBuf(cipher, "decr CBC");
257 return numBlocks*cipher->blockLen;
267 cipherInstance *cipher,
283 if (cipher == NULL ||
284 (cipher->mode != MODE_ECB && cipher->mode != MODE_CBC) ||
285 (cipher->blockLen != 128 && cipher->blockLen != 192 && cipher->blockLen != 256)) {
290 blockSizeBytes = cipher->blockLen >> 3; /* was / 8; should just save in cipher */
291 columns = cipher->blockLen >> 5; /* was / 32; ditto */
296 cipher->chainBlock[t][j] = input[4*j+t];
298 _rijndaelEncrypt (cipher->chainBlock, key->keyLen, cipher->blockLen,
303 outBuffer[4*j+t] = (BYTE) cipher->chainBlock[t][j];
305 return cipher->blockLen;
309 cipherInstance *cipher,
320 if (cipher == NULL ||
323 cipher->blockLen != key->blockLen) {
333 if (cipher == NULL ||
334 (cipher->mode != MODE_ECB && cipher->mode != MODE_CBC) ||
335 (cipher->blockLen != 128 && cipher->blockLen != 192 && cipher->blockLen != 256)) {
340 blockSizeBytes = cipher->blockLen >> 3; /* was / 8; should just save in cipher */
341 columns = cipher->blockLen >> 5; /* was / 32; ditto */
348 _rijndaelDecrypt (block, key->keyLen, cipher->blockLen, key->keySched);
355 return cipher->blockLen;